ATLAS Offline Software
AsgTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ASGTOOLS_ASGTOOL_H
6 #define ASGTOOLS_ASGTOOL_H
7 
8 // Athena include(s).
9 #include "CxxUtils/sgkey_t.h"
10 
11 // Local include(s):
12 #include "AsgTools/IAsgTool.h"
13 #include "AsgMessaging/MsgLevel.h"
15 
16 // Environment specific include(s):
17 #ifdef XAOD_STANDALONE
19 # include "AsgTools/AsgComponent.h"
20 # include "AsgTools/SgTEvent.h"
21  // Forward declaration(s):
22 #else // XAOD_STANDALONE
24 #endif // XAOD_STANDALONE
25 
26 // System include(s).
27 #include <string>
28 
29 namespace asg {
30 
31  // Declare the type name of AsgTool's base class
32 #ifndef XAOD_STANDALONE
33  typedef ::AthAlgTool AsgToolBase;
34 #else // not XAOD_STANDALONE
35  typedef AsgComponent AsgToolBase;
36 #endif // not XAOD_STANDALONE
37 
46  class AsgTool : public virtual IAsgTool,
47  public AsgToolBase {
48 
49  public:
51  AsgTool( const std::string& name );
53  ~AsgTool();
54 
55  AsgTool (const AsgTool&) = delete;
56  AsgTool& operator= (const AsgTool&) = delete;
57 
58 
59 #ifdef XAOD_STANDALONE
60 
62  SgTEvent* evtStore() const;
63 
64  // this is just so that my template functions can find this
65  // method in the base class.
66  public:
67  using AsgToolBase::msg;
68 
69 #endif // XAOD_STANDALONE
70 
71 #ifndef XAOD_STANDALONE
72  public:
75 
76 #endif // not XAOD_STANDALONE
77 
80 
82  template< class T >
83  const T* getProperty( const std::string& name ) const;
84 
86  const std::string& msg_level_name() const __attribute__ ((deprecated));
87 
105  const std::string& getName( const void* ptr ) const;
106 
124  SG::sgkey_t getKey( const void* ptr ) const;
125 
127 
133  virtual StatusCode initialize() { return StatusCode::SUCCESS; }
134 
136  virtual void print() const;
137 
138  private:
139 #ifdef XAOD_STANDALONE
140  mutable SgTEvent m_event;
141 #endif // XAOD_STANDALONE
142 
143  }; // class AsgTool
144 
145 } // namespace asg
146 
147 // Include the implementation of the template functions:
148 #include "AsgTools/AsgTool.icc"
149 
150 // Include static methods for working with AsgTools
151 #include "AsgTools/SetProperty.h"
152 
153 #endif // ASGTOOLS_ASGTOOL_H
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
AsgTool.icc
asg::AsgTool::getName
const std::string & getName(const void *ptr) const
Get the name of an object that is / should be in the event store.
Definition: AsgTool.cxx:106
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
asg::AsgTool::operator=
AsgTool & operator=(const AsgTool &)=delete
asg::IAsgTool
Base class for the dual-use tool interface classes.
Definition: IAsgTool.h:41
asg
Definition: DataHandleTestTool.h:28
asg::AsgTool::AsgTool
AsgTool(const AsgTool &)=delete
asg::AsgTool::getProperty
const T * getProperty(const std::string &name) const
Get one of the tool's properties.
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
AsgMessaging.h
asg::AsgTool::~AsgTool
~AsgTool()
Destructor.
Definition: AsgTool.cxx:73
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
asg::AsgTool::getKey
SG::sgkey_t getKey(const void *ptr) const
Get the (hashed) key of an object that is in the event store.
Definition: AsgTool.cxx:119
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
AthAlgTool.h
TestMuonSF::getProperty
T getProperty(const asg::IAsgTool *interface_tool, const std::string &prop_name)
Definition: MuonSFTestHelper.cxx:17
IAsgTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
asg::AsgTool::msg_level_name
const std::string & msg_level_name() const __attribute__((deprecated))
A deprecated function for getting the message level's name.
Definition: AsgTool.cxx:101
AsgComponent.h
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
asg::SgTEvent
Wrapper for TEvent to make it look like StoreGate.
Definition: SgTEvent.h:44
SetProperty.h
runJobs.deprecated
deprecated
Definition: runJobs.py:191
sgkey_t.h
Define the type used for hashed StoreGate key+CLID pairs.
MsgLevel.h
Definition of message levels and a helper function.
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
asg::AsgToolBase
::AthAlgTool AsgToolBase
Definition: AsgTool.h:33
AthAlgTool
Definition: AthAlgTool.h:26
asg::AsgTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgTool.h:133
asg::AsgTool::print
virtual void print() const
Print the state of the tool.
Definition: AsgTool.cxx:131
SgTEvent.h