1 #ifndef GAUDIUTILS_GETDATA_H 2 #define GAUDIUTILS_GETDATA_H 1 51 template <
class CONTAINER>
56 template <
class CONTAINER>
64 template <class TYPE, typename std::enable_if<!std::is_constructible<TYPE>::value,
void*>
::type=
nullptr>
84 template <class TYPE, typename std::enable_if<std::is_constructible<TYPE>::value,
void*>::type=
nullptr>
114 template <
class TYPE>
132 template <
class COMMON>
133 inline return_type operator()
134 (
const COMMON& common ,
137 const bool checkData =
true)
const 140 return_type obj = getFromTS<Type>(service,
location);
142 common.Assert(obj,
"get():: No valid data at '" + location +
"'");
146 common.debug() <<
"The object of type '" 149 << (obj ?
"has been" :
"could not be")
150 <<
" retrieved from TS at address '" 151 << location <<
"'" <<
endmsg ;
160 template <
class TYPE>
178 template <
class COMMON>
179 inline return_type operator()
180 (
const COMMON& common ,
183 const bool checkData =
true)
const 187 DataObject*
object =
this -> getData ( service , location ) ;
191 typedef typename TYPE::Selection Selection_;
192 const Selection_*
sel =
dynamic_cast<Selection_*
> ( object ) ;
196 { common.debug() <<
"The object of type '" 198 <<
"' has been retrieved from TS at address '" 199 << location <<
"'" <<
endmsg ; }
200 return make_range ( sel ) ;
203 typedef typename TYPE::Container Container_ ;
204 const Container_* cnt =
dynamic_cast<Container_*
> ( object ) ;
208 { common.debug() <<
"The object of type '" 210 <<
"' has been retrieved from TS at address '" 211 << location <<
"'" <<
endmsg ; }
212 return make_range ( cnt ) ;
216 common.Assert (
false ,
"get():: No valid data at '" + location +
"'" ) ;
220 common.Assert (
false ,
"get():: No data at '" + location +
"'" ) ;
228 return_type
make_range (
const typename TYPE::Container* cnt )
const 229 {
return 0 == cnt ?
return_type() : make_range ( cnt->begin() , cnt->end() ) ; }
231 return_type
make_range (
const typename TYPE::Selection* cnt )
const 245 service ,
nullptr , location ) ;
251 template <
class ITERATOR>
252 return_type make_range
254 ITERATOR last )
const 256 auto _begin =
reinterpret_cast<typename return_type::const_iterator*
>(&first);
257 auto _end =
reinterpret_cast<typename return_type::const_iterator*
>(&last);
264 template <
class TYPE>
282 template <
class COMMON>
283 inline return_type operator()
284 (
const COMMON& common ,
287 const bool checkData =
true)
const 289 return return_type ( m_range( common , service , location, checkData ) , location ) ;
295 return_type
make_range (
const typename TYPE::Container* cnt )
const 301 ( m_range.make_range ( cnt ) , reg ? reg->
identifier() : s_empty ) ;
304 return_type
make_range (
const typename TYPE::Selection* cnt )
const 310 ( m_range.make_range ( cnt ) , reg ? reg->
identifier() : s_empty ) ;
320 {
return m_range.getData ( service , location ) ; }
330 template <
class TYPE>
334 template <
class TYPE>
338 template <
class TYPE>
349 template <
class TYPE>
360 inline bool operator()
365 return getFromTS<TYPE>(service,
location);
371 template <
class TYPE>
382 inline bool operator()
386 DataObject*
object = this->getData( service , location ) ;
387 if ( !
object ) {
return false ; }
389 dynamic_cast<typename TYPE::Selection*
> ( object ) ||
390 dynamic_cast<typename TYPE::Container*> (
object ) ;
406 service ,
nullptr , location ) ;
413 template <
class TYPE>
415 :
public CheckData<Gaudi::Range_<std::vector<const TYPE*> > > {} ;
418 template <
class TYPE>
422 template <
class TYPE>
426 template <
class TYPE>
437 template <
class TYPE,
class TYPE2>
459 template <
class COMMON>
460 inline return_type operator()
461 (
const COMMON& common ,
469 TYPE2* o =
new TYPE2() ;
470 common.put ( service , o , location2 ) ;
472 { common.debug() <<
"The object of type '" 474 <<
"' has been created from TS at address '" 475 << location2 <<
"'" <<
endmsg ; }
478 auto ret = obj.
ptr() ;
480 common.Assert ( !(!ret) ,
"get():: No valid data at '" + location +
"'" ) ;
482 { common.debug() <<
"The object of type '" 484 <<
"' has been retrieved from TS at address '" 485 << location <<
"'" <<
endmsg ; }
492 template <
class TYPE,
class TYPE2>
517 template <
class COMMON>
518 inline return_type operator()
519 (
const COMMON& common ,
524 DataObject* obj = m_getter.getData ( service , location ) ;
527 common.put ( service ,
new TYPE2() , location2 ) ;
529 { common.debug() <<
"The object of type '" 531 <<
"' has been created from TS at address '" 532 << location2 <<
"'" <<
endmsg ; }
534 return m_getter ( common , service , location ) ;
545 template <
class TYPE,
class TYPE2>
570 template <
class COMMON>
571 inline return_type operator()
572 (
const COMMON& common ,
580 location2 ) , location ) ;
590 template <
class TYPE,
class TYPE2>
593 template <
class TYPE,
class TYPE2>
596 template <
class TYPE,
class TYPE2>
600 template <
class TYPE,
class TYPE2>
603 template <
class TYPE,
class TYPE2>
606 template <
class TYPE,
class TYPE2>
610 template <
class TYPE,
class TYPE2>
613 template <
class TYPE,
class TYPE2>
616 template <
class TYPE,
class TYPE2>
626 #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
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
_GetType< Type >::return_type return_type
GetData< Range > Getter
the actual data getter
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
Data provider interface definition.
const T & getData() const
Getter::return_type return_type
the actual return type
TYPE * ptr()
Automatic conversion to data 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
virtual const id_type & identifier() const =0
Full identifier (or key)
Helper structure for implementation of "exists"-functions for GaudiCommon<BASE>
This class is used for returning status codes from appropriate routines.
This file has been imported from LoKi project "C++ ToolKit for Smart and Friendly Physics Analysis" ...
DataObject * accessData()
Static Object retrieval method: must call specific function.
Helper structure for implementation of "getOrCreate"-functions for GaudiCommon<BASE> ...
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
This file has been imported from LoKi project "C++ ToolKit for Smart and Friendly Physics Analysis" ...
_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
Gaudi::Range_< std::vector< const TYPE * > > Range_
A DataObject is the base class of any identifiable object on any data store.
Gaudi::Range_< CONTAINER > return_type
Helper functions to set/get the application return code.
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.