ATLAS Offline Software
Loading...
Searching...
No Matches
CondCont< T > Class Template Reference

Hold mapping of ranges to condition objects. More...

#include <CondCont.h>

Inheritance diagram for CondCont< T >:
Collaboration diagram for CondCont< T >:

Public Types

typedef CondContBaseInfo< T >::Base Base
 Base class.
typedef Base::CondContSet CondContSet
typedef T Payload
 Payload type held by this class.
typedef CondContBase::key_type key_type
enum class  KeyType { SINGLE , TIMESTAMP , RUNLBN , MIXED }
 Type of key used for this container. More...

Public Member Functions

 CondCont (Athena::IRCUSvc &rcusvc, const DataObjID &id, SG::DataProxy *proxy=nullptr, size_t capacity=16)
 Constructor.
virtual ~CondCont ()
 Destructor.
 CondCont (const CondCont &)=delete
 No copying.
CondContoperator= (const CondCont &)=delete
StatusCode insert (const EventIDRange &r, std::unique_ptr< T > obj, const EventContext &ctx)
 Insert a new conditions object.
bool find (const EventIDBase &t, T const *&obj, EventIDRange const **r=nullptr) const
 Look up a conditions object for a given time.
const T * find (const EventIDBase &t) const
 Look up a conditions object for a given time.
virtual void list (std::ostream &ost) const override final
 Dump the container contents for debugging.
virtual std::vector< EventIDRange > ranges () const override final
 Return all IOV validity ranges defined in this container.
virtual StatusCode typelessInsert (const EventIDRange &r, void *obj, const EventContext &ctx) override final
 Insert a new conditions object.
virtual bool valid (const EventIDBase &t) const override final
 Test to see if a given IOV time is mapped in the container.
virtual bool range (const EventIDBase &t, EventIDRange &r) const override final
 Return the mapped validity range for an IOV time.
virtual StatusCode erase (const EventIDBase &t, const EventContext &ctx) override final
 Erase the first element not less than t.
virtual StatusCode extendLastRange (const EventIDRange &newRange, const EventContext &ctx) override final
 Extend the range of the last IOV.
CLID clid () const
 Return the CLID of the most-derived CondCont.
KeyType keyType () const
 Return the key type for this container.
const DataObjID & id () const
 Return CLID/key corresponding to this container.
SG::DataProxyproxy ()
 Return the associated DataProxy, if any.
const SG::DataProxyproxy () const
 Return the associated DataProxy, if any.
void setProxy (SG::DataProxy *)
 Set the associated DataProxy.
void print () const
 Dump the container to cout.
virtual size_t entries () const
 Return the number of conditions objects in the container.
virtual size_t trim (const std::vector< key_type > &runLbnKeys, const std::vector< key_type > &TSKeys)
 Remove unused entries from the front of the list.
void clear ()
 Remove all entries in the container.
void quiescent (const EventContext &ctx)
 Mark that this thread is no longer accessing data from this container.
size_t nInserts () const
 Return the number times an item was inserted into the map.
size_t maxSize () const
 Return the maximum size of the map.
void addDep (CondContBase *dep)
 Declare another conditions container that depends on this one.
std::vector< CondContBase * > getDeps ()
 Return the list of conditions containers that depend on this one.

Static Public Member Functions

static void registerBaseInit ()
 Helper to ensure that the inheritance information for this class gets initialized.
static key_type keyFromRunLBN (const EventIDBase &b)
 Make a run+lbn key from an EventIDBase.
static key_type keyFromTimestamp (const EventIDBase &b)
 Make a timestamp key from an EventIDBase.
static void setCleanerSvcName ATLAS_NOT_THREAD_SAFE (const std::string &name)
 Allow overriding the name of the global conditions cleaner service (for testing purposes).

Protected Types

typedef CondContSet::Updater_t Updater_t
typedef CondContSet::delete_function delete_function

Protected Member Functions

 CondCont (Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< typename CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
 Internal constructor.
const void * cast (CLID clid, const void *ptr) const
 Do pointer conversion for the payload type.
virtual const void * doCast (CLID clid, const void *ptr) const override
 Do pointer conversion for the payload type.
StatusCode insertBase (const EventIDRange &r, CondContSet::payload_unique_ptr t, const EventContext &ctx)
 Insert a new conditions object.
StatusCode eraseBase (const EventIDBase &t, const EventContext &ctx)
 Erase the first element not less than t.
StatusCode extendLastRangeBase (const EventIDRange &newRange, const EventContext &ctx)
 Extend the range of the last IOV.
const void * findBase (const EventIDBase &t, EventIDRange const **r) const
 Internal lookup function.
template<class FUNC>
void forEach (const FUNC &func) const
 Call func on each entry in the container.
StatusCode inserted (const EventContext &ctx)
 Tell the cleaner that a new object was added to the container.
void insertError (CLID usedCLID) const
 Helper to report an error due to using a base class for insertion.
delete_functiondelfcn () const
 Return the deletion function for this container.
std::string title () const
 Description of this container to use for MsgStream.

Private Types

using DepSet = CxxUtils::ConcurrentPtrSet<CondContBase, CxxUtils::SimpleUpdater>
 Other conditions dependencies that depend on this one, as inferred by addDependency calls.

Private Attributes

std::atomic< KeyTypem_keyType
 Key type of this container.
CLID m_clid
 CLID of the most-derived CondCont.
DataObjID m_id
 CLID+key for this container.
SG::DataProxym_proxy
 Associated DataProxy.
CondContSet m_condSet
 Set of mapped objects.
ServiceHandle< Athena::IConditionsCleanerSvcm_cleanerSvc
 Handle to the cleaner service.
DepSet m_deps

Static Private Attributes

static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
 Name of the global conditions cleaner service.

Detailed Description

template<typename T>
class CondCont< T >

Hold mapping of ranges to condition objects.

This object holds mappings from a set of IOV ranges (represented as EventIDRange) to conditions objects (which are owned by this object). It has methods to insert a new mapping and to retrieve objects by IOV time.

This object is recorded in the conditions store, so it must have a CLID (the CondCont object, not T). This CLID should be declared using the CONDCONT_DEF macro:

#define CONDCONT_DEF(...)
Definition CondCont.h:1413
uint32_t CLID
The Class ID type.
#define TYPE(CODE, TYP, IOTYP)

It is possible for one conditions object to derive from another. If TYPE derives from BASE, then declare this with a third argument to CONDCONT_DEF:

before any references to CondCont<TYPE>. This is implemented by having CondCont<TYPE> derive from CondCont<BASE>. In that case, the mappings will be stored only in the most-derived class.

Definition at line 888 of file CondCont.h.

Member Typedef Documentation

◆ Base

template<typename T>
typedef CondContBaseInfo<T>::Base CondCont< T >::Base

Base class.

Definition at line 892 of file CondCont.h.

◆ CondContSet

template<typename T>
typedef Base::CondContSet CondCont< T >::CondContSet

Definition at line 894 of file CondCont.h.

◆ delete_function

typedef CondContSet::delete_function CondContBase::delete_function
protectedinherited

Definition at line 520 of file CondCont.h.

◆ DepSet

Other conditions dependencies that depend on this one, as inferred by addDependency calls.

There should only be a few of them.

Definition at line 682 of file CondCont.h.

◆ key_type

template<typename T>
typedef CondContBase::key_type CondCont< T >::key_type

Definition at line 899 of file CondCont.h.

◆ Payload

template<typename T>
typedef T CondCont< T >::Payload

Payload type held by this class.

Definition at line 897 of file CondCont.h.

◆ Updater_t

typedef CondContSet::Updater_t CondContBase::Updater_t
protectedinherited

Definition at line 519 of file CondCont.h.

Member Enumeration Documentation

◆ KeyType

enum class CondContBase::KeyType
stronginherited

Type of key used for this container.

Enumerator
SINGLE 

Either TIMESTAMP or RUNLBN, but nothing's been put in the container yet, so we don't know which one.

TIMESTAMP 

Container uses timestamp keys.

RUNLBN 

Container uses run+lbn keys.

MIXED 

Mixed Run+lbn / timestamp container.

Definition at line 179 of file CondCont.h.

180 {
183 SINGLE,
184
186 TIMESTAMP,
187
189 RUNLBN,
190
192 MIXED,
193 };

Constructor & Destructor Documentation

◆ CondCont() [1/3]

template<typename T>
CondCont< T >::CondCont ( Athena::IRCUSvc & rcusvc,
const DataObjID & id,
SG::DataProxy * proxy = nullptr,
size_t capacity = 16 )

Constructor.

Parameters
rcusvcRCU service instance.
idCLID+key for this object.
proxyDataProxy for this object.
capacityInitial capacity of the container.

◆ ~CondCont()

template<typename T>
virtual CondCont< T >::~CondCont ( )
virtual

Destructor.

◆ CondCont() [2/3]

template<typename T>
CondCont< T >::CondCont ( const CondCont< T > & )
delete

No copying.

◆ CondCont() [3/3]

template<typename T>
CondCont< T >::CondCont ( Athena::IRCUSvc & rcusvc,
CLID clid,
const DataObjID & id,
SG::DataProxy * proxy,
std::shared_ptr< typename CondContSet::IPayloadDeleter > payloadDeleter,
size_t capacity )
protected

Internal constructor.

Parameters
rcusvcRCU service instance.
CLIDof the most-derived CondCont.
idCLID+key for this object.
proxyDataProxy for this object.
payloadDeleterObject for deleting payload objects.
capacityInitial capacity of the container.

Member Function Documentation

◆ addDep()

void CondContBase::addDep ( CondContBase * dep)
inherited

Declare another conditions container that depends on this one.

Parameters
depConditions container that depends on this one.

Definition at line 695 of file CondCont.cxx.

696{
697 m_deps.insert (dep);
698}
DepSet m_deps
Definition CondCont.h:683

◆ ATLAS_NOT_THREAD_SAFE()

void setCleanerSvcName CondContBase::ATLAS_NOT_THREAD_SAFE ( const std::string & name)
staticinherited

Allow overriding the name of the global conditions cleaner service (for testing purposes).

Parameters
nameThe name of the global conditions cleaner service.

◆ cast()

template<typename T>
const void * CondCont< T >::cast ( CLID clid,
const void * ptr ) const
protected

Do pointer conversion for the payload type.

Parameters
clidCLID for the desired pointer type.
ptrPointer of type T*.

Converts ptr from T* to a pointer to the type given by clid. Returns nullptr if the conversion is not possible.

◆ clear()

void CondContBase::clear ( )
inherited

Remove all entries in the container.

Mostly for testing — should not normally be used.

Definition at line 360 of file CondCont.cxx.

361{
362 m_condSet.clear();
363}
CondContSet m_condSet
Set of mapped objects.
Definition CondCont.h:675

◆ clid()

CLID CondContBase::clid ( ) const
inherited

Return the CLID of the most-derived CondCont.

◆ delfcn()

CondContBase::delete_function * CondContBase::delfcn ( ) const
protectedinherited

Return the deletion function for this container.

Definition at line 739 of file CondCont.cxx.

740{
741 return m_condSet.deleter().delfcn();
742}

◆ doCast()

template<typename T>
virtual const void * CondCont< T >::doCast ( CLID clid,
const void * ptr ) const
overrideprotectedvirtual

Do pointer conversion for the payload type.

Parameters
clidCLID for the desired pointer type.
ptrPointer of type T*.

Converts ptr from T* to a pointer to the type given by clid. Returns nullptr if the conversion is not possible.

This is a virtual function that calls cast from the most-derived class of the hierarchy.

Implements CondContBase.

◆ entries()

size_t CondContBase::entries ( ) const
virtualinherited

Return the number of conditions objects in the container.

Reimplemented in CondContMixedBase.

Definition at line 293 of file CondCont.cxx.

294{
295 return m_condSet.size();
296}

◆ erase()

StatusCode CondContSingleBase::erase ( const EventIDBase & t,
const EventContext & ctx )
finaloverridevirtualinherited

Erase the first element not less than t.

Parameters
IOVtime of element to erase.
ctxEvent context for the current thread.

Implements CondContBase.

Definition at line 842 of file CondCont.cxx.

844{
845 return CondContBase::eraseBase (t, ctx);
846}
StatusCode eraseBase(const EventIDBase &t, const EventContext &ctx)
Erase the first element not less than t.
Definition CondCont.cxx:538

◆ eraseBase()

StatusCode CondContBase::eraseBase ( const EventIDBase & t,
const EventContext & ctx )
protectedinherited

Erase the first element not less than t.

Parameters
IOVtime of element to erase.
ctxEvent context for the current thread.

Definition at line 538 of file CondCont.cxx.

540{
541 switch (m_keyType) {
542 case KeyType::RUNLBN:
543 if (!t.isRunLumi()) {
544 MsgStream msg (Athena::getMessageSvc(), title());
545 msg << MSG::ERROR << "CondContBase::erase: "
546 << "Non-Run/LBN key used in Run/LBN container."
547 << endmsg;
548 return StatusCode::FAILURE;
549 }
550 m_condSet.erase (CondContBase::keyFromRunLBN (t), ctx);
551 break;
553 if (!t.isTimeStamp()) {
554 MsgStream msg (Athena::getMessageSvc(), title());
555 msg << MSG::ERROR << "CondContBase::erase: "
556 << "Non-Timestamp key used in timestamp container."
557 << endmsg;
558 return StatusCode::FAILURE;
559 }
561 break;
562 case KeyType::SINGLE:
563 break;
564 default:
565 std::abort();
566 }
567 return StatusCode::SUCCESS;
568}
#define endmsg
@ SINGLE
Either TIMESTAMP or RUNLBN, but nothing's been put in the container yet, so we don't know which one.
Definition CondCont.h:183
@ TIMESTAMP
Container uses timestamp keys.
Definition CondCont.h:186
@ RUNLBN
Container uses run+lbn keys.
Definition CondCont.h:189
std::string title() const
Description of this container to use for MsgStream.
Definition CondCont.cxx:748
std::atomic< KeyType > m_keyType
Key type of this container.
Definition CondCont.h:663
static key_type keyFromTimestamp(const EventIDBase &b)
Make a timestamp key from an EventIDBase.
static key_type keyFromRunLBN(const EventIDBase &b)
Make a run+lbn key from an EventIDBase.
IMessageSvc * getMessageSvc(bool quiet=false)
MsgStream & msg
Definition testRead.cxx:32

◆ extendLastRange()

StatusCode CondContSingleBase::extendLastRange ( const EventIDRange & newRange,
const EventContext & ctx )
finaloverridevirtualinherited

Extend the range of the last IOV.

Parameters
newRangeNew validity range.
ctxEvent context.

Returns failure if the start time of newRange does not match the start time of the last IOV in the container. Otherwise, the end time for the last IOV is changed to the end time for newRange. (If the end time for newRange is before the end of the last IOV, then nothing is changed.)

Implements CondContBase.

Definition at line 860 of file CondCont.cxx.

862{
863 return CondContBase::extendLastRangeBase (newRange, ctx);
864}
StatusCode extendLastRangeBase(const EventIDRange &newRange, const EventContext &ctx)
Extend the range of the last IOV.
Definition CondCont.cxx:582

◆ extendLastRangeBase()

StatusCode CondContBase::extendLastRangeBase ( const EventIDRange & newRange,
const EventContext & ctx )
protectedinherited

Extend the range of the last IOV.

Parameters
newRangeNew validity range.
ctxEvent context.

Returns failure if the start time of newRange does not match the start time of the last IOV in the container. Otherwise, the end time for the last IOV is changed to the end time for newRange. (If the end time for newRange is before the end of the last IOV, then nothing is changed.)

Definition at line 582 of file CondCont.cxx.

584{
587 switch (m_keyType) {
588 case KeyType::RUNLBN:
589 case KeyType::MIXED: // To handle the extension case of insertMixed().
590 if (!newRange.start().isRunLumi()) {
591 MsgStream msg (Athena::getMessageSvc(), title());
592 msg << MSG::ERROR << "CondContBase::extendLastRange: "
593 << "Non-Run/LBN range used in Run/LBN container."
594 << endmsg;
595 return StatusCode::FAILURE;
596 }
597 start = keyFromRunLBN (newRange.start());
598 stop = keyFromRunLBN (newRange.stop());
599 break;
601 if (!newRange.start().isTimeStamp()) {
602 MsgStream msg (Athena::getMessageSvc(), title());
603 msg << MSG::ERROR << "CondContBase::extendLastRange: "
604 << "Non-timestamp range used in timestamp container."
605 << endmsg;
606 return StatusCode::FAILURE;
607 }
608 start = keyFromTimestamp (newRange.start());
609 stop = keyFromTimestamp (newRange.stop());
610 break;
611 case KeyType::SINGLE:
612 // Empty container.
613 return StatusCode::FAILURE;
614 default:
615 std::abort();
616 }
617
618 if (m_condSet.extendLastRange (RangeKey (newRange, start, stop), ctx) >= 0)
619 {
620 return StatusCode::SUCCESS;
621 }
622 return StatusCode::FAILURE;
623}
@ MIXED
Mixed Run+lbn / timestamp container.
Definition CondCont.h:192
uint64_t key_type
Type used to store an IOV time internally.
Definition CondCont.h:204
Range object to store in ConcurrentRangeMap.
Definition CondCont.h:425

◆ find() [1/2]

template<typename T>
const T * CondCont< T >::find ( const EventIDBase & t) const

Look up a conditions object for a given time.

Parameters
tIOV time to find.

Returns the found object, or nullptr.

This variant may be more convenient to call from python.

◆ find() [2/2]

template<typename T>
bool CondCont< T >::find ( const EventIDBase & t,
T const *& obj,
EventIDRange const ** r = nullptr ) const

Look up a conditions object for a given time.

Parameters
tIOV time to find.
obj[out]Object found.
rIf non-null, copy validity range of the object here.

Returns true if the object was found; false otherwide.

◆ findBase()

const void * CondContBase::findBase ( const EventIDBase & t,
EventIDRange const ** r ) const
protectedinherited

Internal lookup function.

Parameters
tIOV time to find.
rIf non-null, copy validity range of the object here.

Looks up the conditions object corresponding to the IOV time t. If found, return the pointer (as a pointer to the payload type of the most-derived CondCont). Otherwise, return nullptr.

Parameters
clidCLID for the desired pointer type.
tIOV time to find.
rIf non-null, copy validity range of the object here.

Looks up the conditions object corresponding to the IOV time t. If found, convert the pointer to a pointer to the type identified by CLID and return it. Otherwise, return nullptr.

Definition at line 636 of file CondCont.cxx.

638{
639 const void* ptr = nullptr;
641 switch (m_keyType) {
642 case KeyType::RUNLBN:
643 case KeyType::MIXED:
644 if (!t.isRunLumi()) [[unlikely]] {
645 MsgStream msg (Athena::getMessageSvc(), title());
646 msg << MSG::ERROR << "CondContBase::findBase: "
647 << "Non-Run/LBN key used in Run/LBN container."
648 << endmsg;
649 return nullptr;
650 }
651 key = keyFromRunLBN (t);
652 break;
654 if (!t.isTimeStamp()) [[unlikely]] {
655 MsgStream msg (Athena::getMessageSvc(), title());
656 msg << MSG::ERROR << "CondContBase::findBase: "
657 << "Non-timestamp key used in timestamp container."
658 << endmsg;
659 return nullptr;
660 }
661 key = keyFromTimestamp (t);
662 break;
663 case KeyType::SINGLE:
664 // Empty container.
665 return nullptr;
666 default:
667 std::abort();
668 }
669
670 CondContSet::const_iterator it = m_condSet.find (key);
671 if (it && key < it->first.m_stop) {
672 if (r) {
673 *r = &it->first.m_range;
674 }
675 ptr = it->second;
676 }
677
678 return ptr;
679}
int r
Definition globals.cxx:22
bool first
Definition DeMoScan.py:534
void * ptr(T *p)
Definition SGImplSvc.cxx:74
#define unlikely(x)

◆ forEach()

template<class FUNC>
void CondContBase::forEach ( const FUNC & func) const
protectedinherited

Call func on each entry in the container.

Parameters
funcFunctional to call on each entry.

func will be called on each container element (being passed const CondContSet::value_type&).

◆ getDeps()

std::vector< CondContBase * > CondContBase::getDeps ( )
inherited

Return the list of conditions containers that depend on this one.

Definition at line 704 of file CondCont.cxx.

705{
706 return std::vector<CondContBase*> (m_deps.begin(), m_deps.end());
707}

◆ id()

const DataObjID & CondContBase::id ( ) const
inherited

Return CLID/key corresponding to this container.

◆ insert()

template<typename T>
StatusCode CondCont< T >::insert ( const EventIDRange & r,
std::unique_ptr< T > obj,
const EventContext & ctx )

Insert a new conditions object.

Parameters
rRange of validity of this object.
objPointer to the object being inserted.
ctxEvent context for the current thread.

obj must point to an object of type T. This will give an error if this is not called on the most-derived CondCont.

Returns SUCCESS if the object was successfully inserted; EXTENDED if the last existing range in the container was extended to match the new range; OVERLAP if the object was inserted but the range partially overlaps with an existing one; DUPLICATE if the object wasn't inserted because the range duplicates an existing one, and FAILURE otherwise (ownership of the object will be taken in any case).

◆ insertBase()

StatusCode CondContBase::insertBase ( const EventIDRange & r,
CondContSet::payload_unique_ptr t,
const EventContext & ctx )
protectedinherited

Insert a new conditions object.

Parameters
rRange of validity of this object.
tPointer to the object being inserted.
ctxEvent context for the current thread.

Returns SUCCESS if the object was successfully inserted; EXTENDED if the last existing range in the container was extended to match the new range; OVERLAP if the object was inserted but the range partially overlaps with an existing one; DUPLICATE if the object wasn't inserted because the range duplicates an existing one, and FAILURE otherwise (ownership of the object will be taken in any case).

Definition at line 445 of file CondCont.cxx.

448{
449 EventIDBase start = r.start();
450 EventIDBase stop = r.stop();
451
452 key_type start_key, stop_key;
453
454 if (m_keyType == KeyType::MIXED) {
455 if (start.run_number() == EventIDBase::UNDEFNUM ||
456 stop.run_number() == EventIDBase::UNDEFNUM)
457 {
458 MsgStream msg (Athena::getMessageSvc(), title());
459 msg << MSG::ERROR << "CondContBase::insertBase: "
460 << "Run part of range invalid in mixed container."
461 << endmsg;
462 return StatusCode::FAILURE;
463 }
464
465 start_key = keyFromRunLBN (start);
466 stop_key = keyFromRunLBN (stop);
467 }
468 else if (start.isTimeStamp() && stop.isTimeStamp()) {
469 if (m_keyType == KeyType::SINGLE) {
471 }
472 else if (m_keyType != KeyType::TIMESTAMP) {
473 MsgStream msg (Athena::getMessageSvc(), title());
474 msg << MSG::ERROR << "CondContBase::insertBase: "
475 << "Timestamp key used in non-timestamp container."
476 << endmsg;
477 return StatusCode::FAILURE;
478 }
479
480 start_key = keyFromTimestamp (start);
481 stop_key = keyFromTimestamp (stop);
482 }
483
484 else if (start.run_number() != EventIDBase::UNDEFNUM &&
485 stop.run_number() != EventIDBase::UNDEFNUM)
486 {
487 if (m_keyType == KeyType::SINGLE) {
489 }
490 else if (m_keyType != KeyType::RUNLBN) {
491 MsgStream msg (Athena::getMessageSvc(), title());
492 msg << MSG::ERROR << "CondContBase::insertBase: "
493 << "Run/LBN key used in non-Run/LBN container."
494 << endmsg;
495 return StatusCode::FAILURE;
496 }
497
498 start_key = keyFromRunLBN (start);
499 stop_key = keyFromRunLBN (stop);
500 }
501
502 else {
503 MsgStream msg (Athena::getMessageSvc(), title());
504 msg << MSG::ERROR << "CondContBase::insertBase: EventIDRange " << r
505 << " is neither fully RunEvent nor TimeStamp"
506 << endmsg;
507 return StatusCode::FAILURE;
508 }
509
510 CondContSet::EmplaceResult reslt =
511 m_condSet.emplace( RangeKey(r, start_key, stop_key),
512 std::move(t),
514 ctx );
515
516 if (reslt == CondContSet::EmplaceResult::DUPLICATE)
517 {
519 }
520 else if (reslt == CondContSet::EmplaceResult::EXTENDED)
521 {
523 }
524 else if (reslt == CondContSet::EmplaceResult::OVERLAP) {
526 }
527
528 return this->inserted (ctx);
529}
StatusCode inserted(const EventContext &ctx)
Tell the cleaner that a new object was added to the container.
Definition CondCont.cxx:685

◆ inserted()

StatusCode CondContBase::inserted ( const EventContext & ctx)
protectedinherited

Tell the cleaner that a new object was added to the container.

Definition at line 685 of file CondCont.cxx.

686{
687 return m_cleanerSvc->condObjAdded (ctx, *this);
688}
ServiceHandle< Athena::IConditionsCleanerSvc > m_cleanerSvc
Handle to the cleaner service.
Definition CondCont.h:678

◆ insertError()

void CondContBase::insertError ( CLID usedCLID) const
protectedinherited

Helper to report an error due to using a base class for insertion.

Parameters
usedCLIDCLID of the class used for insertion.

Definition at line 726 of file CondCont.cxx.

727{
728 MsgStream msg (Athena::getMessageSvc(), title());
729 msg << MSG::ERROR << "CondCont<T>::insert: Not most-derived class; "
730 << "CLID used: " << usedCLID
731 << "; container CLID: " << m_clid
732 << endmsg;
733}
CLID m_clid
CLID of the most-derived CondCont.
Definition CondCont.h:666

◆ keyFromRunLBN()

key_type CondContBase::keyFromRunLBN ( const EventIDBase & b)
staticinherited

Make a run+lbn key from an EventIDBase.

Parameters
EventID to convert.

◆ keyFromTimestamp()

key_type CondContBase::keyFromTimestamp ( const EventIDBase & b)
staticinherited

Make a timestamp key from an EventIDBase.

Parameters
EventID to convert.

◆ keyType()

KeyType CondContBase::keyType ( ) const
inherited

Return the key type for this container.

◆ list()

void CondContSingleBase::list ( std::ostream & ost) const
finaloverridevirtualinherited

Dump the container contents for debugging.

Parameters
ostStream to which to write the dump.

Implements CondContBase.

Definition at line 761 of file CondCont.cxx.

762{
763 ost << "id: " << id() << " proxy: " << proxy() << " ["
764 << entries() << "] entries" << std::endl;
765 forEach ([&] (const CondContSet::value_type& ent)
766 { ost << ent.first.m_range << " " << ent.second << std::endl; });
767}
void forEach(const FUNC &func) const
Call func on each entry in the container.
virtual size_t entries() const
Return the number of conditions objects in the container.
Definition CondCont.cxx:293
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
const DataObjID & id() const
Return CLID/key corresponding to this container.

◆ maxSize()

size_t CondContBase::maxSize ( ) const
inherited

Return the maximum size of the map.

Definition at line 392 of file CondCont.cxx.

393{
394 return m_condSet.maxSize();
395}

◆ nInserts()

size_t CondContBase::nInserts ( ) const
inherited

Return the number times an item was inserted into the map.

Definition at line 383 of file CondCont.cxx.

384{
385 return m_condSet.nInserts();
386}

◆ operator=()

template<typename T>
CondCont & CondCont< T >::operator= ( const CondCont< T > & )
delete

◆ print()

void CondContBase::print ( ) const
inherited

Dump the container to cout.

For calling from the debugger.

Definition at line 284 of file CondCont.cxx.

285{
286 list (std::cout);
287}
virtual void list(std::ostream &ost) const =0
Dump the container contents for debugging.

◆ proxy() [1/2]

SG::DataProxy * CondContBase::proxy ( )
inherited

Return the associated DataProxy, if any.

◆ proxy() [2/2]

const SG::DataProxy * CondContBase::proxy ( ) const
inherited

Return the associated DataProxy, if any.

◆ quiescent()

void CondContBase::quiescent ( const EventContext & ctx)
inherited

Mark that this thread is no longer accessing data from this container.

Parameters
ctxEvent context for the current thread.

This would normally be done through RCU service. Defined here for purposes of testing.

Definition at line 374 of file CondCont.cxx.

375{
376 m_condSet.quiescent (ctx);
377}

◆ range()

bool CondContSingleBase::range ( const EventIDBase & t,
EventIDRange & r ) const
finaloverridevirtualinherited

Return the mapped validity range for an IOV time.

Parameters
tIOV time to check.
r[out]The range containing t.

Returns true if t is mapped; false otherwise.

Implements CondContBase.

Definition at line 825 of file CondCont.cxx.

826{
827 const EventIDRange* rp = nullptr;
828 if (findBase (t, &rp) != nullptr) {
829 r = *rp;
830 return true;
831 }
832 return false;
833}
ReadCards * rp
const void * findBase(const EventIDBase &t, EventIDRange const **r) const
Internal lookup function.
Definition CondCont.cxx:636

◆ ranges()

std::vector< EventIDRange > CondContSingleBase::ranges ( ) const
finaloverridevirtualinherited

Return all IOV validity ranges defined in this container.

Implements CondContBase.

Definition at line 774 of file CondCont.cxx.

775{
776 std::vector<EventIDRange> r;
777 r.reserve (entries());
778
779 forEach ([&] (const CondContSet::value_type& ent)
780 { r.push_back (ent.first.m_range); });
781
782 return r;
783}

◆ registerBaseInit()

template<typename T>
void CondCont< T >::registerBaseInit ( )
static

Helper to ensure that the inheritance information for this class gets initialized.

◆ setProxy()

void CondContBase::setProxy ( SG::DataProxy * proxy)
inherited

Set the associated DataProxy.

Parameters
proxyThe proxy to set.

Definition at line 275 of file CondCont.cxx.

276{
277 m_proxy = proxy;
278}
SG::DataProxy * m_proxy
Associated DataProxy.
Definition CondCont.h:672

◆ title()

std::string CondContBase::title ( ) const
protectedinherited

Description of this container to use for MsgStream.

Definition at line 748 of file CondCont.cxx.

749{
750 return m_id.fullKey();
751}
DataObjID m_id
CLID+key for this container.
Definition CondCont.h:669

◆ trim()

size_t CondContBase::trim ( const std::vector< key_type > & runLbnKeys,
const std::vector< key_type > & TSKeys )
virtualinherited

Remove unused entries from the front of the list.

Parameters
runLbnKeysList of Run-Lumi keys that may still be in use. (Must be sorted.)
TSKeysList of time-stamp keys that may still be in use. (Must be sorted.)

We examine the objects in the container, starting with the earliest one. If none of the keys in keys match the range for this object, then it is removed from the container. We stop when we either find an object with a range matching a key in keys or when there is only one object left. Mixed containers are trimmed recursivly.

The list runLbnKeys should contain keys as computed by keyFromRunLBN, the list TSKey should contain keys from keyFromTimestamp. Depending on the type (RUNLUMI, TIMESTAMP, MIXED) only one of the lists or both are used. The list must be sorted.

Removed objects are queued for deletion once all slots have been marked as quiescent.

Returns the number of objects that were removed.

Parameters
keysList of keys that may still be in use. (Must be sorted.)

We examine the objects in the container, starting with the earliest one. If none of the keys in keys match the range for this object, then it is removed from the container. We stop when we either find an object with a range matching a key in keys or when there is only one object left.

The list keys should contain keys as computed by keyFromRunLBN or keyFromTimestamp, as appropriate for the container's key type (as returned from keyType()). The list must be sorted.

Removed objects are queued for deletion once all slots have been marked as quiescent.

Returns the number of objects that were removed.

Definition at line 319 of file CondCont.cxx.

320{
321 if (m_keyType == KeyType::RUNLBN) {
322 return m_condSet.trim (runLbnKeys);
323 }
324
326 return m_condSet.trim ( TSKeys );
327 }
328
329
330 if (m_keyType == KeyType::MIXED) {
331 //For mixed containers, first trim inner container based in TimeStamps
332 size_t nTrimmed=0;
333 for (const typename CondContSet::value_type& ent : m_condSet.range()) {
334 const CondContSet* tsmap = reinterpret_cast<const CondContSet*> (ent.second);
335 //size_t before=tsmap->size();
336 CondContSet* tsmap_nc ATLAS_THREAD_SAFE = const_cast<CondContSet*>(tsmap);
337 // Trim inner containers, allowing the removal of all elements.
338 // See ATLASRECTS-7421.
339 size_t ntrim=tsmap_nc->trim (TSKeys, true);
340 nTrimmed+=ntrim;
341 //std::cout << "WL: Trimming inner container for clid " << m_clid << " (" << ntrim << " out of " << before << ", nKeys= " << TSKeys.size() << ")" << std::endl;
342 }
343 // Then trim outer container based on run-LB.
344 size_t outerTrimmed=m_condSet.trim(runLbnKeys);
345 //std::cout << "WL: Removing outer sets " << outerTrimmed << ", remaining " << m_condSet.size() << std::endl;
346 //FIXME: The number returned may be inaccurate, only correct if the outer container
347 //has exactly one element left by the time it gets removed.
348 return nTrimmed+outerTrimmed;
349 }
350
351//Arrive here for KeyType::SINGLE .. do nothing.
352 return 0;
353}
static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
Name of the global conditions cleaner service.
Definition CondCont.h:686
CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdater > CondContSet
Definition CondCont.h:517

◆ typelessInsert()

StatusCode CondContSingleBase::typelessInsert ( const EventIDRange & r,
void * obj,
const EventContext & ctx )
finaloverridevirtualinherited

Insert a new conditions object.

Parameters
rRange of validity of this object.
objPointer to the object being inserted.
ctxEvent context for the current thread.

obj must point to an object of type T, except in the case of inheritance, where the type of obj must correspond to the most-derived CondCont type. The container will take ownership of this object.

Returns SUCCESS if the object was successfully inserted; EXTENDED if the last existing range in the container was extended to match the new range; OVERLAP if the object was inserted but the range partially overlaps with an existing one; DUPLICATE if the object wasn't inserted because the range duplicates an existing one, and FAILURE otherwise (ownership of the object will be taken in any case).

Implements CondContBase.

Definition at line 807 of file CondCont.cxx.

810{
811 return insertBase (r,
812 CondContSet::payload_unique_ptr (obj, delfcn()),
813 ctx);
814}
delete_function * delfcn() const
Return the deletion function for this container.
Definition CondCont.cxx:739
StatusCode insertBase(const EventIDRange &r, CondContSet::payload_unique_ptr t, const EventContext &ctx)
Insert a new conditions object.
Definition CondCont.cxx:445

◆ valid()

virtual bool CondContSingleBase::valid ( const EventIDBase & t) const
finaloverridevirtualinherited

Test to see if a given IOV time is mapped in the container.

Parameters
tIOV time to check.

Implements CondContBase.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::string s_cleanerSvcName CondContBase::ATLAS_THREAD_SAFE
staticprivateinherited

Name of the global conditions cleaner service.

Definition at line 686 of file CondCont.h.

◆ m_cleanerSvc

ServiceHandle<Athena::IConditionsCleanerSvc> CondContBase::m_cleanerSvc
privateinherited

Handle to the cleaner service.

Definition at line 678 of file CondCont.h.

◆ m_clid

CLID CondContBase::m_clid
privateinherited

CLID of the most-derived CondCont.

Definition at line 666 of file CondCont.h.

◆ m_condSet

CondContSet CondContBase::m_condSet
privateinherited

Set of mapped objects.

Definition at line 675 of file CondCont.h.

◆ m_deps

DepSet CondContBase::m_deps
privateinherited

Definition at line 683 of file CondCont.h.

◆ m_id

DataObjID CondContBase::m_id
privateinherited

CLID+key for this container.

Definition at line 669 of file CondCont.h.

◆ m_keyType

std::atomic<KeyType> CondContBase::m_keyType
privateinherited

Key type of this container.

Definition at line 663 of file CondCont.h.

◆ m_proxy

SG::DataProxy* CondContBase::m_proxy
privateinherited

Associated DataProxy.

Definition at line 672 of file CondCont.h.


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