ATLAS Offline Software
Public Member Functions | List of all members
SG::IAuxTypeVectorFactory Class Referenceabstract

Interface for factory objects that create vectors. More...

#include <IAuxTypeVectorFactory.h>

Inheritance diagram for SG::IAuxTypeVectorFactory:
Collaboration diagram for SG::IAuxTypeVectorFactory:

Public Member Functions

virtual ~IAuxTypeVectorFactory ()
 Destructor. More...
 
virtual std::unique_ptr< IAuxTypeVectorcreate (SG::auxid_t auxid, size_t size, size_t capacity, bool isLinked) const =0
 Create a vector object of this type. More...
 
virtual std::unique_ptr< IAuxTypeVectorcreateFromData (SG::auxid_t auxid, void *data, IAuxTypeVector *linkedVector, bool isPacked, bool ownFlag, bool isLinked) const =0
 Create a vector object of this type from a data blob. More...
 
virtual void copy (SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
 Copy elements between vectors. More...
 
void copy (SG::auxid_t auxid, AuxVectorData &&dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
 Copy elements between vectors. More...
 
virtual void copyForOutput (SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
 Copy elements between vectors, possibly applying thinning. More...
 
virtual void swap (SG::auxid_t auxid, AuxVectorData &a, size_t aindex, AuxVectorData &b, size_t bindex, size_t n) const =0
 Swap elements between vectors. More...
 
virtual void clear (SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, size_t n) const =0
 Clear a range of elements within a vector. More...
 
virtual size_t getEltSize () const =0
 Return the size of an element of this vector type. More...
 
virtual const std::type_info * tiVec () const =0
 Return the type_info of the vector. More...
 
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. More...
 
virtual const std::type_info * tiAlloc () const =0
 Return the type_info of the vector allocator. More...
 
virtual std::string tiAllocName () const =0
 Return the (demangled) name of the vector allocator. More...
 

Detailed Description

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.

Definition at line 49 of file IAuxTypeVectorFactory.h.

Constructor & Destructor Documentation

◆ ~IAuxTypeVectorFactory()

virtual SG::IAuxTypeVectorFactory::~IAuxTypeVectorFactory ( )
inlinevirtual

Destructor.

Definition at line 55 of file IAuxTypeVectorFactory.h.

55 {}

Member Function Documentation

◆ clear()

virtual void SG::IAuxTypeVectorFactory::clear ( SG::auxid_t  auxid,
AuxVectorData dst,
size_t  dst_index,
size_t  n 
) const
pure virtual

Clear a range of elements within a vector.

Parameters
auxidThe aux data item being operated on.
dstContainer holding the element
dst_indexIndex of the first element in the vector.
nNumber of elements to clear.

Implemented in xAOD::TAuxVectorFactory, SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, SG::AuxTypeVectorFactoryImpl< T, AuxAllocator_t< T > >, and SG::AuxTypeVectorFactoryImpl< ElementLink< DataVector >, AuxAllocator_t< ElementLink< DataVector > > >.

◆ copy() [1/2]

void SG::IAuxTypeVectorFactory::copy ( SG::auxid_t  auxid,
AuxVectorData &&  dst,
size_t  dst_index,
const AuxVectorData src,
size_t  src_index,
size_t  n 
) const
inline

Copy elements between vectors.

Parameters
auxidThe aux data item being operated on.
dstContainer for the destination vector. Declared as a rvalue reference to allow passing a temporary here (such as from AuxVectorInterface).
dst_indexIndex of the first destination element in the vector.
srcContainer for the source vector.
src_indexIndex of the first source element in the vector.
nNumber of elements to copy.

dst and @ src can be either the same or different.

Definition at line 132 of file IAuxTypeVectorFactory.h.

136  {
137  copy (auxid, dst, dst_index, src, src_index, n);
138  }

◆ copy() [2/2]

virtual void SG::IAuxTypeVectorFactory::copy ( SG::auxid_t  auxid,
AuxVectorData dst,
size_t  dst_index,
const AuxVectorData src,
size_t  src_index,
size_t  n 
) const
pure virtual

Copy elements between vectors.

Parameters
auxidThe aux data item being operated on.
dstContainer for the destination vector.
dst_indexIndex of the first destination element in the vector.
srcContainer for the source vector.
src_indexIndex of the first source element in the vector.
nNumber of elements to copy.

dst and @ src can be either the same or different.

Implemented in xAOD::TAuxVectorFactory, SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, SG::AuxTypeVectorFactoryImpl< T, AuxAllocator_t< T > >, and SG::AuxTypeVectorFactoryImpl< ElementLink< DataVector >, AuxAllocator_t< ElementLink< DataVector > > >.

◆ copyForOutput()

virtual void SG::IAuxTypeVectorFactory::copyForOutput ( SG::auxid_t  auxid,
AuxVectorData dst,
size_t  dst_index,
const AuxVectorData src,
size_t  src_index,
size_t  n 
) const
pure virtual

Copy elements between vectors, possibly applying thinning.

Parameters
auxidThe aux data item being operated on.
dstContainer for the destination vector.
dst_indexIndex of the first destination element in the vector.
srcContainer for the source vector.
src_indexIndex of source element in the vector.
src_indexIndex of the first source element in the vector.
nNumber of elements to copy.

dst and @ src can be either the same or different.

Implemented in xAOD::TAuxVectorFactory, SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, SG::AuxTypeVectorFactoryImpl< T, AuxAllocator_t< T > >, and SG::AuxTypeVectorFactoryImpl< ElementLink< DataVector >, AuxAllocator_t< ElementLink< DataVector > > >.

◆ create()

virtual std::unique_ptr<IAuxTypeVector> SG::IAuxTypeVectorFactory::create ( SG::auxid_t  auxid,
size_t  size,
size_t  capacity,
bool  isLinked 
) const
pure virtual

Create a vector object of this type.

Parameters
auxidID for the variable being created.
sizeInitial size of the new vector.
capacityInitial capacity of the new vector.
isLinkedTrue if this variable is linked from another one.

Returns a newly-allocated object.

Implemented in SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, SG::AuxTypeVectorFactoryImpl< T, AuxAllocator_t< T > >, SG::AuxTypeVectorFactoryImpl< ElementLink< DataVector >, AuxAllocator_t< ElementLink< DataVector > > >, and xAOD::TAuxVectorFactory.

◆ createFromData()

virtual std::unique_ptr<IAuxTypeVector> SG::IAuxTypeVectorFactory::createFromData ( SG::auxid_t  auxid,
void *  data,
IAuxTypeVector linkedVector,
bool  isPacked,
bool  ownFlag,
bool  isLinked 
) const
pure virtual

Create a vector object of this type from a data blob.

Parameters
auxidID for the variable being created.
dataThe vector object.
linkedVectorThe interface for another variable linked to this one, or nullptr if there isn't one. (We do not take ownership.)
isPackedIf true, data is a PackedContainer.
ownFlagIf true, the newly-created IAuxTypeVector object will take ownership of data.
isLinkedTrue if this variable is linked from another one.

If the element type is T, then data should be a pointer to a std::vector<T> object, which was obtained with new. But if isPacked is true, then data should instead point at an object of type SG::PackedContainer<T>.

Returns a newly-allocated object.

Implemented in xAOD::TAuxVectorFactory, SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, SG::AuxTypeVectorFactoryImpl< T, AuxAllocator_t< T > >, and SG::AuxTypeVectorFactoryImpl< ElementLink< DataVector >, AuxAllocator_t< ElementLink< DataVector > > >.

◆ getEltSize()

virtual size_t SG::IAuxTypeVectorFactory::getEltSize ( ) const
pure virtual

Return the size of an element of this vector type.

Implemented in SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, and xAOD::TAuxVectorFactory.

◆ isDynamic()

virtual bool SG::IAuxTypeVectorFactory::isDynamic ( ) const
pure virtual

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.

Implemented in SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, and xAOD::TAuxVectorFactory.

◆ swap()

virtual void SG::IAuxTypeVectorFactory::swap ( SG::auxid_t  auxid,
AuxVectorData a,
size_t  aindex,
AuxVectorData b,
size_t  bindex,
size_t  n 
) const
pure virtual

Swap elements between vectors.

Parameters
auxidThe aux data item being operated on.
aContainer for the first vector.
aindexIndex of the first element in the first vector.
bContainer for the second vector.
bindexIndex of the first element in the second vector.
nNumber of elements to swap.

a and @ b can be either the same or different. However, the ranges should not overlap.

Implemented in xAOD::TAuxVectorFactory, SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, SG::AuxTypeVectorFactoryImpl< T, AuxAllocator_t< T > >, and SG::AuxTypeVectorFactoryImpl< ElementLink< DataVector >, AuxAllocator_t< ElementLink< DataVector > > >.

◆ tiAlloc()

virtual const std::type_info* SG::IAuxTypeVectorFactory::tiAlloc ( ) const
pure virtual

Return the type_info of the vector allocator.

May be nullptr for a dynamic vector.

Implemented in SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, and xAOD::TAuxVectorFactory.

◆ tiAllocName()

virtual std::string SG::IAuxTypeVectorFactory::tiAllocName ( ) const
pure virtual

Return the (demangled) name of the vector allocator.

Implemented in SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, and xAOD::TAuxVectorFactory.

◆ tiVec()

virtual const std::type_info* SG::IAuxTypeVectorFactory::tiVec ( ) const
pure virtual

Return the type_info of the vector.

Implemented in SG::RootAuxVectorFactory, SG::AuxTypeVectorFactoryImpl< T, ALLOC >, and xAOD::TAuxVectorFactory.


The documentation for this class was generated from the following file:
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
beamspotman.n
n
Definition: beamspotman.py:731
SG::IAuxTypeVectorFactory::copy
virtual void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
Copy elements between vectors.