ATLAS Offline Software
TSMethodCall.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
15 #ifndef ROOTUTILS_TSMETHODCALL_H
16 #define ROOTUTILS_TSMETHODCALL_H
17 
18 
19 #include "TClass.h"
20 #include "TMethodCall.h"
21 #include "boost/thread/tss.hpp"
22 #include <atomic>
23 #include <mutex>
24 
25 
26 namespace RootUtils {
27 
28 
33 {
34 public:
36  TSMethodCall();
37 
38  // Copy constructor.
40 
41  // Assignment.
43 
44  // Destructor.
45  ~TSMethodCall();
46 
47 
55  void setProto (TClass* cls,
56  const std::string& fname,
57  const std::string& args,
58  ROOT::EFunctionMatchMode mode = ROOT::kExactMatch);
59 
60 
67  TMethodCall* call();
68 
69 
70 private:
72  TClass* m_cls;
73 
75  std::string m_fname;
76 
78  std::string m_args;
79 
81  ROOT::EFunctionMatchMode m_mode;
82 
93  std::unique_ptr<TMethodCall> m_meth;
94 
98  std::atomic<bool> m_initialized;
99 
102 
107  boost::thread_specific_ptr<TMethodCall> m_tsMeth;
108 };
109 
110 
111 } // namespace RootUtils
112 
113 
114 #endif // not ROOTUTILS_TSMETHODCALL_H
RootUtils
Definition: ILogger.h:20
RootUtils::TSMethodCall::m_meth
std::unique_ptr< TMethodCall > m_meth
Object to call the method on the payload type.
Definition: TSMethodCall.h:93
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
CaloClusterListBadChannel.cls
cls
Definition: CaloClusterListBadChannel.py:8
RootUtils::TSMethodCall::operator=
TSMethodCall & operator=(const TSMethodCall &other)
Assignment.
Definition: TSMethodCall.cxx:53
RootUtils::TSMethodCall::m_fname
std::string m_fname
Name of the function we're calling.
Definition: TSMethodCall.h:75
RootUtils::TSMethodCall
Helper for making a thread-safe function call.
Definition: TSMethodCall.h:33
RootUtils::TSMethodCall::TSMethodCall
TSMethodCall()
Constructor.
Definition: TSMethodCall.cxx:26
RootUtils::TSMethodCall::m_mutex
std::mutex m_mutex
Control access to m_assign for initialization.
Definition: TSMethodCall.h:101
Preparation.mode
mode
Definition: Preparation.py:95
RootUtils::TSMethodCall::m_mode
ROOT::EFunctionMatchMode m_mode
Matching mode.
Definition: TSMethodCall.h:81
RootUtils::TSMethodCall::call
TMethodCall * call()
Return a pointer to the thread-specific TMethodCall.
Definition: TSMethodCall.cxx:109
RootUtils::TSMethodCall::setProto
void setProto(TClass *cls, const std::string &fname, const std::string &args, ROOT::EFunctionMatchMode mode=ROOT::kExactMatch)
Set the function that we're to call.
Definition: TSMethodCall.cxx:90
RootUtils::TSMethodCall::m_cls
TClass * m_cls
Class that we're calling.
Definition: TSMethodCall.h:72
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
RootUtils::TSMethodCall::m_initialized
std::atomic< bool > m_initialized
Flag whether or not m_meth has been initialized.
Definition: TSMethodCall.h:98
RootUtils::TSMethodCall::m_args
std::string m_args
Argument list.
Definition: TSMethodCall.h:78
RootUtils::TSMethodCall::m_tsMeth
boost::thread_specific_ptr< TMethodCall > m_tsMeth
Objects used to call the method on the payload object.
Definition: TSMethodCall.h:107
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
RootUtils::TSMethodCall::~TSMethodCall
~TSMethodCall()
Destructor.
Definition: TSMethodCall.cxx:72