Helper class to provide const generic access to aux data. More...
#include <AuxElement.h>
Public Member Functions | |
TypelessConstAccessor (const std::string &name) | |
Constructor. | |
TypelessConstAccessor (const std::type_info &ti, const std::string &name) | |
Constructor. | |
TypelessConstAccessor (const std::string &name, const std::string &clsname) | |
Constructor. | |
TypelessConstAccessor (const std::type_info &ti, const std::string &name, const std::string &clsname) | |
Constructor. | |
const void * | operator() (const AuxElement &e) const |
Fetch the variable for one element, as a const pointer. | |
const void * | operator() (const AuxVectorData &container, size_t index) const |
Fetch the variable for one element, as a const pointer. | |
const void * | getDataArray (const AuxVectorData &container) const |
Get a pointer to the start of the auxiliary data array. | |
bool | isAvailable (const AuxElement &e) const |
Test to see if this variable exists in the store. | |
SG::auxid_t | auxid () const |
Return the aux id for this variable. | |
Protected Attributes | |
SG::auxid_t | m_auxid |
The cached auxid . | |
size_t | m_eltSize |
Cached element size. |
Helper class to provide const generic access to aux data.
This is written as a separate class in order to be able to cache the name -> auxid lookup.
This should generally only be used by code which treats auxiliary data generically (that is, where the type is not known at compile-time). Most of the time, you'd want to use the type-safe versions ConstAccessor
and Accessor
.
SG::AuxElement::TypelessConstAccessor::TypelessConstAccessor | ( | const std::string & | name | ) | [inline] |
Constructor.
name | Name of this aux variable. |
The name -> auxid lookup is done here.
SG::AuxElement::TypelessConstAccessor::TypelessConstAccessor | ( | const std::type_info & | ti, | |
const std::string & | name | |||
) | [inline] |
Constructor.
ti | The type for this aux data item. | |
name | Name of this aux variable. |
The name -> auxid lookup is done here.
SG::AuxElement::TypelessConstAccessor::TypelessConstAccessor | ( | const std::string & | name, | |
const std::string & | clsname | |||
) | [inline] |
Constructor.
name | Name of this aux variable. | |
clsname | The name of its associated class. May be blank. |
The name -> auxid lookup is done here.
SG::AuxElement::TypelessConstAccessor::TypelessConstAccessor | ( | const std::type_info & | ti, | |
const std::string & | name, | |||
const std::string & | clsname | |||
) | [inline] |
Constructor.
ti | The type for this aux data item. | |
name | Name of this aux variable. | |
clsname | The name of its associated class. May be blank. |
The name -> auxid lookup is done here.
const void * SG::AuxElement::TypelessConstAccessor::getDataArray | ( | const AuxVectorData & | container | ) | const [inline] |
Get a pointer to the start of the auxiliary data array.
container | The container from which to fetch the variable. |
bool SG::AuxElement::TypelessConstAccessor::isAvailable | ( | const AuxElement & | e | ) | const [inline] |
Test to see if this variable exists in the store.
e | An element of the container which to test the variable. |
const void * SG::AuxElement::TypelessConstAccessor::operator() | ( | const AuxVectorData & | container, | |
size_t | index | |||
) | const [inline] |
Fetch the variable for one element, as a const pointer.
container | The container from which to fetch the variable. | |
index | The index of the desired element. |
This allows retrieving aux data by container / index. Looping over the index via this method will be faster then looping over the elements of the container.
const void * SG::AuxElement::TypelessConstAccessor::operator() | ( | const AuxElement & | e | ) | const [inline] |
Fetch the variable for one element, as a const pointer.
e | The element for which to fetch the variable. |