3 #ifndef GAUDIUTILS_GETDATA_H
4 #define GAUDIUTILS_GETDATA_H 1
49 template <
class CONTAINER>
54 template <
class CONTAINER>
64 const std::string& location ) {
98 template <
class COMMON>
100 (
const COMMON& common ,
102 const std::string& location ,
103 const bool checkData =
true)
const
106 return_type obj = getFromTS<Type>(service, location);
108 common.Assert(obj,
"get():: No valid data at '" + location +
"'");
112 common.debug() <<
"The object of type '"
115 << (obj ?
"has been" :
"could not be")
116 <<
" retrieved from TS at address '"
117 << location <<
"'" <<
endmsg ;
126 template <
class TYPE>
144 template <
class COMMON>
146 (
const COMMON& common ,
148 const std::string& location ,
149 const bool checkData =
true)
const
153 DataObject*
object =
this -> getData ( service , location ) ;
157 typedef typename TYPE::Selection Selection_;
158 const Selection_*
sel =
dynamic_cast<Selection_*
> ( object ) ;
162 { common.debug() <<
"The object of type '"
164 <<
"' has been retrieved from TS at address '"
165 << location <<
"'" <<
endmsg ; }
166 return make_range ( sel ) ;
169 typedef typename TYPE::Container Container_ ;
170 const Container_* cnt =
dynamic_cast<Container_*
> ( object ) ;
174 { common.debug() <<
"The object of type '"
176 <<
"' has been retrieved from TS at address '"
177 << location <<
"'" <<
endmsg ; }
178 return make_range ( cnt ) ;
182 common.Assert (
false ,
"get():: No valid data at '" + location +
"'" ) ;
186 common.Assert (
false ,
"get():: No data at '" + location +
"'" ) ;
195 {
return 0 == cnt ?
return_type() : make_range ( cnt->begin() , cnt->end() ) ; }
206 const std::string& location )
const
211 service , 0 , location ) ;
217 template <
class ITERATOR>
220 ITERATOR last )
const
222 typename return_type::const_iterator* _begin =
reinterpret_cast<typename return_type::const_iterator*
>(&first);
223 typename return_type::const_iterator* _end =
reinterpret_cast<typename return_type::const_iterator*
>(&last);
230 template <
class TYPE>
248 template <
class COMMON>
250 (
const COMMON& common ,
252 const std::string& location ,
253 const bool checkData =
true)
const
255 return return_type ( m_range( common , service , location, checkData ) , location ) ;
264 static const std::string s_empty =
"" ;
267 ( m_range.make_range ( cnt ) , 0 != reg ? reg->
identifier() : s_empty ) ;
273 static const std::string s_empty =
"" ;
276 ( m_range.make_range ( cnt ) , 0 != reg ? reg->
identifier() : s_empty ) ;
285 const std::string& location )
const
286 {
return m_range.getData ( service , location ) ; }
296 template <
class TYPE>
300 template <
class TYPE>
304 template <
class TYPE>
315 template <
class TYPE>
326 inline bool operator()
328 const std::string& location )
const
331 return getFromTS<TYPE>(service, location);
337 template <
class TYPE>
348 inline bool operator()
350 const std::string& location )
const
352 DataObject*
object = this->getData( service , location ) ;
353 if ( 0 ==
object ) {
return false ; }
355 0 !=
dynamic_cast<typename TYPE::Selection*
> ( object ) ||
356 0 != dynamic_cast<typename TYPE::Container*> (
object ) ;
367 const std::string& location )
const
372 service , 0 , location ) ;
379 template <
class TYPE>
381 :
public CheckData<Gaudi::Range_<std::vector<const TYPE*> > > {} ;
384 template <
class TYPE>
388 template <
class TYPE>
392 template <
class TYPE>
403 template <
class TYPE,
class TYPE2>
425 template <
class COMMON>
427 (
const COMMON& common ,
429 const std::string& location ,
430 const std::string& location2 )
const
435 TYPE2* o =
new TYPE2() ;
436 common.put ( service , o , location2 ) ;
438 { common.debug() <<
"The object of type '"
440 <<
"' has been created from TS at address '"
441 << location2 <<
"'" <<
endmsg ; }
447 common.Assert ( !(!ret) ,
"get():: No valid data at '" + location +
"'" ) ;
449 { common.debug() <<
"The object of type '"
451 <<
"' has been retrieved from TS at address '"
452 << location <<
"'" <<
endmsg ; }
459 template <
class TYPE,
class TYPE2>
484 template <
class COMMON>
486 (
const COMMON& common ,
488 const std::string& location ,
489 const std::string& location2 )
const
491 DataObject* obj = m_getter.getData ( service , location ) ;
494 TYPE2* o =
new TYPE2() ;
495 common.put ( service , o , location2 ) ;
497 { common.debug() <<
"The object of type '"
499 <<
"' has been created from TS at address '"
500 << location2 <<
"'" <<
endmsg ; }
502 return m_getter ( common , service , location ) ;
513 template <
class TYPE,
class TYPE2>
538 template <
class COMMON>
540 (
const COMMON& common ,
542 const std::string& location ,
543 const std::string& location2 )
const
548 location2 ) , location ) ;
558 template <
class TYPE,
class TYPE2>
561 template <
class TYPE,
class TYPE2>
564 template <
class TYPE,
class TYPE2>
568 template <
class TYPE,
class TYPE2>
571 template <
class TYPE,
class TYPE2>
574 template <
class TYPE,
class TYPE2>
578 template <
class TYPE,
class TYPE2>
581 template <
class TYPE,
class TYPE2>
584 template <
class TYPE,
class TYPE2>
594 #endif // GAUDIUTILS_GETDATA_H
GetOrCreateData< Range_, TYPE2 > Helper
Gaudi::NamedRange_< CONTAINER > return_type
Helper structure to define the proper return type for "get"-functions.
Gaudi::NamedRange_< std::vector< const TYPE * > > Range
This file has been imported from LoKi project "C++ ToolKit for Smart and Friendly Physics Analysis" ...
Getter m_getter
the actual data getter
GetData< Range > Getter
the actual data getter
Gaudi::NamedRange_< std::vector< const TYPE * > > Type
the actual return type
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
bool isSuccess() const
Test for a status code of SUCCESS.
DataObject * getData(IDataProviderSvc *service, const std::string &location) const
get the data form transient store
return_type make_range(const typename TYPE::Selection *cnt) const
This file has been imported from LoKi project "C++ ToolKit for Smart and Friendly Physics Analysis" ...
_GetType< Type >::return_type return_type
GetData< Range > Getter
the actual data getter
Helper structure for implementation of "get"-functions for GaudiCommon
Data provider interface definition.
Getter::return_type return_type
the actual return type
DataObject * getData(IDataProviderSvc *service, const std::string &location) const
get the data form transient store
return_type make_range(const typename TYPE::Selection *cnt) const
Helper m_range
the actual data getter
return_type make_range(const typename TYPE::Container *cnt) const
Helper structure for implementation of "exists"-functions for GaudiCommon
DataObject * accessData()
Static Object retrieval method: must call specific function.
Helper structure for implementation of "getOrCreate"-functions for GaudiCommon ...
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Getter::return_type return_type
the actual return type
_GetType< Type >::return_type return_type
the actual return type
return_type make_range(const typename TYPE::Container *cnt) const
Getter::return_type return_type
the actual return type
A small class used to access easily (and efficiently) data items residing in data stores...
_GetType< TYPE >::return_type getFromTS(IDataProviderSvc *service, const std::string &location)
Helper function to provide the minimal lookup and cast functionality of SmartDataPtr used in the help...
DataObject * getData(IDataProviderSvc *service, const std::string &location) const
get the data form transient store
_GetType< Type >::return_type return_type
CheckData< Range > Checker
the actual data checker
GetData< Gaudi::Range_< std::vector< const TYPE * > > > m_range
===================================================================== the actual processor ...
static AccessFunction access()
Gaudi::Range_< std::vector< const TYPE * > > Type
the actual return type
Useful class for representation of "sequence" of the objects through the range of valid iterators...
A small class used to access easily (and efficiently) data items residing in data stores...
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Gaudi::Range_< std::vector< const TYPE * > > Range
virtual const id_type & identifier() const =0
Full identifier (or key)
Gaudi::Range_< std::vector< const TYPE * > > Range_
This is a number of static methods for bootstrapping the Gaudi framework.
A DataObject is the base class of any identifiable object on any data store.
Gaudi::Range_< CONTAINER > return_type
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
GetData< TYPE > Getter
the actual data getter
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.