ToolSvc Class Reference

This service manages tools. More...

#include <src/ApplicationMgr/ToolSvc.h>

Inheritance diagram for ToolSvc:
Collaboration diagram for ToolSvc:

Public Member Functions

StatusCode initialize () override
 Initialize the service. More...
 
StatusCode finalize () override
 Finalize the service. More...
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode retrieve (const std::string &type, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent, bool createIf) override
 Retrieve tool, create it by default as common tool if it does not already exist. More...
 
StatusCode retrieve (const std::string &tooltype, const std::string &toolname, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent, bool createIf) override
 Retrieve tool, create it by default as common tool if it does not already exist. More...
 
std::vector< std::stringgetInstances (const std::string &toolType) override
 Get names of all tool instances of a given type. More...
 
std::vector< std::stringgetInstances () const override
 Get names of all tool instances. More...
 
std::vector< IAlgTool * > getTools () const override
 Get pointers to all tool instances. More...
 
StatusCode releaseTool (IAlgTool *tool) override
 Release tool. More...
 
StatusCode create (const std::string &type, const IInterface *parent, IAlgTool *&tool)
 Create Tool standard way with automatically assigned name. More...
 
StatusCode create (const std::string &type, const std::string &name, const IInterface *parent, IAlgTool *&tool)
 Create Tool standard way with specified name. More...
 
bool existsTool (const std::string &toolname) const
 Check if the tool instance exists. More...
 
std::string nameTool (const std::string &nameByUser, const IInterface *parent)
 Get Tool full name by combining nameByUser and "parent" part. More...
 
 ToolSvc (const std::string &name, ISvcLocator *svc)
 Standard Constructor. More...
 
 ~ToolSvc () override
 Destructor. More...
 
void registerObserver (IToolSvc::Observer *obs) override
 
- Public Member Functions inherited from extends< Service, IToolSvc >
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::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
const std::stringname () 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::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (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::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
 
Gaudi::Details::PropertyBasedeclareProperty (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::PropertyBasedeclareRemoteProperty (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::PropertyBasegetProperty (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
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
 Specializations for various GaudiHandles. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (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...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () 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 Types

typedef std::recursive_mutex CallMutex
 

Private Member Functions

unsigned long totalToolRefCount () const
 The total number of refCounts on all tools in the instancesTools list. More...
 
unsigned long minimumToolRefCount () const
 The minimum number of refCounts of all tools. More...
 
StatusCode finalizeTool (IAlgTool *itool) const
 Finalize the given tool, with exception handling. More...
 

Private Attributes

std::vector< IAlgTool * > m_instancesTools
 Common Tools. More...
 
IHistorySvcm_pHistorySvc = nullptr
 Pointer to HistorySvc. More...
 
std::vector< IToolSvc::Observer * > m_observers
 
CallMutex m_mut
 

Additional Inherited Members

- Public Types inherited from extends< Service, IToolSvc >
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::PropertyBaseproperty (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< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 

Detailed Description

This service manages tools.

Tools can be common, in which case a single instance can be shared by different algorithms, or private in which case it is necessary to specify the parent when requesting it. The parent of a tool can be an algortihm or a Service The environment of a tool is set by using that of the parent. A common tool is considered to belong to the ToolSvc itself.

Author
G. Corti, P. Mato

Definition at line 23 of file ToolSvc.h.

Member Typedef Documentation

Definition at line 109 of file ToolSvc.h.

Constructor & Destructor Documentation

ToolSvc::ToolSvc ( const std::string name,
ISvcLocator svc 
)

Standard Constructor.

Parameters
nameString with service name
svcPointer to service locator interface

Definition at line 48 of file ToolSvc.cpp.

50  : base_class( name, svc) { }
extends base_class
Typedef to this class.
Definition: extends.h:14
ToolSvc::~ToolSvc ( )
override

Destructor.

Definition at line 52 of file ToolSvc.cpp.

53 {
54  // tell the remaining observers that we're gone, and forget about unregistering..
56  [&]( IToolSvc::Observer* obs )
57  { obs->setUnregister( { } ); }
58  );
59 }
allow call-backs when a tool is a created or retrieved
Definition: IToolSvc.h:245
T end(T...args)
std::vector< IToolSvc::Observer * > m_observers
Definition: ToolSvc.h:107
void setUnregister(std::function< void()> unregister)
Definition: IToolSvc.h:248
T begin(T...args)
T for_each(T...args)

Member Function Documentation

StatusCode ToolSvc::create ( const std::string type,
const IInterface parent,
IAlgTool *&  tool 
)

Create Tool standard way with automatically assigned name.

Definition at line 423 of file ToolSvc.cpp.

427 {
428  const std::string & toolname = tooltype;
429  return create( tooltype, toolname, parent, tool);
430 }
StatusCode create(const std::string &type, const IInterface *parent, IAlgTool *&tool)
Create Tool standard way with automatically assigned name.
Definition: ToolSvc.cpp:423
STL class.
StatusCode ToolSvc::create ( const std::string tooltype,
const std::string toolname,
const IInterface parent,
IAlgTool *&  tool 
)

Create Tool standard way with specified name.

Now able to handle clones.

The test of tool existence is performed according to three criteria: name, type and parent. If a tool is private, i.e. the parent is not the tool Svc, and it exist but the parent is not the specified one, a clone is handed over. No clones of public tools are allowed since they would be undistinguishable.

invoke create callbacks...

Definition at line 488 of file ToolSvc.cpp.

493 {
494 
496  // protect against empty type
497  if ( UNLIKELY(tooltype.empty()) ) {
498  error() << "create(): No Tool Type given" << endmsg;
499  return StatusCode::FAILURE;
500  }
501 
502  // If parent has not been specified, assume it is the ToolSvc
503  if ( !parent ) parent = this;
504 
505  tool = nullptr;
506  // Automatically deletes the tool if not explicitly kept (i.e. on success).
507  // The tool is removed from the list of known tools too.
508  auto toolguard = make_toolCreateGuard(m_instancesTools);
509 
510  // Check if the tool already exist : this could happen with clones
511  std::string fullname = nameTool(toolname, parent);
512  if( UNLIKELY(existsTool(fullname)) ) {
513  // Now check if the parent is the same. This allows for clones
515  if ( iAlgTool->name() == toolname && iAlgTool->parent() == parent){
516  // The tool exist with this name, type and parent: this is bad!
517  // This excludes the possibility of cloning public tools intrinsecally
518  error() << "Tool " << fullname << " already exists with the same parent" << endmsg;
519  if (parent == this)
520  error() << "... In addition, the parent is the ToolSvc: public tools cannot be cloned!" << endmsg;
521 
522  return StatusCode::FAILURE;
523  }
524  }
525  ON_DEBUG debug() << "Creating clone of " << fullname << endmsg;
526  }
527  // instantiate the tool using the factory
528  try {
529  toolguard.create( tooltype, fullname, parent );
530  if ( UNLIKELY(! toolguard.get()) ){
531  error() << "Cannot create tool " << tooltype << " (No factory found)" << endmsg;
532  return StatusCode::FAILURE;
533  }
534  }
535  catch ( const GaudiException& Exception ) {
536  // (1) perform the printout of message
537  fatal() << "Exception with tag=" << Exception.tag()
538  << " is caught whilst instantiating tool '" << tooltype << "'" << endmsg;
539  // (2) print the exception itself
540  // (NB! - GaudiException is a linked list of all "previous exceptions")
541  fatal() << Exception << endmsg;
542  return StatusCode::FAILURE;
543  }
544  catch( const std::exception& Exception ) {
545  // (1) perform the printout of message
546  fatal() << "Standard std::exception is caught whilst instantiating tool '"
547  << tooltype << "'" << endmsg;
548  // (2) print the exception itself
549  // (NB! - GaudiException is a linked list of all "previous exceptions")
550  fatal() << Exception.what() << endmsg;
551  return StatusCode::FAILURE;
552  }
553  catch(...) {
554  // (1) perform the printout
555  fatal() << "UNKNOWN Exception is caught whilst instantiating tool '"
556  << tooltype << "'" << endmsg;
557  return StatusCode::FAILURE;
558  }
559  ON_VERBOSE verbose() << "Created tool " << tooltype << "/" << fullname << endmsg;
560 
561  // Since only AlgTool has the setProperties() method it is necessary to cast
562  // to downcast IAlgTool to AlgTool in order to set the properties via the JobOptions
563  // service
564  AlgTool* mytool = dynamic_cast<AlgTool*> (toolguard.get());
565  if ( mytool ) {
566  StatusCode sc = mytool->setProperties();
567  if ( UNLIKELY(sc.isFailure()) ) {
568  error() << "Error setting properties for tool '"
569  << fullname << "'" << endmsg;
570  return sc;
571  }
572  }
573 
574  // Initialize the Tool
576  try {
577  sc = toolguard->sysInitialize();
578  }
579  // Catch any exceptions
580  catch ( const GaudiException & Exception )
581  {
582  error()
583  << "GaudiException with tag=" << Exception.tag()
584  << " caught whilst initializing tool '" << fullname << "'" << endmsg
585  << Exception << endmsg;
586  return StatusCode::FAILURE;
587  }
588  catch( const std::exception & Exception )
589  {
590  error()
591  << "Standard std::exception caught whilst initializing tool '"
592  << fullname << "'" << endmsg << Exception.what() << endmsg;
593  return StatusCode::FAILURE;
594  }
595  catch (...)
596  {
597  error()
598  << "UNKNOWN Exception caught whilst initializing tool '"
599  << fullname << "'" << endmsg;
600  return StatusCode::FAILURE;
601  }
602 
603  // Status of tool initialization
604  if ( UNLIKELY(sc.isFailure()) ) {
605  error() << "Error initializing tool '" << fullname << "'" << endmsg;
606  return sc;
607  }
608 
609  // Start the tool if we are running.
611  sc = toolguard->sysStart();
612 
613  if (UNLIKELY(sc.isFailure())) {
614  error() << "Error starting tool '" << fullname << "'" << endmsg;
615  return sc;
616  }
617  }
618 
619 
620  // The tool has been successfully created and initialized,
621  // so we inform the guard that it can release it
622  tool = toolguard.release();
623 
628  m_observers.end(),
629  [&](IToolSvc::Observer* obs) { obs->onCreate(tool); } );
630  // TODO: replace by generic callback
631  // Register the tool with the HistorySvc
632  if (m_pHistorySvc || service("HistorySvc",m_pHistorySvc,false).isSuccess() ) {
634  }
635  return StatusCode::SUCCESS;
636 
637 }
IHistorySvc * m_pHistorySvc
Pointer to HistorySvc.
Definition: ToolSvc.h:105
T empty(T...args)
Define general base for Gaudi exception.
Gaudi::StateMachine::State m_state
Service state.
Definition: Service.h:191
std::string nameTool(const std::string &nameByUser, const IInterface *parent)
Get Tool full name by combining nameByUser and "parent" part.
Definition: ToolSvc.cpp:640
allow call-backs when a tool is a created or retrieved
Definition: IToolSvc.h:245
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
#define UNLIKELY(x)
Definition: Kernel.h:126
T end(T...args)
std::vector< IToolSvc::Observer * > m_observers
Definition: ToolSvc.h:107
bool existsTool(const std::string &toolname) const
Check if the tool instance exists.
Definition: ToolSvc.cpp:662
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
StatusCode setProperties()
Method for setting declared properties to the values specified in the jobOptions via the job option s...
Definition: AlgTool.cpp:117
STL class.
virtual void onCreate(const IAlgTool *)
Definition: IToolSvc.h:250
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode registerAlgTool(const IAlgTool &)=0
T lock(T...args)
virtual const std::string & tag() const
name tag for the exception, or exception type
STL class.
virtual unsigned long release()=0
Release Interface instance.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
T begin(T...args)
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:48
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
#define ON_DEBUG
Definition: ToolSvc.cpp:21
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
void ignore() const
Definition: StatusCode.h:106
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
CallMutex m_mut
Definition: ToolSvc.h:110
T for_each(T...args)
#define ON_VERBOSE
Definition: ToolSvc.cpp:22
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool ToolSvc::existsTool ( const std::string toolname) const

Check if the tool instance exists.

Definition at line 662 of file ToolSvc.cpp.

664 {
667  [&](const IAlgTool* tool) { return tool->name() == fullname; } );
668  return i != std::end(m_instancesTools);
669 }
T end(T...args)
T lock(T...args)
T find_if(T...args)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
T begin(T...args)
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
CallMutex m_mut
Definition: ToolSvc.h:110
virtual const std::string & name() const =0
Retrieve the name of the instance.
StatusCode ToolSvc::finalize ( )
override

Finalize the service.

Algorithm: 2 passes. First pass:

  • do not explicitly release any tools
  • finalize tools, in the order of increasing number of refCounts Second pass:
  • explicitly release all tools, one release() on all tools per loop. -> tools are deleted in the order of increasing number of refCounts.

Inner loop: full loop over all left-over tools

  • finalize tools with the minimum number of refCounts in the list.
  • Remove finalized tools from list of tools, and add them to the list of finalized tools, to be deleted at the end. This way, any non-finalized tools who still reference already finalized tools in their finalize() will still find a live tool. Outer loop: keep on going until nothing changes in the list of tools. Checking for:
  • number of left-over tools
  • total number of refcounts
  • minimum number of refcounts

Definition at line 83 of file ToolSvc.cpp.

85 {
86  // Finalize and delete all left-over tools. Normally all tools created with
87  // ToolSvc are left over, since ToolSvc holds a refCount (via AlgTool ctor).
88  // Several cases need to be covered:
89  // 1) Simple dependencies: no circular dependencies between tools,
90  // and tools not using other tools
91  // 2) Tools-using-tools (but no circular dependencies)
92  // a) release() is called in the tool::finalize() (e.g. via GaudiAlgorithm)
93  // b) release() is called in the tool destructor (e.g. via ToolHandle)
94  // 3) Circular dependencies between tools
95  // a) release() is called in the tool::finalize() (e.g. via GaudiAlgorithm)
96  // b) release() is called in the tool destructor (e.g. via ToolHandle)
97  // 4) In addition to each of the above cases, refCounting of a particular tool
98  // might not have been done correctly in the code. Typically release()
99  // is not called, so we are left with a too high refCount.
100  // What to do with those, and how to avoid a crash while handling them...
101 
110  info() << "Removing all tools created by ToolSvc" << endmsg;
111 
112  // Print out list of tools
113  ON_DEBUG {
114  auto &log = debug();
115  log << " Tool List : ";
116  for ( const auto& iTool : m_instancesTools ) {
117  log << iTool->name() << ":" << iTool->refCount( ) << " ";
118  }
119  log << endmsg;
120  }
121 
122  //
123  // first pass: Finalize all tools (but don't delete them)
124  //
137  boost::circular_buffer<IAlgTool*> finalizedTools(m_instancesTools.size()); // list of tools that have been finalized
138  bool fail(false);
139  size_t toolCount = m_instancesTools.size();
140  unsigned long startRefCount = 0;
141  unsigned long endRefCount = totalToolRefCount();
142  unsigned long startMinRefCount = 0;
143  unsigned long endMinRefCount = minimumToolRefCount();
144  while ( toolCount > 0 &&
145  endRefCount > 0 &&
146  (endRefCount != startRefCount || endMinRefCount != startMinRefCount) ) {
147  ON_DEBUG if ( endMinRefCount != startMinRefCount ) {
148  debug() << toolCount << " tools left to finalize. Summed refCounts: "
149  << endRefCount << endmsg;
150  debug() << "Will finalize tools with refCount <= "
151  << endMinRefCount << endmsg;
152  }
153  startMinRefCount = endMinRefCount;
154  startRefCount = endRefCount;
155  unsigned long maxLoop = toolCount + 1;
156  while ( --maxLoop > 0 && !m_instancesTools.empty() ) {
157  IAlgTool* pTool = m_instancesTools.back();
158  // removing tool from list makes ToolSvc::releaseTool( IAlgTool* ) a noop
159  m_instancesTools.pop_back();
160  unsigned long count = pTool->refCount( );
161  // cache tool name
162  const std::string& toolName = pTool->name();
163  if ( count <= startMinRefCount ) {
164  ON_DEBUG debug() << " Performing finalization of " << toolName
165  << " (refCount " << count << ")" << endmsg;
166  // finalize of one tool may trigger a release of another tool
167  // pTool->sysFinalize().ignore();
168  if (!finalizeTool(pTool).isSuccess()) {
169  warning() << " FAILURE finalizing " << toolName << endmsg;
170  fail = true;
171  }
172  // postpone deletion
173  finalizedTools.push_back(pTool);
174  } else {
175  // Place back at the front of the list to try again later
176  // ToolSvc::releaseTool( IAlgTool* ) remains active for this tool
177  ON_DEBUG debug() << " Delaying finalization of " << toolName
178  << " (refCount " << count << ")" << endmsg;
179  m_instancesTools.insert( std::begin(m_instancesTools), pTool );
180  }
181  } // end of inner loop
182  toolCount = m_instancesTools.size();
183  endRefCount = totalToolRefCount();
184  endMinRefCount = minimumToolRefCount();
185  }; // end of outer loop
186 
187  //
188  // Second pass: Delete all finalized tools
189  //
190  // Delete in the order of increasing number of refCounts.
191  // Loop over tools in the same order as the order in which they were finalized.
192  // All tools in the list of finalized tools are no longer in the instancesTools list.
193  // If a tool destructor calls releaseTool() on another tool, this will have no
194  // effect on the 'other tool' if this 'other tool' is in the list of finalized tools.
195  // If this 'other tool' is still in the instancesTools list, it may trigger finalization
196  // (in releaseTool()), deletion and removal from the instancesTools list.
197  // Therefore, the check on non-finalised tools should happen *after* the deletion
198  // of the finalized tools.
199  ON_DEBUG debug() << "Deleting " << finalizedTools.size() << " finalized tools" << endmsg;
200  auto maxLoop = totalRefCount( finalizedTools ) + 1;
201  while ( --maxLoop > 0 && !finalizedTools.empty() ) {
202  IAlgTool* pTool = finalizedTools.front();
203  finalizedTools.pop_front();
204  auto count = pTool->refCount( );
205  if ( count == 1 ) {
206  ON_DEBUG debug() << " Performing deletion of " << pTool->name() << endmsg;
207  } else {
208  ON_VERBOSE verbose() << " Delaying deletion of " << pTool->name()
209  << " (refCount " << count << ")" << endmsg;
210  // Move to the end when refCount still not zero
211  finalizedTools.push_back(pTool);
212  }
213  // do a forced release
214  pTool->release();
215  }
216 
217  // Error if by now not all tools are properly finalised
218  if ( !m_instancesTools.empty() ) {
219  error() << "Unable to finalize and delete the following tools : ";
220  for ( const auto& iTool : m_instancesTools ) {
221  error() << iTool->name() << ": " << iTool->refCount( ) << " ";
222  }
223  error() << endmsg;
224  }
225 
226  // by now, all tools should be deleted and removed.
227  if ( !finalizedTools.empty() ) {
228  error() << "Failed to delete the following " << finalizedTools.size()
229  << " finalized tools. Bug in ToolSvc::finalize()?: ";
230  for ( const auto& iTool : finalizedTools ) {
231  error() << iTool->name() << ": " << iTool->refCount( ) << " ";
232  }
233  error() << endmsg;
234  }
235 
236  if ( m_pHistorySvc ) m_pHistorySvc->release();
237 
238  // Finalize this specific service
239  return ( Service::finalize().isSuccess() && !fail ) ?
242 
243 }
IHistorySvc * m_pHistorySvc
Pointer to HistorySvc.
Definition: ToolSvc.h:105
StatusCode finalize() override
Definition: Service.cpp:174
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
unsigned long minimumToolRefCount() const
The minimum number of refCounts of all tools.
Definition: ToolSvc.cpp:719
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
STL class.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
unsigned long totalToolRefCount() const
The total number of refCounts on all tools in the instancesTools list.
Definition: ToolSvc.cpp:713
StatusCode finalizeTool(IAlgTool *itool) const
Finalize the given tool, with exception handling.
Definition: ToolSvc.cpp:672
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
T count(T...args)
virtual unsigned long release()=0
Release Interface instance.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
T begin(T...args)
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
#define ON_DEBUG
Definition: ToolSvc.cpp:21
virtual unsigned long refCount() const =0
Current reference count.
#define ON_VERBOSE
Definition: ToolSvc.cpp:22
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const =0
Retrieve the name of the instance.
StatusCode ToolSvc::finalizeTool ( IAlgTool itool) const
private

Finalize the given tool, with exception handling.

Definition at line 672 of file ToolSvc.cpp.

674 {
675 
676  // Cache tool name in case of errors
677  const std::string toolName = itool->name();
678  StatusCode sc;
679 
680  // Finalise the tool inside a try block
681  try {
682  sc = itool->sysFinalize();
683  }
684  // Catch any exceptions
685  catch ( const GaudiException & Exception )
686  {
687  error()
688  << "GaudiException with tag=" << Exception.tag()
689  << " caught whilst finalizing tool '" << toolName << "'" << endmsg
690  << Exception << endmsg;
691  sc = StatusCode::FAILURE;
692  }
693  catch( const std::exception & Exception )
694  {
695  error()
696  << "Standard std::exception caught whilst finalizing tool '"
697  << toolName << "'" << endmsg << Exception.what() << endmsg;
698  sc = StatusCode::FAILURE;
699  }
700  catch (...)
701  {
702  error()
703  << "UNKNOWN Exception caught whilst finalizing tool '"
704  << toolName << "'" << endmsg;
705  sc = StatusCode::FAILURE;
706  }
707 
708  return sc;
709 
710 }
Define general base for Gaudi exception.
virtual StatusCode sysFinalize()=0
Finalization of the Tool.
STL class.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual const std::string & tag() const
name tag for the exception, or exception type
STL class.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const =0
Retrieve the name of the instance.
std::vector< std::string > ToolSvc::getInstances ( const std::string toolType)
override

Get names of all tool instances of a given type.

Definition at line 360 of file ToolSvc.cpp.

362 {
363 
366  for(const auto& tool: m_instancesTools) {
367  if (tool->type() == toolType) tools.push_back( tool->name() );
368  }
369  return tools;
370 }
T push_back(T...args)
T lock(T...args)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
CallMutex m_mut
Definition: ToolSvc.h:110
std::vector< std::string > ToolSvc::getInstances ( ) const
override

Get names of all tool instances.

Definition at line 372 of file ToolSvc.cpp.

374 {
378  std::begin(tools), [](const IAlgTool* t) { return t->name(); } );
379  return tools;
380 }
T end(T...args)
T lock(T...args)
T size(T...args)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
T begin(T...args)
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
T transform(T...args)
CallMutex m_mut
Definition: ToolSvc.h:110
virtual const std::string & name() const =0
Retrieve the name of the instance.
std::vector< IAlgTool * > ToolSvc::getTools ( ) const
override

Get pointers to all tool instances.

Definition at line 382 of file ToolSvc.cpp.

384 {
388 }
T end(T...args)
T lock(T...args)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
T begin(T...args)
CallMutex m_mut
Definition: ToolSvc.h:110
StatusCode ToolSvc::initialize ( )
override

Initialize the service.

Definition at line 61 of file ToolSvc.cpp.

63 {
64 
65  // initialize the Service Base class
67  if (UNLIKELY(status.isFailure()))
68  {
69  error() << "Unable to initialize the Service" << endmsg;
70  return status;
71  }
72 
73  // set my own (ToolSvc) properties via the jobOptionService
74  if (UNLIKELY(setProperties().isFailure())) {
75  error() << "Unable to set base properties" << endmsg;
76  return StatusCode::FAILURE;
77  }
78 
79  return status;
80 }
StatusCode initialize() override
Definition: Service.cpp:64
#define UNLIKELY(x)
Definition: Kernel.h:126
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:295
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
unsigned long ToolSvc::minimumToolRefCount ( ) const
private

The minimum number of refCounts of all tools.

Definition at line 719 of file ToolSvc.cpp.

721 {
723  [](const IAlgTool* lhs, const IAlgTool* rhs) {
724  return lhs->refCount() < rhs->refCount();
725  } );
726  return i!=std::end(m_instancesTools) ? (*i)->refCount() : 0;
727 }
T end(T...args)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
T begin(T...args)
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
virtual unsigned long refCount() const =0
Current reference count.
T min_element(T...args)
std::string ToolSvc::nameTool ( const std::string nameByUser,
const IInterface parent 
)

Get Tool full name by combining nameByUser and "parent" part.

Definition at line 640 of file ToolSvc.cpp.

643 {
644 
645  if ( !parent ) { return this->name() + "." + toolname; } // RETURN
646 
647  // check that parent has a name!
648  auto named_parent = SmartIF<INamedInterface>( const_cast<IInterface*>(parent) );
649  if ( named_parent )
650  {
651  auto fullname = named_parent->name() + "." + toolname ;
652  return fullname ; // RETURN
653  }
654 
655  error() << "Private Tools only allowed for components implementing INamedInterface"
656  << endmsg;
657  //
658  return "." + toolname ;
659 }
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition of the basic interface.
Definition: IInterface.h:234
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void ToolSvc::registerObserver ( IToolSvc::Observer obs)
override

Definition at line 730 of file ToolSvc.cpp.

730  {
731 //------------------------------------------------------------------------------
732  if ( !obs )
733  throw GaudiException( "Received NULL pointer", this->name() + "::registerObserver", StatusCode::FAILURE );
734 
736  obs->setUnregister( [this,obs]() {
738  auto i = std::find(m_observers.begin(),m_observers.end(),obs);
739  if (i!=m_observers.end()) m_observers.erase(i);
740  } );
741  m_observers.push_back(obs);
742 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
T end(T...args)
std::vector< IToolSvc::Observer * > m_observers
Definition: ToolSvc.h:107
T push_back(T...args)
T erase(T...args)
T lock(T...args)
T find(T...args)
void setUnregister(std::function< void()> unregister)
Definition: IToolSvc.h:248
T begin(T...args)
CallMutex m_mut
Definition: ToolSvc.h:110
StatusCode ToolSvc::releaseTool ( IAlgTool tool)
override

Release tool.

Definition at line 390 of file ToolSvc.cpp.

392 {
395  // test if tool is in known list (protect trying to access a previously deleted tool)
398  tool ) ) {
399  unsigned long count = tool->refCount();
400  if ( count == 1 ) {
401  // finalize the tool
402 
404  // We are being called during ToolSvc::finalize()
405  // message format matches the one in ToolSvc::finalize()
406  debug() << " Performing finalization of " << tool->name()
407  << " (refCount " << count << ")" << endmsg;
408  // message format matches the one in ToolSvc::finalize()
409  debug() << " Performing deletion of " << tool->name() << endmsg;
410  } else {
411  debug() << "Performing finalization and deletion of " << tool->name() << endmsg;
412  }
413  sc = finalizeTool(tool);
414  // remove from known tools...
415  remove(m_instancesTools,tool);
416  }
417  tool->release();
418  }
419  return sc;
420 }
Gaudi::StateMachine::State m_targetState
Service state.
Definition: Service.h:193
T rend(T...args)
StatusCode finalizeTool(IAlgTool *itool) const
Finalize the given tool, with exception handling.
Definition: ToolSvc.cpp:672
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
T lock(T...args)
T count(T...args)
T find(T...args)
virtual unsigned long release()=0
Release Interface instance.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
virtual unsigned long refCount() const =0
Current reference count.
CallMutex m_mut
Definition: ToolSvc.h:110
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const =0
Retrieve the name of the instance.
T rbegin(T...args)
StatusCode ToolSvc::retrieve ( const std::string type,
const InterfaceID iid,
IAlgTool *&  tool,
const IInterface parent,
bool  createIf 
)
override

Retrieve tool, create it by default as common tool if it does not already exist.

Definition at line 256 of file ToolSvc.cpp.

262 {
263  // check for tools, which by name are required to be public:
264  if ( ba::ends_with( tooltype, s_PUBLIC ) ) {
265  // parent for PUBLIC tool is 'this', i.e. ToolSvc
266  return retrieve ( ba::erase_tail_copy(tooltype, s_PUBLIC.size()),
267  iid , tool , this , createIf ) ;
268  }
269 
270  // protect against empty type
271  if ( tooltype.empty() ) {
272  error() << "retrieve(): No Tool Type/Name given" << endmsg;
273  return StatusCode::FAILURE;
274  }
275  auto pos = tooltype.find('/');
276  if ( std::string::npos == pos ) {
277  return retrieve ( tooltype , tooltype , iid , tool , parent , createIf );
278  }
279  return retrieve ( tooltype.substr( 0 , pos ),
280  tooltype.substr( pos + 1 ),
281  iid , tool , parent , createIf ) ;
282 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode retrieve(const std::string &type, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent, bool createIf) override
Retrieve tool, create it by default as common tool if it does not already exist.
Definition: ToolSvc.cpp:256
StatusCode ToolSvc::retrieve ( const std::string tooltype,
const std::string toolname,
const InterfaceID iid,
IAlgTool *&  tool,
const IInterface parent,
bool  createIf 
)
override

Retrieve tool, create it by default as common tool if it does not already exist.

invoke retrieve callbacks...

Definition at line 287 of file ToolSvc.cpp.

294 {
295  // check the applicability of another method:
296  // ignore the provided name if it is empty or the type contains a name
297  if( toolname.empty() || (std::string::npos != tooltype.find('/')) )
298  { return retrieve ( tooltype , iid , tool , parent , createIf ) ; }
299 
300  // check for tools, which by name are required to be public:
301  if ( ba::ends_with( toolname, s_PUBLIC ) )
302  {
303  // parent for PUBLIC tool is this, i.e. ToolSvc
304  return retrieve ( tooltype , ba::erase_tail_copy(toolname, s_PUBLIC.size() ),
305  iid , tool , this , createIf ) ;
306  }
307 
309 
310  IAlgTool* itool = nullptr;
312 
313  tool = nullptr;
314 
315  // If parent is not specified it means it is the ToolSvc itself
316  if( !parent ) parent = this;
317  const std::string fullname = nameTool( toolname, parent );
318 
319  // Find tool in list of those already existing, and tell its
320  // interface that it has been used one more time
322  [&](const IAlgTool* i) {
323  return i->name() == fullname && i->parent() == parent;
324  });
325  if (it!=std::end(m_instancesTools)) {
326  ON_DEBUG debug() << "Retrieved tool " << toolname << " with parent " << parent << endmsg;
327  itool = *it;
328  }
329 
330  if ( !itool ) {
331  // Instances of this tool do not exist, create an instance if desired
332  // otherwise return failure
333  if( UNLIKELY(!createIf) ) {
334  warning() << "Tool " << toolname
335  << " not found and creation not requested" << endmsg;
336  return sc;
337  }
338  sc = create( tooltype, toolname, parent, itool );
339  if ( sc.isFailure() ) { return sc; }
340  }
341 
342  // Get the right interface of it
343  sc = itool->queryInterface( iid, pp_cast<void>(&tool) );
344  if( UNLIKELY(sc.isFailure()) ) {
345  error() << "Tool " << toolname
346  << " either does not implement the correct interface, or its version is incompatible"
347  << endmsg;
348  return sc;
349  }
350 
356  [&]( IToolSvc::Observer* obs ) { obs->onRetrieve(itool); } );
357  return sc;
358 }
T empty(T...args)
std::string nameTool(const std::string &nameByUser, const IInterface *parent)
Get Tool full name by combining nameByUser and "parent" part.
Definition: ToolSvc.cpp:640
allow call-backs when a tool is a created or retrieved
Definition: IToolSvc.h:245
StatusCode create(const std::string &type, const IInterface *parent, IAlgTool *&tool)
Create Tool standard way with automatically assigned name.
Definition: ToolSvc.cpp:423
#define UNLIKELY(x)
Definition: Kernel.h:126
T end(T...args)
std::vector< IToolSvc::Observer * > m_observers
Definition: ToolSvc.h:107
STL class.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
T lock(T...args)
T find(T...args)
T size(T...args)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
T begin(T...args)
virtual void onRetrieve(const IAlgTool *)
Definition: IToolSvc.h:251
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
#define ON_DEBUG
Definition: ToolSvc.cpp:21
CallMutex m_mut
Definition: ToolSvc.h:110
T for_each(T...args)
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const =0
Retrieve the name of the instance.
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
StatusCode retrieve(const std::string &type, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent, bool createIf) override
Retrieve tool, create it by default as common tool if it does not already exist.
Definition: ToolSvc.cpp:256
StatusCode ToolSvc::start ( )
override

Definition at line 746 of file ToolSvc.cpp.

748 {
749 
750  ON_DEBUG debug() << "START transition for AlgTools" << endmsg;
751 
752  bool fail(false);
753  for ( auto& iTool : m_instancesTools ) {
754  ON_VERBOSE verbose() << iTool->name() << "::start()" << endmsg;
755 
756  if (UNLIKELY(!iTool->sysStart().isSuccess())) {
757  fail = true;
758  error() << iTool->name() << " failed to start()" << endmsg;
759  }
760 
761  }
762 
763  if (UNLIKELY(fail)) {
764  error() << "One or more AlgTools failed to start()" << endmsg;
765  return StatusCode::FAILURE;
766  }
767  return StatusCode::SUCCESS;
768 }
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
#define UNLIKELY(x)
Definition: Kernel.h:126
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
#define ON_DEBUG
Definition: ToolSvc.cpp:21
#define ON_VERBOSE
Definition: ToolSvc.cpp:22
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode ToolSvc::stop ( )
override

Definition at line 772 of file ToolSvc.cpp.

774 {
775 
776  ON_DEBUG debug() << "STOP transition for AlgTools" << endmsg;
777 
778  bool fail(false);
779  for ( auto& iTool : m_instancesTools ) {
780  ON_VERBOSE verbose() << iTool->name() << "::stop()" << endmsg;
781 
782  if (UNLIKELY(!iTool->sysStop().isSuccess())) {
783  fail = true;
784  error() << iTool->name() << " failed to stop()" << endmsg;
785  }
786 
787  }
788 
789  if (UNLIKELY(fail)) {
790  error() << "One or more AlgTools failed to stop()" << endmsg;
791  return StatusCode::FAILURE;
792  }
793  return StatusCode::SUCCESS;
794 }
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
#define UNLIKELY(x)
Definition: Kernel.h:126
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
#define ON_DEBUG
Definition: ToolSvc.cpp:21
#define ON_VERBOSE
Definition: ToolSvc.cpp:22
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
unsigned long ToolSvc::totalToolRefCount ( ) const
private

The total number of refCounts on all tools in the instancesTools list.

Definition at line 713 of file ToolSvc.cpp.

715 {
716  return totalRefCount( m_instancesTools );
717 }
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102

Member Data Documentation

std::vector<IAlgTool*> ToolSvc::m_instancesTools
private

Common Tools.

Definition at line 102 of file ToolSvc.h.

CallMutex ToolSvc::m_mut
mutableprivate

Definition at line 110 of file ToolSvc.h.

std::vector<IToolSvc::Observer*> ToolSvc::m_observers
private

Definition at line 107 of file ToolSvc.h.

IHistorySvc* ToolSvc::m_pHistorySvc = nullptr
private

Pointer to HistorySvc.

Definition at line 105 of file ToolSvc.h.


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