Interface for factory objects that create vectors. More...
#include <IAuxTypeVectorFactory.h>
Public Member Functions | |
virtual | ~IAuxTypeVectorFactory () |
Destructor. | |
virtual IAuxTypeVector * | create (size_t size, size_t capacity) const =0 |
Create a vector object of this type. | |
virtual void | copy (void *dst, size_t dst_index, const void *src, size_t src_index) const =0 |
Copy an element between vectors. | |
virtual void | swap (void *a, size_t aindex, void *b, size_t bindex) const =0 |
Swap an element between vectors. | |
virtual void | clear (void *dst, size_t dst_index) const =0 |
Clear an element within a vector (static method). | |
virtual size_t | getEltSize () const =0 |
Return the size of an element of this vector type. | |
virtual const std::type_info * | tiVec () const =0 |
Return the type_info of the vector. | |
virtual bool | isDynamic () const =0 |
True if the vectors created by this factory work by dynamic emulation (via TVirtualCollectionProxy or similar); false if the std::vector code is used directly. |
Interface for factory objects that create vectors.
The auxiliary data for a container are stored in a set of STL vectors, one for each data item. However, we want to allow storing arbitrary types in these vectors. Thus, we define an abstract interface to operate on the vectors, IAuxTypeVector
.
Now, we need to registry of how to create an appropriate IAuxTypeVector
for a given std::type_info
. To make that easier, we encapsulate the creation of those vector objects using this factory interface. There will be one instance of this for each vector type that we deal with. Usually, this interface will be implemented by AuxTypeVector
; however, other implementations are used, for example, for reading auxiliary data from root when we don't know its type at compile-time.
virtual void SG::IAuxTypeVectorFactory::clear | ( | void * | dst, | |
size_t | dst_index | |||
) | const [pure virtual] |
Clear an element within a vector (static method).
dst | Pointer to the start of the vector's data. | |
dst_index | Index of the element in the vector. |
Implemented in SG::AuxTypeVectorFactory< T >, and xAOD::TAuxVectorFactory.
virtual void SG::IAuxTypeVectorFactory::copy | ( | void * | dst, | |
size_t | dst_index, | |||
const void * | src, | |||
size_t | src_index | |||
) | const [pure virtual] |
Copy an element between vectors.
dst | Pointer to the start of the destination vector's data. | |
dst_index | Index of destination element in the vector. | |
src | Pointer to the start of the source vector's data. | |
src_index | Index of source element in the vector. |
dst
and @ src can be either the same or different.
Implemented in SG::AuxTypeVectorFactory< T >, and xAOD::TAuxVectorFactory.
virtual IAuxTypeVector* SG::IAuxTypeVectorFactory::create | ( | size_t | size, | |
size_t | capacity | |||
) | const [pure virtual] |
Create a vector object of this type.
size | Initial size of the new vector. | |
capacity | Initial capacity of the new vector. |
Implemented in SG::AuxTypeVectorFactory< T >, and xAOD::TAuxVectorFactory.
virtual void SG::IAuxTypeVectorFactory::swap | ( | void * | a, | |
size_t | aindex, | |||
void * | b, | |||
size_t | bindex | |||
) | const [pure virtual] |
Swap an element between vectors.
a | Pointer to the start of the first vector's data. | |
aindex | Index of the element in the first vector. | |
b | Pointer to the start of the second vector's data. | |
bindex | Index of the element in the second vector. |
a
and @ b can be either the same or different.
Implemented in SG::AuxTypeVectorFactory< T >, and xAOD::TAuxVectorFactory.