ATLAS Offline Software
AsgComponent.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #ifndef ASGTOOLS_ASGCOMPONENT_H
8 #define ASGTOOLS_ASGCOMPONENT_H
9 
10 #if !defined(XAOD_STANDALONE) && !defined(__CPPCHECK__)
11 #error "This header should only be used in XAOD_STANDALONE"
12 #else
13 
17 #include <AsgMessaging/MsgLevel.h>
18 #include <AsgTools/Interfaces.h>
19 #include <memory>
20 #include <vector>
21 
22 class Property;
23 class PropertyMgr;
24 
25 namespace asg
26 {
38 
39  class AsgComponent : public virtual INamedInterface,
40  public AsgMessaging
41  {
42  //
43  // public interface
44  //
45 
46  AsgComponent (const AsgComponent&) = delete;
47  AsgComponent& operator = (const AsgComponent&) = delete;
48 
50  public:
51  AsgComponent (const std::string& val_name);
52 
53 
55  public:
56  ~AsgComponent() noexcept;
57 
58 
63  public:
64  void addCleanup (const std::shared_ptr<void>& cleanup);
65 
66 
67 
68  //
69  // properties interface
70  //
71 
77  public:
79  declareProperty (const std::string& name, T& loc,
80  const std::string& doc = "");
81 
82 
90  public:
92  setProperty (const std::string& name, const T& value);
93  ::StatusCode setProperty (const std::string& name, const char *value);
95 
96 
99  PropertyMgr *getPropertyMgr () noexcept;
100  const PropertyMgr* getPropertyMgr() const noexcept;
102 
103 
104 
105  //
106  // inherited interface
107  //
108 
110  public:
111  virtual const std::string& name() const override;
112 
113 
114 
115  //
116  // private interface
117  //
118 
119  // for some reason AsgTool allows to set/override the tool name
120  // and be able to get properties/the property manager. this
121  // friend declaration allows that.
122  friend class AsgTool;
123 
125  private:
126  std::string m_name;
127 
132  private:
133  PropertyMgr *m_properties {nullptr};
134 
137  private:
138  std::vector<std::shared_ptr<void> > m_cleanup;
139  };
140 }
141 
142 #include "AsgTools/AsgComponent.icc"
143 
144 #endif
145 #endif
taskman.template
dictionary template
Definition: taskman.py:317
asg
Definition: DataHandleTestTool.h:28
INamedInterface.h
athena.value
value
Definition: athena.py:124
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Property
Support class for PropertyMgr.
Definition: Property.h:23
AsgMessaging.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MessageCheck.h
macros for messaging and checking status codes
AsgComponent.icc
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
MsgLevel.h
Definition of message levels and a helper function.
Interfaces.h