ATLAS Offline Software
Loading...
Searching...
No Matches
ToolHandle.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ASGTOOLS_TOOLHANDLE_H
6#define ASGTOOLS_TOOLHANDLE_H
7
8// Local include(s):
9#ifndef XAOD_STANDALONE
10# include "GaudiKernel/ToolHandle.h"
11#else // not XAOD_STANDALONE
12
13// System include(s):
14#include <string>
15#include <iosfwd>
16
17// Local include(s):
19
20class INamedInterface;
21
33class ToolHandleBase {
34
35public:
37 ToolHandleBase( const std::string& typeAndName = "", INamedInterface* parent = 0 );
38
40 const std::string& typeAndName() const;
42 const std::string& type() const;
44 const std::string& name() const;
46 const std::string& parentName() const;
48 INamedInterface *parent() const noexcept;
49
51 void setTypeAndName(const std::string& typeAndName);
53 void setName(const std::string& name);
54
57 std::string m_typeAndName;
59 std::string m_type;
61 std::string m_name;
63 INamedInterface *m_parent;
64
65}; // class ToolHandleBase
66
78template< class T >
79class ToolHandle : public ToolHandleBase {
80
81public:
83 typedef T value_type;
84
86 ToolHandle( T* ptool = 0 );
87
89 ToolHandle( const std::string& toolname, INamedInterface* parent = 0 );
90
92 template<typename T2>
93 ToolHandle (T2 *parent, const std::string& propertyName,
94 const std::string& toolName,
95 const std::string& propertyTitle = "");
96
98 T& operator*();
100 const T& operator*() const;
102 T* operator->();
104 const T* operator->() const;
105
109 StatusCode retrieve() const;
110
112 void disable () noexcept;
113
115 bool empty() const;
116
118 bool isSet() const;
119
120private:
122 mutable T* m_ptool {nullptr};
123
124}; // class ToolHandle
125
127template< class T >
128std::ostream& operator<< ( std::ostream& out,
129 const ToolHandle< T >& handle );
130
131// Include the implementation of the code:
133
134#endif // not XAOD_STANDALONE
135#endif // ASGTOOLS_TOOLHANDLE_H
#define protected
xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1 &met, float scale)
Create new MET object from source with scaled (weighted) kinematics.
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
static const Attributes_t empty
::StatusCode StatusCode
StatusCode definition for legacy code.
unsigned long long T
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
#define private