ATLAS Offline Software
Loading...
Searching...
No Matches
VP1ToolAccessHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Header file for class VP1ToolAccessHelper //
9// //
10// Description: For safe retrieval of tools //
11// //
12// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
13// Initial version: February 2008 //
14// //
16
17#ifndef VP1TOOLACCESSHELPER_H
18#define VP1TOOLACCESSHELPER_H
19
21#include "GaudiKernel/IToolSvc.h"
22#include "GaudiKernel/ToolHandle.h"
23#include <QString>
24#include <map>
25#include <stdexcept>
26
27class IVP1System;
28
30public:
31
32 VP1ToolAccessHelper( IToolSvc* );//Use this to get error messages output to stdout.
33 VP1ToolAccessHelper( IVP1System* );//Use this to also error messages output in VP1 message area.
34 ~VP1ToolAccessHelper() {}//Fixme: We should release tools in destructor.
35
36 //NB: toolname should be in the form "ConcreteToolType/ToolInstanceName"
37 template <class toolT>
38 toolT * getToolPointer( const QString& toolname, bool silent=false,
39 bool createIfNotExists = false );//Returns 0 if tool does not exist or in case of errors.
40 //It never attempts to create the tool.
41 //If silent is set, problems are only output as verbose messages
42
43private:
46 IToolSvc * m_toolsvc;
47 std::map<std::pair<QString,QString>, IAlgTool*> m_toolname2pointer;//key is <toolname, typeinfo>
48};
49
51
52#endif
VP1HelperClassBase(IVP1System *sys=0, QString helpername="")
std::map< std::pair< QString, QString >, IAlgTool * > m_toolname2pointer
VP1ToolAccessHelper & operator=(const VP1ToolAccessHelper &)
toolT * getToolPointer(const QString &toolname, bool silent=false, bool createIfNotExists=false)
VP1ToolAccessHelper(const VP1ToolAccessHelper &)