ATLAS Offline Software
AthToolSupport/AsgDataHandles/AsgDataHandles/VarHandleKeyArray.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ASG_DATA_HANDLES_VAR_HANDLE_KEY_ARRAY_H
6 #define ASG_DATA_HANDLES_VAR_HANDLE_KEY_ARRAY_H
7 
8 #ifndef XAOD_STANDALONE
10 #else
11 
20 #include <vector>
21 #include <string>
22 
23 namespace SG {
24 
37  class VarHandleKeyArray {
38  public:
40  virtual ~VarHandleKeyArray() = default;
41  // virtual StatusCode assign(const std::vector<std::string>& vs)=0;
42  virtual std::string toString() const = 0;
43  // virtual Gaudi::DataHandle::Mode mode() const = 0;
44 
45  // virtual std::vector<SG::VarHandleKey*> keys() const = 0;
46 
47  // virtual void renounce() = 0;
48  // virtual bool renounced() const = 0;
49  // virtual void declare(IDataHandleHolder*) = 0;
50 
51  // virtual void setOwner( IDataHandleHolder* o ) = 0;
52  // virtual const IDataHandleHolder* owner() const = 0;
53  // virtual IDataHandleHolder* owner() = 0;
54 
55  };
56 
57 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
58 // mixin class for common functionality
59 //
60 
77  template <class Base>
78  class VarHandleKeyArrayCommon : public VarHandleKeyArray,
79  public std::vector<Base> {
80  public:
85  VarHandleKeyArrayCommon() : std::vector<Base>() {};
86 
91  VarHandleKeyArrayCommon( const std::vector<Base>& v ):
92  std::vector<Base>(v) {};
93 
99  VarHandleKeyArrayCommon( std::initializer_list<Base> l ):
100  std::vector<Base>{l} {};
101 
108  VarHandleKeyArrayCommon( std::initializer_list<std::string> l ) {
109  for (auto &e : l) {
110  this->push_back( Base{e} );
111  }
112  }
113 
119  StatusCode initialize (bool used = true);
120 
121  // /**
122  // * @brief Set the contents of the VarHandleKeyArray from a
123  // * vector of std::strings
124  // * @param vs vector of initializer strings
125  // */
126  // virtual StatusCode assign(const std::vector<std::string>& vs) override;
127 
131  virtual std::string toString() const override;
132 
133  // /**
134  // * @brief create array of all base VarHandleKeys in the Array
135  // */
136  // virtual std::vector<SG::VarHandleKey*> keys() const override;
137 
138 
139  // /**
140  // * @brief if called, handles will not be declared in the algorithm I/O
141  // */
142  // virtual void renounce() override { m_isRenounced = true; }
143 
144  // /**
145  // * @brief query renounced state
146  // **/
147  // virtual bool renounced() const override { return m_isRenounced; }
148 
149  // virtual void declare( IDataHandleHolder* ) override;
150 
151  // virtual void setOwner( IDataHandleHolder* o ) override { m_owner = o; }
152  // virtual const IDataHandleHolder* owner() const override { return m_owner; }
153  // virtual IDataHandleHolder* owner() override { return m_owner; }
154 
155  private:
156 
157  // bool m_isRenounced{ false };
158  // IDataHandleHolder* m_owner{ nullptr };
159 
160  };
161 
162 } // namespace SG
163 
164 namespace std {
165  ostream& operator<<(ostream& s, const SG::VarHandleKeyArray& m);
166 }
167 
168 
170 
171 #endif
172 
173 #endif
used
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
SG::VarHandleKeyArray::toString
virtual std::string toString() const =0
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
VarHandleKeyArray.icc
VarHandleKeyArray.h
Base class for VarHandleKeyArray for reading from StoreGate.
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
SG::VarHandleKeyArrayCommon::toString
virtual std::string toString() const override
string representation of the VarHandleKeyArray
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
Base
SG::VarHandleKeyArray::~VarHandleKeyArray
virtual ~VarHandleKeyArray()=default
StatusCode.h
SG::VarHandleKeyArrayCommon::initialize
StatusCode initialize(bool used=true)
forward the initialization to the member VarHandleKeys
operator<<
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
Definition: TestGaudiProperty.cxx:69
python.PyAthena.v
v
Definition: PyAthena.py:154
SG::VarHandleKeyArrayCommon::VarHandleKeyArrayCommon
VarHandleKeyArrayCommon()
default base Constructor of mixin
Definition: StoreGate/StoreGate/VarHandleKeyArray.h:68
SG::VarHandleKeyArray::VarHandleKeyArray
VarHandleKeyArray()
Definition: StoreGate/StoreGate/VarHandleKeyArray.h:30
SG::VarHandleKeyArray
Definition: StoreGate/StoreGate/VarHandleKeyArray.h:28