Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
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

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

Definition at line 208 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 209 of file TagCompare.hpp.

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

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

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

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

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

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

Definition at line 204 of file TagCompare.hpp.

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

List of all members.


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