1 #ifndef GAUDIALG_GAUDICOMMONIMP_H 2 #define GAUDIALG_GAUDICOMMONIMP_H 1 23 template <
class PBASE >
26 const bool useRootInTES )
const 38 return ( !useRootInTES || rootInTES().empty() ?
41 location.
empty() || ( location ==
"/Event" ) ?
42 rootInTES().substr(0,rootInTES().size()-1)
44 0 == location.
find(
"/Event/") ?
45 rootInTES() + location.
substr(7)
46 : location[0] ==
'/' ?
47 rootInTES() + location.
substr(1)
53 template <
class PBASE >
54 template <
class TYPE >
58 const bool useRootInTES )
const 61 Assert( service ,
"get():: IDataProvider* points to NULL!" ) ;
64 return getter ( *
this ,
66 fullTESLocation ( location , useRootInTES ) ) ;
71 template <
class PBASE >
72 template <
class TYPE >
76 const bool useRootInTES )
const 79 Assert( service ,
"get():: IDataProvider* points to NULL!" ) ;
82 return getter ( *
this ,
84 fullTESLocation ( location , useRootInTES ),
90 template <
class PBASE >
91 template <
class TYPE >
94 const bool useRootInTES )
const 97 Assert( service ,
"exist():: IDataProvider* points to NULL!" ) ;
100 return checker ( service,
101 fullTESLocation ( location , useRootInTES ) ) ;
108 template <
class PBASE>
109 template <
class TYPE,
class TYPE2>
113 const bool useRootInTES )
const 116 Assert ( service ,
"getOrCreate():: svc points to NULL!" ) ;
119 return getter ( *
this ,
121 fullTESLocation( location, useRootInTES ) ,
127 template <
class PBASE >
128 template <
class TOOL >
135 if ( name.
empty() )
return tool<TOOL>( type , parent , create ) ;
136 Assert( this->toolSvc(),
"tool():: IToolSvc* points to NULL!" ) ;
138 TOOL* Tool = nullptr ;
140 this->toolSvc()->retrieveTool ( type , name , Tool , parent , create ) ;
142 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'/'" + name +
"'", sc ) ; }
144 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'/'" + name +
"'" ) ; }
146 PBASE::registerTool(Tool);
147 m_managedTools.push_back(Tool);
154 template <
class PBASE >
155 template <
class TOOL >
161 Assert ( PBASE::toolSvc(),
"IToolSvc* points to NULL!" );
163 TOOL* Tool = nullptr ;
165 this->toolSvc() -> retrieveTool ( type, Tool, parent , create );
167 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'", sc ) ; }
169 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'" ) ; }
171 PBASE::registerTool(Tool);
172 m_managedTools.push_back(Tool);
179 template <
class PBASE >
180 template <
class SERVICE >
182 const bool create )
const 184 Assert ( this->svcLoc(),
"ISvcLocator* points to NULL!" );
196 auto baseSvc = this->svcLoc()->service(name, create);
200 if ( !baseSvc || !s ) {
204 addToServiceList(baseSvc);
212 template <
class PBASE>
217 { m_updMgrSvc = svc<IUpdateManagerSvc>(
"UpdateManagerSvc",
true); }
223 template <
class PBASE>
228 if (!ok) Exception( msg , sc );
233 template <
class PBASE>
238 if (!ok) Exception( msg , sc );
255 #define ALG_ERROR( message , code ) \ 257 std::string ( " [ at line " ) + \ 258 std::to_string ( __LINE__ ) + \ 259 std::string ( " in file '" ) + \ 260 std::string ( __FILE__ ) + "']" , code ) ) 266 #endif // GAUDIALG_GAUDICOMMONIMP_H 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.
bool isFailure() const
Test for a status code of FAILURE.
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> ...
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.
const std::string fullTESLocation(const std::string &location, const bool useRootInTES) const
Returns the full correct event location given the rootInTes settings.
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.