2 #include "GaudiKernel/AlgTool.h"
3 #include "GaudiKernel/IMessageSvc.h"
4 #include "GaudiKernel/ISvcLocator.h"
5 #include "GaudiKernel/IJobOptionsSvc.h"
6 #include "GaudiKernel/IDataManagerSvc.h"
8 #include "GaudiKernel/Algorithm.h"
9 #include "GaudiKernel/Service.h"
10 #include "GaudiKernel/Auditor.h"
11 #include "GaudiKernel/System.h"
12 #include "GaudiKernel/GaudiException.h"
13 #include "GaudiKernel/ServiceLocatorHelper.h"
14 #include "GaudiKernel/ThreadGaudi.h"
15 #include "GaudiKernel/Guards.h"
16 #include "GaudiKernel/ToolHandle.h"
20 template <
typename FUN>
29 catch(
const std::exception& Exception ) {
52 [&](
const std::pair<InterfaceID,void*>&
item) {
53 return item.first.versionMatch(riid);
149 return m_propertyMgr->getProperty(p);
162 return m_propertyMgr->getProperty(
n,v);
190 if(jos->setMyProperties(
name(),
this ).isFailure()) {
206 const std::string&
name,
211 , m_parent ( parent )
227 if (
Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) )
233 else if (
Service* _svc = dynamic_cast<Service*> ( _p ) )
239 else if (
AlgTool* _too = dynamic_cast<AlgTool*> ( _p ) )
245 else if (
Auditor* _aud = dynamic_cast<Auditor*> ( _p ) )
254 (
"Failure to create tool '"
255 + type +
"/" + name +
"': illegal parent type '"
263 throw GaudiException(
"Could not locate ApplicationMgr",
"AlgTool",0);
284 return attempt( *
this,
"sysInitialize", [&]() {
297 if (m_inputDataObjects[tag].isValid()) {
298 if (m_inputDataObjects[tag].
initialize().isSuccess())
299 log <<
MSG::DEBUG <<
"Data Handle " << tag <<
" ("
300 << m_inputDataObjects[tag].dataProductName()
301 <<
") initialized" <<
endmsg;
303 log <<
MSG::FATAL <<
"Data Handle " << tag <<
" ("
304 << m_inputDataObjects[tag].dataProductName()
305 <<
") could NOT be initialized" <<
endmsg;
309 if (m_outputDataObjects[tag].isValid()) {
310 if (m_outputDataObjects[tag].
initialize().isSuccess())
311 log <<
MSG::DEBUG <<
"Data Handle " << tag <<
" ("
312 << m_outputDataObjects[tag].dataProductName()
313 <<
") initialized" <<
endmsg;
315 log <<
MSG::FATAL <<
"Data Handle " << tag <<
" ("
316 << m_outputDataObjects[tag].dataProductName()
317 <<
") could NOT be initialized" <<
endmsg;
337 return attempt( *
this,
"sysInitialize", [&]() {
360 return attempt( *
this,
"sysStop", [&]() {
383 return attempt( *
this,
"sysFinalize", [&]() {
410 <<
"sysReinitialize(): cannot reinitialize tool not initialized"
415 return attempt(*
this,
"SysReinitialize()", [&]() {
458 <<
"sysRestart(): cannot reinitialize tool not started"
463 return attempt(*
this,
"sysRestart", [&]() {
512 if(th->retrieve(tool).isSuccess() && tool !=
nullptr){
514 log <<
MSG::DEBUG <<
"Adding ToolHandle tool " << tool->name() <<
" (" << tool->
type() <<
")" <<
endmsg;
543 void** ppSvc)
const {
545 return helper.
getService(svcName, createIf, iid, ppSvc);
551 const std::string& svcName,
553 void** ppSvc)
const {
560 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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
StatusCode setProperty(const Property &p) override
set the property form another property
GAUDI_API bool isGaudiThreaded(const std::string &name)
test if current Gaudi object is running /will run in a thread
bool isSuccess() const
Test for a status code of SUCCESS.
auto begin(reverse_wrapper< T > &w)
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
Data provider interface definition.
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.
unsigned long addRef() override
Reference Interface instance.
auto end(reverse_wrapper< T > &w)
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.
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.