cartobase  4.7.0
voxelvalue_d.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_VOXELVALUE_D_H
35 #define CARTOBASE_TYPE_VOXELVALUE_D_H
36 
37 //--- cartobase --------------------------------------------------------------
39 //----------------------------------------------------------------------------
40 
41 namespace carto {
42 
43  //==========================================================================
44  // C O N S T R U C T O R S
45  //==========================================================================
46 
47  template <typename T, unsigned int C>
49  {
50  #ifdef CARTO_DEBUG_VOXELVALUE
51  std::cout << "VOXELVALUE:: constructor()" << std::endl;
52  #endif
53  }
54 
55  template <typename T, unsigned int C>
57  {
58  #ifdef CARTO_DEBUG_VOXELVALUE
59  std::cout << "VOXELVALUE:: constructor( other )" << std::endl;
60  #endif
61  *this = other;
62  }
63 
64  template <typename T, unsigned int C>
66  {
67  #ifdef CARTO_DEBUG_VOXELVALUE
68  std::cout << "VOXELVALUE:: destructor()" << std::endl;
69  #endif
70  }
71 
72  //==========================================================================
73  // I N T E R N O P E R A T O R S
74  //==========================================================================
75 
76  template <typename T, unsigned int C> inline
78  {
79  #ifdef CARTO_DEBUG_VOXELVALUE
80  std::cout << "VOXELVALUE:: VV == VV" << std::endl;
81  #endif
82  unsigned int i;
83  for( i=0; i<C; ++i )
84  if( (*this)[ i ] != aa[ i ] )
85  return false;
86  return true;
87  }
88 
89  template <typename T, unsigned int C> inline
91  {
92  #ifdef CARTO_DEBUG_VOXELVALUE
93  std::cout << "VOXELVALUE:: VV != VV" << std::endl;
94  #endif
95  return !( (*this) == aa );
96  }
97 
98  template <typename T, unsigned int C>
99  bool VoxelValue<T,C>::operator == ( const T &bb ) const
100  {
101  #ifdef CARTO_DEBUG_VOXELVALUE
102  std::cout << "VOXELVALUE:: VV == const" << std::endl;
103  #endif
104  unsigned int i;
105  for( i=0; i<C; ++i )
106  if( (*this)[ i ] != bb )
107  return false;
108  return true;
109  }
110 
111  template <typename T, unsigned int C> inline
112  bool VoxelValue<T,C>::operator != ( const T &bb ) const
113  {
114  #ifdef CARTO_DEBUG_VOXELVALUE
115  std::cout << "VOXELVALUE:: VV != const" << std::endl;
116  #endif
117  return !( (*this) == bb );
118  }
119 
120  //=== CONVERSION =======================================================
121  template <typename T, unsigned int C>
123  {
124  #ifdef CARTO_DEBUG_VOXELVALUE
125  std::cout << "VOXELVALUE:: bool()" << std::endl;
126  #endif
127  unsigned int i;
128  for( i=0; i<C; ++i )
129  if( (*this)[ i ] != T(0) )
130  return true;
131  return false;
132  }
133 }
134 
135 #endif
Base class for any multichannel data (RGB, RGBA, HSV, ...)
Definition: voxelvalue.h:58
bool operator!=(const VoxelValue< T, C > &) const
Definition: voxelvalue_d.h:90
bool operator==(const VoxelValue< T, C > &) const
Definition: voxelvalue_d.h:77