ATLAS Offline Software
|
Base class for all conditions containers. More...
#include <CondCont.h>
Classes | |
class | Category |
Status code category for ContCont. More... | |
struct | Compare |
Comparison object needed by ConcurrentRangeMap. More... | |
struct | RangeKey |
Range object to store in ConcurrentRangeMap . More... | |
Public Types | |
enum | KeyType { KeyType::SINGLE, KeyType::TIMESTAMP, KeyType::RUNLBN, KeyType::MIXED } |
Type of key used for this container. More... | |
typedef void | Payload |
Payload type held by this class. More... | |
typedef uint64_t | key_type |
Type used to store an IOV time internally. More... | |
Public Member Functions | |
virtual | ~CondContBase () |
Destructor. More... | |
CLID | clid () const |
Return the CLID of the most-derived CondCont . More... | |
KeyType | keyType () const |
Return the key type for this container. More... | |
const DataObjID & | id () const |
Return CLID/key corresponding to this container. More... | |
SG::DataProxy * | proxy () |
Return the associated DataProxy , if any. More... | |
const SG::DataProxy * | proxy () const |
Return the associated DataProxy , if any. More... | |
void | setProxy (SG::DataProxy *) |
Set the associated DataProxy . More... | |
virtual void | list (std::ostream &ost) const =0 |
Dump the container contents for debugging. More... | |
void | print () const |
Dump the container to cout. More... | |
virtual size_t | entries () const |
Return the number of conditions objects in the container. More... | |
virtual std::vector< EventIDRange > | ranges () const =0 |
Return all IOV validity ranges defined in this container. More... | |
virtual StatusCode | typelessInsert (const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext())=0 |
Insert a new conditions object. More... | |
virtual bool | valid (const EventIDBase &t) const =0 |
Test to see if a given IOV time is mapped in the container. More... | |
virtual bool | range (const EventIDBase &t, EventIDRange &r) const =0 |
Return the mapped validity range for an IOV time. More... | |
virtual StatusCode | erase (const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())=0 |
Erase the first element not less than t . More... | |
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. More... | |
void | clear () |
Remove all entries in the container. More... | |
void | quiescent (const EventContext &ctx=Gaudi::Hive::currentContext()) |
Mark that this thread is no longer accessing data from this container. More... | |
size_t | nInserts () const |
Return the number times an item was inserted into the map. More... | |
size_t | maxSize () const |
Return the maximum size of the map. More... | |
virtual StatusCode | extendLastRange (const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())=0 |
Extend the range of the last IOV. More... | |
void | addDep (CondContBase *dep) |
Declare another conditions container that depends on this one. More... | |
std::vector< CondContBase * > | getDeps () |
Return the list of conditions containers that depend on this one. More... | |
Static Public Member Functions | |
static key_type | keyFromRunLBN (const EventIDBase &b) |
Make a run+lbn key from an EventIDBase. More... | |
static key_type | keyFromTimestamp (const EventIDBase &b) |
Make a timestamp key from an EventIDBase. More... | |
static void setCleanerSvcName | ATLAS_NOT_THREAD_SAFE (const std::string &name) |
Allow overriding the name of the global conditions cleaner service (for testing purposes). More... | |
Protected Types | |
typedef CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdater > | CondContSet |
typedef CondContSet::Updater_t | Updater_t |
typedef CondContSet::delete_function | delete_function |
Protected Member Functions | |
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. 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... | |
Private Types | |
using | DepSet = CxxUtils::ConcurrentPtrSet< CondContBase, CxxUtils::SimpleUpdater > |
Other conditions dependencies that depend on this one, as inferred by addDependency calls. More... | |
Private Attributes | |
std::atomic< KeyType > | m_keyType |
Key type of this container. More... | |
CLID | m_clid |
CLID of the most-derived CondCont . More... | |
DataObjID | m_id |
CLID+key for this container. More... | |
SG::DataProxy * | m_proxy |
Associated DataProxy . More... | |
CondContSet | m_condSet |
Set of mapped objects. More... | |
ServiceHandle< Athena::IConditionsCleanerSvc > | m_cleanerSvc |
Handle to the cleaner service. More... | |
DepSet | m_deps |
Static Private Attributes | |
static std::string s_cleanerSvcName | ATLAS_THREAD_SAFE |
Name of the global conditions cleaner service. More... | |
Base class for all conditions containers.
Definition at line 139 of file CondCont.h.
|
protected |
Definition at line 517 of file CondCont.h.
|
protected |
Definition at line 520 of file CondCont.h.
|
private |
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.
typedef uint64_t CondContBase::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.
typedef void CondContBase::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.
|
protected |
Definition at line 519 of file CondCont.h.
|
strong |
Type of key used for this container.
Definition at line 179 of file CondCont.h.
|
inlinevirtual |
|
protected |
Internal constructor.
rcusvc | RCU service instance. |
keyType | Key type for this container. |
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 409 of file CondCont.cxx.
void CondContBase::addDep | ( | CondContBase * | dep | ) |
Declare another conditions container that depends on this one.
dep | Conditions container that depends on this one. |
Definition at line 696 of file CondCont.cxx.
|
static |
Allow overriding the name of the global conditions cleaner service (for testing purposes).
name | The name of the global conditions cleaner service. |
Do pointer conversion for the payload type.
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.
void CondContBase::clear | ( | ) |
Remove all entries in the container.
Mostly for testing — should not normally be used.
Definition at line 361 of file CondCont.cxx.
|
protected |
Return the deletion function for this container.
Definition at line 740 of file CondCont.cxx.
|
protectedpure virtual |
Do pointer conversion for the payload type.
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.
|
virtual |
Return the number of conditions objects in the container.
Reimplemented in CondContMixedBase.
Definition at line 294 of file CondCont.cxx.
|
pure virtual |
Erase the first element not less than t
.
IOV | time of element to erase. |
ctx | Event context for the current thread. |
Implemented in CondContMixedBase, and CondContSingleBase.
|
protected |
Erase the first element not less than t
.
IOV | time of element to erase. |
ctx | Event context for the current thread. |
Definition at line 539 of file CondCont.cxx.
|
pure virtual |
Extend the range of the last IOV.
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.)
Implemented in CondContMixedBase, and CondContSingleBase.
|
protected |
Extend the range of the last IOV.
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.
|
protected |
Internal lookup function.
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.
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.
|
protected |
Call func
on each entry in the container.
func | Functional to call on each entry. |
func
will be called on each container element (being passed const CondContSet::value_type&).
std::vector< CondContBase * > CondContBase::getDeps | ( | ) |
const DataObjID& CondContBase::id | ( | ) | const |
Return CLID/key corresponding to this container.
|
protected |
Insert a new conditions object.
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.
|
protected |
Tell the cleaner that a new object was added to the container.
Definition at line 686 of file CondCont.cxx.
|
protected |
Helper to report an error due to using a base class for insertion.
usedCLID | CLID of the class used for insertion. |
Definition at line 727 of file CondCont.cxx.
Make a run+lbn key from an EventIDBase.
Event | ID to convert. |
Make a timestamp key from an EventIDBase.
Event | ID to convert. |
KeyType CondContBase::keyType | ( | ) | const |
Return the key type for this container.
|
pure virtual |
Dump the container contents for debugging.
ost | Stream to which to write the dump. |
Implemented in CondContMixedBase, and CondContSingleBase.
size_t CondContBase::maxSize | ( | ) | const |
Return the maximum size of the map.
Definition at line 393 of file CondCont.cxx.
size_t CondContBase::nInserts | ( | ) | const |
Return the number times an item was inserted into the map.
Definition at line 384 of file CondCont.cxx.
void CondContBase::print | ( | ) | const |
Dump the container to cout.
For calling from the debugger.
Definition at line 285 of file CondCont.cxx.
SG::DataProxy* CondContBase::proxy | ( | ) |
Return the associated DataProxy
, if any.
const SG::DataProxy* CondContBase::proxy | ( | ) | const |
Return the associated DataProxy
, if any.
void CondContBase::quiescent | ( | const EventContext & | ctx = Gaudi::Hive::currentContext() | ) |
Mark that this thread is no longer accessing data from this container.
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.
|
pure virtual |
Return the mapped validity range for an IOV time.
t | IOV time to check. |
r[out] | The range containing t . |
Returns true if t
is mapped; false otherwise.
Implemented in CondContMixedBase, and CondContSingleBase.
|
pure virtual |
Return all IOV validity ranges defined in this container.
Implemented in CondContMixedBase, and CondContSingleBase.
void CondContBase::setProxy | ( | SG::DataProxy * | proxy | ) |
Set the associated DataProxy
.
proxy | The proxy to set. |
Definition at line 276 of file CondCont.cxx.
|
protected |
Description of this container to use for MsgStream.
Definition at line 749 of file CondCont.cxx.
|
virtual |
Remove unused entries from the front of the list.
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.
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.
|
pure virtual |
Insert a new conditions object.
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).
Implemented in CondContMixedBase, and CondContSingleBase.
|
pure virtual |
Test to see if a given IOV time is mapped in the container.
t | IOV time to check. |
Implemented in CondContMixedBase, and CondContSingleBase.
|
staticprivate |
Name of the global conditions cleaner service.
Definition at line 686 of file CondCont.h.
|
private |
Handle to the cleaner service.
Definition at line 678 of file CondCont.h.
|
private |
CLID of the most-derived CondCont
.
Definition at line 666 of file CondCont.h.
|
private |
Set of mapped objects.
Definition at line 675 of file CondCont.h.
|
private |
Definition at line 683 of file CondCont.h.
|
private |
CLID+key for this container.
Definition at line 669 of file CondCont.h.
|
private |
Key type of this container.
Definition at line 663 of file CondCont.h.
|
private |
Associated DataProxy
.
Definition at line 672 of file CondCont.h.