  | 
  
    ATLAS Offline Software
    
   | 
 
 
 
 
Go to the documentation of this file.
   66 #ifndef ATHENAKERNEL_CONDCONT_H 
   67 #define ATHENAKERNEL_CONDCONT_H 
   80 #include "GaudiKernel/EventIDBase.h" 
   81 #include "GaudiKernel/EventIDRange.h" 
   82 #include "GaudiKernel/DataObjID.h" 
   83 #include "GaudiKernel/StatusCode.h" 
   84 #include "GaudiKernel/ServiceHandle.h" 
   85 #include "boost/preprocessor/facilities/overload.hpp" 
   92 #include <type_traits> 
  153     virtual const char* 
name() 
const override;
 
  159     virtual bool isSuccess (
code_t code) 
const override;
 
  226   const DataObjID& 
id() 
const;
 
  265   virtual size_t entries() 
const;
 
  272   std::vector<EventIDRange> 
ranges() 
const = 0;
 
  298                              const EventContext& ctx = Gaudi::Hive::currentContext()) = 0;
 
  306   bool valid( 
const EventIDBase& 
t) 
const = 0;
 
  317   bool range (
const EventIDBase& 
t, EventIDRange& 
r) 
const = 0;
 
  327                     const EventContext& ctx = Gaudi::Hive::currentContext()) = 0;
 
  354   size_t trim (
const std::vector<key_type>& runLbnKeys, 
const std::vector<key_type>& TSKeys);
 
  371   void quiescent (
const EventContext& ctx = Gaudi::Hive::currentContext());
 
  377   size_t nInserts() 
const;
 
  383   size_t maxSize() 
const;
 
  398                               const EventContext& ctx = Gaudi::Hive::currentContext()) = 0;
 
  452     { 
return r1.m_start < r2.m_start; }
 
  454     { 
return t < r2.m_start; }
 
  457       return t >= 
r.m_start && 
t< 
r.m_stop;
 
  475     int overlap (
const EventContext& ctx,
 
  503   std::vector<CondContBase*> getDeps();
 
  537                 std::shared_ptr<CondContSet::IPayloadDeleter> payloadDeleter,
 
  557                          CondContSet::payload_unique_ptr 
t,
 
  558                          const EventContext& ctx = Gaudi::Hive::currentContext());
 
  567                         const EventContext& ctx = Gaudi::Hive::currentContext());
 
  581   extendLastRangeBase (
const EventIDRange& newRange,
 
  582                        const EventContext& ctx = Gaudi::Hive::currentContext());
 
  594   const void* findBase (
const EventIDBase& 
t,
 
  595                         EventIDRange 
const** 
r) 
const;
 
  632   template <
class FUNC>
 
  639   StatusCode inserted (
const EventContext& ctx);
 
  646   void insertError (
CLID usedCLID) 
const;
 
  658   std::string 
title() 
const;
 
  682   using DepSet = CxxUtils::ConcurrentPtrSet<CondContBase, CxxUtils::SimpleUpdater>;
 
  709   void list (std::ostream& 
ost) 
const override final;
 
  716   std::vector<EventIDRange> 
ranges() 
const override final;
 
  742                              const EventContext& ctx = Gaudi::Hive::currentContext()) 
override final;
 
  750   bool valid( 
const EventIDBase& 
t) 
const override final;
 
  761   bool range (
const EventIDBase& 
t, EventIDRange& 
r) 
const override final;
 
  771                     const EventContext& ctx = Gaudi::Hive::currentContext()) override 
final;
 
  786                               const EventContext& ctx = 
Gaudi::Hive::currentContext()) override 
final;
 
  803                       std::shared_ptr<
CondContSet::IPayloadDeleter> payloadDeleter,
 
  830 template <
typename T>
 
  846 #define CONDCONT_BASE(D, B)       \ 
  848 class CondContBaseInfo<D>         \ 
  851   typedef CondCont<B> Base;       \ 
  853 SG_BASES(CondCont<D>, CondCont<B>);\ 
  887 template <
typename T>
 
  912             size_t capacity = 16);
 
  943                      std::unique_ptr<T> 
obj,
 
  944                      const EventContext& ctx = Gaudi::Hive::currentContext());
 
  957              EventIDRange 
const** 
r = 
nullptr) 
const;
 
  968   const T* 
find (
const EventIDBase& 
t) 
const;
 
  985             std::shared_ptr<typename CondContSet::IPayloadDeleter> payloadDeleter,
 
 1039   void list (std::ostream& 
ost) 
const override final;
 
 1045   virtual size_t entries() 
const override final;
 
 1052   std::vector<EventIDRange> 
ranges() 
const override final;
 
 1076                              const EventContext& ctx = Gaudi::Hive::currentContext()) 
override final;
 
 1084   bool valid( 
const EventIDBase& 
t) 
const override final;
 
 1095   bool range (
const EventIDBase& 
t, EventIDRange& 
r) 
const override final;
 
 1107                     const EventContext& ctx = Gaudi::Hive::currentContext()) override 
final;
 
 1124                               const EventContext& ctx = 
Gaudi::Hive::currentContext()) override 
final;
 
 1139                      const DataObjID& 
id,
 
 1141                      std::shared_ptr<
CondContSet::IPayloadDeleter> payloadDeleter,
 
 1160                           const EventContext& ctx = 
Gaudi::Hive::currentContext());
 
 1217 template <
typename T>
 
 1231 #define CONDCONT_MIXED_BASE(D, B)                                          \ 
 1233 class CondContMixedBaseInfo<D>                                             \ 
 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;                                                \ 
 1240 SG_BASES(CondContMixed<D>, CondCont<B>);                                   \ 
 1253 template <
typename T>
 
 1294                      std::unique_ptr<T> 
obj,
 
 1295                      const EventContext& ctx = Gaudi::Hive::currentContext());
 
 1308              EventIDRange 
const** 
r = 
nullptr) 
const;
 
 1334                  const DataObjID& 
id,
 
 1336                  std::shared_ptr<typename CondContSet::IPayloadDeleter> payloadDeleter,
 
 1350                  const DataObjID& 
id,
 
 1395 #define CONCATUNF_(x,y) x##y 
 1396 #define CONCATUNF(x,y) CONCATUNF_(x,y) 
 1397 #define UNIQUEVARNAME CONCATUNF(CONCATUNF(REGCCM_,__COUNTER__),__LINE__) 
 1407 #define CONDCONT_DEF_2(T, CLID_)    \ 
 1408   CLASS_DEF( CondCont<T>, CLID_, 1) \ 
 1409   static CondContainer::CondContMaker<T> maker_ ## CLID_ {} 
 1410 #define CONDCONT_DEF_3(T, CLID_, BASE)           \ 
 1411   CONDCONT_BASE(T, BASE);                        \ 
 1412   CONDCONT_DEF_2(T, CLID_) 
 1413 #define CONDCONT_DEF(...)  \ 
 1414   BOOST_PP_OVERLOAD(CONDCONT_DEF_, __VA_ARGS__)(__VA_ARGS__) 
 1426 #define CONDCONT_MIXED_DEF_2(T, CLID_)                                   \ 
 1427   template<> class CondCont<T> : public CondContMixed<T> {               \ 
 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) {}         \ 
 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) {}        \ 
 1440   CLASS_DEF( CondCont<T>, CLID_, 1)                                      \ 
 1441   SG_BASES(CondCont<T>, CondContMixed<T>);                               \ 
 1442   static CondContainer::CondContMaker<T> maker_ ## CLID_ {} 
 1443 #define CONDCONT_MIXED_DEF_3(T, CLID_, BASE)                             \ 
 1444   CONDCONT_MIXED_BASE(T, BASE);                                          \ 
 1445   CONDCONT_MIXED_DEF_2(T, CLID_) 
 1446 #define CONDCONT_MIXED_DEF(...)                                          \ 
 1447   BOOST_PP_OVERLOAD(CONDCONT_MIXED_DEF_, __VA_ARGS__)(__VA_ARGS__) 
 1450 #endif // not ATHENAKERNEL_CONDCONT_H 
  
Range object to store in ConcurrentRangeMap.
 
CondContMixed(const CondContMixed &)=delete
No copying.
 
std::mutex m_mutex
Mutex for insertions.
 
Traits class to find the base for CondContMixed.
 
CondContMixed(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< typename CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
Internal Constructor.
 
bool find(const EventIDBase &t, T const *&obj, EventIDRange const **r=nullptr) const
Look up a conditions object for a given time.
 
static key_type keyFromTimestamp(const EventIDBase &b)
Make a timestamp key from an EventIDBase.
 
Traits class to find the base for CondCont.
 
static void setCleanerSvcName ATLAS_NOT_THREAD_SAFE(const std::string &name)
Allow overriding the name of the global conditions cleaner service (for testing purposes).
 
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())=0
Insert a new conditions object.
 
virtual const void * doCast(CLID clid, const void *ptr) const override
Do pointer conversion for the payload type.
 
Interface for doing garbage collection of conditions objects.
 
Deletion object for conditions payloads.
 
virtual const void * doCast(CLID clid, const void *ptr) const =0
Do pointer conversion for the payload type.
 
static key_type keyFromRunLBN(const EventIDBase &b)
Make a run+lbn key from an EventIDBase.
 
CondContMixed(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, size_t capacity)
Internal Constructor.
 
Base class for conditions containers for which keys are ranges in both Run+LBN and timestamp.
 
delete_function * payloadDelfcn() const
Return the payload deletion function for this container.
 
StatusCode insert(const EventIDRange &r, std::unique_ptr< T > obj, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
 
std::shared_ptr< CondContSet::IPayloadDeleter > m_payloadDeleter
Deletion object for actual payload objects.
 
void Payload
Payload type held by this class.
 
Base class for conditions containers that are either Run+LBN or timestamp.
 
CondContSet::Updater_t Updater_t
 
CondCont & operator=(const CondCont &)=delete
 
KeyType
Type of key used for this container.
 
virtual bool valid(const EventIDBase &t) const override final
Test to see if a given IOV time is mapped in the container.
 
bool find(const EventIDBase &t, T const *&obj, EventIDRange const **r=nullptr) const
Look up a conditions object for a given time.
 
KeyType keyType() const
Return the key type for this container.
 
AccessorTemplate & operator=(AccessorTemplate &&that)
 
virtual bool valid(const EventIDBase &t) const =0
Test to see if a given IOV time is mapped in the container.
 
key_type m_start
Packed start time.
 
virtual void list(std::ostream &ost) const =0
Dump the container contents for debugging.
 
bool const RAWDATA *ch2 const
 
DataObjID m_id
CLID+key for this container.
 
T Payload
Payload type held by this class.
 
CxxUtils::ConcurrentPtrSet< CondContBase, CxxUtils::SimpleUpdater > DepSet
Other conditions dependencies that depend on this one, as inferred by addDependency calls.
 
T Payload
Payload type held by this class.
 
CondContSet::delete_function delete_function
 
virtual ~CondContBase()
Destructor.
 
Base::CondContSet CondContSet
 
CondContBase::key_type key_type
 
RangeKey(const EventIDRange &r, key_type start, key_type stop)
Constructor from range+start/stop.
 
CondCont(Athena::IRCUSvc &rcusvc, const DataObjID &id, SG::DataProxy *proxy=nullptr, size_t capacity=16)
Constructor.
 
const T * find(const EventIDBase &t) const
Look up a conditions object for a given time.
 
StatusCode insertMixed(const EventIDRange &r, CondContBase::CondContSet::payload_unique_ptr t, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
 
Conditions container for which keys are ranges in both Run+LBN and timestamp.
 
virtual ~CondContMixed()
Destructor.
 
Base::CondContSet CondContSet
 
virtual std::vector< EventIDRange > ranges() const =0
Return all IOV validity ranges defined in this container.
 
virtual void list(std::ostream &ost) const override final
Dump the container contents for debugging.
 
virtual StatusCode erase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Erase the first element not less than t.
 
virtual bool range(const EventIDBase &t, EventIDRange &r) const =0
Return the mapped validity range for an IOV time.
 
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Insert a new conditions object.
 
const DataObjID & id() const
Return CLID/key corresponding to this container.
 
void forEach(const FUNC &func) const
Call func on each entry in the container.
 
Provide an interface for finding inheritance information at run time.
 
virtual StatusCode erase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Erase the first element not less than t.
 
Some weak symbol referencing magic...
 
virtual bool range(const EventIDBase &t, EventIDRange &r) const override final
Return the mapped validity range for an IOV time.
 
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
 
::StatusCode StatusCode
StatusCode definition for legacy code.
 
Athena::IRCUSvc & m_rcusvc
Need to remember the RCU svc here in order to pass it to the TS maps.
 
Base class for all conditions containers.
 
bool inRange(key_type t, const RangeKey &r) const
 
DataProxy provides the registry services for StoreGate.
 
Traits class to hold derivation information.
 
CLID m_clid
CLID of the most-derived CondCont.
 
CondContMixedBaseInfo< T >::Base Base
Base class.
 
virtual StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Extend the range of the last IOV.
 
Implementation of Updater for RCUSvc.
 
Interface for RCU service.
 
Comparison object needed by ConcurrentRangeMap.
 
StatusCode insert(const EventIDRange &r, std::unique_ptr< T > obj, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
 
key_type m_stop
Packed stop time.
 
SG::DataProxy * m_proxy
Associated DataProxy.
 
uint32_t CLID
The Class ID type.
 
const void * cast(CLID clid, const void *ptr) const
Do pointer conversion for the payload type.
 
void print(char *figname, TCanvas *c1)
 
const void * cast(CLID clid, const void *ptr) const
Do pointer conversion for the payload type.
 
RangeKey()
Default constructor.
 
CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdater > CondContSet
 
virtual bool valid(const EventIDBase &t) const override final
Test to see if a given IOV time is mapped in the container.
 
virtual StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Extend the range of the last IOV.
 
static void registerBaseInit()
Helper to ensure that the inheritance information for this class gets initialized.
 
CondCont(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< typename CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
Internal constructor.
 
static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
Name of the global conditions cleaner service.
 
CondContBase::key_type key_type
 
CondContStatusCode
Define extended status codes used by CondCont.
 
ServiceHandle< Athena::IConditionsCleanerSvc > m_cleanerSvc
Handle to the cleaner service.
 
CondContBaseInfo< T >::Base Base
Base class.
 
StatusCode::code_t code_t
 
Hold mapping of ranges to condition objects.
 
Simple (non-deleting) Updater implementation.
 
const SG::DataProxy * proxy() const
Return the associated DataProxy, if any.
 
const T * find(const EventIDBase &t) const
Look up a conditions object for a given time.
 
const void * findMixed(const EventIDBase &t, EventIDRange const **r) const
Internal lookup function.
 
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
 
const void * cast(CLID clid, const void *ptr) const
Do pointer conversion for the payload type.
 
CLID clid() const
Return the CLID of the most-derived CondCont.
 
void trim(std::string &input)
 
uint64_t key_type
Type used to store an IOV time internally.
 
virtual ~CondCont()
Destructor.
 
CondCont(const CondCont &)=delete
No copying.
 
=============================================================================
 
CondContSet m_condSet
Set of mapped objects.
 
Map from range to payload object, allowing concurrent, lockless reads.
 
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
 
decltype(auto) operator()(ObjectId< CI, CM > id) const noexcept
 
Define macros for attributes used to control the static checker.
 
macros to associate a CLID to a type
 
Implementation of Updater for RCUSvc.
 
virtual const void * doCast(CLID clid, const void *ptr) const override
Do pointer conversion for the payload type.
 
virtual size_t entries() const override final
Return the number of conditions objects in the container.
 
static void registerBaseInit()
Helper to ensure that the inheritance information for this class gets initialized.
 
Status code category for ContCont.
 
EventIDRange m_range
Original range object.
 
A set of pointers, alowing concurrent, lockless reads.
 
std::atomic< KeyType > m_keyType
Key type of this container.
 
Represent a list of base classes.