|
ATLAS Offline Software
|
Base class for conditions containers that are either Run+LBN or timestamp.
More...
#include <CondCont.h>
|
| CondContSingleBase (Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity) |
| Internal constructor. More...
|
|
StatusCode | insertBase (const EventIDRange &r, CondContSet::payload_unique_ptr t, const EventContext &ctx=Gaudi::Hive::currentContext()) |
| Insert a new conditions object. More...
|
|
StatusCode | eraseBase (const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext()) |
| Erase the first element not less than t . More...
|
|
StatusCode | extendLastRangeBase (const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext()) |
| Extend the range of the last IOV. More...
|
|
const void * | findBase (const EventIDBase &t, EventIDRange const **r) const |
| Internal lookup function. More...
|
|
const void * | cast (CLID clid, const void *ptr) const |
| Do pointer conversion for the payload type. More...
|
|
virtual const void * | doCast (CLID clid, const void *ptr) const =0 |
| Do pointer conversion for the payload type. More...
|
|
template<class FUNC > |
void | forEach (const FUNC &func) const |
| Call func on each entry in the container. More...
|
|
StatusCode | inserted (const EventContext &ctx) |
| Tell the cleaner that a new object was added to the container. More...
|
|
void | insertError (CLID usedCLID) const |
| Helper to report an error due to using a base class for insertion. More...
|
|
delete_function * | delfcn () const |
| Return the deletion function for this container. More...
|
|
std::string | title () const |
| Description of this container to use for MsgStream. More...
|
|
Base class for conditions containers that are either Run+LBN or timestamp.
Definition at line 700 of file CondCont.h.
◆ CondContSet
◆ delete_function
◆ 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
Type used to store an IOV time internally.
For efficiency, we pack two 32-bit words into a 64-bit word Can be either run+lbn or a timestamp.
Definition at line 204 of file CondCont.h.
◆ Payload
Payload type held by this class.
Need to define this here for cast()
to work properly.
Definition at line 198 of file CondCont.h.
◆ Updater_t
◆ KeyType
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.
◆ CondContSingleBase()
CondContSingleBase::CondContSingleBase |
( |
Athena::IRCUSvc & |
rcusvc, |
|
|
CLID |
clid, |
|
|
const DataObjID & |
id, |
|
|
SG::DataProxy * |
proxy, |
|
|
std::shared_ptr< CondContSet::IPayloadDeleter > |
payloadDeleter, |
|
|
size_t |
capacity |
|
) |
| |
|
protected |
Internal constructor.
- Parameters
-
rcusvc | RCU service instance. |
CLID | of the most-derived CondCont . |
id | CLID+key for this object. |
proxy | DataProxy for this object. |
payloadDeleter | Object for deleting payload objects. |
capacity | Initial capacity of the container. |
Definition at line 877 of file CondCont.cxx.
884 payloadDeleter, capacity)
◆ addDep()
Declare another conditions container that depends on this one.
- Parameters
-
dep | Conditions container that depends on this one. |
Definition at line 696 of file CondCont.cxx.
◆ ATLAS_NOT_THREAD_SAFE()
static 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
-
name | The name of the global conditions cleaner service. |
◆ cast()
Do pointer conversion for the payload type.
- Parameters
-
clid | CLID for the desired pointer type. |
ptr | Pointer 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.
◆ clid()
CLID CondContBase::clid |
( |
| ) |
const |
|
inherited |
Return the CLID of the most-derived CondCont
.
◆ delfcn()
Return the deletion function for this container.
Definition at line 740 of file CondCont.cxx.
◆ doCast()
virtual const void* CondContBase::doCast |
( |
CLID |
clid, |
|
|
const void * |
ptr |
|
) |
| const |
|
protectedpure virtualinherited |
Do pointer conversion for the payload type.
- Parameters
-
clid | CLID for the desired pointer type. |
ptr | Pointer 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.
◆ entries()
size_t CondContBase::entries |
( |
| ) |
const |
|
virtualinherited |
◆ erase()
StatusCode CondContSingleBase::erase |
( |
const EventIDBase & |
t, |
|
|
const EventContext & |
ctx = Gaudi::Hive::currentContext() |
|
) |
| |
|
finaloverridevirtual |
Erase the first element not less than t
.
- Parameters
-
IOV | time of element to erase. |
ctx | Event context for the current thread. |
Implements CondContBase.
Definition at line 843 of file CondCont.cxx.
◆ eraseBase()
StatusCode CondContBase::eraseBase |
( |
const EventIDBase & |
t, |
|
|
const EventContext & |
ctx = Gaudi::Hive::currentContext() |
|
) |
| |
|
protectedinherited |
Erase the first element not less than t
.
- Parameters
-
IOV | time of element to erase. |
ctx | Event context for the current thread. |
Definition at line 539 of file CondCont.cxx.
544 if (!
t.isRunLumi()) {
546 msg << MSG::ERROR <<
"CondContBase::erase: "
547 <<
"Non-Run/LBN key used in Run/LBN container."
549 return StatusCode::FAILURE;
554 if (!
t.isTimeStamp()) {
556 msg << MSG::ERROR <<
"CondContBase::erase: "
557 <<
"Non-Timestamp key used in timestamp container."
559 return StatusCode::FAILURE;
568 return StatusCode::SUCCESS;
◆ extendLastRange()
StatusCode CondContSingleBase::extendLastRange |
( |
const EventIDRange & |
newRange, |
|
|
const EventContext & |
ctx = Gaudi::Hive::currentContext() |
|
) |
| |
|
finaloverridevirtual |
Extend the range of the last IOV.
- Parameters
-
newRange | New validity range. |
ctx | Event 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.
◆ extendLastRangeBase()
StatusCode CondContBase::extendLastRangeBase |
( |
const EventIDRange & |
newRange, |
|
|
const EventContext & |
ctx = Gaudi::Hive::currentContext() |
|
) |
| |
|
protectedinherited |
Extend the range of the last IOV.
- Parameters
-
newRange | New validity range. |
ctx | Event 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.
591 if (!newRange.start().isRunLumi()) {
593 msg << MSG::ERROR <<
"CondContBase::extendLastRange: "
594 <<
"Non-Run/LBN range used in Run/LBN container."
596 return StatusCode::FAILURE;
602 if (!newRange.start().isTimeStamp()) {
604 msg << MSG::ERROR <<
"CondContBase::extendLastRange: "
605 <<
"Non-timestamp range used in timestamp container."
607 return StatusCode::FAILURE;
614 return StatusCode::FAILURE;
621 return StatusCode::SUCCESS;
623 return StatusCode::FAILURE;
◆ findBase()
const void * CondContBase::findBase |
( |
const EventIDBase & |
t, |
|
|
EventIDRange const ** |
r |
|
) |
| const |
|
protectedinherited |
Internal lookup function.
- Parameters
-
t | IOV time to find. |
r | If 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
-
clid | CLID for the desired pointer type. |
t | IOV time to find. |
r | If 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.
640 const void*
ptr =
nullptr;
647 msg << MSG::ERROR <<
"CondContBase::findBase: "
648 <<
"Non-Run/LBN key used in Run/LBN container."
657 msg << MSG::ERROR <<
"CondContBase::findBase: "
658 <<
"Non-timestamp key used in timestamp container."
672 if (
it && key < it->
first.m_stop) {
674 *
r = &
it->first.m_range;
◆ forEach()
template<class FUNC >
void CondContBase::forEach |
( |
const FUNC & |
func | ) |
const |
|
protectedinherited |
Call func
on each entry in the container.
- Parameters
-
func | Functional to call on each entry. |
func
will be called on each container element (being passed const CondContSet::value_type&).
◆ getDeps()
Return the list of conditions containers that depend on this one.
Definition at line 705 of file CondCont.cxx.
◆ id()
const DataObjID& CondContBase::id |
( |
| ) |
const |
|
inherited |
Return CLID/key corresponding to this container.
◆ 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
-
r | Range of validity of this object. |
t | Pointer to the object being inserted. |
ctx | Event 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.
450 EventIDBase
start =
r.start();
451 EventIDBase
stop =
r.stop();
456 if (
start.run_number() == EventIDBase::UNDEFNUM ||
457 stop.run_number() == EventIDBase::UNDEFNUM)
460 msg << MSG::ERROR <<
"CondContBase::insertBase: "
461 <<
"Run part of range invalid in mixed container."
463 return StatusCode::FAILURE;
469 else if (
start.isTimeStamp() &&
stop.isTimeStamp()) {
475 msg << MSG::ERROR <<
"CondContBase::insertBase: "
476 <<
"Timestamp key used in non-timestamp container."
478 return StatusCode::FAILURE;
485 else if (
start.run_number() != EventIDBase::UNDEFNUM &&
486 stop.run_number() != EventIDBase::UNDEFNUM)
493 msg << MSG::ERROR <<
"CondContBase::insertBase: "
494 <<
"Run/LBN key used in non-Run/LBN container."
496 return StatusCode::FAILURE;
505 msg << MSG::ERROR <<
"CondContBase::insertBase: EventIDRange " <<
r
506 <<
" is neither fully RunEvent nor TimeStamp"
508 return StatusCode::FAILURE;
511 CondContSet::EmplaceResult reslt =
512 m_condSet.emplace( RangeKey(
r, start_key, stop_key),
517 if (reslt == CondContSet::EmplaceResult::DUPLICATE)
521 else if (reslt == CondContSet::EmplaceResult::EXTENDED)
525 else if (reslt == CondContSet::EmplaceResult::OVERLAP) {
◆ 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.
◆ insertError()
void CondContBase::insertError |
( |
CLID |
usedCLID | ) |
const |
|
protectedinherited |
Helper to report an error due to using a base class for insertion.
- Parameters
-
usedCLID | CLID of the class used for insertion. |
Definition at line 727 of file CondCont.cxx.
730 msg << MSG::ERROR <<
"CondCont<T>::insert: Not most-derived class; "
731 <<
"CLID used: " << usedCLID
732 <<
"; container CLID: " <<
m_clid
◆ keyFromRunLBN()
static key_type CondContBase::keyFromRunLBN |
( |
const EventIDBase & |
b | ) |
|
|
staticinherited |
Make a run+lbn key from an EventIDBase.
- Parameters
-
◆ keyFromTimestamp()
static key_type CondContBase::keyFromTimestamp |
( |
const EventIDBase & |
b | ) |
|
|
staticinherited |
Make a timestamp key from an EventIDBase.
- Parameters
-
◆ keyType()
KeyType CondContBase::keyType |
( |
| ) |
const |
|
inherited |
Return the key type for this container.
◆ list()
void CondContSingleBase::list |
( |
std::ostream & |
ost | ) |
const |
|
finaloverridevirtual |
Dump the container contents for debugging.
- Parameters
-
ost | Stream to which to write the dump. |
Implements CondContBase.
Definition at line 762 of file CondCont.cxx.
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; });
◆ maxSize()
size_t CondContBase::maxSize |
( |
| ) |
const |
|
inherited |
Return the maximum size of the map.
Definition at line 393 of file CondCont.cxx.
◆ 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.
◆ print()
void CondContBase::print |
( |
| ) |
const |
|
inherited |
Dump the container to cout.
For calling from the debugger.
Definition at line 285 of file CondCont.cxx.
◆ proxy() [1/2]
◆ proxy() [2/2]
◆ quiescent()
void CondContBase::quiescent |
( |
const EventContext & |
ctx = Gaudi::Hive::currentContext() | ) |
|
|
inherited |
Mark that this thread is no longer accessing data from this container.
- Parameters
-
ctx | Event 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.
◆ range()
bool CondContSingleBase::range |
( |
const EventIDBase & |
t, |
|
|
EventIDRange & |
r |
|
) |
| const |
|
finaloverridevirtual |
Return the mapped validity range for an IOV time.
- Parameters
-
t | IOV 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.
828 const EventIDRange*
rp =
nullptr;
◆ ranges()
std::vector< EventIDRange > CondContSingleBase::ranges |
( |
| ) |
const |
|
finaloverridevirtual |
Return all IOV validity ranges defined in this container.
Implements CondContBase.
Definition at line 775 of file CondCont.cxx.
777 std::vector<EventIDRange>
r;
780 forEach ([&] (
const CondContSet::value_type& ent)
781 {
r.push_back (ent.first.m_range); });
◆ setProxy()
◆ title()
std::string CondContBase::title |
( |
| ) |
const |
|
protectedinherited |
Description of this container to use for MsgStream.
Definition at line 749 of file CondCont.cxx.
751 return m_id.fullKey();
◆ trim()
Remove unused entries from the front of the list.
- Parameters
-
runLbnKeys | List of Run-Lumi keys that may still be in use. (Must be sorted.) |
TSKeys | List 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
-
keys | List 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.
334 for (
const typename CondContSet::value_type& ent :
m_condSet.range()) {
340 size_t ntrim=tsmap_nc->trim (TSKeys,
true);
345 size_t outerTrimmed=
m_condSet.trim(runLbnKeys);
349 return nTrimmed+outerTrimmed;
◆ typelessInsert()
StatusCode CondContSingleBase::typelessInsert |
( |
const EventIDRange & |
r, |
|
|
void * |
obj, |
|
|
const EventContext & |
ctx = Gaudi::Hive::currentContext() |
|
) |
| |
|
finaloverridevirtual |
Insert a new conditions object.
- Parameters
-
r | Range of validity of this object. |
obj | Pointer to the object being inserted. |
ctx | Event 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.
813 CondContSet::payload_unique_ptr (
obj,
delfcn()),
◆ valid()
virtual bool CondContSingleBase::valid |
( |
const EventIDBase & |
t | ) |
const |
|
finaloverridevirtual |
Test to see if a given IOV time is mapped in the container.
- Parameters
-
Implements CondContBase.
◆ 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
Handle to the cleaner service.
Definition at line 678 of file CondCont.h.
◆ m_clid
CLID CondContBase::m_clid |
|
privateinherited |
◆ m_condSet
Set of mapped objects.
Definition at line 675 of file CondCont.h.
◆ m_deps
◆ 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
The documentation for this class was generated from the following files:
static key_type keyFromTimestamp(const EventIDBase &b)
Make a timestamp key from an EventIDBase.
@ RUNLBN
Container uses run+lbn keys.
static key_type keyFromRunLBN(const EventIDBase &b)
Make a run+lbn key from an EventIDBase.
const void * findBase(const EventIDBase &t, EventIDRange const **r) const
Internal lookup function.
virtual void list(std::ostream &ost) const =0
Dump the container contents for debugging.
DataObjID m_id
CLID+key for this container.
IMessageSvc * getMessageSvc(bool quiet=false)
StatusCode inserted(const EventContext &ctx)
Tell the cleaner that a new object was added to the container.
const DataObjID & id() const
Return CLID/key corresponding to this container.
std::pair< const_iterator, bool > insert(const key_type p)
Add an element to the set.
void forEach(const FUNC &func) const
Call func on each entry in the container.
const_iterator end() const
Iterator at the end of the set.
CLID m_clid
CLID of the most-derived CondCont.
@ TIMESTAMP
Container uses timestamp keys.
virtual size_t entries() const
Return the number of conditions objects in the container.
SG::DataProxy * m_proxy
Associated DataProxy.
const_iterator begin() const
Iterator at the start of the set.
CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdater > CondContSet
@ MIXED
Mixed Run+lbn / timestamp container.
static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
Name of the global conditions cleaner service.
StatusCode extendLastRangeBase(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())
Extend the range of the last IOV.
ServiceHandle< Athena::IConditionsCleanerSvc > m_cleanerSvc
Handle to the cleaner service.
std::string title() const
Description of this container to use for MsgStream.
CondContBase(Athena::IRCUSvc &rcusvc, KeyType keytype, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
Internal constructor.
CLID clid() const
Return the CLID of the most-derived CondCont.
StatusCode eraseBase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())
Erase the first element not less than t.
uint64_t key_type
Type used to store an IOV time internally.
CondContSet m_condSet
Set of mapped objects.
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
StatusCode insertBase(const EventIDRange &r, CondContSet::payload_unique_ptr t, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
delete_function * delfcn() const
Return the deletion function for this container.
@ SINGLE
Either TIMESTAMP or RUNLBN, but nothing's been put in the container yet, so we don't know which one.
std::atomic< KeyType > m_keyType
Key type of this container.