1 #ifndef GAUDIALG_GAUDICOMMONIMP_H 2 #define GAUDIALG_GAUDICOMMONIMP_H 1 23 template <
class PBASE>
28 Assert( service,
"get():: IDataProvider* points to NULL!" );
31 return getter( *
this, service, this->
fullTESLocation( location, useRootInTES ) );
36 template <
class PBASE>
40 const bool useRootInTES )
const {
42 Assert( service,
"get():: IDataProvider* points to NULL!" );
45 return getter( *
this, service, this->
fullTESLocation( location, useRootInTES ),
false );
50 template <
class PBASE>
53 const bool useRootInTES )
const {
55 Assert( service,
"exist():: IDataProvider* points to NULL!" );
58 return checker( service, this->
fullTESLocation( location, useRootInTES ) );
65 template <
class PBASE>
66 template <
class TYPE,
class TYPE2>
69 const bool useRootInTES )
const {
71 Assert( service,
"getOrCreate():: svc points to NULL!" );
74 return getter( *
this, service, this->
fullTESLocation( location, useRootInTES ), location );
79 template <
class PBASE>
84 if ( name.
empty() )
return tool<TOOL>( type, parent, create );
85 Assert( this->toolSvc(),
"tool():: IToolSvc* points to NULL!" );
88 const StatusCode sc = this->toolSvc()->retrieveTool( type, name, Tool, parent, create );
89 if ( sc.
isFailure() ) { Exception(
"tool():: Could not retrieve Tool '" + type +
"'/'" + name +
"'", sc ); }
90 if ( !Tool ) { Exception(
"tool():: Could not retrieve Tool '" + type +
"'/'" + name +
"'" ); }
92 PBASE::registerTool( Tool );
93 m_managedTools.push_back( Tool );
100 template <
class PBASE>
101 template <
class TOOL>
104 Assert( PBASE::toolSvc(),
"IToolSvc* points to NULL!" );
106 TOOL* Tool =
nullptr;
107 const StatusCode sc = this->toolSvc()->retrieveTool( type, Tool, parent, create );
108 if ( sc.
isFailure() ) { Exception(
"tool():: Could not retrieve Tool '" + type +
"'", sc ); }
109 if ( !Tool ) { Exception(
"tool():: Could not retrieve Tool '" + type +
"'" ); }
111 PBASE::registerTool( Tool );
112 m_managedTools.push_back( Tool );
119 template <
class PBASE>
120 template <
class SERVICE>
122 Assert( this->svcLoc(),
"ISvcLocator* points to NULL!" );
130 if ( !s ) { Exception(
"svc():: Could not retrieve Svc '" + name +
"'",
StatusCode::FAILURE ); }
132 auto baseSvc = this->svcLoc()->service( name, create );
136 if ( !baseSvc || !s ) { Exception(
"svc():: Could not retrieve Svc '" + name +
"'",
StatusCode::FAILURE ); }
138 addToServiceList( baseSvc );
146 template <
class PBASE>
148 if ( !m_updMgrSvc ) { m_updMgrSvc = svc<IUpdateManagerSvc>(
"UpdateManagerSvc",
true ); }
154 template <
class PBASE>
156 if ( !ok ) Exception( msg, sc );
161 template <
class PBASE>
163 if ( !ok ) Exception( msg, sc );
180 #define ALG_ERROR( message, code ) \ 181 ( Error( message + std::string( " [ at line " ) + std::to_string( __LINE__ ) + std::string( " in file '" ) + \ 182 std::string( __FILE__ ) + "']", \ 188 #endif // GAUDIALG_GAUDICOMMONIMP_H class MergingTransformer< Out(const vector_of_const_< In > true
Small smart pointer class with automatic reference counting for IInterface.
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Get the existing data object from Gaudi Event Transient store.
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
bool exist(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Check the existence of a data object or container in the Gaudi Transient Event Store.
Data provider interface definition.
constexpr const struct GaudiCommon_details::svc_lt_t svc_lt
Helper structure for implementation of "exists"-functions for GaudiCommon<BASE>
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
Helper structure for implementation of "getOrCreate"-functions for GaudiCommon<BASE> ...
std::string fullTESLocation(std::string_view location, std::string_view rit)
Interface class to the Update Manager service.
Gaudi::Utils::GetData< TYPE >::return_type get(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Templated access to the data in Gaudi Transient Store.
void Assert(const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
Assertion - throw exception if the given condition is not fulfilled.
constexpr static const auto FAILURE
Gaudi::Utils::GetData< TYPE >::return_type getIfExists(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Quicker version of the get function which bypasses the check on the retrieved data.
TOOL * tool(const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const
Useful method for the easy location of tools.
SmartIF< SERVICE > svc(const std::string &name, const bool create=true) const
A useful method for the easy location of services.