cartobase  5.0.5
voxelrgb_decl.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTOBASE_TYPE_RGB_DECL_H
35 #define CARTOBASE_TYPE_RGB_DECL_H
36 //--- cartobase --------------------------------------------------------------
38 #include <cartobase/type/types.h>
39 //----------------------------------------------------------------------------
40 
41 /*****************************************************************************
42  * Even though declarations are here, this is NOT the file you want to
43  * include to use VoxelRGB.
44  * Since all methods are inline and for readability issues, declarations
45  * are contained in "_decl.h" file and definitions in "_def.h" file.
46  * You should include ".h" file which binds all necessary headers.
47  ****************************************************************************/
48 
49 namespace carto {
50 
51  class VoxelRGBA;
52  class VoxelRGB;
53 
54  template<> inline std::string DataTypeCode<VoxelRGB>::dataType()
55  {
56  return "RGB";
57  }
58 
71  class VoxelRGB : public VoxelValue<uint8_t,3>
72  {
73  public:
74 
75  //=== CONSTRUCTORS =====================================================
76  VoxelRGB( const VoxelRGB &other );
77  VoxelRGB( const VoxelRGBA &other );
78  VoxelRGB( const VoxelValue<uint8_t,3> &other );
79  VoxelRGB( const uint8_t &r = 0,
80  const uint8_t &g = 0,
81  const uint8_t &b = 0 );
82  ~VoxelRGB();
83 
84  //=== AFFECTATION ======================================================
85  VoxelRGB & operator = ( const VoxelRGB & other );
86  VoxelRGB & operator = ( const VoxelRGBA & other );
87  VoxelRGB & operator = ( const uint8_t & value );
88 
89  //=== OPERATORS ========================================================
90  VoxelRGB & operator += ( const VoxelRGB & other );
91  VoxelRGB & operator += ( const VoxelRGBA & other );
92  VoxelRGB & operator -= ( const VoxelRGB & other );
93  VoxelRGB & operator -= ( const VoxelRGBA & other );
94  VoxelRGB & operator += ( const uint8_t & value );
95  VoxelRGB & operator -= ( const uint8_t & value );
96  VoxelRGB & operator *= ( const uint8_t & value );
97  VoxelRGB & operator *= ( const uint16_t & value );
98  VoxelRGB & operator *= ( const uint32_t & value );
99  VoxelRGB & operator *= ( const uint64_t & value );
100  VoxelRGB & operator *= ( const float & value );
101  VoxelRGB & operator *= ( const double & value );
102  VoxelRGB & operator /= ( const uint8_t & value );
103  VoxelRGB & operator /= ( const uint16_t & value );
104  VoxelRGB & operator /= ( const uint32_t & value );
105  VoxelRGB & operator /= ( const uint64_t & value );
106  VoxelRGB & operator /= ( const float & value );
107  VoxelRGB & operator /= ( const double & value );
108  // long int are still used in volumes
109  VoxelRGB & operator *= ( const long & value );
110  VoxelRGB & operator /= ( const long & value );
111 
112  //=== ACCESSORS ========================================================
113  inline const uint8_t& red () const { return (*this)[0]; }
114  inline const uint8_t& green() const { return (*this)[1]; }
115  inline const uint8_t& blue () const { return (*this)[2]; }
116  inline uint8_t& red () { return (*this)[0]; }
117  inline uint8_t& green() { return (*this)[1]; }
118  inline uint8_t& blue () { return (*this)[2]; }
119  };
120 
121  VoxelRGB operator + (const VoxelRGB &aa, const VoxelRGB &bb);
122  VoxelRGB operator + (const VoxelRGB &aa, const uint8_t &bb);
123  VoxelRGB operator + (const VoxelRGB &aa, const uint16_t &bb);
124  VoxelRGB operator + (const VoxelRGB &aa, const uint32_t &bb);
125  VoxelRGB operator + (const VoxelRGB &aa, const uint64_t &bb);
126  VoxelRGB operator + (const VoxelRGB &aa, const float &bb);
127  VoxelRGB operator + (const VoxelRGB &aa, const double &bb);
128  VoxelRGB operator + (const uint8_t &aa, const VoxelRGB &bb);
129  VoxelRGB operator + (const uint16_t &aa, const VoxelRGB &bb);
130  VoxelRGB operator + (const uint32_t &aa, const VoxelRGB &bb);
131  VoxelRGB operator + (const uint64_t &aa, const VoxelRGB &bb);
132  VoxelRGB operator + (const float &aa, const VoxelRGB &bb);
133  VoxelRGB operator + (const double &aa, const VoxelRGB &bb);
134  VoxelRGB operator - (const VoxelRGB &aa, const VoxelRGB &bb);
135  VoxelRGB operator - (const VoxelRGB &aa, const uint8_t &bb);
136  VoxelRGB operator - (const VoxelRGB &aa, const uint16_t &bb);
137  VoxelRGB operator - (const VoxelRGB &aa, const uint32_t &bb);
138  VoxelRGB operator - (const VoxelRGB &aa, const uint64_t &bb);
139  VoxelRGB operator - (const VoxelRGB &aa, const float &bb);
140  VoxelRGB operator - (const VoxelRGB &aa, const double &bb);
141  VoxelRGB operator - (const uint8_t &aa, const VoxelRGB &bb);
142  VoxelRGB operator - (const uint16_t &aa, const VoxelRGB &bb);
143  VoxelRGB operator - (const uint32_t &aa, const VoxelRGB &bb);
144  VoxelRGB operator - (const uint64_t &aa, const VoxelRGB &bb);
145  VoxelRGB operator - (const float &aa, const VoxelRGB &bb);
146  VoxelRGB operator - (const double &aa, const VoxelRGB &bb);
147  VoxelRGB operator * (const VoxelRGB &aa, const uint8_t &bb);
148  VoxelRGB operator * (const VoxelRGB &aa, const uint16_t &bb);
149  VoxelRGB operator * (const VoxelRGB &aa, const uint32_t &bb);
150  VoxelRGB operator * (const VoxelRGB &aa, const uint64_t &bb);
151  VoxelRGB operator * (const VoxelRGB &aa, const float &bb);
152  VoxelRGB operator * (const VoxelRGB &aa, const double &bb);
153  VoxelRGB operator * (const uint8_t &aa, const VoxelRGB &bb);
154  VoxelRGB operator * (const uint16_t &aa, const VoxelRGB &bb);
155  VoxelRGB operator * (const uint32_t &aa, const VoxelRGB &bb);
156  VoxelRGB operator * (const uint64_t &aa, const VoxelRGB &bb);
157  VoxelRGB operator * (const float &aa, const VoxelRGB &bb);
158  VoxelRGB operator * (const double &aa, const VoxelRGB &bb);
159  VoxelRGB operator / (const VoxelRGB &aa, const uint8_t &bb);
160  VoxelRGB operator / (const VoxelRGB &aa, const uint16_t &bb);
161  VoxelRGB operator / (const VoxelRGB &aa, const uint32_t &bb);
162  VoxelRGB operator / (const VoxelRGB &aa, const uint64_t &bb);
163  VoxelRGB operator / (const VoxelRGB &aa, const float &bb);
164  VoxelRGB operator / (const VoxelRGB &aa, const double &bb);
165  // long int are still used in volumes
166  VoxelRGB operator * (const VoxelRGB &aa, const long &bb);
167  VoxelRGB operator * (const long &aa, const VoxelRGB &bb);
168  VoxelRGB operator / (const VoxelRGB &aa, const long &bb);
169 
170 }
171 
172 #endif
RGBA Value.
VoxelRGB(const VoxelRGB &other)
Definition: voxelrgb_def.h:61
VoxelRGB operator/(const VoxelRGB &aa, const uint8_t &bb)
Definition: voxelrgb_def.h:757
VoxelRGB & operator+=(const VoxelRGB &other)
Definition: voxelrgb_def.h:149
VoxelRGB & operator=(const VoxelRGB &other)
Definition: voxelrgb_def.h:111
VoxelRGB operator+(const VoxelRGB &aa, const VoxelRGB &bb)
Definition: voxelrgb_def.h:377
VoxelRGB & operator-=(const VoxelRGB &other)
Definition: voxelrgb_def.h:173
Base class for any multichannel data (RGB, RGBA, HSV, ...)
Definition: voxelvalue.h:58
uint8_t & red()
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)
Definition: voxelrgb_def.h:637
RGB Value.
Definition: voxelrgb_decl.h:71
VoxelRGB & operator*=(const uint8_t &value)
Definition: voxelrgb_def.h:221
VoxelRGB operator-(const VoxelRGB &aa, const VoxelRGB &bb)
Definition: voxelrgb_def.h:507
static std::string dataType()
Definition: types.h:230
const uint8_t & blue() const
uint8_t & blue()
const uint8_t & green() const
uint8_t & green()
VoxelRGB & operator/=(const uint8_t &value)
Definition: voxelrgb_def.h:295
const uint8_t & red() const