![]() |
ATLAS Offline Software
|
Helper for making a thread-safe function call. More...
#include <TSMethodCall.h>
Public Member Functions | |
| TSMethodCall () | |
| Constructor. More... | |
| TSMethodCall (const TSMethodCall &other) | |
| Copy constructor. More... | |
| TSMethodCall & | operator= (const TSMethodCall &other) |
| Assignment. More... | |
| ~TSMethodCall () | |
| Destructor. More... | |
| 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. More... | |
| TMethodCall * | call () |
Return a pointer to the thread-specific TMethodCall. More... | |
Private Attributes | |
| TClass * | m_cls |
| Class that we're calling. More... | |
| std::string | m_fname |
| Name of the function we're calling. More... | |
| std::string | m_args |
| Argument list. More... | |
| ROOT::EFunctionMatchMode | m_mode |
| Matching mode. More... | |
| std::unique_ptr< TMethodCall > | m_meth |
| Object to call the method on the payload type. More... | |
| std::atomic< bool > | m_initialized |
| Flag whether or not m_meth has been initialized. More... | |
| std::mutex | m_mutex |
| Control access to m_assign for initialization. More... | |
| boost::thread_specific_ptr< TMethodCall > | m_tsMeth |
| Objects used to call the method on the payload object. More... | |
Helper for making a thread-safe function call.
We can't use TMethodCall directly because we have to change the object state to make a call.
Definition at line 32 of file TSMethodCall.h.
| RootUtils::TSMethodCall::TSMethodCall | ( | ) |
| RootUtils::TSMethodCall::TSMethodCall | ( | const TSMethodCall & | other | ) |
| RootUtils::TSMethodCall::~TSMethodCall | ( | ) |
| TMethodCall * RootUtils::TSMethodCall::call | ( | ) |
Return a pointer to the thread-specific TMethodCall.
Returns nullptr if setProto hasn't been called or if the method was not found.
Definition at line 109 of file TSMethodCall.cxx.
| TSMethodCall & RootUtils::TSMethodCall::operator= | ( | const TSMethodCall & | other | ) |
Assignment.
Definition at line 53 of file TSMethodCall.cxx.
| void RootUtils::TSMethodCall::setProto | ( | TClass * | cls, |
| const std::string & | fname, | ||
| const std::string & | args, | ||
| ROOT::EFunctionMatchMode | mode = ROOT::kExactMatch |
||
| ) |
Set the function that we're to call.
| cls | The class of the object we're calling. |
| fname | The name of the function. |
| args | Its argument list. |
| mode | Controls whether to allow for conversions. |
Definition at line 90 of file TSMethodCall.cxx.
|
private |
Argument list.
Definition at line 78 of file TSMethodCall.h.
|
private |
Class that we're calling.
Definition at line 72 of file TSMethodCall.h.
|
private |
Name of the function we're calling.
Definition at line 75 of file TSMethodCall.h.
|
private |
Flag whether or not m_meth has been initialized.
We don't want to do that before we actually need it, to prevent needless parses with root6.
Definition at line 98 of file TSMethodCall.h.
|
private |
Object to call the method on the payload type.
This will be left invalid if the payload is not a class type. This instance is not actually used for calls — since we have to change the object state to make a call (registering the arguments), this is not thread-safe. Instead, we use the thread-specific instances accessed through m_tsMeth.
Held by pointer rather than value to work around a ROOT problem where the TMethodCall destructor will crash if gCling has already been destroyed.
Definition at line 93 of file TSMethodCall.h.
|
private |
Matching mode.
Definition at line 81 of file TSMethodCall.h.
|
private |
Control access to m_assign for initialization.
Definition at line 101 of file TSMethodCall.h.
|
private |
Objects used to call the method on the payload object.
Left invalid if the payload does not have class type. Copied from m_meth the first time it's used in a particular thread.
Definition at line 107 of file TSMethodCall.h.
1.8.18