1 #ifndef GAUDIUTILS_GETDATA_H 2 #define GAUDIUTILS_GETDATA_H 1 53 template <
class CONTAINER>
59 template <
class CONTAINER>
68 template <class TYPE, std::enable_if_t<!std::is_constructible<TYPE>::value,
void*> =
nullptr>
86 template <class TYPE, std::enable_if_t<std::is_constructible<TYPE>::value,
void*> =
nullptr>
96 if ( tobj2 ) { tobj = &( tobj2->
getData() ); }
112 template <
class TYPE>
129 template <
class COMMON>
131 const bool checkData =
true )
const {
133 return_type obj = getFromTS<Type>( service,
location );
135 common.Assert( obj,
"get():: No valid data at '" + location +
"'" );
140 << ( obj ?
"has been" :
"could not be" ) <<
" retrieved from TS at address '" << location
150 template <
class TYPE>
167 template <
class COMMON>
169 const bool checkData =
true )
const {
172 DataObject*
object = this->getData( service, location );
175 typedef typename TYPE::Selection Selection_;
176 const Selection_*
sel =
dynamic_cast<Selection_*
>( object );
180 <<
"' has been retrieved from TS at address '" << location <<
"'" <<
endmsg;
185 typedef typename TYPE::Container Container_;
186 const Container_* cnt =
dynamic_cast<Container_*
>( object );
190 <<
"' has been retrieved from TS at address '" << location <<
"'" <<
endmsg;
195 if ( checkData ) common.Assert(
false,
"get():: No valid data at '" + location +
"'" );
198 if ( checkData ) common.Assert(
false,
"get():: No data at '" + location +
"'" );
206 return_type
make_range(
const typename TYPE::Container* cnt )
const {
210 return_type
make_range(
const typename TYPE::Selection* cnt )
const {
227 template <
class ITERATOR>
228 return_type
make_range( ITERATOR first, ITERATOR last )
const {
229 auto _begin =
reinterpret_cast<typename return_type::const_iterator*
>( &first );
230 auto _end =
reinterpret_cast<typename return_type::const_iterator*
>( &last );
237 template <
class TYPE>
254 template <
class COMMON>
256 const bool checkData =
true )
const {
257 return return_type( m_range( common, service, location, checkData ), location );
263 return_type
make_range(
const typename TYPE::Container* cnt )
const {
270 return_type
make_range(
const typename TYPE::Selection* cnt )
const {
283 return m_range.getData( service, location );
294 template <
class TYPE>
298 template <
class TYPE>
302 template <
class TYPE>
313 template <
class TYPE>
325 return getFromTS<TYPE>( service,
location );
331 template <
class TYPE>
342 DataObject*
object = this->getData( service, location );
343 if ( !
object ) {
return false; }
344 return dynamic_cast<typename TYPE::Selection*
>( object ) || dynamic_cast<typename TYPE::Container*>(
object );
363 template <
class TYPE>
365 :
public CheckData<Gaudi::Range_<std::vector<const TYPE*>>> {};
368 template <
class TYPE>
372 template <
class TYPE>
376 template <
class TYPE>
387 template <
class TYPE,
class TYPE2>
408 template <
class COMMON>
413 auto o = std::make_unique<TYPE2>();
415 common.put( service,
std::move( o ), location2 );
418 <<
"' has been created from TS at address '" << location2 <<
"'" <<
endmsg;
422 auto ret = obj.
ptr();
424 common.Assert( !( !ret ),
"get():: No valid data at '" + location +
"'" );
427 <<
"' has been retrieved from TS at address '" << location <<
"'" <<
endmsg;
435 template <
class TYPE,
class TYPE2>
459 template <
class COMMON>
462 DataObject* obj = m_getter.getData( service, location );
464 common.put( service, std::make_unique<TYPE2>(), location2 );
467 <<
"' has been created from TS at address '" << location2 <<
"'" <<
endmsg;
470 return m_getter( common, service, location );
481 template <
class TYPE,
class TYPE2>
505 template <
class COMMON>
508 return return_type( m_range( common, service, location, location2 ), location );
518 template <
class TYPE,
class TYPE2>
520 template <
class TYPE,
class TYPE2>
522 template <
class TYPE,
class TYPE2>
525 template <
class TYPE,
class TYPE2>
527 template <
class TYPE,
class TYPE2>
529 template <
class TYPE,
class TYPE2>
532 template <
class TYPE,
class TYPE2>
534 template <
class TYPE,
class TYPE2>
536 template <
class TYPE,
class TYPE2>
545 #endif // GAUDIUTILS_GETDATA_H bool operator()(IDataProviderSvc *service, const std::string &location) const
the only one essential method
Gaudi::NamedRange_< CONTAINER > return_type
Helper structure to define the proper return type for "get"-functions.
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const std::string &location2) const
the only one essential method
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.
DataObject * getData(IDataProviderSvc *service, const std::string &location) const
get the data form transient store
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const std::string &location2) const
the only one essential method
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>
bool operator()(IDataProviderSvc *service, const std::string &location) const
the only one essential method
Data provider interface definition.
GetOrCreateData< Range_, TYPE2 > Helper
const T & getData() const
Getter::return_type return_type
the actual return type
return_type make_range(ITERATOR first, ITERATOR last) const
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
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const bool checkData=true) const
the only one essential method
Helper m_range
the actual data getter
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const std::string &location2) const
the only one essential method
return_type make_range(const typename TYPE::Container *cnt) const
Range make_range(const DataObject *obj)
virtual const id_type & identifier() const =0
Full identifier (or key)
Helper structure for implementation of "exists"-functions for GaudiCommon<BASE>
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const bool checkData=true) const
the only one essential method
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
virtual StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
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_
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const bool checkData=true) const
the only one essential method
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