ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TrigCostDataStore< PAYLOAD > Class Template Reference

Thread safe and multi-slot hash-map to cache PAYLOAD objects/primitives during event execution. More...

#include <TrigCostDataStore.h>

Collaboration diagram for TrigCostDataStore< PAYLOAD >:

Public Member Functions

 TrigCostDataStore ()
 Default constructor. More...
 
 ~TrigCostDataStore ()
 Destructor. More...
 
StatusCode initialize (size_t nSlots)
 Initialise internal storage. More...
 
StatusCode insert (const AlgorithmIdentifier &ai, const PAYLOAD &payload, MsgStream &msg)
 Inserts the payload into the map. More...
 
template<typename ENTRY >
StatusCode push_back (const AlgorithmIdentifier &ai, ENTRY &&entry, MsgStream &msg)
 Inserts the entry in the vector payload into the map. More...
 
StatusCode retrieve (const AlgorithmIdentifier &ai, typename tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare >::const_accessor &payload, MsgStream &msg) const
 Retrieve a payload from the map given an AlgorithmIdentifier. More...
 
StatusCode clear (const EventContext &context, MsgStream &msg)
 Clears all data stored in an event slot. More...
 
StatusCode getIterators (const EventContext &context, MsgStream &msg, typename tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare >::const_iterator &begin, typename tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare >::const_iterator &end)
 Fetches Begin and End const iterators to iterate over the data store. More...
 

Private Member Functions

StatusCode checkSlot (const size_t slot, MsgStream &msg) const
 Internal check that the supplied slot number is in range. More...
 

Private Attributes

std::vector< tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare > > m_store
 Underlying thread-safe data store for all slots: vector< hashmap< AlgorithmIdentifier, payload > > More...
 

Detailed Description

template<typename PAYLOAD>
class TrigCostDataStore< PAYLOAD >

Thread safe and multi-slot hash-map to cache PAYLOAD objects/primitives during event execution.

The PAYLOAD objects are later used to construct a trigger cost summary for the event. Data are partitioned based on the slot of the event context and both the name and store of the audited algorithm, these three pieces of data uniquely identify an algorithm execution.

See also
AlgorithmIdentifier The struct which makes the key used within the map

Definition at line 28 of file TrigCostDataStore.h.

Constructor & Destructor Documentation

◆ TrigCostDataStore()

template<typename PAYLOAD >
TrigCostDataStore< PAYLOAD >::TrigCostDataStore ( )
inline

Default constructor.

Definition at line 34 of file TrigCostDataStore.h.

34 : m_store() {}

◆ ~TrigCostDataStore()

template<typename PAYLOAD >
TrigCostDataStore< PAYLOAD >::~TrigCostDataStore ( )
inline

Destructor.

Currently empty.

Definition at line 39 of file TrigCostDataStore.h.

39 {}

Member Function Documentation

◆ checkSlot()

template<typename PAYLOAD >
StatusCode TrigCostDataStore< PAYLOAD >::checkSlot ( const size_t  slot,
MsgStream &  msg 
) const
private

Internal check that the supplied slot number is in range.

Parameters
[in]slotEvent context slot ID
[in]msgMessage service reference
Returns
Success if the class has been initialised with setSlots(nSlots) where nSlots > slot

◆ clear()

template<typename PAYLOAD >
StatusCode TrigCostDataStore< PAYLOAD >::clear ( const EventContext &  context,
MsgStream &  msg 
)

Clears all data stored in an event slot.

Parameters
[in]contextThe event context of the slot to clear
[in]msgMessage service reference
Returns
Success if the slot was cleared

◆ getIterators()

template<typename PAYLOAD >
StatusCode TrigCostDataStore< PAYLOAD >::getIterators ( const EventContext &  context,
MsgStream &  msg,
typename tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare >::const_iterator &  begin,
typename tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare >::const_iterator &  end 
)

Fetches Begin and End const iterators to iterate over the data store.

Parameters
[in]contextThe event context of the slot to return iterators over
[in]msgMessage service reference
[out]beginReturn of iterator to start of map
[out]endReturn of iterator to end of map
Returns
Success if the slot is populated, else Failure

◆ initialize()

template<typename PAYLOAD >
StatusCode TrigCostDataStore< PAYLOAD >::initialize ( size_t  nSlots)

Initialise internal storage.

Parameters
[in]nSlots.Number of possible concurrent slots to reserve space for.

◆ insert()

template<typename PAYLOAD >
StatusCode TrigCostDataStore< PAYLOAD >::insert ( const AlgorithmIdentifier ai,
const PAYLOAD &  payload,
MsgStream &  msg 
)

Inserts the payload into the map.

Parameters
[in]aiThe AlgorithmIdentifier to insert for (the key)
[in]payloadThe payload to record
[in]msga reference to the msgstream for printing
Returns
Success unless and out-of-range slot, then Failure

◆ push_back()

template<typename PAYLOAD >
template<typename ENTRY >
StatusCode TrigCostDataStore< PAYLOAD >::push_back ( const AlgorithmIdentifier ai,
ENTRY &&  entry,
MsgStream &  msg 
)

Inserts the entry in the vector payload into the map.

Parameters
[in]aiThe AlgorithmIdentifier to insert for (the key)
[in]entryThe entry to record
[in]msga reference to the msgstream for printing
Returns
Success unless and class is not initialized, then Failure

◆ retrieve()

template<typename PAYLOAD >
StatusCode TrigCostDataStore< PAYLOAD >::retrieve ( const AlgorithmIdentifier ai,
typename tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare >::const_accessor &  payload,
MsgStream &  msg 
) const

Retrieve a payload from the map given an AlgorithmIdentifier.

Parameters
[in]aiThe AlgorithmIdentifier to fetch (the key)
[out]payloadReference to const_accessor to payload to return
[in]msga reference to the msgstream for printing
Returns
Success if the payload was located, else Failure

Member Data Documentation

◆ m_store

template<typename PAYLOAD >
std::vector< tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare> > TrigCostDataStore< PAYLOAD >::m_store
private

Underlying thread-safe data store for all slots: vector< hashmap< AlgorithmIdentifier, payload > >

Definition at line 109 of file TrigCostDataStore.h.


The documentation for this class was generated from the following file:
TrigCostDataStore::m_store
std::vector< tbb::concurrent_hash_map< AlgorithmIdentifier, PAYLOAD, AlgorithmIdentifierHashCompare > > m_store
Underlying thread-safe data store for all slots: vector< hashmap< AlgorithmIdentifier,...
Definition: TrigCostDataStore.h:109