1 #ifndef TAG_COMPARE_HPP
2 #define TAG_COMPARE_HPP
89 template <
typename T >
101 const T* ddata =
reinterpret_cast< const T*
>( data );
102 for(
int i = 0; i <
size; ++i )
103 if(
value[i] != ddata[i] )
return false;
109 template <
typename T >
121 const T* ddata =
reinterpret_cast< const T*
>( data );
122 for(
int i = 0; i <
size; ++i )
123 if(
value[i] <= ddata[i] )
return false;
131 template <
typename T >
143 const T* ddata =
reinterpret_cast< const T*
>( data );
144 return *ddata ==
value;
151 template <
typename T >
163 const T* ddata =
reinterpret_cast< const T*
>( data );
164 return *ddata <
value;
169 template <
typename T >
182 if( vdata->
size() !=
size *
sizeof( T ) )
return false;
183 const T* ddata =
reinterpret_cast< const T*
>( vdata->
data() );
184 for(
int i = 0; i <
size; ++i )
185 if(
value[i] != ddata[i] )
return false;
191 if( vdata.
size() !=
size *
sizeof( T ) )
return false;
192 const T* ddata =
reinterpret_cast< const T*
>( vdata.
data() );
193 for(
int i = 0; i <
size; ++i )
194 if(
value[i] != ddata[i] )
return false;
200 template <
typename T >
212 const T* ddata =
reinterpret_cast< const T*
>( vdata->
data() );
213 if( (
int)vdata->
size() <
sizeof( T ) *
size )
215 for(
int i = 0; i < vdata->
size() /
sizeof( T ); ++i )
216 if(
value[i] < ddata[i] )
return false;
220 for(
int i = 0; i < vdata->
size() /
sizeof( T ); ++i )
221 if(
value[i] <= ddata[i] )
return false;
227 const T* ddata =
reinterpret_cast< const T*
>( vdata.
data() );
228 if( (
int)vdata.
size() <
sizeof( T ) *
size )
230 for(
int i = 0; i < vdata.
size() /
sizeof( T ); ++i )
231 if(
value[i] < ddata[i] )
return false;
235 for(
int i = 0; i < vdata.
size() /
sizeof( T ); ++i )
236 if(
value[i] <= ddata[i] )
return false;
267 template <
class Functor,
class IteratorType >
271 for( IteratorType i = begin; i != end; ++i )
272 if( compare( i->second ) ) insert = results.
insert( insert, i->first );
275 template <
class Functor,
class IteratorType >
279 std::vector< EntityHandle >& results )
281 for( IteratorType i = begin; i != end; ++i )
282 if( compare( i->second ) ) results.push_back( i->first );
285 template <
class Functor,
class TagMap >
289 const TagMap& tag_map,
293 for( ; lower != upper; ++lower )
295 typename TagMap::const_iterator i = tag_map.find( *lower );
296 if( i != tag_map.end() && compare( i->second ) ) insert = results.
insert( insert, *lower );
306 template <
class IteratorType,
class ContainerType >
312 ContainerType& results )
317 if(
size ==
sizeof(
int ) )
318 find_tag_values< TagOneIntEqual, IteratorType >(
TagOneIntEqual( value ), begin, end, results );
320 find_tag_values< TagIntsEqual, IteratorType >(
TagIntsEqual( value,
size ), begin, end, results );
324 if(
size ==
sizeof(
double ) )
325 find_tag_values< TagOneDoubleEqual, IteratorType >(
TagOneDoubleEqual( value ), begin, end, results );
327 find_tag_values< TagDoublesEqual, IteratorType >(
TagDoublesEqual( value,
size ), begin, end, results );
332 find_tag_values< TagOneHandleEqual, IteratorType >(
TagOneHandleEqual( value ), begin, end, results );
334 find_tag_values< TagHandlesEqual, IteratorType >(
TagHandlesEqual( value,
size ), begin, end, results );
338 find_tag_values< TagBytesEqual, IteratorType >(
TagBytesEqual( value,
size ), begin, end, results );
342 template <
class IteratorType,
class ContainerType >
348 ContainerType& results )
353 find_tag_values< TagVarIntsEqual, IteratorType >(
TagVarIntsEqual( value,
size ), begin, end, results );
364 find_tag_values< TagVarBytesEqual, IteratorType >(
TagVarBytesEqual( value,
size ), begin, end, results );
375 template <
class TagMap >
381 const TagMap& tag_map,
387 if(
size ==
sizeof(
int ) )
388 find_map_values< TagOneIntEqual, TagMap >(
TagOneIntEqual( value ), begin, end, tag_map, results );
390 find_map_values< TagIntsEqual, TagMap >(
TagIntsEqual( value,
size ), begin, end, tag_map, results );
394 if(
size ==
sizeof(
double ) )
395 find_map_values< TagOneDoubleEqual, TagMap >(
TagOneDoubleEqual( value ), begin, end, tag_map,
398 find_map_values< TagDoublesEqual, TagMap >(
TagDoublesEqual( value,
size ), begin, end, tag_map,
404 find_map_values< TagOneHandleEqual, TagMap >(
TagOneHandleEqual( value ), begin, end, tag_map,
407 find_map_values< TagHandlesEqual, TagMap >(
TagHandlesEqual( value,
size ), begin, end, tag_map,
412 find_map_values< TagBytesEqual, TagMap >(
TagBytesEqual( value,
size ), begin, end, tag_map, results );
416 template <
class TagMap >
422 const TagMap& tag_map,
428 find_map_values< TagVarIntsEqual, TagMap >(
TagVarIntsEqual( value,
size ), begin, end, tag_map, results );
439 find_map_values< TagVarBytesEqual, TagMap >(
TagVarBytesEqual( value,
size ), begin, end, tag_map,
449 typedef std::pair< EntityHandle, const char* >
data_type;
457 :
step( tag_size ),
data( start_handle, reinterpret_cast< const char* >( data_array ) )
463 data( start_handle, reinterpret_cast< const char* >( data_array ) )
468 return data.first == other.
data.first;
472 return data.first != other.
data.first;
512 return data.first - other.
data.first;
524 static inline std::pair< EntityType, EntityType >
type_range( EntityType type )
530 EntityType next = type;
532 return std::pair< EntityType, EntityType >( type, next );