ATLAS Offline Software
Loading...
Searching...
No Matches
SG::WriteCondHandle< T > Class Template Reference

#include <WriteCondHandle.h>

Collaboration diagram for SG::WriteCondHandle< T >:

Public Types

typedef T * pointer_type
typedef const T * const_pointer_type
typedef T & reference_type
typedef const T & const_reference_type

Public Member Functions

 WriteCondHandle (const WriteCondHandleKey< T > &key)
 WriteCondHandle (const WriteCondHandleKey< T > &key, const EventContext &ctx)
 WriteCondHandle (SG::WriteCondHandleKey< T > &&key)=delete
 WriteCondHandle (SG::WriteCondHandleKey< T > &&key, const EventContext &ctx)=delete
 ~WriteCondHandle ()
const std::string & key () const
const DataObjID & fullKey () const
bool isValid () const
bool isValid (const EventIDBase &t) const
bool isValid (EventIDRange &range) const
bool isValid (const EventIDBase &t, EventIDRange &range) const
void addDependency (const EventIDRange &range)
template<typename R>
void addDependency (SG::ReadCondHandle< R > &rch)
template<typename R, typename... Args>
void addDependency (ReadCondHandle< R > &rch, Args... args)
StatusCode record (const EventIDRange &range, T *t)
 record handle, with explicit range DEPRECATED
StatusCode record (const EventIDRange &range, std::unique_ptr< T > t)
StatusCode record (std::unique_ptr< T > t)
 record handle, range must have been set by addDependency(...)
StatusCode record (T *t)
StatusCode extendLastRange (const EventIDRange &range, const EventContext &ctx=Gaudi::Hive::currentContext())
 Extend the range of the last IOV.
const std::string & dbKey () const
const EventIDRange & getRange () const

Private Attributes

const EventContext & m_ctx
CondCont< T > * m_cc {nullptr}
const SG::WriteCondHandleKey< T > & m_hkey
EventIDRange m_range {}
bool m_rangeSet {false}

Detailed Description

template<typename T>
class SG::WriteCondHandle< T >

Definition at line 26 of file WriteCondHandle.h.

Member Typedef Documentation

◆ const_pointer_type

template<typename T>
typedef const T* SG::WriteCondHandle< T >::const_pointer_type

Definition at line 30 of file WriteCondHandle.h.

◆ const_reference_type

template<typename T>
typedef const T& SG::WriteCondHandle< T >::const_reference_type

Definition at line 32 of file WriteCondHandle.h.

◆ pointer_type

template<typename T>
typedef T* SG::WriteCondHandle< T >::pointer_type

Definition at line 29 of file WriteCondHandle.h.

◆ reference_type

template<typename T>
typedef T& SG::WriteCondHandle< T >::reference_type

Definition at line 31 of file WriteCondHandle.h.

Constructor & Destructor Documentation

◆ WriteCondHandle() [1/4]

template<typename T>
SG::WriteCondHandle< T >::WriteCondHandle ( const WriteCondHandleKey< T > & key)

Definition at line 109 of file WriteCondHandle.h.

109 :
const std::string & key() const
WriteCondHandle(const WriteCondHandleKey< T > &key)

◆ WriteCondHandle() [2/4]

template<typename T>
SG::WriteCondHandle< T >::WriteCondHandle ( const WriteCondHandleKey< T > & key,
const EventContext & ctx )

Definition at line 115 of file WriteCondHandle.h.

116 :
117 m_ctx(ctx),
118 m_cc( key.getCC() ),
119 m_hkey(key)
120 {
121 if (m_cc == 0) {
122 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
123 msg << MSG::ERROR
124 << "WriteCondHandle : ptr to CondCont<T> is zero"
125 << endmsg;
126 }
127
128 if (! m_hkey.isInit()) {
129 throw SG::ExcUninitKey (key.clid(), key.key(), key.storeHandle().name(),
130 "", "WriteCond");
131 }
132
133 }
const EventContext & m_ctx
const SG::WriteCondHandleKey< T > & m_hkey
CondCont< T > * m_cc
MsgStream & msg
Definition testRead.cxx:32

◆ WriteCondHandle() [3/4]

template<typename T>
SG::WriteCondHandle< T >::WriteCondHandle ( SG::WriteCondHandleKey< T > && key)
delete

◆ WriteCondHandle() [4/4]

template<typename T>
SG::WriteCondHandle< T >::WriteCondHandle ( SG::WriteCondHandleKey< T > && key,
const EventContext & ctx )
delete

◆ ~WriteCondHandle()

template<typename T>
SG::WriteCondHandle< T >::~WriteCondHandle ( )
inline

Definition at line 42 of file WriteCondHandle.h.

42{};

Member Function Documentation

◆ addDependency() [1/3]

template<typename T>
void SG::WriteCondHandle< T >::addDependency ( const EventIDRange & range)

Definition at line 279 of file WriteCondHandle.h.

279 {
280 if ( !m_rangeSet ) {
281 m_range = range;
282 } else {
284 }
285 m_rangeSet = true;
287 if (m_cc->keyType()==KeyType::RUNLBN && (range.start().isTimeStamp() || range.stop().isTimeStamp())) {
288 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
289 msg << MSG::ERROR << "Adding a time-stamp dependency on a run-lumi indexed CondCont. Consider a mixed ConditionsContainer for type " << fullKey() << endmsg;
290 }
291 if (m_cc->keyType()==KeyType::TIMESTAMP && (range.start().isRunLumi() || range.stop().isRunLumi())) {
292 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
293 msg << MSG::ERROR << "Adding a run-lumi dependency on a timestamp-indexed CondCont. Consider a mixed ConditionsContainer for type " << fullKey() << endmsg;
294 }
295 }
const DataObjID & fullKey() const

◆ addDependency() [2/3]

template<typename T>
template<typename R, typename... Args>
void SG::WriteCondHandle< T >::addDependency ( ReadCondHandle< R > & rch,
Args... args )

Definition at line 310 of file WriteCondHandle.h.

310 {
312 return addDependency( args... );
313 }
void addDependency(const EventIDRange &range)

◆ addDependency() [3/3]

template<typename T>
template<typename R>
void SG::WriteCondHandle< T >::addDependency ( SG::ReadCondHandle< R > & rch)

Definition at line 301 of file WriteCondHandle.h.

301 {
302 CondContBase* dep_cc = rch.getCC();
303 dep_cc->addDep (m_cc);
304 return addDependency(rch.getRange());
305 }
const EventIDRange & getRange() const

◆ dbKey()

template<typename T>
const std::string & SG::WriteCondHandle< T >::dbKey ( ) const
inline

Definition at line 91 of file WriteCondHandle.h.

91{ return m_hkey.dbKey(); }

◆ extendLastRange()

template<typename T>
StatusCode SG::WriteCondHandle< T >::extendLastRange ( const EventIDRange & r,
const EventContext & ctx = Gaudi::Hive::currentContext() )

Extend the range of the last IOV.

Parameters
rangeNew validity range.
ctxEvent context.

Returns failure if the start time of range 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 range. (If the end time for range is before the end of the last IOV, then nothing is changed.)

Definition at line 232 of file WriteCondHandle.h.

233 {
234 return m_cc->extendLastRange (r, ctx);
235 }

◆ fullKey()

template<typename T>
const DataObjID & SG::WriteCondHandle< T >::fullKey ( ) const
inline

Definition at line 45 of file WriteCondHandle.h.

45{ return m_hkey.fullKey(); }

◆ getRange()

template<typename T>
const EventIDRange & SG::WriteCondHandle< T >::getRange ( ) const
inline

Definition at line 93 of file WriteCondHandle.h.

93{ return m_range; }

◆ isValid() [1/4]

template<typename T>
bool SG::WriteCondHandle< T >::isValid ( ) const

Definition at line 252 of file WriteCondHandle.h.

252 {
253
254 return (m_cc->valid(m_ctx.eventID()));
255 }

◆ isValid() [2/4]

template<typename T>
bool SG::WriteCondHandle< T >::isValid ( const EventIDBase & t) const

Definition at line 242 of file WriteCondHandle.h.

242 {
243
244 return (m_cc->valid(t));
245 }

◆ isValid() [3/4]

template<typename T>
bool SG::WriteCondHandle< T >::isValid ( const EventIDBase & t,
EventIDRange & range ) const

Definition at line 261 of file WriteCondHandle.h.

261 {
262
263 return (m_cc->range(t, range));
264 }

◆ isValid() [4/4]

template<typename T>
bool SG::WriteCondHandle< T >::isValid ( EventIDRange & range) const

Definition at line 271 of file WriteCondHandle.h.

271 {
272
273 return (m_cc->range(m_ctx.eventID(), range));
274 }

◆ key()

template<typename T>
const std::string & SG::WriteCondHandle< T >::key ( ) const
inline

Definition at line 44 of file WriteCondHandle.h.

44{ return m_hkey.key(); }

◆ record() [1/4]

template<typename T>
StatusCode SG::WriteCondHandle< T >::record ( const EventIDRange & range,
std::unique_ptr< T > t )

Definition at line 140 of file WriteCondHandle.h.

141 {
142
143 if (m_rangeSet) {
144 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
145 msg << MSG::ERROR
146 << "WriteCondHandle::record(EventIDRange, T*): for key "
147 << this->fullKey()
148 << " cannot use this method if range has already been set via dependencies"
149 << endmsg;
150 return StatusCode::FAILURE;
151 }
152
153 m_range = r;
154 m_rangeSet = true;
155
156 return record( std::move(t) );
157 }
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED

◆ record() [2/4]

template<typename T>
StatusCode SG::WriteCondHandle< T >::record ( const EventIDRange & range,
T * t )

record handle, with explicit range DEPRECATED

Parameters
rangeIOVRange of handle
tunique_ptr to handle

Definition at line 161 of file WriteCondHandle.h.

162 {
163 return record (r, std::unique_ptr<T> (t));
164 }

◆ record() [3/4]

template<typename T>
StatusCode SG::WriteCondHandle< T >::record ( std::unique_ptr< T > t)

record handle, range must have been set by addDependency(...)

Parameters
tunique_ptr to handle

Definition at line 174 of file WriteCondHandle.h.

174 {
175 if (! m_rangeSet) {
176 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
177 msg << MSG::ERROR
178 << "WriteCondHandle::record() : no range defined for key "
179 << this->fullKey()
180 << endmsg;
181 return StatusCode::FAILURE;
182 }
183
184 #ifndef NDEBUG
185 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
186 if (msg.level() <= MSG::DEBUG) {
187 msg << MSG::DEBUG
188 << "WriteCondHandle::record() : obj at: " << t.get() << " range: "
189 << m_range << endmsg;
190 }
191 #endif
192
193 StatusCode sc = m_cc->insert(m_range, std::move(t));
194 // Preserve sc for return, since it may be DUPLICATE.
195 if (sc.isFailure()) {
196 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
197 msg << MSG::ERROR
198 << "WriteCondHandle::record() : unable to insert obj in CondCont<T>"
199 << endmsg;
200 return StatusCode::FAILURE;
202#if 0
203 // Temporarily disable this check until caching issues with IOVDbSvc
204 // are sorted out.
205 MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
206 msg << MSG::ERROR
207 << "WriteCondHandle::record() : IOV ranges overlap."
208 << endmsg;
209 return StatusCode::FAILURE;
210#endif
212 }
213
214 return sc;
215 }

◆ record() [4/4]

template<typename T>
StatusCode SG::WriteCondHandle< T >::record ( T * t)

Definition at line 168 of file WriteCondHandle.h.

168 {
169 return record (std::unique_ptr<T> (t));
170 }

Member Data Documentation

◆ m_cc

template<typename T>
CondCont<T>* SG::WriteCondHandle< T >::m_cc {nullptr}
private

Definition at line 98 of file WriteCondHandle.h.

98{nullptr};

◆ m_ctx

template<typename T>
const EventContext& SG::WriteCondHandle< T >::m_ctx
private

Definition at line 97 of file WriteCondHandle.h.

◆ m_hkey

template<typename T>
const SG::WriteCondHandleKey<T>& SG::WriteCondHandle< T >::m_hkey
private

Definition at line 100 of file WriteCondHandle.h.

◆ m_range

template<typename T>
EventIDRange SG::WriteCondHandle< T >::m_range {}
private

Definition at line 102 of file WriteCondHandle.h.

102{};

◆ m_rangeSet

template<typename T>
bool SG::WriteCondHandle< T >::m_rangeSet {false}
private

Definition at line 103 of file WriteCondHandle.h.

103{false};

The documentation for this class was generated from the following file: