ATLAS Offline Software
Loading...
Searching...
No Matches
CondCont.h File Reference

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

#include "AthenaKernel/ClassID_traits.h"
#include "AthenaKernel/CLASS_DEF.h"
#include "AthenaKernel/BaseInfo.h"
#include "AthenaKernel/RCUUpdater.h"
#include "AthenaKernel/IConditionsCleanerSvc.h"
#include "AthenaKernel/CondObjDeleter.h"
#include "CxxUtils/ConcurrentRangeMap.h"
#include "CxxUtils/ConcurrentPtrSet.h"
#include "CxxUtils/SimpleUpdater.h"
#include "CxxUtils/checker_macros.h"
#include "GaudiKernel/EventIDBase.h"
#include "GaudiKernel/EventIDRange.h"
#include "GaudiKernel/DataObjID.h"
#include "GaudiKernel/StatusCode.h"
#include "GaudiKernel/ServiceHandle.h"
#include "boost/preprocessor/facilities/overload.hpp"
#include <iostream>
#include <set>
#include <vector>
#include <typeinfo>
#include <mutex>
#include <type_traits>
#include "AthenaKernel/CondCont.icc"
#include "AthenaKernel/CondContMaker.h"

Go to the source code of this file.

Classes

class  CondContBase
 Base class for all conditions containers. More...
class  CondContBase::Category
 Status code category for ContCont. More...
struct  CondContBase::RangeKey
 Range object to store in ConcurrentRangeMap. More...
struct  CondContBase::Compare
 Comparison object needed by ConcurrentRangeMap. More...
class  CondContSingleBase
 Base class for conditions containers that are either Run+LBN or timestamp. More...
class  CondContBaseInfo< T >
 Traits class to find the base for CondCont. More...
struct  SG::Bases< CondCont< T > >
class  CondCont< T >
 Hold mapping of ranges to condition objects. More...
class  CondContMixedBase
 Base class for conditions containers for which keys are ranges in both Run+LBN and timestamp. More...
class  CondContMixedBaseInfo< T >
 Traits class to find the base for CondContMixed. More...
struct  SG::Bases< CondContMixed< T > >
class  CondContMixed< T >
 Conditions container for which keys are ranges in both Run+LBN and timestamp. More...

Namespaces

namespace  SG
 Forward declaration.
namespace  Athena
 Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc.h and will be non-nullptr in case the GaudiSvc/AthenaKernel shared libraries have been loaded.

Macros

#define CONDCONT_BASE(D, B)
 Declare that conditions object D derives from B.
#define CONDCONT_MIXED_BASE(D, B)
 Declare that conditions object D derives from B.
#define CONCATUNF_(x, y)
#define CONCATUNF(x, y)
#define UNIQUEVARNAME   CONCATUNF(CONCATUNF(REGCCM_,__COUNTER__),__LINE__)
#define CONDCONT_DEF_2(T, CLID_)
 Declare a conditions container along with its CLID.
#define CONDCONT_DEF_3(T, CLID_, BASE)
#define CONDCONT_DEF(...)
#define CONDCONT_MIXED_DEF_2(T, CLID_)
 Declare a conditions container along with its CLID.
#define CONDCONT_MIXED_DEF_3(T, CLID_, BASE)
#define CONDCONT_MIXED_DEF(...)

Enumerations

enum class  CondContStatusCode : StatusCode::code_t {
  FAILURE = 0 , SUCCESS = 1 , RECOVERABLE = 2 , DUPLICATE = 10 ,
  OVERLAP = 11 , EXTENDED = 12
}
 Define extended status codes used by CondCont. More...

Detailed Description

Hold mappings of ranges to condition objects.

Author
Vakho, Charles, Scott
Date
2017

Conditions objects of type T are managed by CondCont<T>, which are recorded in the conditions store. CondCont<T> is a map of IOV ranges to payload objects of type T.

A conditions container must be declared as such and given a CLID using the macro CONDCONT_DEF:

CONDCONT_DEF (MyType, 12345);
#define CONDCONT_DEF(...)
Definition CondCont.h:1413

If one payload class derives from another, it is possible to declare conditions containers so that they have the same inheritance by adding the payload base class as a thir argument to CONDCONT_DEF. For example, if MyType derived from MyBase then you can use

CONDCONT_DEF (MyType, 12345, MyBase);

A conditions container declared in this way should have keys that are either ranges in run+lbn or timestamp; they cannot be mixed. However, in the case where one has a conditions algorithm that takes as input both a run+lbn and a timestamp condition, the result will be IOVs that have both run+lbn and timestamp ranges. Such conditions may be stored in a mixed conditions container, declared as:

CONDCONT_MIXED_DEF (MyType, 12345);
#define CONDCONT_MIXED_DEF(...)
Definition CondCont.h:1446

CondCont<MyType> is now declared as a mixed container. Mixed containers may also participate in inheritance, but the base class declared for a mixed container must also have been declared as mixed.

Implementation notes: All conditions containers derive from CondContBase. This defines virtual functions that are used by the IOV services. CondContSingleBase derives from this and collects non-templated implementations used by non-mixed containers; most virtual functions can be declared final here. Finally, CondCont<T> derives from CondContSingleBase and implements the type-specific part.

We reduce the amount of templated code that must be instantiated by storing the payloads as void* in the underlying ConcurrentRangeMap. All this needs to do with the payloads is to be able to delete them; we handle this by giving ConcurrentRangeMap a function to call to delete a payload.

For the case of mixed containers, rather than having the ConcurrentRangeMap store the payload directly, it instead holds another ConcurrentRangeMap which in turn hold the payload. The top map is indexed by run+lbn and the secondary ones by timestamp.

For mixed containers, we have CondContMixedBase deriving from CondContBase and CondContMixed<T> deriving from that. The CONDCONT_MIXED_DEF macro then specializes CondCont<T> so that it derives from CondContMixed<T>

Definition in file CondCont.h.

Macro Definition Documentation

◆ CONCATUNF

#define CONCATUNF ( x,
y )
Value:
#define CONCATUNF_(x, y)
Definition CondCont.h:1395
#define y
#define x

Definition at line 1396 of file CondCont.h.

◆ CONCATUNF_

#define CONCATUNF_ ( x,
y )
Value:
x##y

Definition at line 1395 of file CondCont.h.

◆ CONDCONT_BASE

#define CONDCONT_BASE ( D,
B )
Value:
template <> \
class CondContBaseInfo<D> \
{ \
public: \
typedef CondCont<B> Base; \
}; \
SG_BASES(D, B)
H5Mergers.
Traits class to find the base for CondCont.
Definition CondCont.h:823
Hold mapping of ranges to condition objects.
Definition CondCont.h:889

Declare that conditions object D derives from B.

This allows using ReadCondHandle to retrieve a conditions object of type D as B.

Definition at line 846 of file CondCont.h.

846#define CONDCONT_BASE(D, B) \
847template <> \
848class CondContBaseInfo<D> \
849{ \
850public: \
851 typedef CondCont<B> Base; \
852}; \
853SG_BASES(CondCont<D>, CondCont<B>);\
854SG_BASES(D, B)

◆ CONDCONT_DEF

#define CONDCONT_DEF ( ...)
Value:
BOOST_PP_OVERLOAD(CONDCONT_DEF_, __VA_ARGS__)(__VA_ARGS__)

Definition at line 1413 of file CondCont.h.

1413#define CONDCONT_DEF(...) \
1414 BOOST_PP_OVERLOAD(CONDCONT_DEF_, __VA_ARGS__)(__VA_ARGS__)

◆ CONDCONT_DEF_2

#define CONDCONT_DEF_2 ( T,
CLID_ )
Value:
CLASS_DEF( CondCont<T>, CLID_, 1) \
static CondContainer::CondContMaker<T> maker_ ## CLID_ {}
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg

Declare a conditions container along with its CLID.

Definition at line 1407 of file CondCont.h.

1407#define CONDCONT_DEF_2(T, CLID_) \
1408 CLASS_DEF( CondCont<T>, CLID_, 1) \
1409 static CondContainer::CondContMaker<T> maker_ ## CLID_ {}

◆ CONDCONT_DEF_3

#define CONDCONT_DEF_3 ( T,
CLID_,
BASE )
Value:
CONDCONT_BASE(T, BASE); \
CONDCONT_DEF_2(T, CLID_)
#define CONDCONT_BASE(D, B)
Declare that conditions object D derives from B.
Definition CondCont.h:846

Definition at line 1410 of file CondCont.h.

1410#define CONDCONT_DEF_3(T, CLID_, BASE) \
1411 CONDCONT_BASE(T, BASE); \
1412 CONDCONT_DEF_2(T, CLID_)

◆ CONDCONT_MIXED_BASE

#define CONDCONT_MIXED_BASE ( D,
B )
Value:
template <> \
{ \
public: \
static_assert (std::is_base_of_v<CondContMixed<B>, CondCont<B> >, \
"CondCont<" #B "> is not a mixed conditions container."); \
typedef CondCont<B> Base; \
}; \
SG_BASES(D, B)
Traits class to find the base for CondContMixed.
Definition CondCont.h:1210
Conditions container for which keys are ranges in both Run+LBN and timestamp.
Definition CondCont.h:1255

Declare that conditions object D derives from B.

This allows using ReadCondHandle to retrieve a conditions object of type D as B.

Definition at line 1231 of file CondCont.h.

1231#define CONDCONT_MIXED_BASE(D, B) \
1232template <> \
1233class CondContMixedBaseInfo<D> \
1234{ \
1235public: \
1236 static_assert (std::is_base_of_v<CondContMixed<B>, CondCont<B> >, \
1237 "CondCont<" #B "> is not a mixed conditions container."); \
1238 typedef CondCont<B> Base; \
1239}; \
1240SG_BASES(CondContMixed<D>, CondCont<B>); \
1241SG_BASES(D, B)

◆ CONDCONT_MIXED_DEF

#define CONDCONT_MIXED_DEF ( ...)
Value:
BOOST_PP_OVERLOAD(CONDCONT_MIXED_DEF_, __VA_ARGS__)(__VA_ARGS__)

Definition at line 1446 of file CondCont.h.

1446#define CONDCONT_MIXED_DEF(...) \
1447 BOOST_PP_OVERLOAD(CONDCONT_MIXED_DEF_, __VA_ARGS__)(__VA_ARGS__)

◆ CONDCONT_MIXED_DEF_2

#define CONDCONT_MIXED_DEF_2 ( T,
CLID_ )
Value:
template<> class CondCont<T> : public CondContMixed<T> { \
public: \
CondCont (Athena::IRCUSvc& rcusvc, const DataObjID& id, \
SG::DataProxy* proxy =nullptr, size_t capacity = 16) \
: CondContMixed<T> (rcusvc, CLID_, id, proxy, capacity) {} \
protected: \
CondCont (Athena::IRCUSvc& rcusvc, CLID clid, const DataObjID& id, \
SG::DataProxy* proxy, \
std::shared_ptr<typename CondContSet::IPayloadDeleter> payloadDeleter, \
size_t capacity = 16) \
: CondContMixed<T> (rcusvc, clid, id, proxy, \
std::move(payloadDeleter), capacity) {} \
}; \
CLASS_DEF( CondCont<T>, CLID_, 1) \
SG_BASES(CondCont<T>, CondContMixed<T>); \
static CondContainer::CondContMaker<T> maker_ ## CLID_ {}
uint32_t CLID
The Class ID type.
Interface for RCU service.
Definition IRCUSvc.h:40

Declare a conditions container along with its CLID.

Definition at line 1426 of file CondCont.h.

1426#define CONDCONT_MIXED_DEF_2(T, CLID_) \
1427 template<> class CondCont<T> : public CondContMixed<T> { \
1428 public: \
1429 CondCont (Athena::IRCUSvc& rcusvc, const DataObjID& id, \
1430 SG::DataProxy* proxy =nullptr, size_t capacity = 16) \
1431 : CondContMixed<T> (rcusvc, CLID_, id, proxy, capacity) {} \
1432 protected: \
1433 CondCont (Athena::IRCUSvc& rcusvc, CLID clid, const DataObjID& id, \
1434 SG::DataProxy* proxy, \
1435 std::shared_ptr<typename CondContSet::IPayloadDeleter> payloadDeleter, \
1436 size_t capacity = 16) \
1437 : CondContMixed<T> (rcusvc, clid, id, proxy, \
1438 std::move(payloadDeleter), capacity) {} \
1439 }; \
1440 CLASS_DEF( CondCont<T>, CLID_, 1) \
1441 SG_BASES(CondCont<T>, CondContMixed<T>); \
1442 static CondContainer::CondContMaker<T> maker_ ## CLID_ {}

◆ CONDCONT_MIXED_DEF_3

#define CONDCONT_MIXED_DEF_3 ( T,
CLID_,
BASE )
Value:
CONDCONT_MIXED_BASE(T, BASE); \
CONDCONT_MIXED_DEF_2(T, CLID_)
#define CONDCONT_MIXED_BASE(D, B)
Declare that conditions object D derives from B.
Definition CondCont.h:1231

Definition at line 1443 of file CondCont.h.

1443#define CONDCONT_MIXED_DEF_3(T, CLID_, BASE) \
1444 CONDCONT_MIXED_BASE(T, BASE); \
1445 CONDCONT_MIXED_DEF_2(T, CLID_)

◆ UNIQUEVARNAME

#define UNIQUEVARNAME   CONCATUNF(CONCATUNF(REGCCM_,__COUNTER__),__LINE__)

Definition at line 1397 of file CondCont.h.

Enumeration Type Documentation

◆ CondContStatusCode

enum class CondContStatusCode : StatusCode::code_t
strong

Define extended status codes used by CondCont.

We add DUPLICATE, OVERLAP, and EXTENDED.

Enumerator
FAILURE 
SUCCESS 
RECOVERABLE 
DUPLICATE 
OVERLAP 
EXTENDED 

Definition at line 107 of file CondCont.h.

108{
109 FAILURE = 0,
110 SUCCESS = 1,
111 RECOVERABLE = 2,
112
113 // Attempt to insert an item in a CondCont with a range duplicating
114 // an existing one. The original contents of the container are unchanged,
115 // and the new item has been deleted.
116 // This is classified as Success.
117 DUPLICATE = 10,
118
119 // Attempt to insert an item in a CondCont with a range that partially
120 // overlaps with an existing one.
121 // This is classified as Success.
122 OVERLAP = 11,
123
124 // Attempt to insert an item in a CondCont where the new range is an extension
125 // of the last range. That is, the start time of the new range matches
126 // that of the last range in the container, and the end time of the new range
127 // is larger than that of the last range in the container. The end time
128 // of the last range has been extended to match the new range.
129 // The payload of the existing range is unchanged, and the new
130 // item has been deleted.
131 EXTENDED = 12
132};