ATLAS Offline Software
AsgComponentConfig.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 #ifndef ASG_TOOLS__ASG_COMPONENT_CONFIG_H
10 #define ASG_TOOLS__ASG_COMPONENT_CONFIG_H
11 
12 // Athena include(s).
14 
15 // System include(s).
16 #include <map>
17 #include <memory>
18 #include <string>
19 #include <vector>
20 
21 namespace asg
22 {
24  namespace details
25  {
26  // Forward declaration of the private tool configuration type
28  }
29 
32 
34  {
35  //
36  // public interface
37  //
38 
44  public:
45  AsgComponentConfig () = default;
46 
47 
53  public:
54  explicit AsgComponentConfig (const std::string& val_typeAndName);
55 
56 
60  public:
61  bool empty () const noexcept;
62 
63 
67  public:
68  const std::string& type () const noexcept;
69 
75  public:
76  void setType (const std::string& val_type);
77 
78 
82  public:
83  const std::string& name () const noexcept;
84 
90  public:
91  void setName (const std::string& val_name);
92 
93 
99  public:
100  std::string typeAndName () const;
101 
102 
108  public:
109  void setTypeAndName (const std::string& val_typeAndName);
110 
111 
118  public:
120  setProperty (const std::string& name, const T& value);
121 
122 
128  public:
129  void setPropertyFromString (const std::string& name,
130  const std::string& value);
131 
132 
160  public:
161  StatusCode createPrivateTool (const std::string& name,
162  const std::string& toolType);
163 
164 
174  public:
175  StatusCode addPrivateTool (const std::string& name,
176  AsgComponentConfig toolConfig);
177 
178 
188  public:
189  std::string createPrivateToolInArray (const std::string& name,
190  const std::string& toolType);
191 
192 
202  public:
203  std::string addPrivateToolInArray (const std::string& name,
204  AsgComponentConfig toolConfig);
205 
206 
207 
208 #ifdef XAOD_STANDALONE
209  public:
238  template<typename T> StatusCode
239  makeComponentExpert (std::unique_ptr<T>& component,
240  const std::string& newCommand,
241  bool nestedNames, std::string prefix) const;
242 #endif
243 
244 
245 #ifndef XAOD_STANDALONE
246  public:
261  StatusCode
262  configureComponentExpert (const std::string& prefix,
263  bool nestedNames) const;
264 #endif
265 
266 
267 
268  //
269  // private interface
270  //
271 
272  private:
273 
275  std::string m_type;
276 
278  std::string m_name;
279 
281  std::map<std::string, details::AsgComponentPrivateToolConfig> m_privateTools;
282 
285  std::map<std::string,std::vector<std::string>> m_toolArrays;
286 
288  std::map<std::string,std::string> m_propertyValues;
289 
290 
296  StatusCode checkTypeName (bool nestedNames) const;
297 
298 
305  struct AccessSubtoolData final
306  {
308  std::string prefix;
309  std::string name;
310  };
311  AccessSubtoolData accessSubtool (const std::string& name,
312  std::size_t split);
314  };
315 
316  namespace details {
317 
323  std::string m_propName;
324  };
325 
326  } // namespace details
327 } // namespace asg
328 
329 #include "AsgComponentConfig.icc"
330 
331 #endif
asg::AsgComponentConfig
an object that stores the configuration for an AsgComponent and is able to create one from it
Definition: AsgComponentConfig.h:34
asg::AsgComponentConfig::setType
void setType(const std::string &val_type)
set the value of type
Definition: AsgComponentConfig.cxx:82
asg::AsgComponentConfig::empty
bool empty() const noexcept
whether all properties are unset
Definition: AsgComponentConfig.cxx:64
asg::AsgComponentConfig::m_propertyValues
std::map< std::string, std::string > m_propertyValues
the map of property values
Definition: AsgComponentConfig.h:288
taskman.template
dictionary template
Definition: taskman.py:317
asg
Definition: DataHandleTestTool.h:28
asg::AsgComponentConfig::m_name
std::string m_name
the value of name
Definition: AsgComponentConfig.h:278
athena.value
value
Definition: athena.py:124
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
asg::AsgComponentConfig::m_toolArrays
std::map< std::string, std::vector< std::string > > m_toolArrays
the map of (private) tool handle arrays to manage, and the tools they contain
Definition: AsgComponentConfig.h:285
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
asg::details::AsgComponentPrivateToolConfig::m_propName
std::string m_propName
The property name (?) of the private tool.
Definition: AsgComponentConfig.h:323
asg::AsgComponentConfig::AsgComponentConfig
AsgComponentConfig()=default
standard constructor
asg::AsgComponentConfig::m_type
std::string m_type
the value of type
Definition: AsgComponentConfig.h:275
asg::AsgComponentConfig::checkTypeName
StatusCode checkTypeName(bool nestedNames) const
check that the type and name members have the correct format
Definition: AsgComponentConfig.cxx:214
AsgComponentConfig.icc
details
Definition: IParticleWriter.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
asg::details::AsgComponentPrivateToolConfig::m_config
AsgComponentConfig m_config
The configuration of the private tool.
Definition: AsgComponentConfig.h:321
asg::AsgComponentConfig::AccessSubtoolData::name
std::string name
Definition: AsgComponentConfig.h:309
asg::AsgComponentConfig::addPrivateToolInArray
std::string addPrivateToolInArray(const std::string &name, AsgComponentConfig toolConfig)
the array version of addPrivateTool
Definition: AsgComponentConfig.cxx:189
asg::AsgComponentConfig::type
const std::string & type() const noexcept
the type of the component
Definition: AsgComponentConfig.cxx:74
StatusCode.h
asg::AsgComponentConfig::createPrivateToolInArray
std::string createPrivateToolInArray(const std::string &name, const std::string &toolType)
the array version of createPrivateTool
Definition: AsgComponentConfig.cxx:159
asg::AsgComponentConfig::setTypeAndName
void setTypeAndName(const std::string &val_typeAndName)
set type and name at the same time
Definition: AsgComponentConfig.cxx:116
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
asg::AsgComponentConfig::configureComponentExpert
StatusCode configureComponentExpert(const std::string &prefix, bool nestedNames) const
add component configuration to configuration service (expert only)
Definition: AsgComponentConfig.cxx:365
asg::AsgComponentConfig::AccessSubtoolData
access the configuration for the given subtool
Definition: AsgComponentConfig.h:306
asg::AsgComponentConfig::AccessSubtoolData::prefix
std::string prefix
Definition: AsgComponentConfig.h:308
asg::AsgComponentConfig::setName
void setName(const std::string &val_name)
set the value of name
Definition: AsgComponentConfig.cxx:98
asg::AsgComponentConfig::setProperty
StatusCode setProperty(const std::string &name, const T &value)
set the given property
asg::AsgComponentConfig::typeAndName
std::string typeAndName() const
get type and name at the same time
Definition: AsgComponentConfig.cxx:106
asg::AsgComponentConfig::setPropertyFromString
void setPropertyFromString(const std::string &name, const std::string &value)
set a given property from a string value
Definition: AsgComponentConfig.cxx:133
asg::details::AsgComponentPrivateToolConfig
Helper type with all necessary details about private tools.
Definition: AsgComponentConfig.h:319
asg::AsgComponentConfig::name
const std::string & name() const noexcept
the name of the component
Definition: AsgComponentConfig.cxx:90
asg::AsgComponentConfig::addPrivateTool
StatusCode addPrivateTool(const std::string &name, AsgComponentConfig toolConfig)
add a private tool from the given configuration
Definition: AsgComponentConfig.cxx:168
asg::AsgComponentConfig::accessSubtool
AccessSubtoolData accessSubtool(const std::string &name, std::size_t split)
Definition: AsgComponentConfig.cxx:240
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
asg::AsgComponentConfig::createPrivateTool
StatusCode createPrivateTool(const std::string &name, const std::string &toolType)
create a private tool of the given name and type
Definition: AsgComponentConfig.cxx:150
asg::AsgComponentConfig::m_privateTools
std::map< std::string, details::AsgComponentPrivateToolConfig > m_privateTools
the map of (private) tools to create
Definition: AsgComponentConfig.h:281