The Gaudi Framework  v37r0 (b608885e)
Gaudi::Examples::Conditions::ConditionAccessorHolder< Base > Class Template Reference

Example of a ConditionAccessorHolder implementation. More...

#include </builds/gaudi/Gaudi/GaudiExamples/include/Gaudi/Examples/Conditions/ConditionAccessorHolder.h>

Inheritance diagram for Gaudi::Examples::Conditions::ConditionAccessorHolder< Base >:
Collaboration diagram for Gaudi::Examples::Conditions::ConditionAccessorHolder< Base >:

Classes

class  ConditionAccessor
 Class wrapping the communication between condition users and conditions backend. More...
 

Public Types

using base_class = ConditionAccessorHolder< Base >
 Helper to expose this class to specializations without having to spell the whole name (see Gaudi::Examples::Conditions::UserAlg) More...
 
using ConditionContext = details::ConditionsStore::ConditionContext
 Forward backend specific ConditionContext to specializations. More...
 
using ConditionKey = details::ConditionsStore::ConditionKey
 Forward backend specific ConditionKey to specializations. More...
 

Public Member Functions

StatusCode initialize () override
 
const ConditionContextgetConditionContext (const EventContext &ctx) const
 Helper to map the event being processed to the corresponding conditions slot. More...
 

Private Member Functions

template<typename T >
void registerConditionAccessor (ConditionAccessor< T > &accessor)
 Register a ConditionAccessor instance to internal bookkeeping. More...
 

Private Attributes

std::list< std::function< void()> > m_delayedRegistrations
 Helper to postpone the registration to the backend. More...
 

Friends

template<typename T >
class ConditionAccessor
 

Detailed Description

template<typename Base>
class Gaudi::Examples::Conditions::ConditionAccessorHolder< Base >

Example of a ConditionAccessorHolder implementation.

Requirements are:

Component classes that require conditions have to inherit from this class, templated with the component base class. E.g.

class MyConditionAlgorithm final : ConditionAccessorHolder<Gaudi::Algorithm> {
// ...
};

See Gaudi::Examples::Conditions::UserAlg for example.

Definition at line 77 of file ConditionAccessorHolder.h.

Member Typedef Documentation

◆ base_class

Helper to expose this class to specializations without having to spell the whole name (see Gaudi::Examples::Conditions::UserAlg)

Definition at line 84 of file ConditionAccessorHolder.h.

◆ ConditionContext

Forward backend specific ConditionContext to specializations.

It is used to refer to a specific conditions slot.

Definition at line 89 of file ConditionAccessorHolder.h.

◆ ConditionKey

Forward backend specific ConditionKey to specializations.

Used to identify a specific condition in a condition slot.

Definition at line 94 of file ConditionAccessorHolder.h.

Member Function Documentation

◆ getConditionContext()

template<typename Base >
const ConditionContext& Gaudi::Examples::Conditions::ConditionAccessorHolder< Base >::getConditionContext ( const EventContext ctx) const
inline

Helper to map the event being processed to the corresponding conditions slot.

Definition at line 141 of file ConditionAccessorHolder.h.

141  {
143  }

◆ initialize()

template<typename Base >
StatusCode Gaudi::Examples::Conditions::ConditionAccessorHolder< Base >::initialize ( )
inlineoverride

Definition at line 127 of file ConditionAccessorHolder.h.

127  {
128  auto sc = Base::initialize();
129  if ( !sc ) return sc;
130 
131  // backend-specific initialization
132 
133  // trigger delayed registrations
134  for ( auto& action : m_delayedRegistrations ) { action(); }
136 
137  return sc;
138  }

◆ registerConditionAccessor()

template<typename Base >
template<typename T >
void Gaudi::Examples::Conditions::ConditionAccessorHolder< Base >::registerConditionAccessor ( ConditionAccessor< T > &  accessor)
inlineprivate

Register a ConditionAccessor instance to internal bookkeeping.

Definition at line 151 of file ConditionAccessorHolder.h.

151  {
152  if ( this->targetFSMState() == Gaudi::StateMachine::INITIALIZED ) {
154  } else {
155  m_delayedRegistrations.push_back( [this, &accessor]() { registerConditionAccessor( accessor ); } );
156  }
157  }

Friends And Related Function Documentation

◆ ConditionAccessor

template<typename Base >
template<typename T >
friend class ConditionAccessor
friend

Definition at line 147 of file ConditionAccessorHolder.h.

Member Data Documentation

◆ m_delayedRegistrations

template<typename Base >
std::list<std::function<void()> > Gaudi::Examples::Conditions::ConditionAccessorHolder< Base >::m_delayedRegistrations
private

Helper to postpone the registration to the backend.

In Gaudi properties are set during initialize, so, in this example implementation, the registration has to be delayed from construction time to initialization time.

Definition at line 163 of file ConditionAccessorHolder.h.


The documentation for this class was generated from the following file:
Gaudi::Examples::Conditions::ConditionAccessorHolder::m_delayedRegistrations
std::list< std::function< void()> > m_delayedRegistrations
Helper to postpone the registration to the backend.
Definition: ConditionAccessorHolder.h:163
Gaudi::Examples::Conditions::details::ConditionsStore::declareKey
void declareKey(const ConditionKey &key)
Definition: Backend.cpp:20
std::list::clear
T clear(T... args)
std::list::push_back
T push_back(T... args)
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:588
Gaudi::Examples::Conditions::details::ConditionsStore::instance
static ConditionsStore & instance()
Definition: Backend.cpp:15
Gaudi::Examples::Conditions::details::ConditionsStore::getConditionContext
const ConditionContext & getConditionContext(const EventContext &ctx) const
Definition: Backend.cpp:26
Gaudi::StateMachine::INITIALIZED
@ INITIALIZED
Definition: StateMachine.h:25
gaudirun.action
action
Definition: gaudirun.py:155
Gaudi::Examples::Conditions::ConditionAccessorHolder::registerConditionAccessor
void registerConditionAccessor(ConditionAccessor< T > &accessor)
Register a ConditionAccessor instance to internal bookkeeping.
Definition: ConditionAccessorHolder.h:151