3 #ifndef GAUDIALG_GAUDICOMMONIMP_H
4 #define GAUDIALG_GAUDICOMMONIMP_H 1
23 template <
class PBASE >
24 inline const std::string
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)
47 rootInTES() + location );
52 template <
class PBASE >
53 template <
class TYPE >
56 const std::string& location,
57 const bool useRootInTES )
const
60 Assert( 0 != service ,
"get():: IDataProvider* points to NULL!" ) ;
63 return getter ( *
this ,
65 fullTESLocation ( location , useRootInTES ) ) ;
70 template <
class PBASE >
71 template <
class TYPE >
74 const std::string& location,
75 const bool useRootInTES )
const
78 Assert( 0 != service ,
"get():: IDataProvider* points to NULL!" ) ;
81 return getter ( *
this ,
83 fullTESLocation ( location , useRootInTES ),
89 template <
class PBASE >
90 template <
class TYPE >
92 const std::string& location ,
93 const bool useRootInTES )
const
96 Assert( 0 != service ,
"exist():: IDataProvider* points to NULL!" ) ;
99 return checker ( service,
100 fullTESLocation ( location , useRootInTES ) ) ;
107 template <
class PBASE>
108 template <
class TYPE,
class TYPE2>
111 const std::string& location ,
112 const bool useRootInTES )
const
115 Assert ( 0 != service ,
"getOrCreate():: svc points to NULL!" ) ;
118 return getter ( *
this ,
120 fullTESLocation( location, useRootInTES ) ,
126 template <
class PBASE >
127 template <
class TOOL >
129 const std::string& name ,
137 Tool = tool<TOOL>(
type , parent , create ) ;
141 Assert( this->toolSvc() != 0,
"tool():: IToolSvc* points to NULL!" ) ;
144 this->toolSvc()->retrieveTool ( type , name , Tool , parent , create ) ;
146 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'/'" + name +
"'", sc ) ; }
148 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'/'" + name +
"'" ) ; }
150 addToToolList( Tool );
158 template <
class PBASE >
159 template <
class TOOL >
165 Assert ( PBASE::toolSvc() != 0,
"IToolSvc* points to NULL!" );
169 this->toolSvc() -> retrieveTool ( type, Tool, parent , create );
171 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'", sc ) ; }
173 { Exception(
"tool():: Could not retrieve Tool '" + type +
"'" ) ; }
175 addToToolList( Tool );
182 template <
class PBASE >
183 template <
class SERVICE >
185 const bool create )
const
187 Assert ( this->svcLoc() != 0,
"ISvcLocator* points to NULL!" );
191 if (it != m_services.end()) {
207 addToServiceList(baseSvc);
215 template <
class PBASE>
220 { m_updMgrSvc = svc<IUpdateManagerSvc>(
"UpdateManagerSvc",
true); }
226 template <
class PBASE>
231 { m_msgStream =
new MsgStream ( PBASE::msgSvc() , this->name() ) ; }
232 return *m_msgStream <<
level ;
237 template <
class PBASE>
239 const std::string&
msg ,
242 if (!ok) Exception( msg , sc );
247 template <
class PBASE>
250 if ( 0 != m_msgStream ) {
delete m_msgStream; m_msgStream = 0; }
255 template <
class PBASE>
260 if (!ok) Exception( msg , sc );
277 #define ALG_ERROR( message , code ) \
279 std::string ( " [ at line " ) + \
280 GaudiAlg::fileLine ( __LINE__ ) + \
281 std::string ( " in file '" ) + \
282 std::string ( __FILE__ ) + "']" , code ) )
287 #endif // GAUDIALG_GAUDICOMMONIMP_H
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
Definition of the MsgStream class used to transmit messages.
Small smart pointer class with automatic reference counting for IInterface.
IUpdateManagerSvc * updMgrSvc() const
Short-cut to locate the Update Manager Service.
void resetMsgStream() const
Reset (delete) the current message stream object.
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
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.
bool isValid() const
Allow for check if smart pointer is valid.
Helper structure for implementation of "exists"-functions for GaudiCommon
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 ...
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.
map_type::iterator iterator
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.