![]() |
ATLAS Offline Software
|
Abstract interface for manipulating vectors of arbitrary types. More...
#include <IAuxTypeVector.h>
Public Member Functions | |
IAuxTypeVector (auxid_t auxid, bool isLinked) | |
Constructor. More... | |
virtual | ~IAuxTypeVector ()=default |
Destructor. More... | |
virtual std::unique_ptr< IAuxTypeVector > | clone () const =0 |
Make a copy of this vector. More... | |
virtual void * | toPtr ()=0 |
Return a pointer to the start of the vector's data. More... | |
virtual const void * | toPtr () const =0 |
Return a pointer to the start of the vector's data. More... | |
virtual void * | toVector ()=0 |
Return a pointer to the STL vector itself. More... | |
virtual size_t | size () const =0 |
Return the size of the vector. More... | |
virtual bool | resize (size_t sz)=0 |
Change the size of the vector. More... | |
virtual void | reserve (size_t sz)=0 |
Change the capacity of the vector. More... | |
virtual bool | shift (size_t pos, ptrdiff_t offs)=0 |
Shift the elements of the vector. More... | |
virtual bool | insertMove (size_t pos, void *beg, void *end, IAuxStore &srcStore)=0 |
Insert elements into the vector via move semantics. More... | |
virtual bool | setOption (const AuxDataOption &) |
Set an option for this variable. More... | |
virtual std::unique_ptr< IAuxTypeVector > | toPacked () |
Make a packed version of the variable. More... | |
virtual const std::type_info * | objType () const |
Return the type of the complete object to be saved. More... | |
virtual std::unique_ptr< IAuxTypeVector > | linkedVector () |
Return IAuxTypeVector of a linked variable, if there is one. More... | |
bool | isLinked () const |
Return true if this variable is linked from another one. More... | |
auxid_t | auxid () const |
Return the auxid of the variable this vector represents. More... | |
Private Attributes | |
auxid_t | m_auxid |
The auxid of the variable this vector represents. More... | |
bool | m_isLinked |
True if this variable is linked from another one. More... | |
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.
Definition at line 39 of file IAuxTypeVector.h.
|
inline |
Constructor.
auxid | The ID of the variable that this vector represents. |
isLinked | True if this variable is linked from another one. |
Definition at line 47 of file IAuxTypeVector.h.
|
virtualdefault |
Destructor.
|
inline |
Return the auxid of the variable this vector represents.
Definition at line 227 of file IAuxTypeVector.h.
|
pure virtual |
Make a copy of this vector.
Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::RootAuxVector, xAOD::TAuxVector, xAOD::AuxPersInfo< T >, and xAOD::AuxPersVector< T, VEC >.
|
pure virtual |
Insert elements into the vector via move semantics.
pos | The starting index of the insertion. |
beg | Start of the range of elements to insert. |
end | End of the range of elements to insert. |
srcStore | The source store. |
beg
and end
define a range of container elements, with length len
defined by the difference of the pointers divided by the element size.
The size of the container will be increased by len
, with the elements starting at pos
copied to pos+len
.
The contents of the beg:end
range will then be moved to our vector starting at pos
. This will be done via move semantics if possible; otherwise, it will be done with a copy.
Returns true if it is known that the vector's memory did not move, false otherwise.
Implemented in xAOD::AuxPersInfo< T >, SG::RootAuxVector, xAOD::TAuxVector, SG::AuxTypeVectorHolder< T, CONT >, and SG::AuxTypeVectorHolder< T, std::vector< T > >.
|
inline |
Return true if this variable is linked from another one.
This is inlined here rather than being a virtual function because this is frequently called from loops over auxids.
Definition at line 221 of file IAuxTypeVector.h.
|
inlinevirtual |
Return IAuxTypeVector
of a linked variable, if there is one.
If the variable represented by this vector has a linked variable, then return its IAuxTypeVector
. Otherwise, return nullptr. Beware of potential threading issues: the returned object is not locked, so it should not be modified in contexts where the parent container cannot be modified.
This returns a unique_ptr
, so it can generally be called only once on a given instance. After that, it will return nullptr.
Definition at line 212 of file IAuxTypeVector.h.
|
inlinevirtual |
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::RootAuxVector, SG::AuxTypeVectorHolder< T, CONT >, and xAOD::AuxPersInfo< T >.
Definition at line 197 of file IAuxTypeVector.h.
|
pure virtual |
Change the capacity of the vector.
sz | The new vector capacity. |
Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::AuxTypeVectorHolder< T, std::vector< T > >, SG::RootAuxVector, xAOD::TAuxVector, and xAOD::AuxPersInfo< T >.
|
pure virtual |
Change the size of the vector.
sz | The new vector size. Returns true if it is known that iterators have not been invalidated; false otherwise. (Will always return false when increasing the size of an empty container.) |
Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::AuxTypeVectorHolder< T, std::vector< T > >, SG::RootAuxVector, xAOD::TAuxVector, and xAOD::AuxPersInfo< T >.
|
inlinevirtual |
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::AuxTypeVectorHolder< T, CONT >, and SG::AuxTypeVectorHolder< T, std::vector< T > >.
Definition at line 167 of file IAuxTypeVector.h.
|
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).
Returns true if it is known that iterators have not been invalidated; false otherwise. (Will always return false when increasing the size of an empty container.)
Implemented in xAOD::AuxPersInfo< T >, SG::AuxTypeVectorHolder< T, CONT >, SG::AuxTypeVectorHolder< T, std::vector< T > >, SG::RootAuxVector, and xAOD::TAuxVector.
|
pure virtual |
Return the size of the vector.
Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::RootAuxVector, xAOD::TAuxVector, and xAOD::AuxPersInfo< T >.
|
inlinevirtual |
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::AuxTypeVectorHolder< T, CONT >, and SG::AuxTypeVectorHolder< T, std::vector< T > >.
Definition at line 183 of file IAuxTypeVector.h.
|
pure virtual |
Return a pointer to the start of the vector's data.
Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::RootAuxVector, xAOD::TAuxVector, and xAOD::AuxPersInfo< T >.
|
pure virtual |
Return a pointer to the start of the vector's data.
Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::AuxTypeVectorHolder< T, std::vector< T > >, SG::RootAuxVector, xAOD::TAuxVector, xAOD::AuxPersInfo< T >, and SG::AuxTypeVectorHolder< T, std::vector< T > >.
|
pure virtual |
Return a pointer to the STL vector itself.
Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::AuxTypeVectorHolder< T, std::vector< T > >, SG::RootAuxVector, xAOD::TAuxVector, and xAOD::AuxPersInfo< T >.
|
private |
The auxid of the variable this vector represents.
Definition at line 235 of file IAuxTypeVector.h.
|
private |
True if this variable is linked from another one.
Definition at line 238 of file IAuxTypeVector.h.