![]() |
ATLAS Offline Software
|
Hold mapping of ranges to condition objects. More...
#include <CondCont.h>
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. | |
| CondCont & | operator= (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::DataProxy * | proxy () |
Return the associated DataProxy, if any. | |
| const SG::DataProxy * | proxy () 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_function * | delfcn () 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< KeyType > | m_keyType |
| Key type of this container. | |
| CLID | m_clid |
CLID of the most-derived CondCont. | |
| DataObjID | m_id |
| CLID+key for this container. | |
| SG::DataProxy * | m_proxy |
Associated DataProxy. | |
| CondContSet | m_condSet |
| Set of mapped objects. | |
| ServiceHandle< Athena::IConditionsCleanerSvc > | m_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. | |
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:
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.
| typedef CondContBaseInfo<T>::Base CondCont< T >::Base |
Base class.
Definition at line 892 of file CondCont.h.
| typedef Base::CondContSet CondCont< T >::CondContSet |
Definition at line 894 of file CondCont.h.
|
protectedinherited |
Definition at line 520 of file CondCont.h.
|
privateinherited |
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 CondContBase::key_type CondCont< T >::key_type |
Definition at line 899 of file CondCont.h.
| typedef T CondCont< T >::Payload |
Payload type held by this class.
Definition at line 897 of file CondCont.h.
|
protectedinherited |
Definition at line 519 of file CondCont.h.
|
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.
| CondCont< T >::CondCont | ( | Athena::IRCUSvc & | rcusvc, |
| const DataObjID & | id, | ||
| SG::DataProxy * | proxy = nullptr, | ||
| size_t | capacity = 16 ) |
|
delete |
No copying.
|
protected |
|
inherited |
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.
|
staticinherited |
Allow overriding the name of the global conditions cleaner service (for testing purposes).
| name | The name of the global conditions cleaner service. |
|
protected |
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.
|
inherited |
Remove all entries in the container.
Mostly for testing — should not normally be used.
Definition at line 361 of file CondCont.cxx.
|
protectedinherited |
Return the deletion function for this container.
Definition at line 740 of file CondCont.cxx.
|
overrideprotectedvirtual |
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.
Implements CondContBase.
|
virtualinherited |
Return the number of conditions objects in the container.
Reimplemented in CondContMixedBase.
Definition at line 294 of file CondCont.cxx.
|
finaloverridevirtualinherited |
Erase the first element not less than t.
| IOV | time of element to erase. |
| ctx | Event context for the current thread. |
Implements CondContBase.
Definition at line 843 of file CondCont.cxx.
|
protectedinherited |
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.
|
finaloverridevirtualinherited |
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.)
Implements CondContBase.
Definition at line 861 of file CondCont.cxx.
|
protectedinherited |
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.
| const T * CondCont< T >::find | ( | const EventIDBase & | t | ) | const |
Look up a conditions object for a given time.
| t | IOV time to find. |
Returns the found object, or nullptr.
This variant may be more convenient to call from python.
| bool CondCont< T >::find | ( | const EventIDBase & | t, |
| T const *& | obj, | ||
| EventIDRange const ** | r = nullptr ) const |
Look up a conditions object for a given time.
| t | IOV time to find. |
| obj[out] | Object found. |
| r | If non-null, copy validity range of the object here. |
Returns true if the object was found; false otherwide.
|
protectedinherited |
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.
|
protectedinherited |
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&).
|
inherited |
Return the list of conditions containers that depend on this one.
Definition at line 705 of file CondCont.cxx.
|
inherited |
Return CLID/key corresponding to this container.
| StatusCode CondCont< T >::insert | ( | const EventIDRange & | r, |
| std::unique_ptr< T > | obj, | ||
| const EventContext & | ctx = Gaudi::Hive::currentContext() ) |
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. 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).
|
protectedinherited |
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.
|
protectedinherited |
Tell the cleaner that a new object was added to the container.
Definition at line 686 of file CondCont.cxx.
|
protectedinherited |
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.
|
staticinherited |
|
staticinherited |
|
inherited |
Return the key type for this container.
|
finaloverridevirtualinherited |
Dump the container contents for debugging.
| ost | Stream to which to write the dump. |
Implements CondContBase.
Definition at line 762 of file CondCont.cxx.
|
inherited |
Return the maximum size of the map.
Definition at line 393 of file CondCont.cxx.
|
inherited |
Return the number times an item was inserted into the map.
Definition at line 384 of file CondCont.cxx.
|
inherited |
Dump the container to cout.
For calling from the debugger.
Definition at line 285 of file CondCont.cxx.
|
inherited |
Return the associated DataProxy, if any.
|
inherited |
Return the associated DataProxy, if any.
|
inherited |
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.
|
finaloverridevirtualinherited |
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.
Implements CondContBase.
Definition at line 826 of file CondCont.cxx.
|
finaloverridevirtualinherited |
Return all IOV validity ranges defined in this container.
Implements CondContBase.
Definition at line 775 of file CondCont.cxx.
|
static |
Helper to ensure that the inheritance information for this class gets initialized.
|
inherited |
|
protectedinherited |
Description of this container to use for MsgStream.
Definition at line 749 of file CondCont.cxx.
|
virtualinherited |
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.
|
finaloverridevirtualinherited |
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).
Implements CondContBase.
Definition at line 808 of file CondCont.cxx.
|
finaloverridevirtualinherited |
Test to see if a given IOV time is mapped in the container.
| t | IOV time to check. |
Implements CondContBase.
|
staticprivateinherited |
Name of the global conditions cleaner service.
Definition at line 686 of file CondCont.h.
|
privateinherited |
Handle to the cleaner service.
Definition at line 678 of file CondCont.h.
|
privateinherited |
CLID of the most-derived CondCont.
Definition at line 666 of file CondCont.h.
|
privateinherited |
Set of mapped objects.
Definition at line 675 of file CondCont.h.
|
privateinherited |
Definition at line 683 of file CondCont.h.
|
privateinherited |
CLID+key for this container.
Definition at line 669 of file CondCont.h.
|
privateinherited |
Key type of this container.
Definition at line 663 of file CondCont.h.
|
privateinherited |
Associated DataProxy.
Definition at line 672 of file CondCont.h.