34#ifndef CARTOBASE_TYPE_VOXELVALUE_D_H
35#define CARTOBASE_TYPE_VOXELVALUE_D_H
48 template <
typename T,
unsigned int C>
51 #ifdef CARTO_DEBUG_VOXELVALUE
52 std::cout <<
"VOXELVALUE:: constructor()" << std::endl;
56 template <
typename T,
unsigned int C>
59 #ifdef CARTO_DEBUG_VOXELVALUE
60 std::cout <<
"VOXELVALUE:: constructor( other )" << std::endl;
65 template <
typename T,
unsigned int C>
68 #ifdef CARTO_DEBUG_VOXELVALUE
69 std::cout <<
"VOXELVALUE:: destructor()" << std::endl;
77 template <
typename T,
unsigned int C>
inline
80 #ifdef CARTO_DEBUG_VOXELVALUE
81 std::cout <<
"VOXELVALUE:: VV == VV" << std::endl;
85 if( (*
this)[ i ] != aa[ i ] )
90 template <
typename T,
unsigned int C>
inline
93 #ifdef CARTO_DEBUG_VOXELVALUE
94 std::cout <<
"VOXELVALUE:: VV != VV" << std::endl;
96 return !( (*this) == aa );
99 template <
typename T,
unsigned int C>
102 #ifdef CARTO_DEBUG_VOXELVALUE
103 std::cout <<
"VOXELVALUE:: VV == const" << std::endl;
107 if( (*
this)[ i ] != bb )
112 template <
typename T,
unsigned int C>
inline
115 #ifdef CARTO_DEBUG_VOXELVALUE
116 std::cout <<
"VOXELVALUE:: VV != const" << std::endl;
118 return !( (*this) == bb );
122 template <
typename T,
unsigned int C>
125 #ifdef CARTO_DEBUG_VOXELVALUE
126 std::cout <<
"VOXELVALUE:: bool()" << std::endl;
130 if( (*
this)[ i ] != T(0) )
136 template <
typename V>
140 return uint64_t(value);
143 template <
typename T,
unsigned C>
147 static_assert((
sizeof(T) * C <= 8),
"It is not possible to define toUnsignedInt for carto::VoxelValue<C, T>.");
150 for (
unsigned int c=0; c<carto::VoxelValue<T, C>::channelcount; ++c) {
151 #ifdef CARTO_DEBUG_VOXELVALUE
152 std::cout <<
"VOXELVALUE:: KeyComparator<carto::VoxelValue<T, C> >::toUnsignedInt(), "
156 result |=
static_cast<uint64_t
>(value[c] << (
sizeof(T) * 8 * c));
159 #ifdef CARTO_DEBUG_VOXELVALUE
160 std::cout <<
"VOXELVALUE:: KeyComparator<carto::VoxelValue<T, C> >::toUnsignedInt(), "
167 template <
typename V>
172 #ifdef CARTO_DEBUG_VOXELVALUE
173 std::cout <<
"VOXELVALUE:: KeyComparator<V>::less()" << std::endl;
178 template <
typename T,
unsigned C>
183 #ifdef CARTO_DEBUG_VOXELVALUE
184 std::cout <<
"VOXELVALUE:: KeyComparator<carto::VoxelValue<T, C> >::less()" << std::endl;
192 template <
typename V>
195 #ifdef CARTO_DEBUG_VOXELVALUE
196 std::cout <<
"VOXELVALUE:: KeyComparatorLess<V>::operator()" << std::endl;
197 std::cout <<
"VOXELVALUE:: KeyComparatorLess<V>::operator(), lhs = " <<
carto::toString(lhs) << std::endl;
198 std::cout <<
"VOXELVALUE:: KeyComparatorLess<V>::operator(), rhs = " <<
carto::toString(rhs) << std::endl;
Base class for any multichannel data (RGB, RGBA, HSV, ...)
bool operator==(const VoxelValue< T, C > &) const
bool operator!=(const VoxelValue< T, C > &) const
std::string toString(const T &object)
constexpr bool operator()(const V &lhs, const V &rhs) const
static bool less(const carto::VoxelValue< T, C > &lhs, const carto::VoxelValue< T, C > &rhs)
static uint64_t toUnsignedInt(const carto::VoxelValue< T, C > &value)
KeyComparator is used to compare keys of types that do not have comparison operator.
static uint64_t toUnsignedInt(const V &value)
static bool less(const V &lhs, const V &rhs)