Skip to content
Snippets Groups Projects
Commit be54ccc4 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Update GaudiHandle to return const Tool access from const Handle

via `->` and `*` operators and `get()` method

Also removed unused `ThreadPoolSvc::getThreadInitTools()`.

See merge request !217
parents ac4dbc70 725876e9
No related branches found
No related tags found
1 merge request!217Update GaudiHandle to return const Tool access from const Handle -> and * operators and get()
Pipeline #
......@@ -10,14 +10,17 @@
* @author Marco Cattaneo
* @date 2005-12-14
*/
class GAUDI_API IGenericTool: virtual public IAlgTool {
class GAUDI_API IGenericTool : virtual public IAlgTool
{
public:
/// InterfaceID
DeclareInterfaceID(IGenericTool,2,0);
DeclareInterfaceID(IGenericTool,3,0);
/// Do the action
virtual void execute() = 0;
virtual void execute() const = 0;
virtual ~IGenericTool() = default;
};
#endif // KERNEL_INORMALIZETOOL_H
......@@ -157,28 +157,12 @@ ThreadPoolSvc::terminatePool() {
//-----------------------------------------------------------------------------
std::vector<IThreadInitTool*>
ThreadPoolSvc::getThreadInitTools() const {
std::vector<IThreadInitTool*> tools;
ToolHandleArray<IThreadInitTool>::const_iterator ito = m_threadInitTools.begin();
for ( ; ito != m_threadInitTools.end(); ++ito ) {
IThreadInitTool* it = &(**ito);
tools.push_back(it);
}
return tools;
}
//-----------------------------------------------------------------------------
StatusCode
ThreadPoolSvc::launchTasks(bool terminate) {
if (m_threadInitTools.empty()) return StatusCode::SUCCESS;
const std::string taskType = terminate? "termination" : "initialization";
const std::string taskType = terminate ? "termination" : "initialization";
// If we have a thread pool (via a scheduler), then we want to queue
// the tasks in TBB to execute on each thread.
......
......@@ -29,9 +29,6 @@ public:
/// Constructor
ThreadPoolSvc( const std::string& name, ISvcLocator* svc );
/// Destructor
virtual ~ThreadPoolSvc() {};
/// Initialise
virtual StatusCode initialize() override final;
......@@ -50,10 +47,6 @@ public:
virtual bool isInit() const { return m_init; }
/// @todo Do we actually need this method?
virtual std::vector<IThreadInitTool*> getThreadInitTools()
const override final;
private:
/// Launch tasks to execute the ThreadInitTools
......
......@@ -234,7 +234,7 @@ public:
}
/// Return the wrapped pointer, not calling retrieve() if null.
T* get() const {
typename std::add_const<T>::type * get() const {
return m_pObject;
}
......@@ -253,12 +253,14 @@ public:
return m_pObject;
}
T& operator*() const { // not really const, because it may update m_pObject
typename std::add_const<T>::type & operator*() const {
// not really const, because it may update m_pObject
assertObject();
return *m_pObject;
}
T* operator->() const { // not really const, because it may update m_pObject
typename std::add_const<T>::type * operator->() const {
// not really const, because it may update m_pObject
assertObject();
return m_pObject;
}
......
......@@ -20,9 +20,11 @@
//-----------------------------------------------------------------------------
class GAUDI_API IThreadPoolSvc : virtual public IInterface {
public:
class GAUDI_API IThreadPoolSvc : virtual public IInterface
{
public:
/// InterfaceID
DeclareInterfaceID(IThreadPoolSvc,1,0);
......@@ -35,9 +37,6 @@ class GAUDI_API IThreadPoolSvc : virtual public IInterface {
/// Size of the initialized thread pool
virtual int poolSize() const = 0;
/// Retrieve a list of thread initialization tools
virtual std::vector<IThreadInitTool*> getThreadInitTools() const = 0;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment