ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
xAOD::AuxPersVector< T, VEC > Class Template Referenceabstract

Class managing concrete vector variables. More...

#include <AuxPersVector.h>

Inheritance diagram for xAOD::AuxPersVector< T, VEC >:
Collaboration diagram for xAOD::AuxPersVector< T, VEC >:

Public Types

typedef VEC & vector_type
 Convenience type definition. More...
 
typedef AuxDataTraits< T >::element_type element_type
 Type that the user sees. More...
 
typedef vector_type::value_type vector_value_type
 Vector element type. More...
 

Public Member Functions

 AuxPersVector (SG::auxid_t auxid, vector_type vec)
 Constructor. More...
 
virtual std::unique_ptr< SG::IAuxTypeVectorclone () const
 Make a copy of this vector. More...
 
vector_typevec ()
 Return a reference to the payload vector. More...
 
virtual std::unique_ptr< IAuxTypeVector > clone () const override
 Make a copy of this vector. More...
 
virtual auxid_t auxid () const override
 Return the auxid of the variable this vector represents. More...
 
virtual auxid_t auxid () const =0
 Return the auxid of the variable this vector represents. More...
 
virtual void * toPtr () override
 Return a pointer to the start of the vector's data. More...
 
virtual const void * toPtr () const override
 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 () override
 Return a pointer to the STL vector itself. More...
 
virtual const std::type_info * objType () const override
 Return the type of the payload object for this instance. More...
 
virtual const std::type_info * objType () const
 Return the type of the complete object to be saved. More...
 
virtual size_t size () const override
 Return the size of the vector. More...
 
virtual size_t size () const =0
 Return the size of the vector. More...
 
virtual bool resize (size_t sz) override
 Change the size of the vector. More...
 
virtual void reserve (size_t sz) override
 Change the capacity of the vector. More...
 
virtual bool setOption (const AuxDataOption &option) override
 Make an option setting. More...
 
virtual bool shift (size_t pos, ptrdiff_t offs) override
 Shift the elements of the vector. More...
 
virtual bool insertMove (size_t pos, void *beg, void *end, IAuxStore &srcStore) override
 Insert elements into the vector via move semantics. More...
 
virtual std::unique_ptr< IAuxTypeVector > toPacked () override
 Try to convert this aux vector to a PackedContainer. More...
 

Protected Attributes

auxid_t m_auxid
 The auxid of the variable this vector represents. More...
 

Static Protected Attributes

static const int SCALE
 1 for the usual case of V being vector<T>. More...
 

Private Member Functions

void insertMove1 (typename CONT::iterator pos, element_type *beg, element_type *end, std::true_type)
 Helper for insertMove. More...
 
void insertMove1 (typename CONT::iterator pos, element_type *beg, element_type *end, std::false_type)
 Helper for insertMove. More...
 

Private Attributes

vector_typem_vecPtr
 The contained vector. More...
 
bool m_ownFlag
 True if we need to delete the object. More...
 

Detailed Description

template<class T, class VEC = std::vector< T >>
class xAOD::AuxPersVector< T, VEC >

Class managing concrete vector variables.

This class is used internally by the "special" auxiliary store objects to manage the auxiliary variables handled by them. User code probably doesn't want to touch it directly...

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
793737
Date
2017-01-24 21:11:10 +0100 (Tue, 24 Jan 2017)

Definition at line 28 of file AuxPersVector.h.

Member Typedef Documentation

◆ element_type

typedef AuxDataTraits<T>::element_type SG::AuxTypeVectorHolder< T, std::vector< T > >::element_type
inherited

Type that the user sees.

Definition at line 57 of file AuxTypeVector.h.

◆ vector_type

template<class T , class VEC = std::vector< T >>
typedef VEC& xAOD::AuxPersVector< T, VEC >::vector_type

Convenience type definition.

Definition at line 32 of file AuxPersVector.h.

◆ vector_value_type

typedef vector_type::value_type SG::AuxTypeVectorHolder< T, std::vector< T > >::vector_value_type
inherited

Vector element type.

Definition at line 60 of file AuxTypeVector.h.

Constructor & Destructor Documentation

◆ AuxPersVector()

template<class T , class VEC = std::vector< T >>
xAOD::AuxPersVector< T, VEC >::AuxPersVector ( SG::auxid_t  auxid,
vector_type  vec 
)
inline

Constructor.

Definition at line 35 of file AuxPersVector.h.

Member Function Documentation

◆ auxid() [1/2]

virtual auxid_t SG::IAuxTypeVector::auxid ( ) const
pure virtualinherited

Return the auxid of the variable this vector represents.

Implemented in SG::AuxTypeVectorHolder< T, CONT >, SG::RootAuxVector, xAOD::TAuxVector, and xAOD::AuxPersInfo< T >.

◆ auxid() [2/2]

virtual auxid_t SG::AuxTypeVectorHolder< T, std::vector< T > >::auxid
overridevirtualinherited

Return the auxid of the variable this vector represents.

◆ clone() [1/2]

template<class T , class VEC = std::vector< T >>
virtual std::unique_ptr<SG::IAuxTypeVector> xAOD::AuxPersVector< T, VEC >::clone ( ) const
inlinevirtual

Make a copy of this vector.

Implements SG::IAuxTypeVector.

Definition at line 38 of file AuxPersVector.h.

38  {
39  return std::make_unique<AuxPersVector<T, VEC> >(*this);
40  }

◆ clone() [2/2]

virtual std::unique_ptr<IAuxTypeVector> SG::AuxTypeVectorHolder< T, std::vector< T > >::clone
overridevirtualinherited

Make a copy of this vector.

◆ insertMove()

virtual bool SG::AuxTypeVectorHolder< T, std::vector< T > >::insertMove ( size_t  pos,
void *  beg,
void *  end,
IAuxStore srcStore 
)
overridevirtualinherited

Insert elements into the vector via move semantics.

Parameters
posThe starting index of the insertion.
begStart of the range of elements to insert.
endEnd of the range of elements to insert.
srcStoreThe 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.

Implements SG::IAuxTypeVector.

◆ insertMove1() [1/2]

void SG::AuxTypeVectorHolder< T, std::vector< T > >::insertMove1 ( typename CONT::iterator  pos,
element_type beg,
element_type end,
std::false_type   
)
privateinherited

Helper for insertMove.

Parameters
posThe starting index of the insertion.
begStart of the range of elements to insert.
endEnd of the range of elements to insert.

This does the actual move for non-POD types.

◆ insertMove1() [2/2]

void SG::AuxTypeVectorHolder< T, std::vector< T > >::insertMove1 ( typename CONT::iterator  pos,
element_type beg,
element_type end,
std::true_type   
)
privateinherited

Helper for insertMove.

Parameters
posThe starting index of the insertion.
begStart of the range of elements to insert.
endEnd of the range of elements to insert.

This does the actual move for POD types.

◆ objType() [1/2]

virtual const std::type_info* SG::IAuxTypeVector::objType ( ) const
inlinevirtualinherited

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 192 of file IAuxTypeVector.h.

192 { return 0; }

◆ objType() [2/2]

virtual const std::type_info* SG::AuxTypeVectorHolder< T, std::vector< T > >::objType
overridevirtualinherited

Return the type of the payload object for this instance.

May be different from what we get from the registry; if packing is used, for example.

◆ reserve()

virtual void SG::AuxTypeVectorHolder< T, std::vector< T > >::reserve ( size_t  sz)
overridevirtualinherited

Change the capacity of the vector.

Parameters
szThe new vector capacity.

Implements SG::IAuxTypeVector.

◆ resize()

virtual bool SG::AuxTypeVectorHolder< T, std::vector< T > >::resize ( size_t  sz)
overridevirtualinherited

Change the size of the vector.

Parameters
szThe 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.)

Implements SG::IAuxTypeVector.

◆ setOption()

virtual bool SG::AuxTypeVectorHolder< T, std::vector< T > >::setOption ( const AuxDataOption option)
overridevirtualinherited

Make an option setting.

Parameters
optionThe option to set.

The interpretation of the option depends on the concrete class.

Returns true if the option setting was successful; false otherwise.

Reimplemented from SG::IAuxTypeVector.

◆ shift()

virtual bool SG::AuxTypeVectorHolder< T, std::vector< T > >::shift ( size_t  pos,
ptrdiff_t  offs 
)
overridevirtualinherited

Shift the elements of the vector.

Parameters
posThe starting index for the shift.
offsThe (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.)

Implements SG::IAuxTypeVector.

◆ size() [1/2]

virtual size_t SG::IAuxTypeVector::size ( ) const
pure virtualinherited

◆ size() [2/2]

virtual size_t SG::AuxTypeVectorHolder< T, std::vector< T > >::size
overridevirtualinherited

Return the size of the vector.

◆ toPacked()

virtual std::unique_ptr<IAuxTypeVector> SG::AuxTypeVectorHolder< T, std::vector< T > >::toPacked
overridevirtualinherited

Try to convert this aux vector to a PackedContainer.

If successful, returns a newly-allocated IAuxTypeVector. In this case, the contents of the vector will have been moved to the new vector (and this object will be empty).

Returns null on failure.

Reimplemented from SG::IAuxTypeVector.

◆ toPtr() [1/3]

virtual const void* SG::IAuxTypeVector::toPtr ( ) const
pure virtualinherited

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 >.

◆ toPtr() [2/3]

virtual const void* SG::AuxTypeVectorHolder< T, std::vector< T > >::toPtr
overridevirtualinherited

Return a pointer to the start of the vector's data.

Implements SG::IAuxTypeVector.

◆ toPtr() [3/3]

virtual void* SG::AuxTypeVectorHolder< T, std::vector< T > >::toPtr
overridevirtualinherited

Return a pointer to the start of the vector's data.

Implements SG::IAuxTypeVector.

◆ toVector()

virtual void* SG::AuxTypeVectorHolder< T, std::vector< T > >::toVector
overridevirtualinherited

Return a pointer to the STL vector itself.

Implements SG::IAuxTypeVector.

◆ vec()

vector_type& SG::AuxTypeVectorHolder< T, std::vector< T > >::vec
inherited

Return a reference to the payload vector.

Member Data Documentation

◆ m_auxid

auxid_t SG::AuxTypeVectorHolder< T, std::vector< T > >::m_auxid
protectedinherited

The auxid of the variable this vector represents.

Definition at line 293 of file AuxTypeVector.h.

◆ m_ownFlag

bool SG::AuxTypeVectorHolder< T, std::vector< T > >::m_ownFlag
privateinherited

True if we need to delete the object.

Definition at line 289 of file AuxTypeVector.h.

◆ m_vecPtr

vector_type* SG::AuxTypeVectorHolder< T, std::vector< T > >::m_vecPtr
privateinherited

The contained vector.

Definition at line 286 of file AuxTypeVector.h.

◆ SCALE

const int SG::AuxTypeVectorHolder< T, std::vector< T > >::SCALE
staticprotectedinherited

1 for the usual case of V being vector<T>.

If V is vector<char>, then this is sizeof(T).

Definition at line 66 of file AuxTypeVector.h.


The documentation for this class was generated from the following file:
SG::AuxTypeVectorHolder< T, std::vector< T > >::auxid
virtual auxid_t auxid() const override
Return the auxid of the variable this vector represents.
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
SG::AuxTypeVectorHolder
Implementation of IAuxTypeVector for specific types.
Definition: AuxTypeVector.h:51