moab
moab::TagVarTypeLess< T > Class Template Reference

#include <TagCompare.hpp>

List of all members.

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 190 of file TagCompare.hpp.


Constructor & Destructor Documentation

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

Definition at line 196 of file TagCompare.hpp.

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

Member Function Documentation

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

Definition at line 200 of file TagCompare.hpp.

                                              {
      const VarLenTag* vdata = reinterpret_cast<const VarLenTag*>(data);
      const T* ddata = reinterpret_cast<const T*>(vdata->data());
      if ((int)vdata->size() < sizeof(T)*size) {
        for (int i = 0; i < vdata->size()/sizeof(T); ++i)
          if (value[i] < ddata[i])
            return false;
      }
      else {
        for (int i = 0; i < vdata->size()/sizeof(T); ++i)
          if (value[i] <= ddata[i])
            return false;
      }
      return true;
    }
template<typename T >
bool moab::TagVarTypeLess< T >::operator() ( const VarLenTag vdata) const [inline]

Definition at line 215 of file TagCompare.hpp.

                                                    {
      const T* ddata = reinterpret_cast<const T*>(vdata.data());
      if ((int)vdata.size() < sizeof(T)*size) {
        for (int i = 0; i < vdata.size()/sizeof(T); ++i)
          if (value[i] < ddata[i])
            return false;
      }
      else {
        for (int i = 0; i < vdata.size()/sizeof(T); ++i)
          if (value[i] <= ddata[i])
            return false;
      }
      return true;
    }

Member Data Documentation

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

Definition at line 194 of file TagCompare.hpp.

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

Definition at line 193 of file TagCompare.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines