ATLAS Offline Software
Loading...
Searching...
No Matches
CscDigitContainer Class Referenceabstract

Use IdentifiableContainer with CscDigitCollection. More...

#include <CscDigitContainer.h>

Inheritance diagram for CscDigitContainer:
Collaboration diagram for CscDigitContainer:

Public Types

typedef CscDigitCollection::size_type size_type
typedef IdentifiableContainer< CscDigitCollectionMyBase
typedef T IDENTIFIABLE
typedef EventContainers::IdentifiableCache< T > ICACHE
typedef IdentifiableContainerMT< T > MyType
typedef T *& reference
typedef T *const & const_reference
typedef T * value_type
typedef T ** pointer
typedef T *const * const_pointer
typedef T base_value_type
typedef void deleter_f(const void *p)
typedef std::vector< IdentifierHashHash_Container

Public Member Functions

 CscDigitContainer (unsigned int hash_max)
 ~CscDigitContainer ()
size_type digit_size () const
virtual const CLIDclID () const
 return class ID
virtual bool hasExternalCache () const override final
virtual const T * indexFindPtr (IdentifierHash hashId) const override final
 return pointer on the found entry or null if out of range using hashed index - fast version, does not call cnv if object not there
const_iterator indexFind (IdentifierHash hashId) const
virtual StatusCode addCollection (const T *coll, IdentifierHash hashId) override final
 insert collection into container with id hash if IDC should not take ownership of collection, set ownsColl to false
virtual StatusCode addOrDelete (std::unique_ptr< T >, IdentifierHash hashId) override final
 Tries to add the item to the cache, if the item already exists then it is deleted This is a convenience method for online multithreaded scenarios.
virtual StatusCode addOrDelete (std::unique_ptr< const T >, IdentifierHash hashId) override final
StatusCode addOrDelete (std::unique_ptr< T >, IdentifierHash hashId, bool &deleted)
 identical to previous excepts allows counting of deletions
StatusCode addLock (std::unique_ptr< T > ptr, IdentifierHash hashId)
 Like the other add methods but optimized for changing from the inprogress state.
virtual bool tryAddFromCache (IdentifierHash hashId) override final
 Looks in the cache to see if item already exists if not it returns false, If it does exist it incorporates it into the IDC view but changing the mask.
StatusCode fetchOrCreate (IdentifierHash hashId)
 Tries will look for item in cache, if it doesn't exist will call the cache IMAKER If cache doesn't have an IMAKER then this fails.
StatusCode fetchOrCreate (const std::vector< IdentifierHash > &hashId)
virtual StatusCode naughtyRetrieve ATLAS_NOT_THREAD_SAFE (IdentifierHash hashId, T *&collToRetrieve) const override final
T * removeCollection (IdentifierHash hashId)
 remove collection from container for id hash, returning it (and ownership) to client
virtual void cleanup () override final
 reset m_hashids and call IdentifiableCache's cleanup
virtual size_t fullSize () const override final
 return full size of container
size_t size () const
 Duplicate of fullSize for backwards compatability.
void prepareItr () const
virtual size_t numberOfCollections () const override final
 return number of collections
auto GetAllHashPtrPair () const
virtual std::vector< IdentifierHashGetAllCurrentHashes () const override final
 Returns a collection of all hashes availiable in this IDC.
const_iterator begin () const
 return const_iterator for first entry
const_iterator end () const
 return const_iterator for end of container
bool empty () const
 return true if container is empty
IDC_WriteHandle getWriteHandle (IdentifierHash hash)
virtual StatusCode naughtyRetrieve (IdentifierHash hashId, T *&collToRetrieve) const =0

Static Public Member Functions

static const CLIDclassID ()

Protected Types

typedef EventContainers::IdentifiableCacheBase IdentifiableCacheBase

Protected Member Functions

bool tryAddFromCache (IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock)
void cleanup (deleter_f *deleter)
bool insert (IdentifierHash hashId, const void *ptr)
void Wait () const
void ResetMask ()

Protected Attributes

bool m_OnlineMode
std::unique_ptr< I_InternalIDC > m_link

Detailed Description

Use IdentifiableContainer with CscDigitCollection.

Definition at line 48 of file CscDigitContainer.h.

Member Typedef Documentation

◆ base_value_type

template<class T>
typedef T IdentifiableContainerMT< T >::base_value_type
inherited

Definition at line 78 of file IdentifiableContainerMT.h.

◆ const_pointer

template<class T>
typedef T* const* IdentifiableContainerMT< T >::const_pointer
inherited

Definition at line 77 of file IdentifiableContainerMT.h.

◆ const_reference

template<class T>
typedef T* const& IdentifiableContainerMT< T >::const_reference
inherited

Definition at line 74 of file IdentifiableContainerMT.h.

◆ deleter_f

typedef void EventContainers::IdentifiableContainerBase::deleter_f(const void *p)
inherited

Definition at line 14 of file IdentifiableContainerBase.h.

◆ Hash_Container

◆ ICACHE

template<class T>
typedef EventContainers::IdentifiableCache<T> IdentifiableContainerMT< T >::ICACHE
inherited

Definition at line 70 of file IdentifiableContainerMT.h.

◆ IDENTIFIABLE

template<class T>
typedef T IdentifiableContainerMT< T >::IDENTIFIABLE
inherited

Definition at line 69 of file IdentifiableContainerMT.h.

◆ IdentifiableCacheBase

◆ MyBase

◆ MyType

template<class T>
typedef IdentifiableContainerMT<T> IdentifiableContainerMT< T >::MyType
inherited

Definition at line 71 of file IdentifiableContainerMT.h.

◆ pointer

template<class T>
typedef T** IdentifiableContainerMT< T >::pointer
inherited

Definition at line 76 of file IdentifiableContainerMT.h.

◆ reference

template<class T>
typedef T*& IdentifiableContainerMT< T >::reference
inherited

Definition at line 73 of file IdentifiableContainerMT.h.

◆ size_type

◆ value_type

template<class T>
typedef T* IdentifiableContainerMT< T >::value_type
inherited

Definition at line 75 of file IdentifiableContainerMT.h.

Constructor & Destructor Documentation

◆ CscDigitContainer()

CscDigitContainer::CscDigitContainer ( unsigned int hash_max)

Definition at line 26 of file CscDigitContainer.cxx.

28{
29
30}
IdentifiableContainerMT< T > IdentifiableContainer

◆ ~CscDigitContainer()

CscDigitContainer::~CscDigitContainer ( )
default

Member Function Documentation

◆ addCollection()

template<class T>
StatusCode IdentifiableContainerMT< T >::addCollection ( const T * coll,
IdentifierHash hashId )
finaloverridevirtualinherited

insert collection into container with id hash if IDC should not take ownership of collection, set ownsColl to false

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 306 of file IdentifiableContainerMT.h.

307{
308 // update m_hashids
310 return StatusCode::SUCCESS;
311
312}
#define ATH_UNLIKELY(x)

◆ addLock()

template<class T>
StatusCode IdentifiableContainerMT< T >::addLock ( std::unique_ptr< T > ptr,
IdentifierHash hashId )
inherited

Like the other add methods but optimized for changing from the inprogress state.

Definition at line 381 of file IdentifiableContainerMT.h.

382{
383 return m_link->addLock(hashId, ptr.release());
384}

◆ addOrDelete() [1/3]

template<class T>
virtual StatusCode IdentifiableContainerMT< T >::addOrDelete ( std::unique_ptr< const T > ,
IdentifierHash hashId )
finaloverridevirtualinherited

◆ addOrDelete() [2/3]

template<class T>
StatusCode IdentifiableContainerMT< T >::addOrDelete ( std::unique_ptr< T > uptr,
IdentifierHash hashId )
finaloverridevirtualinherited

Tries to add the item to the cache, if the item already exists then it is deleted This is a convenience method for online multithreaded scenarios.

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 359 of file IdentifiableContainerMT.h.

360{
361 if(ATH_UNLIKELY(hashId >= m_link->fullSize())) return StatusCode::FAILURE;
362 auto ptr = uptr.release();
364 if(!b) delete ptr;
365 return StatusCode::SUCCESS;
366}

◆ addOrDelete() [3/3]

template<class T>
StatusCode IdentifiableContainerMT< T >::addOrDelete ( std::unique_ptr< T > uptr,
IdentifierHash hashId,
bool & deleted )
inherited

identical to previous excepts allows counting of deletions

Definition at line 388 of file IdentifiableContainerMT.h.

389{
390 if(ATH_UNLIKELY(hashId >= m_link->fullSize())) return StatusCode::FAILURE;
391 auto ptr = uptr.release();
393 if(!b) delete ptr;
394 deleted = !b;
395 return StatusCode::SUCCESS;
396}

◆ ATLAS_NOT_THREAD_SAFE()

template<class T>
virtual StatusCode naughtyRetrieve IdentifiableContainerMT< T >::ATLAS_NOT_THREAD_SAFE ( IdentifierHash hashId,
T *& collToRetrieve ) const
finaloverridevirtualinherited

◆ begin()

template<class T>
const_iterator IdentifiableContainerMT< T >::begin ( ) const
inlineinherited

return const_iterator for first entry

Definition at line 242 of file IdentifiableContainerMT.h.

◆ classID()

const CLID & CscDigitContainer::classID ( )
static

Definition at line 42 of file CscDigitContainer.cxx.

43{
45 // static const CLID CLID_CscDigitContainer= 4194;
46 // return CLID_CscDigitContainer ;
47}

◆ cleanup() [1/2]

void IdentifiableContainerBase::cleanup ( deleter_f * deleter)
protectedinherited

Definition at line 38 of file IdentifiableContainerBase.cxx.

38 {
39 if(m_OnlineMode) throw std::runtime_error("Not implemented in online mode");
40 m_link->cleanUp(deleter);
41 }

◆ cleanup() [2/2]

template<class T>
void IdentifiableContainerMT< T >::cleanup ( )
finaloverridevirtualinherited

reset m_hashids and call IdentifiableCache's cleanup

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 318 of file IdentifiableContainerMT.h.

◆ clID()

virtual const CLID & CscDigitContainer::clID ( ) const
inlinevirtual

return class ID

Definition at line 65 of file CscDigitContainer.h.

66 {
67 return classID();
68 }
static const CLID & classID()

◆ digit_size()

CscDigitContainer::size_type CscDigitContainer::digit_size ( ) const

Definition at line 53 of file CscDigitContainer.cxx.

53 {
55 CscDigitContainer::const_iterator it = begin();
56 CscDigitContainer::const_iterator iend = end();
57
58 for (; it != iend; ++it ) {
59 count += (*it)->size();
60 }
61 return count;
62}
CscDigitCollection::size_type size_type
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ empty()

template<class T>
bool IdentifiableContainerMT< T >::empty ( ) const
inlineinherited

return true if container is empty

Definition at line 253 of file IdentifiableContainerMT.h.

253 {
254 return numberOfCollections()==0;
255 }
virtual size_t numberOfCollections() const override final
return number of collections

◆ end()

template<class T>
const_iterator IdentifiableContainerMT< T >::end ( ) const
inlineinherited

return const_iterator for end of container

Definition at line 248 of file IdentifiableContainerMT.h.

248 {
249 return const_iterator(m_link->cend());
250 }

◆ fetchOrCreate() [1/2]

template<class T>
StatusCode IdentifiableContainerMT< T >::fetchOrCreate ( const std::vector< IdentifierHash > & hashId)
inherited

Definition at line 332 of file IdentifiableContainerMT.h.

◆ fetchOrCreate() [2/2]

template<class T>
StatusCode IdentifiableContainerMT< T >::fetchOrCreate ( IdentifierHash hashId)
inherited

Tries will look for item in cache, if it doesn't exist will call the cache IMAKER If cache doesn't have an IMAKER then this fails.

Definition at line 325 of file IdentifiableContainerMT.h.

◆ fullSize()

template<class T>
virtual size_t IdentifiableContainerMT< T >::fullSize ( ) const
inlinefinaloverridevirtualinherited

return full size of container

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 204 of file IdentifiableContainerMT.h.

204 {
205 return m_link->fullSize();
206 }

◆ GetAllCurrentHashes()

template<class T>
virtual std::vector< IdentifierHash > IdentifiableContainerMT< T >::GetAllCurrentHashes ( ) const
inlinefinaloverridevirtualinherited

Returns a collection of all hashes availiable in this IDC.

If this is an "offline" mode IDC then this is identical to the cache If this is an "online" mode IDC then this is the items that both exist in the cache and have a postive mask element

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 237 of file IdentifiableContainerMT.h.

◆ GetAllHashPtrPair()

template<class T>
auto IdentifiableContainerMT< T >::GetAllHashPtrPair ( ) const
inlineinherited

Definition at line 220 of file IdentifiableContainerMT.h.

220 {
221 static_assert(sizeof(const T*) == sizeof(const void*) && std::is_pointer<const T*>::value);
222 static_assert(sizeof(EventContainers::hashPair<T>) == sizeof(EventContainers::hashPair<void>));
223 const auto& void_vec = m_link->getAllHashPtrPair(); // std::vector<hashPair<void>>
224 return void_vec | std::views::transform([](const auto& item) {
225 // We construct a temporary hashPair<T> for each element
227 item.first,
228 static_cast<const T*>(item.second)
229 };
230 });
231 }

◆ getWriteHandle()

template<class T>
IDC_WriteHandle IdentifiableContainerMT< T >::getWriteHandle ( IdentifierHash hash)
inlinenodiscardinherited

Definition at line 257 of file IdentifiableContainerMT.h.

258 {
260 lock.m_hashId = hash;
261 lock.m_IDC_ptr = this;
262 return lock;
263 }

◆ hasExternalCache()

template<class T>
virtual bool IdentifiableContainerMT< T >::hasExternalCache ( ) const
inlinefinaloverridevirtualinherited

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 155 of file IdentifiableContainerMT.h.

155{ return m_OnlineMode; }

◆ indexFind()

template<class T>
const_iterator IdentifiableContainerMT< T >::indexFind ( IdentifierHash hashId) const
inlineinherited

Definition at line 163 of file IdentifiableContainerMT.h.

163 {
164 return m_link->indexFind(hashId);
165 }

◆ indexFindPtr()

template<class T>
const T * IdentifiableContainerMT< T >::indexFindPtr ( IdentifierHash hashId) const
finaloverridevirtualinherited

return pointer on the found entry or null if out of range using hashed index - fast version, does not call cnv if object not there

return valuetype on the found entry or null if out of range using hashed index - fast version, does not call cnv if object not there

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 298 of file IdentifiableContainerMT.h.

◆ insert()

bool EventContainers::IdentifiableContainerBase::insert ( IdentifierHash hashId,
const void * ptr )
inlineprotectedinherited

Definition at line 28 of file IdentifiableContainerBase.h.

28{ return m_link->insert(hashId, ptr); }

◆ naughtyRetrieve()

template<class T>
virtual StatusCode EventContainers::IIdentifiableCont< T >::naughtyRetrieve ( IdentifierHash hashId,
T *& collToRetrieve ) const
pure virtualinherited

◆ numberOfCollections()

template<class T>
virtual size_t IdentifiableContainerMT< T >::numberOfCollections ( ) const
inlinefinaloverridevirtualinherited

return number of collections

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 216 of file IdentifiableContainerMT.h.

◆ prepareItr()

template<class T>
void IdentifiableContainerMT< T >::prepareItr ( ) const
inlineinherited

Definition at line 213 of file IdentifiableContainerMT.h.

213{ m_link->wait(); }

◆ removeCollection()

template<class T>
T * IdentifiableContainerMT< T >::removeCollection ( IdentifierHash hashId)
inherited

remove collection from container for id hash, returning it (and ownership) to client

Definition at line 268 of file IdentifiableContainerMT.h.

269{
270 return std::bit_cast<T*>(m_link->removeCollection(hashId));
271}

◆ ResetMask()

void EventContainers::IdentifiableContainerBase::ResetMask ( )
protectedinherited

◆ size()

template<class T>
size_t IdentifiableContainerMT< T >::size ( ) const
inlineinherited

Duplicate of fullSize for backwards compatability.

Definition at line 209 of file IdentifiableContainerMT.h.

209 {
210 return m_link->fullSize();
211 }

◆ tryAddFromCache() [1/2]

bool EventContainers::IdentifiableContainerBase::tryAddFromCache ( IdentifierHash hashId,
EventContainers::IDC_WriteHandleBase & lock )
inlineprotectedinherited

Definition at line 30 of file IdentifiableContainerBase.h.

30 {
31 return m_link->tryAddFromCache(hashId, lock); }

◆ tryAddFromCache() [2/2]

template<class T>
bool IdentifiableContainerMT< T >::tryAddFromCache ( IdentifierHash hashId)
finaloverridevirtualinherited

Looks in the cache to see if item already exists if not it returns false, If it does exist it incorporates it into the IDC view but changing the mask.

Implements EventContainers::IIdentifiableCont< T >.

Definition at line 340 of file IdentifiableContainerMT.h.

◆ Wait()

void EventContainers::IdentifiableContainerBase::Wait ( ) const
inlineprotectedinherited

Definition at line 29 of file IdentifiableContainerBase.h.

29{ m_link->wait(); }

Member Data Documentation

◆ m_link

std::unique_ptr<I_InternalIDC> EventContainers::IdentifiableContainerBase::m_link
protectedinherited

Definition at line 26 of file IdentifiableContainerBase.h.

◆ m_OnlineMode

bool EventContainers::IdentifiableContainerBase::m_OnlineMode
protectedinherited

Definition at line 24 of file IdentifiableContainerBase.h.


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