11 #ifndef GAUDIALG_GAUDICOMMONIMP_H 12 #define GAUDIALG_GAUDICOMMONIMP_H 1 33 template <
class PBASE>
38 Assert( service,
"get():: IDataProvider* points to NULL!" );
41 return getter( *
this, service, this->
fullTESLocation( location, useRootInTES ) );
46 template <
class PBASE>
50 const bool useRootInTES )
const {
52 Assert( service,
"get():: IDataProvider* points to NULL!" );
55 return getter( *
this, service, this->
fullTESLocation( location, useRootInTES ),
false );
60 template <
class PBASE>
63 const bool useRootInTES )
const {
65 Assert( service,
"exist():: IDataProvider* points to NULL!" );
68 return checker( service, this->
fullTESLocation( location, useRootInTES ) );
75 template <
class PBASE>
76 template <
class TYPE,
class TYPE2>
79 const bool useRootInTES )
const {
81 Assert( service,
"getOrCreate():: svc points to NULL!" );
89 template <
class PBASE>
94 if (
name.empty() )
return tool<TOOL>(
type, parent, create );
95 Assert( this->toolSvc(),
"tool():: IToolSvc* points to NULL!" );
98 const StatusCode sc = this->toolSvc()->retrieveTool(
type,
name, Tool, parent, create );
99 if ( sc.
isFailure() ) { Exception(
"tool():: Could not retrieve Tool '" +
type +
"'/'" +
name +
"'", sc ); }
100 if ( !Tool ) { Exception(
"tool():: Could not retrieve Tool '" +
type +
"'/'" +
name +
"'" ); }
102 PBASE::registerTool( Tool );
103 m_managedTools.push_back( Tool );
110 template <
class PBASE>
111 template <
class TOOL>
114 Assert( PBASE::toolSvc(),
"IToolSvc* points to NULL!" );
116 TOOL* Tool =
nullptr;
117 const StatusCode sc = this->toolSvc()->retrieveTool(
type, Tool, parent, create );
118 if ( sc.
isFailure() ) { Exception(
"tool():: Could not retrieve Tool '" +
type +
"'", sc ); }
119 if ( !Tool ) { Exception(
"tool():: Could not retrieve Tool '" +
type +
"'" ); }
121 PBASE::registerTool( Tool );
122 m_managedTools.push_back( Tool );
129 template <
class PBASE>
130 template <
class SERVICE>
132 Assert( this->svcLoc(),
"ISvcLocator* points to NULL!" );
142 auto baseSvc = this->svcLoc()->service(
name, create );
148 addToServiceList( baseSvc );
156 template <
class PBASE>
158 if ( !m_updMgrSvc ) { m_updMgrSvc = svc<IUpdateManagerSvc>(
"UpdateManagerSvc",
true ); }
164 template <
class PBASE>
166 if ( !ok ) Exception(
msg, sc );
171 template <
class PBASE>
173 if ( !ok ) Exception(
msg, sc );
190 #define ALG_ERROR( message, code ) \ 191 ( Error( message + std::string( " [ at line " ) + std::to_string( __LINE__ ) + std::string( " in file '" ) + \ 192 std::string( __FILE__ ) + "']", \ 198 #endif // GAUDIALG_GAUDICOMMONIMP_H IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
Small smart pointer class with automatic reference counting for IInterface.
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.
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
Data provider interface definition.
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 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.
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.
SmartIF< SERVICE > svc(const std::string &name, const bool create=true) const
A useful method for the easy location of services.
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.
constexpr static const auto FAILURE
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.
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.