#include <AttributeBlob.h>
Public Member Functions | |
void | _alloc (unsigned int n) |
make sure that at least n bytes are allocated: uses realloc | |
void | alloc (unsigned int n) |
make sure that at least n bytes are allocated | |
void | clear () |
clears the memory contents. does not deallocate the memory | |
void | copy (unsigned int i, const void *indata, unsigned int inlen) |
copys over a block of bytes into the given index position | |
const char * | data (unsigned int i) const |
return a pointer to the currently kept memory with the given byte offset. | |
char * | data () |
return a pointer to the currently kept memory | |
const char * | data () const |
return a pointer to the currently kept memory | |
void | dealloc () |
deallocates the kept memory space (we use dealloc() instead of free() as a name, because sometimes "free" is replaced by the preprocessor) | |
const char * | detach () |
detach the memory from the object. returns the memory pointer | |
std::pair< const char *, unsigned int > | detach_pair () |
detach the memory from the object, returning a std::pair containing memory pointer and size. | |
bool | empty () const |
returns true if the TpAttributeBlob is empty | |
template<typename T> | |
T | get (unsigned int i) const |
function template used to retrieve the value any simple type at a given index. | |
void | getAnyType (unsigned int i, AnyType &v) const |
reads a defined AnyType at the position i | |
unsigned int | getAttrChainLength (unsigned int chidx, const AttributePropertiesList &attrlist) const |
Calculates the length of a valid attribute value chain at position i. | |
AnyType | getAttrChainValue (unsigned int chidx, unsigned int attrid, const AttributePropertiesList &attrlist) const |
retrieves the attribute value attrid from an attribute chain at position i | |
bool | getBool (unsigned int i, unsigned int bitnum) const |
returns a bit index based at the given position | |
std::string | getLongstring (unsigned int i) const |
returns a long string at the given position | |
std::string | getRange (unsigned int i, unsigned int len) const |
copys a range into a std::string and return it, used by the tests to check the contents. | |
std::string | getString (unsigned int i) const |
returns a (short) string at the given position | |
void | move (unsigned int src, unsigned int dst, unsigned int len) |
move a block of bytes within the blob. | |
thistype & | operator= (const thistype &other) |
assignment operator: copies data of the other into buffer. | |
char | operator[] (unsigned int i) const |
return the character at the given position | |
template<typename ValTp> | |
void | put (unsigned int i, ValTp v) |
puts the value of the given template type at the given position | |
void | putAnyType (unsigned int i, const AnyType &v) |
saves a defined AnyType at the position i | |
bool | putAttrChainValue (const AttributePropertiesList &attrlist, unsigned int attrid, const AnyType &value) |
write (change) an attribute value within the attribute chain starting at position 0 | |
void | putBool (unsigned int i, unsigned int bitnum, bool v) |
puts a bit at the given index | |
void | putLongstring (unsigned int i, const std::string &s) |
writes a long string at the given positon | |
void | putString (unsigned int i, const std::string &s) |
writes a string at the given position | |
unsigned int | size () const |
return the currently allocated buffer size in bytes. | |
void | swap (thistype &other) |
exchange the data array with another TpAttributeBlob | |
TpAttributeBlob (const thistype &other) | |
copy constructor: allocates a new buffer of the same size. | |
TpAttributeBlob (const void *data, unsigned int len) | |
create an object and copy the specified memory range into it | |
TpAttributeBlob (unsigned int n) | |
create an object with n bytes preallocated | |
TpAttributeBlob () | |
create a new empty object | |
void | zero (unsigned int i, unsigned int len) |
zeros a block of bytes at the given index | |
virtual | ~TpAttributeBlob () |
destroys the memory buffer |
It provides sequential write-function and random access functions to extract attribute positions. It has one pure virtual function which should be a function defining the grow policy.
Definition at line 25 of file AttributeBlob.h.
VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob | ( | ) | [inline] |
VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob | ( | unsigned int | n | ) | [inline, explicit] |
create an object with n bytes preallocated
Definition at line 50 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob | ( | const void * | data, | |
unsigned int | len | |||
) | [inline, explicit] |
create an object and copy the specified memory range into it
Definition at line 57 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::copy().
VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob | ( | const thistype & | other | ) | [inline] |
copy constructor: allocates a new buffer of the same size.
Definition at line 64 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::copy(), VGServer::TpAttributeBlob< AllocPolicy >::data(), and VGServer::TpAttributeBlob< AllocPolicy >::size().
virtual VGServer::TpAttributeBlob< AllocPolicy >::~TpAttributeBlob | ( | ) | [inline, virtual] |
destroys the memory buffer
Definition at line 79 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::dealloc().
void VGServer::TpAttributeBlob< AllocPolicy >::_alloc | ( | unsigned int | n | ) | [inline] |
make sure that at least n bytes are allocated: uses realloc
Definition at line 110 of file AttributeBlob.h.
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::alloc().
void VGServer::TpAttributeBlob< AllocPolicy >::alloc | ( | unsigned int | n | ) | [inline] |
make sure that at least n bytes are allocated
Definition at line 106 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::_alloc().
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::copy(), VGServer::GraphData::loadSnapshot(), VGServer::TpAttributeBlob< AllocPolicy >::move(), VGServer::TpAttributeBlob< AllocPolicy >::put(), VGServer::TpAttributeBlob< AllocPolicy >::putBool(), VGServer::TpAttributeBlob< AllocPolicy >::putLongstring(), VGServer::TpAttributeBlob< AllocPolicy >::putString(), VGServer::GraphLoader::reserve(), VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob(), and VGServer::TpAttributeBlob< AllocPolicy >::zero().
void VGServer::TpAttributeBlob< AllocPolicy >::clear | ( | ) | [inline] |
clears the memory contents. does not deallocate the memory
Definition at line 129 of file AttributeBlob.h.
void VGServer::TpAttributeBlob< AllocPolicy >::copy | ( | unsigned int | i, | |
const void * | indata, | |||
unsigned int | inlen | |||
) | [inline] |
copys over a block of bytes into the given index position
Definition at line 224 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
Referenced by VGServer::GraphData::applyChangelist(), VGServer::TpAttributeBlob< AllocPolicy >::operator=(), and VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob().
const char* VGServer::TpAttributeBlob< AllocPolicy >::data | ( | unsigned int | i | ) | const [inline] |
return a pointer to the currently kept memory with the given byte offset.
Doesnt check that it is valid.
Definition at line 93 of file AttributeBlob.h.
char* VGServer::TpAttributeBlob< AllocPolicy >::data | ( | ) | [inline] |
const char* VGServer::TpAttributeBlob< AllocPolicy >::data | ( | ) | const [inline] |
return a pointer to the currently kept memory
Definition at line 84 of file AttributeBlob.h.
Referenced by VGServer::GraphData::applyChangelist(), VGServer::TpAttributeBlob< AllocPolicy >::detach(), VGServer::GraphContainer::getArea(), VGServer::GraphData::getEdgeAttrBlob(), VGServer::GraphContainer::getNearestNeighbor(), VGServer::TpAttributeBlob< AllocPolicy >::getRange(), VGServer::GraphData::getVertexAttrBlob(), VGServer::GraphData::loadSnapshot(), VGServer::TpAttributeBlob< AllocPolicy >::operator=(), VGServer::GraphData::saveSnapshot(), and VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob().
void VGServer::TpAttributeBlob< AllocPolicy >::dealloc | ( | ) | [inline] |
deallocates the kept memory space (we use dealloc() instead of free() as a name, because sometimes "free" is replaced by the preprocessor)
Definition at line 134 of file AttributeBlob.h.
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::~TpAttributeBlob().
const char* VGServer::TpAttributeBlob< AllocPolicy >::detach | ( | ) | [inline] |
detach the memory from the object. returns the memory pointer
Definition at line 142 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::data().
std::pair<const char*, unsigned int> VGServer::TpAttributeBlob< AllocPolicy >::detach_pair | ( | ) | [inline] |
detach the memory from the object, returning a std::pair containing memory pointer and size.
Definition at line 151 of file AttributeBlob.h.
bool VGServer::TpAttributeBlob< AllocPolicy >::empty | ( | ) | const [inline] |
returns true if the TpAttributeBlob is empty
Definition at line 102 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::size().
Referenced by VGServer::Changelist::addEdge(), VGServer::Changelist::addVertex(), VGServer::Changelist::setEdgeAttr(), and VGServer::Changelist::setVertexAttr().
T VGServer::TpAttributeBlob< AllocPolicy >::get | ( | unsigned int | i | ) | const [inline] |
function template used to retrieve the value any simple type at a given index.
Definition at line 196 of file AttributeBlob.h.
void VGServer::TpAttributeBlob< AllocPolicy >::getAnyType | ( | unsigned int | i, | |
AnyType & | v | |||
) | const [inline] |
reads a defined AnyType at the position i
Definition at line 17 of file AttributeBlob_impl.h.
References VGServer::ATTRTYPE_BOOL, VGServer::ATTRTYPE_BYTE, VGServer::ATTRTYPE_CHAR, VGServer::ATTRTYPE_DOUBLE, VGServer::ATTRTYPE_DWORD, VGServer::ATTRTYPE_FLOAT, VGServer::ATTRTYPE_INTEGER, VGServer::ATTRTYPE_INVALID, VGServer::ATTRTYPE_LONG, VGServer::ATTRTYPE_LONGSTRING, VGServer::ATTRTYPE_QWORD, VGServer::ATTRTYPE_SHORT, VGServer::ATTRTYPE_STRING, VGServer::ATTRTYPE_WORD, VGServer::TpAttributeBlob< AllocPolicy >::getLongstring(), VGServer::TpAttributeBlob< AllocPolicy >::getString(), VGServer::AnyType::getType(), VGServer::AnyType::setDouble(), VGServer::AnyType::setInteger(), VGServer::AnyType::setLong(), and VGServer::AnyType::setString().
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::getAttrChainValue().
unsigned int VGServer::TpAttributeBlob< AllocPolicy >::getAttrChainLength | ( | unsigned int | chidx, | |
const AttributePropertiesList & | attrlist | |||
) | const [inline] |
Calculates the length of a valid attribute value chain at position i.
Definition at line 150 of file AttributeBlob_impl.h.
References VGServer::ATTRTYPE_LONGSTRING, VGServer::ATTRTYPE_STRING, CASE_FIXED_LENGTH, VGServer::AttributePropertiesList::defbits, VGServer::AttributePropertiesList::defbytes, and VGServer::TpAttributeBlob< AllocPolicy >::getBool().
Referenced by VGServer::GraphData::applyChangelist().
AnyType VGServer::TpAttributeBlob< AllocPolicy >::getAttrChainValue | ( | unsigned int | chidx, | |
unsigned int | attrid, | |||
const AttributePropertiesList & | attrlist | |||
) | const [inline] |
retrieves the attribute value attrid from an attribute chain at position i
Definition at line 199 of file AttributeBlob_impl.h.
References VGServer::ATTRTYPE_BOOL, VGServer::ATTRTYPE_LONGSTRING, VGServer::ATTRTYPE_STRING, CASE_FIXED_LENGTH, VGServer::AttributePropertiesList::defbytes, VGServer::TpAttributeBlob< AllocPolicy >::getAnyType(), VGServer::TpAttributeBlob< AllocPolicy >::getBool(), VGServer::AnyType::getType(), and VGServer::AnyType::setInteger().
Referenced by VGServer::EdgeRef::getAttr(), and VGServer::VertexRef::getAttr().
bool VGServer::TpAttributeBlob< AllocPolicy >::getBool | ( | unsigned int | i, | |
unsigned int | bitnum | |||
) | const [inline] |
returns a bit index based at the given position
i | index into the buffer | |
bitnum | index of the bit returned, 0 based, can be larger than 8 |
Definition at line 184 of file AttributeBlob.h.
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::getAttrChainLength(), VGServer::TpAttributeBlob< AllocPolicy >::getAttrChainValue(), and VGServer::TpAttributeBlob< AllocPolicy >::putAttrChainValue().
std::string VGServer::TpAttributeBlob< AllocPolicy >::getLongstring | ( | unsigned int | i | ) | const [inline] |
returns a long string at the given position
Definition at line 211 of file AttributeBlob.h.
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::getAnyType().
std::string VGServer::TpAttributeBlob< AllocPolicy >::getRange | ( | unsigned int | i, | |
unsigned int | len | |||
) | const [inline] |
copys a range into a std::string and return it, used by the tests to check the contents.
Definition at line 161 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::data().
std::string VGServer::TpAttributeBlob< AllocPolicy >::getString | ( | unsigned int | i | ) | const [inline] |
returns a (short) string at the given position
Definition at line 203 of file AttributeBlob.h.
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::getAnyType().
void VGServer::TpAttributeBlob< AllocPolicy >::move | ( | unsigned int | src, | |
unsigned int | dst, | |||
unsigned int | len | |||
) | [inline] |
move a block of bytes within the blob.
this is used to make room for new attribute values. Parameter order is _not_ the same as for memmove()!
Definition at line 239 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::putAttrChainValue().
thistype& VGServer::TpAttributeBlob< AllocPolicy >::operator= | ( | const thistype & | other | ) | [inline] |
assignment operator: copies data of the other into buffer.
Does not zero unused space if our butter happens to be larger.
Definition at line 72 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::copy(), VGServer::TpAttributeBlob< AllocPolicy >::data(), and VGServer::TpAttributeBlob< AllocPolicy >::size().
char VGServer::TpAttributeBlob< AllocPolicy >::operator[] | ( | unsigned int | i | ) | const [inline] |
void VGServer::TpAttributeBlob< AllocPolicy >::put | ( | unsigned int | i, | |
ValTp | v | |||
) | [inline] |
puts the value of the given template type at the given position
Definition at line 267 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
void VGServer::TpAttributeBlob< AllocPolicy >::putAnyType | ( | unsigned int | i, | |
const AnyType & | v | |||
) | [inline] |
saves a defined AnyType at the position i
Definition at line 84 of file AttributeBlob_impl.h.
References VGServer::ATTRTYPE_BOOL, VGServer::ATTRTYPE_BYTE, VGServer::ATTRTYPE_CHAR, VGServer::ATTRTYPE_DOUBLE, VGServer::ATTRTYPE_DWORD, VGServer::ATTRTYPE_FLOAT, VGServer::ATTRTYPE_INTEGER, VGServer::ATTRTYPE_INVALID, VGServer::ATTRTYPE_LONG, VGServer::ATTRTYPE_LONGSTRING, VGServer::ATTRTYPE_QWORD, VGServer::ATTRTYPE_SHORT, VGServer::ATTRTYPE_STRING, VGServer::ATTRTYPE_WORD, VGServer::AnyType::getDouble(), VGServer::AnyType::getInteger(), VGServer::AnyType::getLong(), VGServer::AnyType::getString(), VGServer::AnyType::getType(), VGServer::AnyType::getUnsignedInteger(), VGServer::AnyType::getUnsignedLong(), VGServer::TpAttributeBlob< AllocPolicy >::putLongstring(), and VGServer::TpAttributeBlob< AllocPolicy >::putString().
Referenced by VGServer::AttributePropertiesList::createBlankAttributeBlob(), VGServer::AttributeSelectorList::processEdgeAttributeBlob(), VGServer::AttributeSelectorList::processVertexAttributeBlob(), VGServer::TpAttributeBlob< AllocPolicy >::putAttrChainValue(), VGServer::GraphLoader::setEdgeAttr(), and VGServer::GraphLoader::setVertexAttr().
bool VGServer::TpAttributeBlob< AllocPolicy >::putAttrChainValue | ( | const AttributePropertiesList & | attrlist, | |
unsigned int | attrid, | |||
const AnyType & | value | |||
) | [inline] |
write (change) an attribute value within the attribute chain starting at position 0
Definition at line 284 of file AttributeBlob_impl.h.
References VGServer::ATTRTYPE_BOOL, VGServer::ATTRTYPE_LONGSTRING, VGServer::ATTRTYPE_STRING, CASE_FIXED_LENGTH, VGServer::AnyType::convertType(), VGServer::AttributeProperties::defbitnum, VGServer::AttributePropertiesList::defbytes, VGServer::TpAttributeBlob< AllocPolicy >::getBool(), VGServer::AnyType::getInteger(), VGServer::AnyType::getType(), VGServer::AnyType::getTypeLength(), VGServer::AnyType::getValueLength(), VGServer::AnyType::isFixedLength(), VGServer::AttributeProperties::lookup, VGServer::TpAttributeBlob< AllocPolicy >::move(), VGServer::TpAttributeBlob< AllocPolicy >::putAnyType(), VGServer::TpAttributeBlob< AllocPolicy >::putBool(), VGServer::TpAttributeBlob< AllocPolicy >::size(), and VGServer::AttributeProperties::varying.
Referenced by VGServer::Changelist::setEdgeAttr(), and VGServer::Changelist::setVertexAttr().
void VGServer::TpAttributeBlob< AllocPolicy >::putBool | ( | unsigned int | i, | |
unsigned int | bitnum, | |||
bool | v | |||
) | [inline] |
puts a bit at the given index
i | index into the buffer | |
bitnum | index of the bit, 0 based, can be larger than 8 | |
v | value to put |
Definition at line 251 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
Referenced by VGServer::AttributePropertiesList::createBlankAttributeBlob(), VGServer::AttributeSelectorList::processEdgeAttributeBlob(), VGServer::AttributeSelectorList::processVertexAttributeBlob(), VGServer::TpAttributeBlob< AllocPolicy >::putAttrChainValue(), VGServer::GraphLoader::setEdgeAttr(), and VGServer::GraphLoader::setVertexAttr().
void VGServer::TpAttributeBlob< AllocPolicy >::putLongstring | ( | unsigned int | i, | |
const std::string & | s | |||
) | [inline] |
writes a long string at the given positon
Definition at line 282 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::putAnyType().
void VGServer::TpAttributeBlob< AllocPolicy >::putString | ( | unsigned int | i, | |
const std::string & | s | |||
) | [inline] |
writes a string at the given position
Definition at line 274 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
Referenced by VGServer::TpAttributeBlob< AllocPolicy >::putAnyType().
unsigned int VGServer::TpAttributeBlob< AllocPolicy >::size | ( | ) | const [inline] |
return the currently allocated buffer size in bytes.
this is _not_ the length of the contained data.
Definition at line 98 of file AttributeBlob.h.
Referenced by VGServer::GraphData::checkReferences(), VGServer::TpAttributeBlob< AllocPolicy >::empty(), VGServer::TpAttributeBlob< AllocPolicy >::operator=(), VGServer::TpAttributeBlob< AllocPolicy >::putAttrChainValue(), and VGServer::TpAttributeBlob< AllocPolicy >::TpAttributeBlob().
void VGServer::TpAttributeBlob< AllocPolicy >::swap | ( | thistype & | other | ) | [inline] |
exchange the data array with another TpAttributeBlob
Definition at line 165 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::_data, and VGServer::TpAttributeBlob< AllocPolicy >::_size.
Referenced by VGServer::GraphData::applyChangelist(), and VGServer::GraphData::swap().
void VGServer::TpAttributeBlob< AllocPolicy >::zero | ( | unsigned int | i, | |
unsigned int | len | |||
) | [inline] |
zeros a block of bytes at the given index
Definition at line 231 of file AttributeBlob.h.
References VGServer::TpAttributeBlob< AllocPolicy >::alloc().
Referenced by VGServer::GraphLoader::addEdge(), VGServer::GraphLoader::addVertex(), VGServer::AttributePropertiesList::createBlankAttributeBlob(), VGServer::AttributeSelectorList::processEdgeAttributeBlob(), and VGServer::AttributeSelectorList::processVertexAttributeBlob().