Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
UnitTestTool1.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 #ifndef ASG_TOOLS__UNIT_TEST_TOOL1_H
10 #define ASG_TOOLS__UNIT_TEST_TOOL1_H
11 
12 #include <AsgTools/AsgTool.h>
16 
17 #include <mutex>
18 
19 namespace asg
20 {
25 
26  struct UnitTestTool1 : virtual public IUnitTestTool1,
27  public AsgTool
28  {
29  public:
31 
32 
33  UnitTestTool1 (const std::string& val_name);
34 
36  ~UnitTestTool1 ();
37 
38  virtual StatusCode initialize () override;
39  virtual std::string getPropertyString () const override;
40  virtual int getPropertyInt () const override;
41  virtual void setPropertyInt (int val_property) override;
42  virtual bool isInitialized () const override;
43 
46  static int instance_counts (const std::string& name);
47 
48  private:
50  bool m_isInitialized = false;
51 
53  inline static std::map<std::string, int> m_instances ATLAS_THREAD_SAFE;
54 
56  inline static std::mutex m_mutex;
57 
59  Gaudi::Property<std::string> m_propertyString{this, "propertyString", {}, "the string property"};
60 
62  Gaudi::Property<int> m_propertyInt{this, "propertyInt", 0, "the integer property"};
63 
65  Gaudi::Property<bool> m_initializeFail{this, "initializeFail", false, "whether initialize should fail"};
66  };
67 }
68 
69 #endif
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
asg::UnitTestTool1::UnitTestTool1
UnitTestTool1(const std::string &val_name)
standard constructor
Definition: UnitTestTool1.cxx:25
asg::UnitTestTool1::getPropertyString
virtual std::string getPropertyString() const override
get the integer property
Definition: UnitTestTool1.cxx:71
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
asg::UnitTestTool1
a tool used to unit test AnaToolHandle
Definition: UnitTestTool1.h:28
asg
Definition: DataHandleTestTool.h:28
asg::IUnitTestTool1
the interface for UnitTestTool1
Definition: IUnitTestTool1.h:19
asg::UnitTestTool1::m_propertyString
Gaudi::Property< std::string > m_propertyString
the string property
Definition: UnitTestTool1.h:59
asg::UnitTestTool1::isInitialized
virtual bool isInitialized() const override
get whether we have been initialized
Definition: UnitTestTool1.cxx:95
asg::UnitTestTool1::ATLAS_THREAD_SAFE
static std::map< std::string, int > m_instances ATLAS_THREAD_SAFE
instance counts per name
Definition: UnitTestTool1.h:53
asg::UnitTestTool1::setPropertyInt
virtual void setPropertyInt(int val_property) override
get the integer property
Definition: UnitTestTool1.cxx:87
asg::UnitTestTool1::m_initializeFail
Gaudi::Property< bool > m_initializeFail
whether initialize should fail
Definition: UnitTestTool1.h:65
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
asg::UnitTestTool1::instance_counts
static int instance_counts(const std::string &name)
the number of times the tool of the given name has been instantiated
Definition: UnitTestTool1.cxx:103
IUnitTestTool1.h
asg::UnitTestTool1::m_isInitialized
bool m_isInitialized
whether initialize has been called
Definition: UnitTestTool1.h:50
asg::UnitTestTool1::m_propertyInt
Gaudi::Property< int > m_propertyInt
the integer property
Definition: UnitTestTool1.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
asg::UnitTestTool1::m_mutex
static std::mutex m_mutex
mutex for above map
Definition: UnitTestTool1.h:56
asg::UnitTestTool1::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: UnitTestTool1.cxx:48
asg::UnitTestTool1::getPropertyInt
virtual int getPropertyInt() const override
get the integer property
Definition: UnitTestTool1.cxx:79
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
asg::UnitTestTool1::~UnitTestTool1
~UnitTestTool1()
standard destructor
Definition: UnitTestTool1.cxx:37
AsgTool.h
checker_macros.h
Define macros for attributes used to control the static checker.