11 #ifndef GAUDIUTILS_GETDATA_H 12 #define GAUDIUTILS_GETDATA_H 1 63 template <
class CONTAINER>
69 template <
class CONTAINER>
78 template <
class TYPE, std::enable_if_t<!std::is_constructible_v<TYPE>,
void*> =
nullptr>
96 template <
class TYPE, std::enable_if_t<std::is_constructible_v<TYPE>,
void*> =
nullptr>
106 if ( tobj2 ) { tobj = &( tobj2->
getData() ); }
122 template <
class TYPE>
139 template <
class COMMON>
141 const bool checkData =
true )
const {
145 common.Assert( obj,
"get():: No valid data at '" +
location +
"'" );
150 << ( obj ?
"has been" :
"could not be" ) <<
" retrieved from TS at address '" <<
location 160 template <
class TYPE>
177 template <
class COMMON>
179 const bool checkData =
true )
const {
185 typedef typename TYPE::Selection Selection_;
186 const Selection_*
sel = dynamic_cast<Selection_*>(
object );
190 <<
"' has been retrieved from TS at address '" <<
location <<
"'" <<
endmsg;
195 typedef typename TYPE::Container Container_;
196 const Container_* cnt = dynamic_cast<Container_*>(
object );
200 <<
"' has been retrieved from TS at address '" <<
location <<
"'" <<
endmsg;
205 if ( checkData ) common.Assert(
false,
"get():: No valid data at '" +
location +
"'" );
208 if ( checkData ) common.Assert(
false,
"get():: No data at '" +
location +
"'" );
237 template <
class ITERATOR>
239 auto _begin = reinterpret_cast<typename return_type::const_iterator*>( &first );
240 auto _end = reinterpret_cast<typename return_type::const_iterator*>( &last );
247 template <
class TYPE>
264 template <
class COMMON>
266 const bool checkData =
true )
const {
293 return m_range.getData( service,
location );
304 template <
class TYPE>
308 template <
class TYPE>
312 template <
class TYPE>
323 template <
class TYPE>
335 return getFromTS<TYPE>( service,
location );
341 template <
class TYPE>
353 if ( !
object ) {
return false; }
354 return dynamic_cast<typename TYPE::Selection*>(
object ) || dynamic_cast<typename TYPE::Container*>(
object );
373 template <
class TYPE>
375 :
public CheckData<Gaudi::Range_<std::vector<const TYPE*>>> {};
378 template <
class TYPE>
382 template <
class TYPE>
386 template <
class TYPE>
397 template <
class TYPE,
class TYPE2>
418 template <
class COMMON>
423 auto o = std::make_unique<TYPE2>();
425 common.put( service,
std::move( o ), location2 );
428 <<
"' has been created from TS at address '" << location2 <<
"'" <<
endmsg;
432 auto ret = obj.
ptr();
434 common.Assert( !( !ret ),
"get():: No valid data at '" +
location +
"'" );
437 <<
"' has been retrieved from TS at address '" <<
location <<
"'" <<
endmsg;
445 template <
class TYPE,
class TYPE2>
469 template <
class COMMON>
474 common.put( service, std::make_unique<TYPE2>(), location2 );
477 <<
"' has been created from TS at address '" << location2 <<
"'" <<
endmsg;
480 return m_getter( common, service,
location );
491 template <
class TYPE,
class TYPE2>
515 template <
class COMMON>
528 template <
class TYPE,
class TYPE2>
530 template <
class TYPE,
class TYPE2>
532 template <
class TYPE,
class TYPE2>
535 template <
class TYPE,
class TYPE2>
537 template <
class TYPE,
class TYPE2>
539 template <
class TYPE,
class TYPE2>
542 template <
class TYPE,
class TYPE2>
544 template <
class TYPE,
class TYPE2>
546 template <
class TYPE,
class TYPE2>
555 #endif // GAUDIUTILS_GETDATA_H 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 bool checkData=true) const
the only one essential method
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.
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const bool checkData=true) const
the only one essential method
_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.
GetOrCreateData< Range_, TYPE2 > Helper
DataObject * getData(IDataProviderSvc *service, const std::string &location) const
get the data form transient store
const T & getData() const
Getter::return_type return_type
the actual return type
TYPE * ptr()
Automatic conversion to data type.
Helper m_range
the actual data getter
return_type make_range(ITERATOR first, ITERATOR last) const
Range make_range(const DataObject *obj)
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
DataObject * getData(IDataProviderSvc *service, const std::string &location) const
get the data form transient store
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"
bool operator()(IDataProviderSvc *service, const std::string &location) const
the only one essential method
DataObject * accessData()
Static Object retrieval method: must call specific function.
Helper structure for implementation of "getOrCreate"-functions for GaudiCommon<BASE>
return_type make_range(const typename TYPE::Selection *cnt) const
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 operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const std::string &location2) const
the only one essential method
Getter::return_type return_type
the actual return type
A small class used to access easily (and efficiently) data items residing in data stores.
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
_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...
_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
bool operator()(IDataProviderSvc *service, const std::string &location) const
the only one essential method
return_type operator()(const COMMON &common, IDataProviderSvc *service, const std::string &location, const std::string &location2) const
the only one essential method
static AccessFunction access()
Gaudi::Range_< std::vector< const TYPE * > > Type
the actual return type
return_type make_range(const typename TYPE::Container *cnt) const
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)
return_type make_range(const typename TYPE::Container *cnt) const
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
Header file for std:chrono::duration-based Counters.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
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
GetData< TYPE > Getter
the actual data getter