ATLAS Offline Software
Loading...
Searching...
No Matches
ServiceHandle.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9
10#ifndef ASGSERVICES_SERVICEHANDLE_H
11#define ASGSERVICES_SERVICEHANDLE_H
12
13// Local include(s):
14#ifndef XAOD_STANDALONE
15# include "GaudiKernel/ServiceHandle.h"
16#else // not XAOD_STANDALONE
17
18// System include(s):
19#include <string>
20#include <iosfwd>
21
22// Local include(s):
25
33
34class ServiceHandleBase
35{
36public:
38 ServiceHandleBase( const std::string& typeAndName, const std::string& parentName );
39
41 const std::string& typeAndName() const;
43 const std::string& type() const;
45 const std::string& name() const;
47 const std::string& parentName() const;
48
50 void setTypeAndName(const std::string& typeAndName);
52 void setName(const std::string& name);
53
54protected:
56 std::string m_typeAndName;
58 std::string m_type;
60 std::string m_name;
62 std::string m_parentName;
63
64}; // class ServiceHandleBase
65
72
73template< class T >
74class ServiceHandle : public ServiceHandleBase
75{
76public:
78 typedef T value_type;
79
81 ServiceHandle( const std::shared_ptr<T>& pservice,
82 const std::string& parentName );
83
85 ServiceHandle( const std::string& servicename, const std::string& parentName);
86
88 template<typename T2>
89 ServiceHandle (T2 *parent, const std::string& propertyName,
90 const std::string& serviceName,
91 const std::string& propertyTitle = "");
92
94 T& operator*();
96 const T& operator*() const;
98 T* operator->();
100 const T* operator->() const;
101
105 StatusCode retrieve() const;
106
108 void disable () noexcept;
109
111 bool empty() const;
112
114 bool isSet() const;
115
116private:
118 mutable std::shared_ptr<T> m_pservice;
119
120}; // class ServiceHandle
121
123template< class T >
124std::ostream& operator<< ( std::ostream& out,
125 const ServiceHandle< T >& handle );
126
127// Include the implementation of the code:
128#include "AsgServices/ServiceHandle.icc"
129
130#endif // not XAOD_STANDALONE
131#endif // ASGSERVICES_SERVICEHANDLE_H
xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1 &met, float scale)
Create new MET object from source with scaled (weighted) kinematics.
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