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"
153 virtual const char*
name()
const override;
226 const DataObjID&
id()
const;
253 void list (std::ostream& ost)
const = 0;
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;
326 StatusCode
erase (
const EventIDBase& t,
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());
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,
558 const EventContext& ctx = Gaudi::Hive::currentContext());
566 StatusCode
eraseBase (
const EventIDBase& t,
567 const EventContext& ctx = Gaudi::Hive::currentContext());
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);
658 std::string
title()
const;
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;
770 StatusCode
erase (
const EventIDBase& t,
771 const EventContext& ctx = Gaudi::Hive::currentContext()) override final;
786 const EventContext& ctx =
Gaudi::Hive::currentContext()) override final;
846#define CONDCONT_BASE(D, B) \
848class CondContBaseInfo<D> \
851 typedef CondCont<B> Base; \
853SG_BASES(CondCont<D>, CondCont<B>);\
912 size_t capacity = 16);
943 std::unique_ptr<T> obj,
944 const EventContext& ctx = Gaudi::Hive::currentContext());
955 bool find (
const EventIDBase& t,
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;
1106 StatusCode
erase (
const EventIDBase& t,
1107 const EventContext& ctx = Gaudi::Hive::currentContext()) override final;
1124 const EventContext& ctx =
Gaudi::Hive::currentContext()) override final;
1139 const DataObjID&
id,
1160 const EventContext& ctx =
Gaudi::Hive::currentContext());
1208template <typename T>
1217template <
typename T>
1231#define CONDCONT_MIXED_BASE(D, B) \
1233class 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; \
1240SG_BASES(CondContMixed<D>, CondCont<B>); \
1253template <
typename T>
1294 std::unique_ptr<T> obj,
1295 const EventContext& ctx = Gaudi::Hive::currentContext());
1308 EventIDRange
const**
r =
nullptr)
const;
1319 const T*
find (
const EventIDBase& t)
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__)
A set of pointers, alowing concurrent, lockless reads.
Map from range to payload object, allowing concurrent, lockless reads.
CondContStatusCode
Define extended status codes used by CondCont.
Deletion object for conditions payloads.
Provide an interface for finding inheritance information at run time.
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
uint32_t CLID
The Class ID type.
Interface for doing garbage collection of conditions objects.
Implementation of Updater for RCUSvc.
Simple (non-deleting) Updater implementation.
void print(char *figname, TCanvas *c1)
Define macros for attributes used to control the static checker.
Interface for RCU service.
Implementation of Updater for RCUSvc.
Traits class to find the base for CondCont.
Status code category for ContCont.
StatusCode::code_t code_t
static bool isOverlap(code_t code)
Helper to test whether a code is OVERLAP.
virtual const char * name() const override
Name of the category.
virtual bool isSuccess(code_t code) const override
Is code considered success?
virtual std::string message(code_t code) const override
Description for code within this category.
static bool isExtended(code_t code)
Helper to test whether a code is EXTENDED.
static bool isDuplicate(code_t code)
Helper to test whether a code is DUPLICATE.
Base class for all conditions containers.
StatusCode insertBase(const EventIDRange &r, CondContSet::payload_unique_ptr t, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
CLID m_clid
CLID of the most-derived CondCont.
StatusCode extendLastRangeBase(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())
Extend the range of the last IOV.
void insertError(CLID usedCLID) const
Helper to report an error due to using a base class for insertion.
void forEach(const FUNC &func) const
Call func on each entry in the container.
virtual ~CondContBase()
Destructor.
CondContSet::Updater_t Updater_t
size_t nInserts() const
Return the number times an item was inserted into the map.
void setProxy(SG::DataProxy *)
Set the associated DataProxy.
size_t maxSize() const
Return the maximum size of the map.
KeyType
Type of key used for this container.
@ SINGLE
Either TIMESTAMP or RUNLBN, but nothing's been put in the container yet, so we don't know which one.
@ MIXED
Mixed Run+lbn / timestamp container.
@ TIMESTAMP
Container uses timestamp keys.
@ RUNLBN
Container uses run+lbn keys.
std::string title() const
Description of this container to use for MsgStream.
void clear()
Remove all entries in the container.
std::atomic< KeyType > m_keyType
Key type of this container.
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Insert a new conditions object.
void Payload
Payload type held by this class.
const void * findBase(const EventIDBase &t, EventIDRange const **r) const
Internal lookup function.
CondContSet m_condSet
Set of mapped objects.
virtual std::vector< EventIDRange > ranges() const =0
Return all IOV validity ranges defined in this container.
virtual const void * doCast(CLID clid, const void *ptr) const =0
Do pointer conversion for the payload type.
static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
Name of the global conditions cleaner service.
StatusCode eraseBase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())
Erase the first element not less than t.
delete_function * delfcn() const
Return the deletion function for this container.
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 StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Extend the range of the last IOV.
void quiescent(const EventContext &ctx=Gaudi::Hive::currentContext())
Mark that this thread is no longer accessing data from this container.
virtual StatusCode erase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Erase the first element not less than t.
ServiceHandle< Athena::IConditionsCleanerSvc > m_cleanerSvc
Handle to the cleaner service.
static key_type keyFromTimestamp(const EventIDBase &b)
Make a timestamp key from an EventIDBase.
virtual bool valid(const EventIDBase &t) const =0
Test to see if a given IOV time is mapped in the container.
static key_type keyFromRunLBN(const EventIDBase &b)
Make a run+lbn key from an EventIDBase.
DataObjID m_id
CLID+key for this container.
CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdater > CondContSet
StatusCode inserted(const EventContext &ctx)
Tell the cleaner that a new object was added to the container.
const void * cast(CLID clid, const void *ptr) const
Do pointer conversion for the payload type.
KeyType keyType() const
Return the key type for this container.
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.
uint64_t key_type
Type used to store an IOV time internally.
SG::DataProxy * m_proxy
Associated DataProxy.
virtual bool range(const EventIDBase &t, EventIDRange &r) const =0
Return the mapped validity range for an IOV time.
const SG::DataProxy * proxy() const
Return the associated DataProxy, if any.
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
const DataObjID & id() const
Return CLID/key corresponding to this container.
CondContSet::delete_function delete_function
virtual void list(std::ostream &ost) const =0
Dump the container contents for debugging.
CxxUtils::ConcurrentPtrSet< CondContBase, CxxUtils::SimpleUpdater > DepSet
Other conditions dependencies that depend on this one, as inferred by addDependency calls.
Traits class to find the base for CondContMixed.
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.
virtual void list(std::ostream &ost) const override final
Dump the container contents for debugging.
const void * findMixed(const EventIDBase &t, EventIDRange const **r) const
Internal lookup function.
virtual std::vector< EventIDRange > ranges() const override final
Return all IOV validity ranges defined in this container.
StatusCode insertMixed(const EventIDRange &r, CondContBase::CondContSet::payload_unique_ptr t, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
virtual size_t entries() const override final
Return the number of conditions objects in the container.
virtual StatusCode erase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Erase the first element not less than t.
virtual bool valid(const EventIDBase &t) const override final
Test to see if a given IOV time is mapped in the container.
Athena::IRCUSvc & m_rcusvc
Need to remember the RCU svc here in order to pass it to the TS maps.
std::shared_ptr< CondContSet::IPayloadDeleter > m_payloadDeleter
Deletion object for actual payload objects.
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Insert a new conditions object.
std::mutex m_mutex
Mutex for insertions.
virtual StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Extend the range of the last IOV.
CondContMixedBase(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
Internal constructor.
virtual bool range(const EventIDBase &t, EventIDRange &r) const override final
Return the mapped validity range for an IOV time.
Conditions container for which keys are ranges in both Run+LBN and timestamp.
CondContMixed(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< typename CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
Internal Constructor.
CondContMixed(const CondContMixed &)=delete
No copying.
StatusCode insert(const EventIDRange &r, std::unique_ptr< T > obj, const EventContext &ctx=Gaudi::Hive::currentContext())
Insert a new conditions object.
virtual const void * doCast(CLID clid, const void *ptr) const override
Do pointer conversion for the payload type.
static void registerBaseInit()
Helper to ensure that the inheritance information for this class gets initialized.
CondContBase::key_type key_type
T Payload
Payload type held by this class.
const void * cast(CLID clid, const void *ptr) const
Do pointer conversion for the payload type.
CondContMixedBaseInfo< T >::Base Base
Base class.
Base::CondContSet CondContSet
bool find(const EventIDBase &t, T const *&obj, EventIDRange const **r=nullptr) const
Look up a conditions object for a given time.
CondContMixed(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, size_t capacity)
Internal Constructor.
const T * find(const EventIDBase &t) const
Look up a conditions object for a given time.
virtual ~CondContMixed()
Destructor.
Base class for conditions containers that are either Run+LBN or timestamp.
virtual StatusCode erase(const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Erase the first element not less than t.
CondContSingleBase(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
Internal constructor.
virtual bool range(const EventIDBase &t, EventIDRange &r) const override final
Return the mapped validity range for an IOV time.
virtual void list(std::ostream &ost) const override final
Dump the container contents for debugging.
virtual StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Extend the range of the last IOV.
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext()) override final
Insert a new conditions object.
virtual std::vector< EventIDRange > ranges() const override final
Return all IOV validity ranges defined in this container.
virtual bool valid(const EventIDBase &t) const override final
Test to see if a given IOV time is mapped in the container.
Hold mapping of ranges to condition objects.
CondContBase::key_type key_type
CondCont(const CondCont &)=delete
No copying.
CondCont(Athena::IRCUSvc &rcusvc, const DataObjID &id, SG::DataProxy *proxy=nullptr, size_t capacity=16)
Constructor.
virtual ~CondCont()
Destructor.
static void registerBaseInit()
Helper to ensure that the inheritance information for this class gets initialized.
const T * find(const EventIDBase &t) const
Look up a conditions object for a given time.
CondCont & operator=(const CondCont &)=delete
const void * cast(CLID clid, const void *ptr) const
Do pointer conversion for the payload type.
CondContBaseInfo< T >::Base Base
Base class.
CondCont(Athena::IRCUSvc &rcusvc, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< typename CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
Internal constructor.
virtual const void * doCast(CLID clid, const void *ptr) const override
Do pointer conversion for the payload type.
T Payload
Payload type held by this class.
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.
Base::CondContSet CondContSet
A set of pointers, allowing concurrent, lockless queries.
Map from range to payload object, allowing concurrent, lockless reads.
std::unique_ptr< void, DeletePayload > payload_unique_ptr
Athena::RCUUpdater< Impl > Updater_t
void delete_function(const void *)
DataProxy provides the registry services for StoreGate.
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
=============================================================================
Comparison object needed by ConcurrentRangeMap.
bool inRange(key_type t, const RangeKey &r) const
Range object to store in ConcurrentRangeMap.
key_type m_start
Packed start time.
RangeKey()
Default constructor.
key_type m_stop
Packed stop time.
EventIDRange m_range
Original range object.
RangeKey(const EventIDRange &r, key_type start, key_type stop)
Constructor from range+start/stop.
Represent a list of base classes.
BaseList< CondContBase > bases
BaseList< CondContBase > bases
Traits class to hold derivation information.