Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #pragma once
00010
00011 #include <iostream>
00012 #include "defines.h"
00013
00014 namespace af {
00015 class AFAPI dim4
00016 {
00017 public:
00018 dim4();
00020 dim4(unsigned x, unsigned y=1, unsigned z=1, unsigned w=1);
00021
00022 dim4(unsigned ndims, const unsigned *dims);
00023 dim4(const dim4&);
00024
00025 unsigned elements() const;
00026 unsigned rest(unsigned i) const;
00027 unsigned ndims() const;
00028
00029 bool isempty() const { return elements() == 0; }
00031 bool isscalar() const { return elements() == 1; }
00033 bool isvector() const { return ndims() == 2 && (m_dims[0] == 1 || m_dims[1] == 1); }
00035 bool iscolumn() const { return ndims() == 2 && m_dims[1] == 1; }
00037 bool isrow() const { return ndims() == 2 && m_dims[0] == 1; }
00038
00040 unsigned& operator[](unsigned);
00041 unsigned operator[](unsigned) const;
00042
00043 bool operator==(const dim4&) const;
00044 bool operator!=(const dim4&) const;
00045
00046 dim4& operator=(const dim4&);
00047
00048 AFAPI friend std::ostream& operator<<(std::ostream&, const dim4&);
00049
00050 private:
00051 unsigned m_dims[4];
00052 };
00053 };