ATLAS Offline Software
Loading...
Searching...
No Matches
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
18#include <AsgTools/Interfaces.h>
19#include <memory>
20#include <vector>
21
22class Property;
23class PropertyMgr;
24
25namespace 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:
78 template<typename T> Property *
79 declareProperty (const std::string& name, T& loc,
80 const std::string& doc = "");
81
82
90 public:
91 template<typename T> ::StatusCode
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
143
144#endif
145#endif
macros for messaging and checking status codes
Definition of message levels and a helper function.
Support class for PropertyMgr.
Definition Property.h:23
Class mimicking the AthMessaging class from the offline software.
static StatusCode setProperty(IAsgTool *tool, const std::string &property, W &&value)
Helper method for calling setProperty on an interface class Usage: asg::setProperty( myTool ,...
Definition SetProperty.h:19
#define private