Mesh Oriented datABase  (version 5.5.0)
An array-based unstructured mesh library
moab::TagVarTypeLess< T > Class Template Reference

#include <TagCompare.hpp>

Public Member Functions

 TagVarTypeLess (const void *v, int s)
 
bool operator() (const void *data) const
 
bool operator() (const VarLenTag &vdata) const
 

Private Attributes

const Tvalue
 
int size
 

Detailed Description

template<typename T>
class moab::TagVarTypeLess< T >

Compare variable-length tags containing a known data type

Definition at line 201 of file TagCompare.hpp.

Constructor & Destructor Documentation

◆ TagVarTypeLess()

template<typename T >
moab::TagVarTypeLess< T >::TagVarTypeLess ( const void *  v,
int  s 
)
inline

Definition at line 208 of file TagCompare.hpp.

208 : value( reinterpret_cast< const T* >( v ) ), size( s / sizeof( T ) ) {}

Member Function Documentation

◆ operator()() [1/2]

template<typename T >
bool moab::TagVarTypeLess< T >::operator() ( const VarLenTag vdata) const
inline

Definition at line 225 of file TagCompare.hpp.

226  {
227  const T* ddata = reinterpret_cast< const T* >( vdata.data() );
228  if( (int)vdata.size() < sizeof( T ) * size )
229  {
230  for( int i = 0; i < vdata.size() / sizeof( T ); ++i )
231  if( value[i] < ddata[i] ) return false;
232  }
233  else
234  {
235  for( int i = 0; i < vdata.size() / sizeof( T ); ++i )
236  if( value[i] <= ddata[i] ) return false;
237  }
238  return true;
239  }

References moab::VarLenTag::data(), moab::TagVarTypeLess< T >::size, moab::VarLenTag::size(), T, and moab::TagVarTypeLess< T >::value.

◆ operator()() [2/2]

template<typename T >
bool moab::TagVarTypeLess< T >::operator() ( const void *  data) const
inline

Definition at line 209 of file TagCompare.hpp.

210  {
211  const VarLenTag* vdata = reinterpret_cast< const VarLenTag* >( data );
212  const T* ddata = reinterpret_cast< const T* >( vdata->data() );
213  if( (int)vdata->size() < sizeof( T ) * size )
214  {
215  for( int i = 0; i < vdata->size() / sizeof( T ); ++i )
216  if( value[i] < ddata[i] ) return false;
217  }
218  else
219  {
220  for( int i = 0; i < vdata->size() / sizeof( T ); ++i )
221  if( value[i] <= ddata[i] ) return false;
222  }
223  return true;
224  }

References moab::VarLenTag::data(), moab::TagVarTypeLess< T >::size, moab::VarLenTag::size(), T, and moab::TagVarTypeLess< T >::value.

Member Data Documentation

◆ size

template<typename T >
int moab::TagVarTypeLess< T >::size
private

Definition at line 205 of file TagCompare.hpp.

Referenced by moab::TagVarTypeLess< T >::operator()().

◆ value

template<typename T >
const T* moab::TagVarTypeLess< T >::value
private

Definition at line 204 of file TagCompare.hpp.

Referenced by moab::TagVarTypeLess< T >::operator()().


The documentation for this class was generated from the following file: