| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Member Functions | Private Attributes | List of all members
AlgContextSvc Class Reference

`#include <src/AlgContextSvc.h>`

Inheritance diagram for AlgContextSvc:
[legend]
Collaboration diagram for AlgContextSvc:
[legend]

## Public Member Functions
StatusCode | setCurrentAlg (IAlgorithm *a) override
| set the currently executing algorithm ("push_back") More...
StatusCode | unSetCurrentAlg (IAlgorithm *a) override
| remove the algorithm ("pop_back") More...
IAlgorithm * | currentAlg () const override
| accessor to current algorithm: More...
const IAlgContextSvc::Algorithms & | algorithms () const override
| get the stack of executed algorithms More...
void | handle (const Incident &) override
| handle incident More...
StatusCode | initialize () override
| standard initialization of the service More...
StatusCode | finalize () override
| standard finalization of the service More...
| ~AlgContextSvc () override=default
| Standard Destructor. More...
Public Member Functions inherited from extends< Service, IAlgContextSvc, IIncidentListener >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Private Member Functions
| AlgContextSvc ()=delete
| AlgContextSvc (const AlgContextSvc &)=delete
AlgContextSvc & | operator= (const AlgContextSvc &)=delete

## Private Attributes
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > | m_algorithms
| the stack of current algorithms More...
SmartIF< IIncidentSvc > | m_inc = nullptr
| pointer to Incident Service More...
Gaudi::Property< bool > | m_check {this, "Check", true, "Flag to perform more checks"}

## Additional Inherited Members
Public Types inherited from extends< Service, IAlgContextSvc, IIncidentListener >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## Detailed Description

Definition at line 28 of file AlgContextSvc.h.

## Constructor & Destructor Documentation

AlgContextSvc::~AlgContextSvc | ( |  | ) |
| override default

Standard Destructor.

AlgContextSvc::AlgContextSvc | ( |  | ) |
| private delete

AlgContextSvc::AlgContextSvc | ( | const AlgContextSvc & |  | ) |
| private delete

## Member Function Documentation

const IAlgContextSvc::Algorithms& AlgContextSvc::algorithms | ( |  | ) | const
| inline override

get the stack of executed algorithms

See also
  IAlgContextSvc

Definition at line 38 of file AlgContextSvc.h.

38 { return *m_algorithms; }
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62

IAlgorithm * AlgContextSvc::currentAlg | ( |  | ) | const
| override

accessor to current algorithm:

See also
  IAlgContextSvc

Definition at line 124 of file AlgContextSvc.cpp.

125 {
126 return (m_algorithms.get() && ! m_algorithms->empty())
127 ? m_algorithms->back()
128 : nullptr;
129 }
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62

StatusCode AlgContextSvc::finalize | ( |  | ) |
| override

standard finalization of the service

See also
  IService

Definition at line 61 of file AlgContextSvc.cpp.

62 {
63 if ( m_algorithms.get() && !m_algorithms->empty() )
64 {
65 warning() << "Non-empty stack of algorithms #"
66 << m_algorithms->size() << endmsg ;
67 }
68 // Incident Service
69 if ( m_inc )
70 {
71 m_inc -> removeListener ( this ) ;
72 m_inc.reset();
73 }
74 // finalize the base class
75 return Service::finalize () ;
76 }
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
AlgContextSvc::m_inc
SmartIF< IIncidentSvc > m_inc
pointer to Incident Service
Definition: AlgContextSvc.h:64
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void AlgContextSvc::handle | ( | const Incident & |  | ) |
| override

handle incident

See also
  IIncidentListener

Definition at line 133 of file AlgContextSvc.cpp.

133 {
134 if ( m_algorithms.get() && !m_algorithms->empty() ) {
135 error() << "Non-empty stack of algorithms #"
136 << m_algorithms->size() << endmsg ;
137 }
138 }
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode AlgContextSvc::initialize | ( |  | ) |
| override

standard initialization of the service

Instantiation of a static factory class used by clients to create instances of this service.

See also
  IService

Definition at line 28 of file AlgContextSvc.cpp.

29 {
30 // Initialize the base class
31 StatusCode sc = Service::initialize () ;
32 if ( sc.isFailure () ) { return sc ; }
33 // Incident Service
34 if ( m_inc )
35 {
36 m_inc -> removeListener ( this ) ;
37 m_inc.reset();
38 }
39 // perform more checks?
40 if ( m_check )
41 {
42 m_inc = Service::service ( "IncidentSvc" , true ) ;
43 if ( !m_inc )
44 {
45 error() << "Could not locate 'IncidentSvc'" << endmsg ;
46 return StatusCode::FAILURE ;
47 }
48 m_inc -> addListener ( this , IncidentType::BeginEvent ) ;
49 m_inc -> addListener ( this , IncidentType::EndEvent ) ;
50 }
51 if ( m_algorithms.get() && !m_algorithms->empty() )
52 {
53 warning() << "Non-empty stack of algorithms #"
54 << m_algorithms->size() << endmsg ;
55 }
56 return StatusCode::SUCCESS ;
57 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
AlgContextSvc::m_inc
SmartIF< IIncidentSvc > m_inc
pointer to Incident Service
Definition: AlgContextSvc.h:64
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
AlgContextSvc::m_check
Gaudi::Property< bool > m_check
Definition: AlgContextSvc.h:66

AlgContextSvc& AlgContextSvc::operator= | ( | const AlgContextSvc & |  | ) |
| private delete

StatusCode AlgContextSvc::setCurrentAlg | ( | IAlgorithm * | a | ) |
| override

set the currently executing algorithm ("push_back")

See also
  IAlgContextSvc

Definition at line 80 of file AlgContextSvc.cpp.

81 {
82 if ( !a )
83 {
84 warning() << "IAlgorithm* points to NULL" << endmsg ;
85 return StatusCode::RECOVERABLE ;
86 }
87 // check whether thread-local algorithm list already exists
88 // if not, create it
89 if ( ! m_algorithms.get()) {
90 m_algorithms.reset( new IAlgContextSvc::Algorithms() );
91 }
92 m_algorithms->push_back ( a ) ;
93
94 return StatusCode::SUCCESS ;
95 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
std::vector< IAlgorithm * >
StatusCode::RECOVERABLE
Definition: StatusCode.h:31
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode AlgContextSvc::unSetCurrentAlg | ( | IAlgorithm * | a | ) |
| override

remove the algorithm ("pop_back")

See also
  IAlgContextSvc

Definition at line 99 of file AlgContextSvc.cpp.

100 {
101 // check whether thread-local algorithm list already exists
102 // if not, create it
103 if ( ! m_algorithms.get()) {
104 m_algorithms.reset( new IAlgContextSvc::Algorithms() );
105 }
106
107 if ( !a )
108 {
109 warning() << "IAlgorithm* points to NULL" << endmsg ;
110 return StatusCode::RECOVERABLE ;
111 }
112 if ( m_algorithms->empty() || m_algorithms->back() != a )
113 {
114 error() << "Algorithm stack is invalid" << endmsg ;
115 return StatusCode::FAILURE ;
116 }
117 m_algorithms->pop_back() ;
118
119 return StatusCode::SUCCESS ;
120 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
AlgContextSvc::m_algorithms
boost::thread_specific_ptr< IAlgContextSvc::Algorithms > m_algorithms
the stack of current algorithms
Definition: AlgContextSvc.h:62
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
std::vector< IAlgorithm * >
StatusCode::RECOVERABLE
Definition: StatusCode.h:31
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

## Member Data Documentation

boost::thread_specific_ptr<IAlgContextSvc::Algorithms> AlgContextSvc::m_algorithms
| private

the stack of current algorithms

Definition at line 62 of file AlgContextSvc.h.

Gaudi::Property<bool> AlgContextSvc::m_check {this, "Check", true, "Flag to perform more checks"}
| private

Definition at line 66 of file AlgContextSvc.h.

SmartIF<IIncidentSvc> AlgContextSvc::m_inc = nullptr
| private

pointer to Incident Service

Definition at line 64 of file AlgContextSvc.h.

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

- GaudiCommonSvc/src/AlgContextSvc.h
- GaudiCommonSvc/src/AlgContextSvc.cpp