ATLAS Offline Software
AthToolSupport/AsgDataHandles/AsgDataHandles/VarHandleBase.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: VarHandleBase.h 797637 2017-02-17 02:32:11Z ssnyder $
15 #ifndef ASG_DATA_HANDLES_VAR_HANDLE_BASE_H
16 #define ASG_DATA_HANDLES_VAR_HANDLE_BASE_H
17 
18 #ifndef XAOD_STANDALONE
20 #else
21 
22 // STL includes
23 #include <memory>
24 #include <string>
25 
26 // #include "AsgDataHandles/VarHandleKey.h"
27 
28 class EventContext;
29 
30 namespace SG {
31  // static constexpr bool defaultQuiet = false;
32 
33  class VarHandleKey;
34 
35 
42  class VarHandleBase
43  {
44  public:
45 
51  VarHandleBase() = default;
52 
53 
58  explicit VarHandleBase(const std::string& sgkey);
59 
60 
73  explicit VarHandleBase (const VarHandleKey& key, const EventContext* ctx);
74 
75 
76  //*************************************************************************
77  // Accessors
78  //
79 
80 
84  const std::string& key() const;
85 
86 
92  const std::string& name() const ;
93 
94 
95  // /**
96  // * @brief Return the name of the store holding the object we are proxying.
97  // */
98  // std::string store() const;
99 
100 
101  //*************************************************************************
102  // @c VarHandleKey methods.
103  //
104 
105 
106  // /**
107  // * @brief Return the key string of the underlying @c DataObjID.
108  // *
109  // * Compared to @c key(), this will be prefixed with the store name.
110  // */
111  // const std::string& objKey() const;
112 
113 
114  // /**
115  // * @brief Return the key as a @c DataObjID.
116  // */
117  // const DataObjID& fullKey() const;
118 
119 
120  // /**
121  // * @brief Return a non-const reference to the HandleKey.
122  // *
123  // * If this handle was initialized from a HandleKey, then this doesn't work
124  // * (since the HandleKey is const). ExcNonConstHandleKey will be thrown
125  // * in that case.
126  // */
127  // SG::VarHandleKey& vhKey();
128 
129 
130  // /**
131  // * @brief Update the underlying key from a string.
132  // *
133  // * If this handle was initialized from a HandleKey, then this doesn't work
134  // * (since the HandleKey is const). ExcNonConstHandleKey will be thrown
135  // * in that case.
136  // *
137  // * See VarHandleKey::assign.
138  // */
139  // StatusCode assign (const std::string& sgkey);
140 
141 
142 
143  protected:
144  //*************************************************************************
145  // Protected data.
146  //
147 
148 
149  private:
153  std::unique_ptr<VarHandleKey> m_ownedKey;
154 
156  const VarHandleKey* m_key {nullptr};
157 
158  };
159 
160 
161  // //*************************************************************************
162  // // Free functions.
163  // //
164 
165 
166  // /**
167  // * @brief Output stream.
168  // * @param out Stream to which to write.
169  // * @param o Object to write.
170  // */
171  // std::ostream& operator<<( std::ostream& out, const VarHandleBase& o );
172 
173 
174  // /**
175  // * @brief Equality comparison.
176  // */
177  // bool operator==(const VarHandleBase& l, const VarHandleBase& r);
178 
179 
180  // /**
181  // * @brief Inequality comparison.
182  // */
183  // bool operator!=(const VarHandleBase& l, const VarHandleBase& r);
184 
185 
186 } /* namespace SG */
187 
189 
190 #endif
191 
192 #endif
VarHandleBase.h
Base class for VarHandle classes.
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SG::VarHandleBase::VarHandleBase
VarHandleBase(CLID clid, Gaudi::DataHandle::Mode mode)
Constructor with default key.
Definition: StoreGate/src/VarHandleBase.cxx:113
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::VarHandleBase::m_ownedKey
std::unique_ptr< VarHandleKey > m_ownedKey
An owned VarHandleKey.
Definition: StoreGate/StoreGate/VarHandleBase.h:518
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
VarHandleBase.icc
SG::VarHandleBase::m_key
const VarHandleKey * m_key
The associated key object.
Definition: StoreGate/StoreGate/VarHandleBase.h:523
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64