1 #ifndef GAUDIUTILS_GETDATA_H 2 #define GAUDIUTILS_GETDATA_H 1 47 template <
class CONTAINER>
52 template <
class CONTAINER>
96 template <
class COMMON>
97 inline return_type operator()
98 (
const COMMON& common ,
101 const bool checkData =
true)
const 104 return_type obj = getFromTS<Type>(service,
location);
106 common.Assert(obj,
"get():: No valid data at '" + location +
"'");
110 common.debug() <<
"The object of type '" 113 << (obj ?
"has been" :
"could not be")
114 <<
" retrieved from TS at address '" 115 << location <<
"'" <<
endmsg ;
124 template <
class TYPE>
142 template <
class COMMON>
143 inline return_type operator()
144 (
const COMMON& common ,
147 const bool checkData =
true)
const 151 DataObject*
object =
this -> getData ( service , location ) ;
155 typedef typename TYPE::Selection Selection_;
156 const Selection_*
sel =
dynamic_cast<Selection_*
> ( object ) ;
160 { common.debug() <<
"The object of type '" 162 <<
"' has been retrieved from TS at address '" 163 << location <<
"'" <<
endmsg ; }
164 return make_range ( sel ) ;
167 typedef typename TYPE::Container Container_ ;
168 const Container_* cnt =
dynamic_cast<Container_*
> ( object ) ;
172 { common.debug() <<
"The object of type '" 174 <<
"' has been retrieved from TS at address '" 175 << location <<
"'" <<
endmsg ; }
176 return make_range ( cnt ) ;
180 common.Assert (
false ,
"get():: No valid data at '" + location +
"'" ) ;
184 common.Assert (
false ,
"get():: No data at '" + location +
"'" ) ;
192 return_type
make_range (
const typename TYPE::Container* cnt )
const 193 {
return 0 == cnt ?
return_type() : make_range ( cnt->begin() , cnt->end() ) ; }
195 return_type
make_range (
const typename TYPE::Selection* cnt )
const 209 service ,
nullptr , location ) ;
215 template <
class ITERATOR>
216 return_type make_range
218 ITERATOR last )
const 220 auto _begin =
reinterpret_cast<typename return_type::const_iterator*
>(&first);
221 auto _end =
reinterpret_cast<typename return_type::const_iterator*
>(&last);
228 template <
class TYPE>
246 template <
class COMMON>
247 inline return_type operator()
248 (
const COMMON& common ,
251 const bool checkData =
true)
const 253 return return_type ( m_range( common , service , location, checkData ) , location ) ;
259 return_type
make_range (
const typename TYPE::Container* cnt )
const 265 ( m_range.make_range ( cnt ) , reg ? reg->
identifier() : s_empty ) ;
268 return_type
make_range (
const typename TYPE::Selection* cnt )
const 274 ( m_range.make_range ( cnt ) , reg ? reg->
identifier() : s_empty ) ;
284 {
return m_range.getData ( service , location ) ; }
294 template <
class TYPE>
298 template <
class TYPE>
302 template <
class TYPE>
313 template <
class TYPE>
324 inline bool operator()
329 return getFromTS<TYPE>(service,
location);
335 template <
class TYPE>
346 inline bool operator()
351 if ( !
object ) {
return false ; }
353 dynamic_cast<typename TYPE::Selection*
> ( object ) ||
354 dynamic_cast<typename TYPE::Container*> (
object ) ;
370 service ,
nullptr , location ) ;
377 template <
class TYPE>
379 :
public CheckData<Gaudi::Range_<std::vector<const TYPE*> > > {} ;
382 template <
class TYPE>
386 template <
class TYPE>
390 template <
class TYPE>
401 template <
class TYPE,
class TYPE2>
423 template <
class COMMON>
424 inline return_type operator()
425 (
const COMMON& common ,
433 TYPE2* o =
new TYPE2() ;
434 common.put ( service , o , location2 ) ;
436 { common.debug() <<
"The object of type '" 438 <<
"' has been created from TS at address '" 439 << location2 <<
"'" <<
endmsg ; }
442 auto ret = obj.
ptr() ;
444 common.Assert ( !(!ret) ,
"get():: No valid data at '" + location +
"'" ) ;
446 { common.debug() <<
"The object of type '" 448 <<
"' has been retrieved from TS at address '" 449 << location <<
"'" <<
endmsg ; }
456 template <
class TYPE,
class TYPE2>
481 template <
class COMMON>
482 inline return_type operator()
483 (
const COMMON& common ,
488 DataObject* obj = m_getter.getData ( service , location ) ;
491 common.put ( service ,
new TYPE2() , location2 ) ;
493 { common.debug() <<
"The object of type '" 495 <<
"' has been created from TS at address '" 496 << location2 <<
"'" <<
endmsg ; }
498 return m_getter ( common , service , location ) ;
509 template <
class TYPE,
class TYPE2>
534 template <
class COMMON>
535 inline return_type operator()
536 (
const COMMON& common ,
544 location2 ) , location ) ;
554 template <
class TYPE,
class TYPE2>
557 template <
class TYPE,
class TYPE2>
560 template <
class TYPE,
class TYPE2>
564 template <
class TYPE,
class TYPE2>
567 template <
class TYPE,
class TYPE2>
570 template <
class TYPE,
class TYPE2>
574 template <
class TYPE,
class TYPE2>
577 template <
class TYPE,
class TYPE2>
580 template <
class TYPE,
class TYPE2>
590 #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.
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 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.