Abstract interface for manipulating vectors of arbitrary types. More...
#include <IAuxTypeVector.h>
Public Member Functions | |
virtual | ~IAuxTypeVector () |
Destructor. | |
virtual IAuxTypeVector * | clone () const =0 |
Make a copy of this vector. | |
virtual void * | toPtr ()=0 |
Return a pointer to the start of the vector's data. | |
virtual void * | toVector ()=0 |
Return a pointer to the STL vector itself. | |
virtual size_t | size () const =0 |
Return the size of the vector. | |
virtual void | resize (size_t sz)=0 |
Change the size of the vector. | |
virtual void | reserve (size_t sz)=0 |
Change the capacity of the vector. | |
virtual void | shift (size_t pos, ptrdiff_t offs)=0 |
Shift the elements of the vector. | |
virtual bool | setOption (const AuxDataOption &) |
Set an option for this variable. | |
virtual IAuxTypeVector * | toPacked () |
Make a packed version of the variable. | |
virtual const std::type_info * | objType () const |
Return the type of the complete object to be saved. |
Abstract interface for manipulating vectors of arbitrary types.
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 this abstract interface to operate on the vectors. The concrete version of this will own one vector.
virtual const std::type_info* SG::IAuxTypeVector::objType | ( | ) | const [inline, virtual] |
Return the type of the complete object to be saved.
For example, if the object is a std::vector
, then we return the type_info
of the vector. But if we're holding a PackedContainer
, then we return the type_info
of the PackedContainer
.
Can return null if the operation is not supported. In that case, I/O will use the type found from the variable registry.
Reimplemented in SG::AuxTypeVector< T, CONT >, xAOD::AuxPersInfo< T >, and xAOD::AuxPersVector< T, VEC >.
virtual void SG::IAuxTypeVector::reserve | ( | size_t | sz | ) | [pure virtual] |
Change the capacity of the vector.
sz | The new vector capacity. |
Implemented in SG::AuxTypeVector< T, CONT >, xAOD::AuxPersInfo< T >, xAOD::AuxPersVector< T, VEC >, and xAOD::TAuxVector.
virtual void SG::IAuxTypeVector::resize | ( | size_t | sz | ) | [pure virtual] |
Change the size of the vector.
sz | The new vector size. |
Implemented in SG::AuxTypeVector< T, CONT >, xAOD::AuxPersInfo< T >, xAOD::AuxPersVector< T, VEC >, and xAOD::TAuxVector.
virtual bool SG::IAuxTypeVector::setOption | ( | const AuxDataOption & | ) | [inline, virtual] |
Set an option for this variable.
option | The option to set. |
The interpretation of the option depends on the particular representation of the variable provided by the concrete class.
Returns true if the option setting was successful; false otherwise.
Reimplemented in SG::AuxTypeVector< T, CONT >, and xAOD::AuxPersVector< T, VEC >.
virtual void SG::IAuxTypeVector::shift | ( | size_t | pos, | |
ptrdiff_t | offs | |||
) | [pure virtual] |
Shift the elements of the vector.
pos | The starting index for the shift. | |
offs | The (signed) amount of the shift. |
This operation shifts the elements in the vectors for all aux data items, to implement an insertion or deletion. offs
may be either positive or negative.
If offs
is positive, then the container is growing. The container size should be increased by offs
, the element at pos
moved to pos
+ offs
, and similarly for following elements. The elements between pos
and pos
+ offs
should be default-initialized.
If offs
is negative, then the container is shrinking. The element at pos
should be moved to pos
+ offs
, and similarly for following elements. The container should then be shrunk by -offs
elements (running destructors as appropriate).
Implemented in SG::AuxTypeVector< T, CONT >, xAOD::AuxPersInfo< T >, xAOD::AuxPersVector< T, VEC >, and xAOD::TAuxVector.
virtual IAuxTypeVector* SG::IAuxTypeVector::toPacked | ( | ) | [inline, virtual] |
Make a packed version of the variable.
If possible, return a new vector object that stores the data in a PackedContainer
. The data itself should be _moved_ to the new container (so that this vector becomes empty). This ensures that pointers to the data are preserved.
If successful, a newly-allocated object is returned. A null pointer is returned on failure (operation not supported, type can't be packed, type is already packed).
Reimplemented in SG::AuxTypeVector< T, CONT >.