AlgTool.cpp
Go to the documentation of this file.
1 // Include files
2 #include "GaudiKernel/AlgTool.h"
3 #include "GaudiKernel/IMessageSvc.h"
4 #include "GaudiKernel/ISvcLocator.h"
5 #include "GaudiKernel/IJobOptionsSvc.h"
6 
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"
15 
16 //------------------------------------------------------------------------------
18 ( const InterfaceID& riid ,
19  void** ppvi )
20 //------------------------------------------------------------------------------
21 {
22  if ( 0 == ppvi ) { return StatusCode::FAILURE ; } // RETURN
23  StatusCode sc = base_class::queryInterface(riid,ppvi);
24  if (sc.isSuccess()) {
25  return sc;
26  }
27  else {
28  for ( InterfaceList::iterator it = m_interfaceList.begin() ;
29  m_interfaceList.end() != it ; ++it )
30  {
31  if ( !it->first.versionMatch ( riid ) ) { continue ; }
32  // OK
33  *ppvi = it->second ;
34  addRef() ;
35  return SUCCESS ; // RETURN
36  }
37  *ppvi = 0 ;
38  return NO_INTERFACE ; // RETURN
39  }
40  // cannot reach this point
41 }
42 //------------------------------------------------------------------------------
43 void AlgTool::declInterface( const InterfaceID& iid, void* ii)
44 //------------------------------------------------------------------------------
45 {
46  m_interfaceList.push_back(std::make_pair(iid, ii));
47 }
48 
49 
50 //------------------------------------------------------------------------------
51 const std::string& AlgTool::name() const
52 //------------------------------------------------------------------------------
53 {
54  return m_name;
55 }
56 
57 //------------------------------------------------------------------------------
58 const std::string& AlgTool::type() const
59 //------------------------------------------------------------------------------
60 {
61  return m_type;
62 }
63 
64 //------------------------------------------------------------------------------
66 //------------------------------------------------------------------------------
67 {
68  return m_parent;
69 }
70 
71 //------------------------------------------------------------------------------
73 //------------------------------------------------------------------------------
74 {
75  return m_svcLocator;
76 }
77 
78 //------------------------------------------------------------------------------
80 //------------------------------------------------------------------------------
81 {
82  return m_messageSvc;
83 }
84 
85 //------------------------------------------------------------------------------
87 //------------------------------------------------------------------------------
88 {
89  if ( 0 == m_ptoolSvc ) {
90  StatusCode sc = service( "ToolSvc", m_ptoolSvc, true );
91  if( sc.isFailure() ) {
92  throw GaudiException("Service [ToolSvc] not found", name(), sc);
93  }
94  }
95  return m_ptoolSvc;
96 }
97 
98 //------------------------------------------------------------------------------
100 //------------------------------------------------------------------------------
101 {
102  return m_propertyMgr->setProperty(p);
103 }
104 
105 //------------------------------------------------------------------------------
106 StatusCode AlgTool::setProperty(const std::string& s)
107 //------------------------------------------------------------------------------
108 {
109  return m_propertyMgr->setProperty(s);
110 }
111 
112 //------------------------------------------------------------------------------
113 StatusCode AlgTool::setProperty(const std::string& n, const std::string& v)
114 //------------------------------------------------------------------------------
115 {
116  return m_propertyMgr->setProperty(n,v);
117 }
118 
119 //------------------------------------------------------------------------------
121 //------------------------------------------------------------------------------
122 {
123  return m_propertyMgr->getProperty(p);
124 }
125 
126 //------------------------------------------------------------------------------
127 const Property& AlgTool::getProperty(const std::string& n) const
128 {
129  return m_propertyMgr->getProperty(n);
130 }
131 
132 //------------------------------------------------------------------------------
133 StatusCode AlgTool::getProperty(const std::string& n, std::string& v ) const
134 //------------------------------------------------------------------------------
135 {
136  return m_propertyMgr->getProperty(n,v);
137 }
138 
139 //------------------------------------------------------------------------------
140 const std::vector<Property*>& AlgTool::getProperties() const
141 //------------------------------------------------------------------------------
142 {
143  return m_propertyMgr->getProperties();
144 }
145 
146 bool AlgTool::hasProperty(const std::string& name) const {
147  return m_propertyMgr->hasProperty(name);
148 }
149 
150 //------------------------------------------------------------------------------
152 //------------------------------------------------------------------------------
153 {
154  if( m_svcLocator == 0) {
155  return StatusCode::FAILURE;
156  }
157  SmartIF<IJobOptionsSvc> jos(m_svcLocator->service("JobOptionsSvc"));
158  if( !jos.isValid() ) return StatusCode::FAILURE;
159 
160  // set first generic Properties
161  StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
162  if( sc.isFailure() ) return StatusCode::FAILURE;
163 
164  // set specific Properties
165  if (isGaudiThreaded(name())) {
166  if(jos->setMyProperties( name(), this ).isFailure()) {
167  return StatusCode::FAILURE;
168  }
169  }
170 
171  // Change my own outputlevel
172  if ( 0 != m_messageSvc )
173  {
174  if ( MSG::NIL != m_outputLevel )
175  { m_messageSvc -> setOutputLevel ( name () , m_outputLevel ) ; }
177  }
178 
179  return StatusCode::SUCCESS;
180 }
181 
182 //------------------------------------------------------------------------------
183 AlgTool::AlgTool( const std::string& type,
184  const std::string& name,
185  const IInterface* parent)
186 //------------------------------------------------------------------------------
187  : m_outputLevel ( MSG::NIL )
188  , m_type ( type )
189  , m_name ( name )
190  , m_parent ( parent )
191  , m_svcLocator ( 0 )
192  , m_messageSvc ( 0 )
193  , m_ptoolSvc ( 0 )
194  , m_pMonitorSvc ( NULL )
195  , m_propertyMgr ( new PropertyMgr() )
196  , m_interfaceList ( )
197  , m_threadID ( )
198  , m_pAuditorSvc ( 0 )
199  , m_auditInit ( false )
200  , m_auditorInitialize(false)
201  , m_auditorStart(false)
202  , m_auditorStop(false)
203  , m_auditorFinalize(false)
204  , m_auditorReinitialize(false)
205  , m_auditorRestart(false)
206  , m_state ( Gaudi::StateMachine::CONFIGURED )
207  , m_targetState ( Gaudi::StateMachine::CONFIGURED )
208 {
209  addRef(); // Initial count set to 1
210 
211  declareProperty( "MonitorService", m_monitorSvcName = "MonitorSvc" );
212 
213  { // get the "OutputLevel" property from parent
214  const Property* _p = Gaudi::Utils::getProperty ( parent , "OutputLevel") ;
215  if ( 0 != _p ) { m_outputLevel.assign( *_p ) ; }
216  declareProperty ( "OutputLevel" , m_outputLevel ) ;
218  }
219 
220  IInterface* _p = const_cast<IInterface*> ( parent ) ;
221 
222  if ( Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) )
223  {
224  m_svcLocator = _alg -> serviceLocator () ;
225  m_messageSvc = _alg -> msgSvc () ;
226  m_threadID = getGaudiThreadIDfromName ( _alg -> name() ) ;
227  }
228  else if ( Service* _svc = dynamic_cast<Service*> ( _p ) )
229  {
230  m_svcLocator = _svc -> serviceLocator () ;
231  m_messageSvc = _svc -> msgSvc () ;
232  m_threadID = getGaudiThreadIDfromName ( _svc -> name() ) ;
233  }
234  else if ( AlgTool* _too = dynamic_cast<AlgTool*> ( _p ) )
235  {
236  m_svcLocator = _too -> m_svcLocator;
237  m_messageSvc = _too -> m_messageSvc;
239  }
240  else if ( Auditor* _aud = dynamic_cast<Auditor*> ( _p ) )
241  {
242  m_svcLocator = _aud -> serviceLocator() ;
243  m_messageSvc = _aud -> msgSvc() ;
244  m_threadID = getGaudiThreadIDfromName ( _aud -> name() ) ;
245  }
246  else
247  {
248  throw GaudiException
249  ( "Failure to create tool '"
250  + type + "/" + name + "': illegal parent type '"
251  + System::typeinfoName(typeid(*_p)) + "'", "AlgTool", 0 );
252  }
253 
254 
255  { // audit tools
256  SmartIF<IProperty> appMgr(m_svcLocator->service("ApplicationMgr"));
257  if ( !appMgr.isValid() ) {
258  throw GaudiException("Could not locate ApplicationMgr","AlgTool",0);
259  }
260  const Property* p = Gaudi::Utils::getProperty( appMgr , "AuditTools");
261  if ( 0 != p ) { m_auditInit.assign ( *p ) ; }
262  declareProperty ( "AuditTools", m_auditInit );
263  bool audit = m_auditInit.value();
264  // Declare common AlgTool properties with their defaults
265  declareProperty ( "AuditInitialize" , m_auditorInitialize = audit ) ;
266  declareProperty ( "AuditStart" , m_auditorStart = audit ) ;
267  declareProperty ( "AuditStop" , m_auditorStop = audit ) ;
268  declareProperty ( "AuditFinalize" , m_auditorFinalize = audit ) ;
269  }
270 
271  // check thread ID and try if tool name indicates thread ID
272  if ( m_threadID.empty() )
274 }
275 
276 //-----------------------------------------------------------------------------
278 //-----------------------------------------------------------------------------
279 
280  try {
282  Gaudi::Guards::AuditorGuard guard(this,
283  // check if we want to audit the initialize
287  if (sc.isSuccess())
289  return sc;
290  }
291  catch( const GaudiException& Exception ) {
292  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
293  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
294  << " is caught " << endmsg;
295  log << MSG::ERROR << Exception << endmsg;
296  }
297  catch( const std::exception& Exception ) {
298  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
299  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
300  log << MSG::ERROR << Exception.what() << endmsg;
301  }
302  catch( ... ) {
303  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
304  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
305  }
306  return StatusCode::FAILURE ;
307 
308 }
309 
310 //------------------------------------------------------------------------------
312 //------------------------------------------------------------------------------
313 {
314  // For the time being there is nothing to be done here.
315  // Setting the properties is done by the ToolSvc calling setProperties()
316  // explicitly.
317  return StatusCode::SUCCESS;
318 }
319 
320 //-----------------------------------------------------------------------------
322 //-----------------------------------------------------------------------------
323 
324  try {
326  Gaudi::Guards::AuditorGuard guard(this,
327  // check if we want to audit the initialize
328  (m_auditorStart) ? auditorSvc() : 0,
330  StatusCode sc = start();
331  if (sc.isSuccess())
333  return sc;
334  }
335  catch( const GaudiException& Exception ) {
336  MsgStream log ( msgSvc() , name() + ".sysStart()" );
337  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
338  << " is caught " << endmsg;
339  log << MSG::ERROR << Exception << endmsg;
340  }
341  catch( const std::exception& Exception ) {
342  MsgStream log ( msgSvc() , name() + ".sysStart()" );
343  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
344  log << MSG::ERROR << Exception.what() << endmsg;
345  }
346  catch( ... ) {
347  MsgStream log ( msgSvc() , name() + ".sysStart()" );
348  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
349  }
350  return StatusCode::FAILURE ;
351 
352 }
353 
354 //------------------------------------------------------------------------------
356 //------------------------------------------------------------------------------
357 {
358  // For the time being there is nothing to be done here.
359  return StatusCode::SUCCESS;
360 }
361 
362 //-----------------------------------------------------------------------------
364 //-----------------------------------------------------------------------------
365 
366  try {
368  Gaudi::Guards::AuditorGuard guard(this,
369  // check if we want to audit the initialize
370  (m_auditorStop) ? auditorSvc() : 0,
372  StatusCode sc = stop();
373  if (sc.isSuccess())
375  return sc;
376  }
377  catch( const GaudiException& Exception ) {
378  MsgStream log ( msgSvc() , name() + ".sysStop()" );
379  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
380  << " is caught " << endmsg;
381  log << MSG::ERROR << Exception << endmsg;
382  }
383  catch( const std::exception& Exception ) {
384  MsgStream log ( msgSvc() , name() + ".sysStop()" );
385  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
386  log << MSG::ERROR << Exception.what() << endmsg;
387  }
388  catch( ... ) {
389  MsgStream log ( msgSvc() , name() + ".sysStop()" );
390  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
391  }
392  return StatusCode::FAILURE ;
393 
394 }
395 
396 //------------------------------------------------------------------------------
398 //------------------------------------------------------------------------------
399 {
400  // For the time being there is nothing to be done here.
401  return StatusCode::SUCCESS;
402 }
403 
404 //-----------------------------------------------------------------------------
406 //-----------------------------------------------------------------------------
407 
408  try {
410  Gaudi::Guards::AuditorGuard guard(this,
411  // check if we want to audit the initialize
412  (m_auditorFinalize) ? auditorSvc() : 0,
414  StatusCode sc = finalize();
415  if (sc.isSuccess())
417  return sc;
418  }
419  catch( const GaudiException& Exception ) {
420  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
421  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
422  << " is caught " << endmsg;
423  log << MSG::ERROR << Exception << endmsg;
424  }
425  catch( const std::exception& Exception ) {
426  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
427  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
428  log << MSG::ERROR << Exception.what() << endmsg;
429  }
430  catch( ... ) {
431  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
432  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
433  }
434  return StatusCode::FAILURE;
435 
436 }
437 //------------------------------------------------------------------------------
439 //------------------------------------------------------------------------------
440 {
441  // For the time being there is nothing to be done here.
442  return StatusCode::SUCCESS;
443 }
444 
445 //-----------------------------------------------------------------------------
447 //-----------------------------------------------------------------------------
448 
449  // Check that the current status is the correct one.
451  MsgStream log ( msgSvc() , name() );
452  log << MSG::ERROR
453  << "sysReinitialize(): cannot reinitialize tool not initialized"
454  << endmsg;
455  return StatusCode::FAILURE;
456  }
457 
458  try {
459  Gaudi::Guards::AuditorGuard guard(this,
460  // check if we want to audit the initialize
464  return sc;
465  }
466  catch( const GaudiException& Exception ) {
467  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
468  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
469  << " is caught" << endmsg;
470  log << MSG::ERROR << Exception << endmsg;
471  }
472  catch( const std::exception& Exception ) {
473  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
474  log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
475  log << MSG::ERROR << Exception.what() << endmsg;
476  }
477  catch( ... ) {
478  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
479  log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
480  }
481  return StatusCode::FAILURE ;
482 
483 }
484 
485 //------------------------------------------------------------------------------
487 //------------------------------------------------------------------------------
488 {
489  /* @TODO
490  * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
491  * is causing too many problems
492  *
493  // Default implementation is finalize+initialize
494  StatusCode sc = finalize();
495  if (sc.isFailure()) {
496  MsgStream log ( msgSvc() , name() );
497  log << MSG::ERROR << "reinitialize(): cannot be finalized" << endmsg;
498  return sc;
499  }
500  sc = initialize();
501  if (sc.isFailure()) {
502  MsgStream log ( msgSvc() , name() );
503  log << MSG::ERROR << "reinitialize(): cannot be initialized" << endmsg;
504  return sc;
505  }
506  */
507  return StatusCode::SUCCESS;
508 }
509 
510 //-----------------------------------------------------------------------------
512 //-----------------------------------------------------------------------------
513 
514  // Check that the current status is the correct one.
516  MsgStream log ( msgSvc() , name() );
517  log << MSG::ERROR
518  << "sysRestart(): cannot reinitialize tool not started"
519  << endmsg;
520  return StatusCode::FAILURE;
521  }
522 
523  try {
525  Gaudi::Guards::AuditorGuard guard(this,
526  // check if we want to audit the initialize
527  (m_auditorRestart) ? auditorSvc() : 0,
529  StatusCode sc = restart();
530  return sc;
531  }
532  catch( const GaudiException& Exception ) {
533  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
534  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
535  << " is caught" << endmsg;
536  log << MSG::ERROR << Exception << endmsg;
537  }
538  catch( const std::exception& Exception ) {
539  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
540  log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
541  log << MSG::ERROR << Exception.what() << endmsg;
542  }
543  catch( ... ) {
544  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
545  log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
546  }
547  return StatusCode::FAILURE ;
548 
549 }
550 
551 //------------------------------------------------------------------------------
553 //------------------------------------------------------------------------------
554 {
555  // Default implementation is stop+start
556  StatusCode sc = stop();
557  if (sc.isFailure()) {
558  MsgStream log ( msgSvc() , name() );
559  log << MSG::ERROR << "restart(): cannot be stopped" << endmsg;
560  return sc;
561  }
562  sc = start();
563  if (sc.isFailure()) {
564  MsgStream log ( msgSvc() , name() );
565  log << MSG::ERROR << "restart(): cannot be started" << endmsg;
566  return sc;
567  }
568  return StatusCode::SUCCESS;
569 }
570 
571 //------------------------------------------------------------------------------
573 //------------------------------------------------------------------------------
574 {
575  delete m_propertyMgr;
576  if( m_ptoolSvc ) m_ptoolSvc->release();
579 }
580 
581 //------------------------------------------------------------------------------
584 AlgTool::service_i(const std::string& svcName,
585  bool createIf,
586  const InterfaceID& iid,
587  void** ppSvc) const {
588  const ServiceLocatorHelper helper(*serviceLocator(), *this);
589  return helper.getService(svcName, createIf, iid, ppSvc);
590 }
591 
592 //------------------------------------------------------------------------------
594 AlgTool::service_i(const std::string& svcType,
595  const std::string& svcName,
596  const InterfaceID& iid,
597  void** ppSvc) const {
598  const ServiceLocatorHelper helper(*serviceLocator(), *this);
599  return helper.createService(svcType, svcName, iid, ppSvc);
600 }
601 
602 SmartIF<IService> AlgTool::service(const std::string& name, const bool createIf, const bool quiet) const {
603  const ServiceLocatorHelper helper(*serviceLocator(), *this);
604  return helper.service(name, quiet, createIf);
605 }
606 
607 //-----------------------------------------------------------------------------
609 //---------------------------------------------------------------------------
610  if ( 0 == m_pAuditorSvc ) {
611  StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true );
612  if( sc.isFailure() ) {
613  throw GaudiException("Service [AuditorSvc] not found", name(), sc);
614  }
615  }
616  return m_pAuditorSvc;
617 }
618 
619 
620 //-----------------------------------------------------------------------------
622 //-----------------------------------------------------------------------------
623  // do nothing... yet ?
624 }
625 
void initOutputLevel(Property &prop)
callback for output level property
Definition: AlgTool.cpp:621
The interface implemented by the IToolSvc base class.
Definition: IToolSvc.h:17
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
an helper to share the implementation of service() among the various kernel base classes $Id: ...
StatusCode setProperty(const Property &p)
set the property form another property
Define general base for Gaudi exception.
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:332
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
GAUDI_API std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
Definition: ThreadGaudi.cpp:28
virtual StatusCode restart()
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition: AlgTool.cpp:552
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:324
virtual const std::string & type() const
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:58
virtual StatusCode setProperty(const Property &p)
Default implementations for IProperty interface.
Definition: AlgTool.cpp:99
virtual StatusCode sysReinitialize()
Initialize AlgTool.
Definition: AlgTool.cpp:446
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: AlgTool.cpp:438
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
Definition: AlgTool.h:65
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: AlgTool.cpp:584
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GAUDI_API bool isGaudiThreaded(const std::string &name)
test if current Gaudi object is running /will run in a thread
Definition: ThreadGaudi.cpp:75
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
IMessageSvc * m_messageSvc
Message service.
Definition: AlgTool.h:328
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition: AlgTool.cpp:486
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...
Definition: StateMachine.cpp:8
IToolSvc * toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
Definition: AlgTool.cpp:86
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
Definition: AlgTool.cpp:397
IAuditorSvc * m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:346
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:323
return false
Definition: Bootstrap.cpp:338
GAUDI_API std::string getGaudiThreadGenericName(const std::string &name)
helper function to extract Gaudi instance name from thread copy name
Definition: ThreadGaudi.cpp:52
Property manager helper class.
Definition: PropertyMgr.h:34
bool hasProperty(const std::string &name) const
Return true if we have a property with the given name.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
virtual StatusCode sysStart()
Start AlgTool.
Definition: AlgTool.cpp:321
virtual StatusCode sysRestart()
Start AlgTool.
Definition: AlgTool.cpp:511
StatusCode setProperties()
Method for setting declared properties to the values specified in the jobOptions via the job option s...
Definition: AlgTool.cpp:151
Gaudi::InterfaceId< IInterface, 0, 0 > iid
Interface ID.
Definition: IInterface.h:164
std::string m_monitorSvcName
Name to use for Monitor Service.
Definition: AlgTool.h:331
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:325
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
Query for a given interface.
Definition: AlgTool.cpp:18
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
Interface ID class.
Definition: IInterface.h:55
AlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: AlgTool.cpp:183
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: AlgTool.h:235
virtual bool hasProperty(const std::string &name) const
Return true if we have a property with the given name.
Definition: AlgTool.cpp:146
Definition of the basic interface.
Definition: IInterface.h:160
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
std::string m_threadID
Thread Id for Alg Tool.
Definition: AlgTool.h:334
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:326
StatusCode service(const std::string &name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:180
StatusCode getProperty(Property *p) const
get the property
virtual const std::string & tag() const
name tag for the exception, or exception type
virtual StatusCode getProperty(Property *p) const
Get the property by property.
Definition: AlgTool.cpp:120
const TYPE & value() const
explicit conversion
Definition: Property.h:355
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
Definition: Property.cpp:349
bool m_auditorFinalize
flag for auditors in "finalize()"
Definition: AlgTool.h:352
virtual StatusCode sysFinalize()
Finalize AlgTool.
Definition: AlgTool.cpp:405
virtual bool assign(const Property &source)
get the value from another property
Definition: Property.h:283
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
const std::vector< Property * > & getProperties() const
get all properties
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
IMonitorSvc * m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:330
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:356
virtual unsigned long release()=0
Release Interface instance.
virtual ~AlgTool()
Definition: AlgTool.cpp:572
Print levels enumeration.
Definition: IMessageSvc.h:14
bool m_auditorReinitialize
flag for auditors in "reinitialize()"
Definition: AlgTool.h:353
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:34
int outputLevel() const
get tool's output level
Definition: AlgTool.h:306
virtual const std::vector< Property * > & getProperties() const
Get list of properties.
Definition: AlgTool.cpp:140
string s
Definition: gaudirun.py:244
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
Definition: AlgTool.cpp:355
ISvcLocator * m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:327
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
bool m_auditorRestart
flag for auditors in "restart()"
Definition: AlgTool.h:354
tuple appMgr
Definition: IOTest.py:83
virtual const IInterface * parent() const
Retrieve parent of the sub-algtool.
Definition: AlgTool.cpp:65
SmartIF< IService > service(const std::string &name, const bool quiet=false, const bool createIf=true) const
virtual StatusCode sysStop()
Stop AlgTool.
Definition: AlgTool.cpp:363
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:333
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: AlgTool.cpp:311
BooleanProperty m_auditInit
Definition: AlgTool.h:348
bool m_auditorStart
flag for auditors in "start()"
Definition: AlgTool.h:350
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:357
virtual StatusCode sysInitialize()
Initialize AlgTool.
Definition: AlgTool.cpp:277
void declInterface(const InterfaceID &, void *)
declare interface
Definition: AlgTool.cpp:43
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:218
The interface implemented by the IAuditorSvc base class.
Definition: IAuditorSvc.h:16
Base class for all services.
Definition: Service.h:33
bool m_auditorStop
flag for auditors in "stop()"
Definition: AlgTool.h:351
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
virtual void undeclareAll(const IInterface *owner)=0
Undeclare monitoring information.
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
bool m_auditorInitialize
flag for auditors in "initialize()"
Definition: AlgTool.h:349
Helper functions to set/get the application return code.
Definition: __init__.py:1
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:608
string type
Definition: gaudirun.py:151
StatusCode createService(const std::string &name, const InterfaceID &iid, void **ppSvc) const
IToolSvc * m_ptoolSvc
Tool service.
Definition: AlgTool.h:329
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:34