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=Gaudi::Hive::currentContext())
 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=Gaudi::Hive::currentContext()) 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=Gaudi::Hive::currentContext()) override final
 Erase the first element not less than t.
virtual StatusCode extendLastRange (const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext()) 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=Gaudi::Hive::currentContext())
 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=Gaudi::Hive::currentContext())
 Insert a new conditions object.
StatusCode eraseBase (const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())
 Erase the first element not less than t.
StatusCode extendLastRangeBase (const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())
 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 696 of file CondCont.cxx.

697{
698 m_deps.insert (dep);
699}
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 361 of file CondCont.cxx.

362{
363 m_condSet.clear();
364}
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 740 of file CondCont.cxx.

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

◆ 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 294 of file CondCont.cxx.

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

◆ erase()

StatusCode CondContSingleBase::erase ( const EventIDBase & t,
const EventContext & ctx = Gaudi::Hive::currentContext() )
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 843 of file CondCont.cxx.

845{
846 return CondContBase::eraseBase (t, ctx);
847}
StatusCode eraseBase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())
Erase the first element not less than t.
Definition CondCont.cxx:539

◆ eraseBase()

StatusCode CondContBase::eraseBase ( const EventIDBase & t,
const EventContext & ctx = Gaudi::Hive::currentContext() )
protectedinherited

Erase the first element not less than t.

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

Definition at line 539 of file CondCont.cxx.

541{
542 switch (m_keyType) {
543 case KeyType::RUNLBN:
544 if (!t.isRunLumi()) {
545 MsgStream msg (Athena::getMessageSvc(), title());
546 msg << MSG::ERROR << "CondContBase::erase: "
547 << "Non-Run/LBN key used in Run/LBN container."
548 << endmsg;
549 return StatusCode::FAILURE;
550 }
551 m_condSet.erase (CondContBase::keyFromRunLBN (t), ctx);
552 break;
554 if (!t.isTimeStamp()) {
555 MsgStream msg (Athena::getMessageSvc(), title());
556 msg << MSG::ERROR << "CondContBase::erase: "
557 << "Non-Timestamp key used in timestamp container."
558 << endmsg;
559 return StatusCode::FAILURE;
560 }
562 break;
563 case KeyType::SINGLE:
564 break;
565 default:
566 std::abort();
567 }
568 return StatusCode::SUCCESS;
569}
#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:749
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 = Gaudi::Hive::currentContext() )
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 861 of file CondCont.cxx.

863{
864 return CondContBase::extendLastRangeBase (newRange, ctx);
865}
StatusCode extendLastRangeBase(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())
Extend the range of the last IOV.
Definition CondCont.cxx:583

◆ extendLastRangeBase()

StatusCode CondContBase::extendLastRangeBase ( const EventIDRange & newRange,
const EventContext & ctx = Gaudi::Hive::currentContext() )
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 583 of file CondCont.cxx.

585{
588 switch (m_keyType) {
589 case KeyType::RUNLBN:
590 case KeyType::MIXED: // To handle the extension case of insertMixed().
591 if (!newRange.start().isRunLumi()) {
592 MsgStream msg (Athena::getMessageSvc(), title());
593 msg << MSG::ERROR << "CondContBase::extendLastRange: "
594 << "Non-Run/LBN range used in Run/LBN container."
595 << endmsg;
596 return StatusCode::FAILURE;
597 }
598 start = keyFromRunLBN (newRange.start());
599 stop = keyFromRunLBN (newRange.stop());
600 break;
602 if (!newRange.start().isTimeStamp()) {
603 MsgStream msg (Athena::getMessageSvc(), title());
604 msg << MSG::ERROR << "CondContBase::extendLastRange: "
605 << "Non-timestamp range used in timestamp container."
606 << endmsg;
607 return StatusCode::FAILURE;
608 }
609 start = keyFromTimestamp (newRange.start());
610 stop = keyFromTimestamp (newRange.stop());
611 break;
612 case KeyType::SINGLE:
613 // Empty container.
614 return StatusCode::FAILURE;
615 default:
616 std::abort();
617 }
618
619 if (m_condSet.extendLastRange (RangeKey (newRange, start, stop), ctx) >= 0)
620 {
621 return StatusCode::SUCCESS;
622 }
623 return StatusCode::FAILURE;
624}
@ 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 637 of file CondCont.cxx.

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

◆ 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 705 of file CondCont.cxx.

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

◆ 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 = Gaudi::Hive::currentContext() )

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 = Gaudi::Hive::currentContext() )
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 446 of file CondCont.cxx.

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

◆ inserted()

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

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

Definition at line 686 of file CondCont.cxx.

687{
688 return m_cleanerSvc->condObjAdded (ctx, *this);
689}
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 727 of file CondCont.cxx.

728{
729 MsgStream msg (Athena::getMessageSvc(), title());
730 msg << MSG::ERROR << "CondCont<T>::insert: Not most-derived class; "
731 << "CLID used: " << usedCLID
732 << "; container CLID: " << m_clid
733 << endmsg;
734}
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 762 of file CondCont.cxx.

763{
764 ost << "id: " << id() << " proxy: " << proxy() << " ["
765 << entries() << "] entries" << std::endl;
766 forEach ([&] (const CondContSet::value_type& ent)
767 { ost << ent.first.m_range << " " << ent.second << std::endl; });
768}
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:294
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 393 of file CondCont.cxx.

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

◆ nInserts()

size_t CondContBase::nInserts ( ) const
inherited

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

Definition at line 384 of file CondCont.cxx.

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

◆ 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 285 of file CondCont.cxx.

286{
287 list (std::cout);
288}
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 = Gaudi::Hive::currentContext())
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 375 of file CondCont.cxx.

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

◆ 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 826 of file CondCont.cxx.

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

◆ ranges()

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

Return all IOV validity ranges defined in this container.

Implements CondContBase.

Definition at line 775 of file CondCont.cxx.

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

◆ 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 276 of file CondCont.cxx.

277{
278 m_proxy = proxy;
279}
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 749 of file CondCont.cxx.

750{
751 return m_id.fullKey();
752}
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 320 of file CondCont.cxx.

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

811{
812 return insertBase (r,
814 ctx);
815}
StatusCode insertBase(const EventIDRange &r, CondContSet::payload_unique_ptr t, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
Definition CondCont.cxx:446
delete_function * delfcn() const
Return the deletion function for this container.
Definition CondCont.cxx:740

◆ 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: