| The Gaudi Framework v28r2-patches (bc4ad17a)

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

- File List
- File Members

ToolSvc.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_TOOLSVC_H
2 #define GAUDISVC_TOOLSVC_H
3
4 // Include Files
5 #include "GaudiKernel/Service.h"
6 #include "GaudiKernel/IToolSvc.h"
7 #include <vector>
8 #include <mutex>
9
23 class ToolSvc : public extends<Service,
24 IToolSvc> {
25
26 public:
27
29 StatusCode initialize() override;
30
32 StatusCode finalize() override;
33
34 // Start transition for tools
35 StatusCode start() override;
36
37 // Stop transition for tools
38 StatusCode stop() override;
39
41 StatusCode retrieve(const std::string& type, const InterfaceID& iid,
42 IAlgTool*& tool, const IInterface* parent,
43 bool createIf) override;
44
46 StatusCode retrieve(const std::string& tooltype, const std::string& toolname,
47 const InterfaceID& iid, IAlgTool*& tool,
48 const IInterface* parent, bool createIf) override;
49
51 std::vector<std::string> getInstances( const std::string& toolType ) override;
52
54 std::vector<std::string> getInstances() const override;
55
57 std::vector<IAlgTool*> getTools() const override;
58
60 StatusCode releaseTool( IAlgTool* tool ) override;
61
63 StatusCode create(const std::string& type, const IInterface* parent,
64 IAlgTool*& tool);
65
67 StatusCode create(const std::string& type, const std::string& name,
68 const IInterface* parent, IAlgTool*& tool);
69
71 bool existsTool( const std::string& toolname) const;
72
74 std::string nameTool(const std::string& nameByUser, const IInterface* parent);
75
80 ToolSvc( const std::string& name, ISvcLocator* svc );
81
83 ~ToolSvc() override;
84
85 void registerObserver(IToolSvc::Observer *obs) override;
86
87
88 private: // methods
89 // helper functions
90 //
92 unsigned long totalToolRefCount() const;
94 unsigned long minimumToolRefCount() const;
95
97 StatusCode finalizeTool( IAlgTool* itool ) const;
98
99 private: // data
100
102 std::vector<IAlgTool*> m_instancesTools; // List of all instances of tools
103
105 IHistorySvc* m_pHistorySvc = nullptr;
106
107 std::vector<IToolSvc::Observer*> m_observers;
108
109 typedef std::recursive_mutex CallMutex;
110 mutable CallMutex m_mut;
111 };
112
113 #endif
114
115
ToolSvc::m_pHistorySvc
IHistorySvc * m_pHistorySvc
Pointer to HistorySvc.
Definition: ToolSvc.h:105
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
ToolSvc::releaseTool
StatusCode releaseTool(IAlgTool *tool) override
Release tool.
Definition: ToolSvc.cpp:390
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
ToolSvc::nameTool
std::string nameTool(const std::string &nameByUser, const IInterface *parent)
Get Tool full name by combining nameByUser and "parent" part.
Definition: ToolSvc.cpp:640
IToolSvc::Observer
allow call-backs when a tool is a created or retrieved
Definition: IToolSvc.h:245
ToolSvc::minimumToolRefCount
unsigned long minimumToolRefCount() const
The minimum number of refCounts of all tools.
Definition: ToolSvc.cpp:719
ToolSvc::create
StatusCode create(const std::string &type, const IInterface *parent, IAlgTool *&tool)
Create Tool standard way with automatically assigned name.
Definition: ToolSvc.cpp:423
ToolSvc::getInstances
std::vector< std::string > getInstances() const override
Get names of all tool instances.
Definition: ToolSvc.cpp:372
ToolSvc::registerObserver
void registerObserver(IToolSvc::Observer *obs) override
Definition: ToolSvc.cpp:730
ToolSvc::m_observers
std::vector< IToolSvc::Observer * > m_observers
Definition: ToolSvc.h:107
IToolSvc.h
ToolSvc::existsTool
bool existsTool(const std::string &toolname) const
Check if the tool instance exists.
Definition: ToolSvc.cpp:662
ToolSvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: ToolSvc.cpp:61
ToolSvc
This service manages tools.
Definition: ToolSvc.h:23
ToolSvc::CallMutex
std::recursive_mutex CallMutex
Definition: ToolSvc.h:109
std::string
STL class.
ToolSvc::start
StatusCode start() override
Definition: ToolSvc.cpp:746
Service.h
InterfaceID
Interface ID class.
Definition: IInterface.h:30
ToolSvc::totalToolRefCount
unsigned long totalToolRefCount() const
The total number of refCounts on all tools in the instancesTools list.
Definition: ToolSvc.cpp:713
ToolSvc::finalizeTool
StatusCode finalizeTool(IAlgTool *itool) const
Finalize the given tool, with exception handling.
Definition: ToolSvc.cpp:672
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ToolSvc::~ToolSvc
~ToolSvc() override
Destructor.
Definition: ToolSvc.cpp:52
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
gaudirun.type
type
Definition: gaudirun.py:125
gaudirun.toolname
toolname
Definition: gaudirun.py:327
std::recursive_mutex
std::vector< std::string >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
ToolSvc::m_instancesTools
std::vector< IAlgTool * > m_instancesTools
Common Tools.
Definition: ToolSvc.h:102
ToolSvc::ToolSvc
ToolSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: ToolSvc.cpp:48
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ToolSvc::finalize
StatusCode finalize() override
Finalize the service.
Definition: ToolSvc.cpp:83
ToolSvc::getTools
std::vector< IAlgTool * > getTools() const override
Get pointers to all tool instances.
Definition: ToolSvc.cpp:382
ToolSvc::m_mut
CallMutex m_mut
Definition: ToolSvc.h:110
ToolSvc::stop
StatusCode stop() override
Definition: ToolSvc.cpp:772
IHistorySvc
Definition of the IHistorySvc interface class.
Definition: IHistorySvc.h:32
ToolSvc::retrieve
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