MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Class for storing variable-length tag data. More...
#include <VarLenTag.hpp>
Public Member Functions | |
VarLenTag () | |
VarLenTag (unsigned size) | |
~VarLenTag () | |
VarLenTag (const VarLenTag ©) | |
VarLenTag (unsigned size, const void *data) | |
unsigned | size () const |
unsigned char * | data () |
unsigned long | mem () const |
const unsigned char * | data () const |
unsigned char * | resize (unsigned size) |
void | clear () |
void | set (const void *dat, unsigned sz) |
VarLenTag & | operator= (const VarLenTag &other) |
Protected Attributes | |
VarLenTagData | mData |
Class for storing variable-length tag data.
Class for managing variable-length tag data. This class must behave as if it were initialized to empty if it is memset to zero w/out invoking any constructor.
Definition at line 152 of file VarLenTag.hpp.
moab::VarLenTag::VarLenTag | ( | ) | [inline] |
Definition at line 158 of file VarLenTag.hpp.
References moab::VarLenTagData::mData.
moab::VarLenTag::VarLenTag | ( | unsigned | size | ) | [inline] |
Definition at line 249 of file VarLenTag.hpp.
References moab::VarLenTagData::INLINE_COUNT, and moab::VarLenTagData::mData.
moab::VarLenTag::~VarLenTag | ( | ) | [inline] |
Definition at line 163 of file VarLenTag.hpp.
{ clear(); }
moab::VarLenTag::VarLenTag | ( | const VarLenTag & | copy | ) | [inline] |
Definition at line 269 of file VarLenTag.hpp.
References moab::VarLenTagData::INLINE_COUNT, moab::VarLenTagData::mData, mData, moab::VarLenTagData::mPointer, and size().
moab::VarLenTag::VarLenTag | ( | unsigned | size, |
const void * | data | ||
) | [inline] |
Definition at line 280 of file VarLenTag.hpp.
References moab::VarLenTagData::mData, mData, moab::VarLenTagData::mPointer, and resize().
void moab::VarLenTag::clear | ( | ) | [inline] |
Definition at line 258 of file VarLenTag.hpp.
References moab::VarLenTagData::INLINE_COUNT, moab::VarLenTagData::mData, and moab::VarLenTagData::size.
Referenced by moab::SequenceData::release_tag_data(), and moab::VarLenDenseTag::remove_data().
unsigned char* moab::VarLenTag::data | ( | ) | [inline] |
Definition at line 175 of file VarLenTag.hpp.
References moab::VarLenTagData::INLINE_COUNT, moab::VarLenTagData::mData, and moab::VarLenTagData::size.
Referenced by moab::VarLenDenseTag::get_data(), moab::get_tagged(), moab::VarLenDenseTag::is_tagged(), moab::TagVarBytesEqual::operator()(), moab::TagVarBytesLess::operator()(), moab::TagVarTypeEqual< T >::operator()(), moab::TagVarTypeLess< T >::operator()(), operator=(), test_inline(), test_non_inline(), test_resize_ii(), test_resize_in(), test_resize_ni(), and test_resize_nn().
const unsigned char* moab::VarLenTag::data | ( | ) | const [inline] |
Definition at line 197 of file VarLenTag.hpp.
unsigned long moab::VarLenTag::mem | ( | ) | const [inline] |
Definition at line 186 of file VarLenTag.hpp.
References moab::VarLenTagData::INLINE_COUNT, and moab::VarLenTagData::size.
Referenced by moab::VarLenDenseTag::get_memory_use().
{ return size() <= VarLenTagData::INLINE_COUNT ? 0 : size(); }
Definition at line 211 of file VarLenTag.hpp.
References data(), and size().
{ set( other.data(), other.size() ); return *this; }
unsigned char * moab::VarLenTag::resize | ( | unsigned | size | ) | [inline] |
Definition at line 218 of file VarLenTag.hpp.
References moab::VarLenTagData::INLINE_COUNT, moab::VarLenTagData::mData, and moab::VarLenTagData::size.
Referenced by test_resize_ii(), test_resize_in(), test_resize_ni(), test_resize_nn(), and VarLenTag().
{ #ifdef VAR_LEN_TAG_ELIDE_DATA if( s <= VarLenTagData::INLINE_COUNT ) { if( size() > VarLenTagData::INLINE_COUNT ) { unsigned char* tmp_ptr = mData.mData.mPointer.array; memcpy( mData.mData.mInline.array, tmp_ptr, s ); free( tmp_ptr ); } mData.mData.mInline.size = s; return mData.mData.mInline.array; } else if( size() <= VarLenTagData::INLINE_COUNT ) { void* tmp_ptr = malloc( s ); memcpy( tmp_ptr, mData.mData.mInline.array, size() ); mData.mData.mPointer.array = reinterpret_cast< unsigned char* >( tmp_ptr ); } else #endif if( size() < s ) { void* tmp_ptr = size() ? realloc( mData.mData.mPointer.array, s ) : malloc( s ); mData.mData.mPointer.array = reinterpret_cast< unsigned char* >( tmp_ptr ); } mData.mData.mPointer.size = s; return mData.mData.mPointer.array; }
void moab::VarLenTag::set | ( | const void * | dat, |
unsigned | sz | ||
) | [inline] |
Definition at line 206 of file VarLenTag.hpp.
Referenced by moab::VarLenDenseTag::set_data().
{ memcpy( resize( sz ), dat, sz ); }
unsigned moab::VarLenTag::size | ( | ) | const [inline] |
Definition at line 170 of file VarLenTag.hpp.
References moab::VarLenTagData::mData.
Referenced by moab::VarLenDenseTag::get_data(), moab::get_tagged(), moab::TagVarBytesEqual::operator()(), moab::TagVarBytesLess::operator()(), moab::TagVarTypeEqual< T >::operator()(), moab::TagVarTypeLess< T >::operator()(), operator=(), and VarLenTag().
VarLenTagData moab::VarLenTag::mData [protected] |
Definition at line 155 of file VarLenTag.hpp.
Referenced by VarLenTag().