ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
TileMutableDataContainer< BASE_T > Class Template Reference

Helper for holding non-const raw data prior to recording in SG. More...

#include <TileMutableDataContainer.h>

Inheritance diagram for TileMutableDataContainer< BASE_T >:
Collaboration diagram for TileMutableDataContainer< BASE_T >:

Public Types

typedef BASE_T BASE
 
typedef BASE::TYPE TYPE
 
typedef BASE::UNIT UNIT
 
typedef BASE::IDENTIFIABLE Collection
 
typedef BASE::TElement Element
 

Public Member Functions

 TileMutableDataContainer (bool createColl=false, TYPE type=TileFragHash::Default, UNIT unit=TileRawChannelUnit::ADCcounts, SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS)
 Constructor. More...
 
 TileMutableDataContainer (const BASE &other)
 Copy constructor. More...
 
 TileMutableDataContainer (const TileMutableDataContainer &)=delete
 
TileMutableDataContaineroperator= (const TileMutableDataContainer &)=delete
 
StatusCode addCollection (std::unique_ptr< Collection > coll, IdentifierHash hash)
 Add a collection to the container. More...
 
StatusCode push_back (std::unique_ptr< Element > rch)
 Add a new channel. More...
 
StatusCode push_back (Element *rch)
 Add a new channel. More...
 
CollectionindexFindPtr (IdentifierHash hash)
 Look up a (non-const) collection via hash. More...
 
StatusCode status () const
 Return the error status from the constructors. More...
 
virtual void lock () override
 Lock this object. More...
 

Protected Member Functions

void recycle ()
 Recycle this object for use in another event. More...
 

Private Attributes

std::vector< Collection * > m_mutableCollections
 Non-const references to collections, indexed by hash value. More...
 
bool m_locked
 Is the container locked? More...
 
StatusCode m_sc
 StatusCode from constructors. More...
 
TYPE m_defaultType
 Default type; reset to this on recycle. More...
 
UNIT m_defaultUnit
 Default unit; reset to this on recycle. More...
 

Detailed Description

template<class BASE_T>
class TileMutableDataContainer< BASE_T >

Helper for holding non-const raw data prior to recording in SG.

Sometimes one wants to construct a tile raw data container and then, before it is recorded in SG, modify the contents. This is problematic as the container classes only support const access to the contents.

This helper derives from a specific tile raw data container and also maintains non-const pointers to the collections, which we can return. However, once the object has been made const in SG, we set a flag so that non-const access is no longer possible.

After constructing one of these objects, one should call status() to check for errors.

This class does not have its own CLID. Record in SG via a handle of type matching the base tile raw data container.

Definition at line 50 of file TileMutableDataContainer.h.

Member Typedef Documentation

◆ BASE

template<class BASE_T >
typedef BASE_T TileMutableDataContainer< BASE_T >::BASE

Definition at line 54 of file TileMutableDataContainer.h.

◆ Collection

template<class BASE_T >
typedef BASE::IDENTIFIABLE TileMutableDataContainer< BASE_T >::Collection

Definition at line 57 of file TileMutableDataContainer.h.

◆ Element

template<class BASE_T >
typedef BASE::TElement TileMutableDataContainer< BASE_T >::Element

Definition at line 58 of file TileMutableDataContainer.h.

◆ TYPE

template<class BASE_T >
typedef BASE::TYPE TileMutableDataContainer< BASE_T >::TYPE

Definition at line 55 of file TileMutableDataContainer.h.

◆ UNIT

template<class BASE_T >
typedef BASE::UNIT TileMutableDataContainer< BASE_T >::UNIT

Definition at line 56 of file TileMutableDataContainer.h.

Constructor & Destructor Documentation

◆ TileMutableDataContainer() [1/3]

template<class BASE_T >
TileMutableDataContainer< BASE_T >::TileMutableDataContainer ( bool  createColl = false,
TYPE  type = TileFragHash::Default,
UNIT  unit = TileRawChannelUnit::ADCcounts,
SG::OwnershipPolicy  ownPolicy = SG::OWN_ELEMENTS 
)

Constructor.

Parameters
createCollIf true, create all collections now.
typeHash type (from TileFragHash::TYPE).
unitMeasurement units for amplitude data.
ownPolicyOwnership mode for collections.

Call status() after this to check for errors.

◆ TileMutableDataContainer() [2/3]

template<class BASE_T >
TileMutableDataContainer< BASE_T >::TileMutableDataContainer ( const BASE other)

Copy constructor.

Parameters
otherContainer to copy.

This is a deep copy; all contained collections and channels will be copied. Call status() after this to check for errors.

◆ TileMutableDataContainer() [3/3]

template<class BASE_T >
TileMutableDataContainer< BASE_T >::TileMutableDataContainer ( const TileMutableDataContainer< BASE_T > &  )
delete

Member Function Documentation

◆ addCollection()

template<class BASE_T >
StatusCode TileMutableDataContainer< BASE_T >::addCollection ( std::unique_ptr< Collection coll,
IdentifierHash  hash 
)

Add a collection to the container.

Parameters
collCollection ot add.
hashHash value for the collection.

We maintain a non-const reference to the collection.

◆ indexFindPtr()

template<class BASE_T >
Collection* TileMutableDataContainer< BASE_T >::indexFindPtr ( IdentifierHash  hash)

Look up a (non-const) collection via hash.

Parameters
hashHash value to find.

◆ lock()

template<class BASE_T >
virtual void TileMutableDataContainer< BASE_T >::lock ( )
overridevirtual

Lock this object.

Called when this object is locked in SG. Prohibit non-const acces to this container.

Implements ILockable.

◆ operator=()

template<class BASE_T >
TileMutableDataContainer& TileMutableDataContainer< BASE_T >::operator= ( const TileMutableDataContainer< BASE_T > &  )
delete

◆ push_back() [1/2]

template<class BASE_T >
StatusCode TileMutableDataContainer< BASE_T >::push_back ( Element rch)

Add a new channel.

Parameters
rchChannel to add.

This should be used for non-owning container (created with SG::VIEW_ELEMENTS). A new collection will be created if needed. In that case, we maintain a non-const reference to it.

◆ push_back() [2/2]

template<class BASE_T >
StatusCode TileMutableDataContainer< BASE_T >::push_back ( std::unique_ptr< Element rch)

Add a new channel.

Parameters
rchChannel to add.

This should be used for owning container (created with SG::OWN_ELEMENTS). A new collection will be created if needed. In that case, we maintain a non-const reference to it.

◆ recycle()

template<class BASE_T >
void TileMutableDataContainer< BASE_T >::recycle ( )
protected

Recycle this object for use in another event.

This is called from AthenaKernel/RecyclableDataObject when this object is released by StoreGate. Unlock the object so that non-const access is again possible, and clear out the contents if the collections.

◆ status()

template<class BASE_T >
StatusCode TileMutableDataContainer< BASE_T >::status ( ) const

Return the error status from the constructors.

Member Data Documentation

◆ m_defaultType

template<class BASE_T >
TYPE TileMutableDataContainer< BASE_T >::m_defaultType
private

Default type; reset to this on recycle.

Definition at line 175 of file TileMutableDataContainer.h.

◆ m_defaultUnit

template<class BASE_T >
UNIT TileMutableDataContainer< BASE_T >::m_defaultUnit
private

Default unit; reset to this on recycle.

Definition at line 178 of file TileMutableDataContainer.h.

◆ m_locked

template<class BASE_T >
bool TileMutableDataContainer< BASE_T >::m_locked
private

Is the container locked?

Definition at line 169 of file TileMutableDataContainer.h.

◆ m_mutableCollections

template<class BASE_T >
std::vector<Collection*> TileMutableDataContainer< BASE_T >::m_mutableCollections
private

Non-const references to collections, indexed by hash value.

Definition at line 166 of file TileMutableDataContainer.h.

◆ m_sc

template<class BASE_T >
StatusCode TileMutableDataContainer< BASE_T >::m_sc
private

StatusCode from constructors.

Definition at line 172 of file TileMutableDataContainer.h.


The documentation for this class was generated from the following file: