ATLAS Offline Software
AsgComponent.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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 <memory>
19 #include <vector>
20 
21 class Property;
22 class PropertyMgr;
23 
24 namespace asg
25 {
37 
38  class AsgComponent : public virtual INamedInterface,
39  public AsgMessaging
40  {
41  //
42  // public interface
43  //
44 
45  AsgComponent (const AsgComponent&) = delete;
46  AsgComponent& operator = (const AsgComponent&) = delete;
47 
49  public:
50  AsgComponent (const std::string& val_name);
51 
52 
54  public:
55  ~AsgComponent() noexcept;
56 
57 
62  public:
63  void addCleanup (const std::shared_ptr<void>& cleanup);
64 
65 
66 
67  //
68  // properties interface
69  //
70 
76  public:
78  declareProperty (const std::string& name, T& loc,
79  const std::string& doc = "");
80 
81 
89  public:
91  setProperty (const std::string& name, const T& value);
92  ::StatusCode setProperty (const std::string& name, const char *value);
94 
95 
98  PropertyMgr *getPropertyMgr () noexcept;
99  const PropertyMgr* getPropertyMgr() const noexcept;
101 
102 
103 
104  //
105  // inherited interface
106  //
107 
109  public:
110  virtual const std::string& name() const override;
111 
112 
113 
114  //
115  // private interface
116  //
117 
118  // for some reason AsgTool allows to set/override the tool name
119  // and be able to get properties/the property manager. this
120  // friend declaration allows that.
121  friend class AsgTool;
122 
124  private:
125  std::string m_name;
126 
131  private:
132  PropertyMgr *m_properties {nullptr};
133 
136  private:
137  std::vector<std::shared_ptr<void> > m_cleanup;
138  };
139 }
140 
141 #include "AsgTools/AsgComponent.icc"
142 
143 #endif
144 #endif
taskman.template
dictionary template
Definition: taskman.py:317
asg
Definition: DataHandleTestTool.h:28
INamedInterface.h
athena.value
value
Definition: athena.py:122
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
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:195
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
MsgLevel.h
Definition of message levels and a helper function.
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15