ATLAS Offline Software
AthToolSupport/AsgDataHandles/AsgDataHandles/HandleKeyArray.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_HANDLE_KEY_ARRAY_H
6 #define ASG_DATA_HANDLES_HANDLE_KEY_ARRAY_H
7 
8 #ifndef XAOD_STANDALONE
10 #else
11 
13 
14 class EventContext;
15 
16 namespace SG {
17 
31  template <class T_Handle, class T_HandleKey/*, Gaudi::DataHandle::Mode MODE*/>
32  class HandleKeyArray : public VarHandleKeyArrayCommon< T_HandleKey > {
33  public:
37  HandleKeyArray(){}
38 
39  // /**
40  // * @brief Constructor from a HandleKeyArray that takes a vector
41  // * of ReadHandleKeys
42  // * @param v vector of HandleKey
43  // */
44  // HandleKeyArray( const std::vector<T_HandleKey>& v ) :
45  // VarHandleKeyArrayCommon<T_HandleKey> ( v ) {}
46 
47  // /**
48  // * @brief Constructor from a HandleKeyArray that takes an
49  // * initializer list of HandleKeys
50  // * @param l initializer list of HandleKey
51  // */
52  // HandleKeyArray( std::initializer_list<T_HandleKey> l ):
53  // VarHandleKeyArrayCommon<T_HandleKey> {l} {}
54 
55  // /**
56  // * @brief Constructor from a HandleKeyArray that takes an
57  // * initializer list of std::strings.
58  // * @param l initializer list of std::strings used to create the
59  // * HandleKeys
60  // */
61  // HandleKeyArray( std::initializer_list<std::string> key_names):
62  // VarHandleKeyArrayCommon<T_HandleKey> {key_names} {}
63 
73  template <class OWNER>
74  inline HandleKeyArray( OWNER* owner,
75  std::string name,
76  std::initializer_list<std::string> l,
77  std::string doc="") :
78  VarHandleKeyArrayCommon<T_HandleKey> {l} {
79  owner->declareProperty(std::move(name), *this, std::move(doc));
80  }
81 
82 
83  // /**
84  // * @brief return the type (Read/Write/Update) of handle
85  // */
86  // Gaudi::DataHandle::Mode mode() const { return MODE; }
87 
92  std::vector< T_Handle > makeHandles() const {
93  std::vector< T_Handle > hndl;
94  typename std::vector<T_HandleKey>::const_iterator itr;
95  for (itr = this->begin(); itr != this->end(); ++itr) {
96  hndl.push_back ( T_Handle( *itr) );
97  }
98  return hndl;
99  }
100 
105  std::vector< T_Handle > makeHandles (const EventContext& ctx) const
106  {
107  std::vector< T_Handle > hndl;
108  typename std::vector<T_HandleKey>::const_iterator itr;
109  for (itr = this->begin(); itr != this->end(); ++itr) {
110  hndl.push_back ( T_Handle( *itr, ctx) );
111  }
112  return hndl;
113  }
114 
115  };
116 
117 } // namespace SG
118 
119 namespace asg
120 {
121  namespace detail
122  {
123  template<typename T> struct GetStringHelper;
124 
125  template<typename T1,typename T2> struct GetStringHelper<SG::HandleKeyArray<T1,T2> >
126  : public GetStringHelper<std::vector<T2> >
127  {
128  };
129 
130  template<typename T> struct SetStringHelper;
131 
132  template<typename T1,typename T2> struct SetStringHelper<SG::HandleKeyArray<T1,T2> >
133  : public SetStringHelper<std::vector<T2> >
134  {
135  };
136  }
137 }
138 
139 #endif
140 
141 #endif
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
asg
Definition: DataHandleTestTool.h:28
detail
Definition: extract_histogram_tag.cxx:14
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::HandleKeyArray::HandleKeyArray
HandleKeyArray()
default Constructor from a HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:43
SG::VarHandleKeyArrayCommon< T_HandleKey >::owner
virtual const IDataHandleHolder * owner() const override
Definition: StoreGate/StoreGate/VarHandleKeyArray.h:135
VarHandleKeyArray.h
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
HandleKeyArray.h
SG::VarHandleKeyArrayCommon< T_HandleKey >::VarHandleKeyArrayCommon
VarHandleKeyArrayCommon()
default base Constructor of mixin
Definition: StoreGate/StoreGate/VarHandleKeyArray.h:68
SG::HandleKeyArray::makeHandles
std::vector< T_Handle > makeHandles() const
create a vector of Handles from the HandleKeys in the array
Definition: StoreGate/StoreGate/HandleKeyArray.h:100