5#ifndef STOREGATE_WRITECONDHANDLE_H
6#define STOREGATE_WRITECONDHANDLE_H 1
15#include "GaudiKernel/ServiceHandle.h"
16#include "GaudiKernel/DataHandle.h"
17#include "GaudiKernel/DataObjID.h"
18#include "GaudiKernel/EventIDBase.h"
40 const EventContext& ctx) =
delete;
44 const std::string&
key()
const {
return m_hkey.key(); }
51 bool isValid(
const EventIDBase& t, EventIDRange& range)
const;
58 template <
typename R,
typename...
Args>
68 StatusCode
record(
const EventIDRange& range, T* t);
69 StatusCode
record(
const EventIDRange& range, std::unique_ptr<T> t);
75 StatusCode
record(std::unique_ptr<T> t);
89 const EventContext& ctx = Gaudi::Hive::currentContext());
108 template <
typename T>
114 template <
typename T>
116 const EventContext& ctx) :
124 <<
"WriteCondHandle : ptr to CondCont<T> is zero"
129 throw SG::ExcUninitKey (key.clid(), key.key(), key.storeHandle().name(),
138 template <
typename T>
146 <<
"WriteCondHandle::record(EventIDRange, T*): for key "
148 <<
" cannot use this method if range has already been set via dependencies"
150 return StatusCode::FAILURE;
156 return record( std::move(t) );
159 template <
typename T>
163 return record (
r, std::unique_ptr<T> (t));
166 template <
typename T>
169 return record (std::unique_ptr<T> (t));
172 template <
typename T>
178 <<
"WriteCondHandle::record() : no range defined for key "
181 return StatusCode::FAILURE;
186 if (
msg.level() <= MSG::DEBUG) {
188 <<
"WriteCondHandle::record() : obj at: " << t.get() <<
" range: "
195 if (
sc.isFailure()) {
198 <<
"WriteCondHandle::record() : unable to insert obj in CondCont<T>"
200 return StatusCode::FAILURE;
207 <<
"WriteCondHandle::record() : IOV ranges overlap."
209 return StatusCode::FAILURE;
211 sc = StatusCode::SUCCESS;
230 template <
typename T>
234 return m_cc->extendLastRange (
r, ctx);
240 template <
typename T>
244 return (
m_cc->valid(t));
250 template <
typename T>
259 template <
typename T>
263 return (
m_cc->range(t, range));
269 template <
typename T>
273 return (
m_cc->range(
m_ctx.eventID(), range));
278 template <
typename T>
287 if (
m_cc->keyType()==KeyType::RUNLBN && (range.start().isTimeStamp() || range.stop().isTimeStamp())) {
289 msg << MSG::ERROR <<
"Adding a time-stamp dependency on a run-lumi indexed CondCont. Consider a mixed ConditionsContainer for type " <<
fullKey() <<
endmsg;
291 if (
m_cc->keyType()==KeyType::TIMESTAMP && (range.start().isRunLumi() || range.stop().isRunLumi())) {
293 msg << MSG::ERROR <<
"Adding a run-lumi dependency on a timestamp-indexed CondCont. Consider a mixed ConditionsContainer for type " <<
fullKey() <<
endmsg;
298 template <
typename T>
299 template<
typename R>
307 template<
typename T>
308 template <
typename R,
typename...
Args>
318 const EventContext& ctx = Gaudi::Hive::currentContext()) {
Hold mappings of ranges to condition objects.
static bool isOverlap(code_t code)
Helper to test whether a code is OVERLAP.
Base class for all conditions containers.
KeyType
Type of key used for this container.
void addDep(CondContBase *dep)
Declare another conditions container that depends on this one.
Hold mapping of ranges to condition objects.
const EventIDRange & getRange()
StatusCode extendLastRange(const EventIDRange &range, const EventContext &ctx=Gaudi::Hive::currentContext())
Extend the range of the last IOV.
const std::string & key() const
bool isValid(EventIDRange &range) const
const std::string & dbKey() const
void addDependency(ReadCondHandle< R > &rch, Args... args)
StatusCode record(std::unique_ptr< T > t)
record handle, range must have been set by addDependency(...)
WriteCondHandle(SG::WriteCondHandleKey< T > &&key)=delete
const T * const_pointer_type
void addDependency(SG::ReadCondHandle< R > &rch)
bool isValid(const EventIDBase &t, EventIDRange &range) const
void addDependency(const EventIDRange &range)
const EventContext & m_ctx
bool isValid(const EventIDBase &t) const
const EventIDRange & getRange() const
const SG::WriteCondHandleKey< CscCondDbData > & m_hkey
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
WriteCondHandle(const WriteCondHandleKey< T > &key, const EventContext &ctx)
WriteCondHandle(SG::WriteCondHandleKey< T > &&key, const EventContext &ctx)=delete
StatusCode record(const EventIDRange &range, std::unique_ptr< T > t)
const T & const_reference_type
CondCont< CscCondDbData > * m_cc
const DataObjID & fullKey() const
WriteCondHandle(const WriteCondHandleKey< T > &key)
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
=============================================================================
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())