2 #include "GaudiKernel/AlgTool.h"
3 #include "GaudiKernel/IMessageSvc.h"
4 #include "GaudiKernel/ISvcLocator.h"
5 #include "GaudiKernel/IJobOptionsSvc.h"
7 #include "GaudiKernel/Algorithm.h"
8 #include "GaudiKernel/Service.h"
9 #include "GaudiKernel/Auditor.h"
10 #include "GaudiKernel/System.h"
11 #include "GaudiKernel/GaudiException.h"
12 #include "GaudiKernel/ServiceLocatorHelper.h"
13 #include "GaudiKernel/ThreadGaudi.h"
14 #include "GaudiKernel/Guards.h"
18 template <
typename FUN>
27 catch(
const std::exception& Exception ) {
50 [&](
const std::pair<InterfaceID,void*>&
item) {
51 return item.first.versionMatch(riid);
134 return m_propertyMgr->getProperty(p);
147 return m_propertyMgr->getProperty(
n,v);
175 if(jos->setMyProperties(
name(),
this ).isFailure()) {
191 const std::string&
name,
196 , m_parent ( parent )
212 if (
Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) )
218 else if (
Service* _svc = dynamic_cast<Service*> ( _p ) )
224 else if (
AlgTool* _too = dynamic_cast<AlgTool*> ( _p ) )
230 else if (
Auditor* _aud = dynamic_cast<Auditor*> ( _p ) )
239 (
"Failure to create tool '"
240 + type +
"/" + name +
"': illegal parent type '"
248 throw GaudiException(
"Could not locate ApplicationMgr",
"AlgTool",0);
269 return attempt( *
this,
"sysInitialize", [&]() {
293 return attempt( *
this,
"sysInitialize", [&]() {
316 return attempt( *
this,
"sysStop", [&]() {
339 return attempt( *
this,
"sysFinalize", [&]() {
366 <<
"sysReinitialize(): cannot reinitialize tool not initialized"
371 return attempt(*
this,
"SysReinitialize()", [&]() {
414 <<
"sysRestart(): cannot reinitialize tool not started"
419 return attempt(*
this,
"sysRestart", [&]() {
462 void** ppSvc)
const {
464 return helper.
getService(svcName, createIf, iid, ppSvc);
470 const std::string& svcName,
472 void** ppSvc)
const {
479 return helper.
service(name, quiet, createIf);
Definition of the MsgStream class used to transmit messages.
an helper to share the implementation of service() among the various kernel base classes ...
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
GAUDI_API std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
StatusCode setProperty(const Property &p) override
set the property form another property
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
GAUDI_API bool isGaudiThreaded(const std::string &name)
test if current Gaudi object is running /will run in a thread
auto begin(reverse_wrapper< T > &w)
bool isSuccess() const
Test for a status code of SUCCESS.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
GAUDI_API std::string getGaudiThreadGenericName(const std::string &name)
helper function to extract Gaudi instance name from thread copy name
Property manager helper class.
bool isFailure() const
Test for a status code of FAILURE.
StatusCode getProperty(Property *p) const override
get the property
TYPE * get() const
Get interface pointer.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Main interface for the JobOptions service.
auto end(reverse_wrapper< T > &w)
unsigned long addRef() override
Reference Interface instance.
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
const std::vector< Property * > & getProperties() const override
get all properties
The IMessage is the interface implemented by the message service.
virtual const std::string & tag() const
name tag for the exception, or exception type
const TYPE & value() const
explicit conversion
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
Base class from which all concrete algorithm classes should be derived.
Property base class allowing Property* collections to be "homogeneous".
bool assign(const Property &source) override
get the value from another property
double fun(const std::vector< double > &x)
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
virtual void declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
SmartIF< IService > service(const std::string &name, const bool quiet=false, const bool createIf=true) const
The IProperty is the basic interface for all components which have properties that can be set or get...
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
The interface implemented by the IAuditorSvc base class.
Base class for all services.
virtual void undeclareAll(const IInterface *owner)=0
Undeclare monitoring information.
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
StatusCode createService(const std::string &name, const InterfaceID &iid, void **ppSvc) const
Base class from which all concrete auditor classes should be derived.