Skip to content
Snippets Groups Projects
Commit cd253430 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'writecondhandle' into 'master'

WriteCondHandle: Extend duplicate cond object range if possible

See merge request atlas/athena!21303
parents 1d41c7a1 9142cbf6
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/*
*/
......@@ -57,11 +57,7 @@ StatusCode CondAlg1::execute (const EventContext& ctx) const
SG::WriteCondHandle<DMTest::S2> scond (m_scondKey, ctx);
auto s2 = std::make_unique<DMTest::S2> (xint*100);
StatusCode sc = scond.record (range, std::move(s2));
ATH_CHECK( sc );
if (CondContBase::Category::isDuplicate (sc)) {
ATH_CHECK( scond.extendLastRange (range, ctx) );
}
ATH_CHECK( scond.record (range, std::move(s2) ) );
return StatusCode::SUCCESS;
}
......
......@@ -63,7 +63,7 @@ namespace SG {
private:
const EventIDBase& m_eid;
const EventContext& m_ctx;
CondCont<T>* m_cc {nullptr};
const SG::WriteCondHandleKey<T>& m_hkey;
......@@ -82,7 +82,7 @@ namespace SG {
template <typename T>
WriteCondHandle<T>::WriteCondHandle( const SG::WriteCondHandleKey<T>& key,
const EventContext& ctx) :
m_eid(ctx.eventID()),
m_ctx(ctx),
m_cc( key.getCC() ),
m_hkey(key)
{
......@@ -135,6 +135,17 @@ namespace SG {
#endif
sc = StatusCode::SUCCESS;
}
// If the object exists already, try to extend it
else if (CondContBase::Category::isDuplicate (sc) &&
m_cc->keyType() != CondContBase::KeyType::MIXED) {
sc = this->extendLastRange(r, m_ctx);
if (sc.isFailure()) {
msg << MSG::ERROR
<< "WriteCondHandle::record() : cannot extend duplicate range"
<< endmsg;
return StatusCode::FAILURE;
}
}
return sc;
}
......@@ -184,7 +195,7 @@ namespace SG {
bool
WriteCondHandle<T>::isValid() {
return (m_cc->valid(m_eid));
return (m_cc->valid(m_ctx.eventID()));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment