ATLAS Offline Software
|
an "initializing" ToolHandle for stand-alone applications More...
#include <StandaloneToolHandle.h>
Public Member Functions | |
StandaloneToolHandle ()=default | |
StandaloneToolHandle (const std::string &typeAndName) | |
StatusCode | initialize () |
initialize the tool, will fail if the tool was already initialized More... | |
StatusCode | retrieve () |
initialize the tool, will succeed if the tool was already initialized More... | |
const ToolHandle< std::remove_const_t< T > > & | getHandle () |
get the contained handle More... | |
auto | typeAndName () const |
auto | name () const |
void | setTypeAndName (const std::string &typeAndName) |
template<typename T2 > | |
StatusCode | setProperty (const std::string &name, T2 &&value) |
StatusCode | createPrivateTool (const std::string &name, const std::string &toolType) |
T * | get () |
access the wrapped tool More... | |
const T * | get () const |
T * | operator-> () |
const T * | operator-> () const |
T & | operator* () |
const T & | operator* () const |
Private Member Functions | |
void | checkNotInitialized () const |
check that we are not initialized yet More... | |
void | checkIsInitialized () const |
check that we are initialized, forcing in-place initialization if necessary More... | |
Private Attributes | |
T * | m_pointer {nullptr} |
the cached pointer to the tool More... | |
ToolHandle< std::remove_const_t< T > > | m_toolHandle |
the ToolHandle holding the tool after initialization More... | |
std::shared_ptr< void > | m_cleanup |
the tool-cleanup pointer More... | |
AsgToolConfig | m_config |
the actual configuration of the tool More... | |
an "initializing" ToolHandle for stand-alone applications
The purpose of this class is to make it easy to configure and instantiate a tool using the proper factory methods, so that they can readily be used within standalone applications. It is not meant to be used within any tools, algorithms or inside a regular Athena or EventLoop job in general. Those should use a regular ToolHandle
(possibly combined with AsgToolConfig
if a default configuration is desired).
This is meant to replace the legacy AnaToolHandle
class as a drop-in replacement, that avoids a lot of the extra functionality that can be problematic, in particular it can not be used as a property and it does not try to manage public tools behind the scenes.
Note that the template argument can be const
qualified, to force that it can only be accessed via a const
pointer after it has been created.
\warn The cleanup behavior of this class is essentially undefined, and code should not try to access the tool after this object goes out of scope, nor should it rely on the tool being destroyed when this object is. In AnalysisBase the tool will be destroyed and removed when the object goes out of scope. In Athena the tool will still be owned by the ToolSvc
and be released at a later point.
Definition at line 43 of file StandaloneToolHandle.h.
|
default |
|
inline |
Definition at line 50 of file StandaloneToolHandle.h.
|
private |
check that we are initialized, forcing in-place initialization if necessary
This is not truly const, but this convention matches the gaudi ToolHandle behavior.
Definition at line 187 of file StandaloneToolHandle.h.
|
private |
check that we are not initialized yet
Definition at line 178 of file StandaloneToolHandle.h.
|
inline |
Definition at line 108 of file StandaloneToolHandle.h.
|
inline |
|
inline |
Definition at line 66 of file StandaloneToolHandle.h.
const ToolHandle< std::remove_const_t< T > > & asg::StandaloneToolHandle< T >::getHandle |
get the contained handle
Note that this is probably not ideal, but it is kept around for legacy code that is using it.
Definition at line 169 of file StandaloneToolHandle.h.
StatusCode asg::StandaloneToolHandle< T >::initialize |
initialize the tool, will fail if the tool was already initialized
Definition at line 157 of file StandaloneToolHandle.h.
|
inline |
Definition at line 99 of file StandaloneToolHandle.h.
|
inline |
Definition at line 72 of file StandaloneToolHandle.h.
|
inline |
Definition at line 74 of file StandaloneToolHandle.h.
|
inline |
Definition at line 68 of file StandaloneToolHandle.h.
|
inline |
Definition at line 70 of file StandaloneToolHandle.h.
StatusCode asg::StandaloneToolHandle< T >::retrieve |
initialize the tool, will succeed if the tool was already initialized
Definition at line 146 of file StandaloneToolHandle.h.
|
inline |
Definition at line 105 of file StandaloneToolHandle.h.
|
inline |
Definition at line 101 of file StandaloneToolHandle.h.
|
inline |
These are mostly direct forwards of the members of AsgToolConfig to avoid directly exposing the member object to the user. It is generally forbidden to try to change the configuration after the tool has been initialized, but read accessor may still be called.
Definition at line 97 of file StandaloneToolHandle.h.
|
private |
the tool-cleanup pointer
Definition at line 127 of file StandaloneToolHandle.h.
|
private |
the actual configuration of the tool
Definition at line 130 of file StandaloneToolHandle.h.
|
private |
the cached pointer to the tool
Definition at line 121 of file StandaloneToolHandle.h.
|
private |
the ToolHandle
holding the tool after initialization
Definition at line 124 of file StandaloneToolHandle.h.