1 #ifndef GAUDIUTILS_GETDATA_H 2 #define GAUDIUTILS_GETDATA_H 1 55 template <
class CONTAINER>
61 template <
class CONTAINER>
70 template <class TYPE, std::enable_if_t<!std::is_constructible<TYPE>::value,
void*> =
nullptr>
89 template <class TYPE, std::enable_if_t<std::is_constructible<TYPE>::value,
void*> =
nullptr>
118 template <
class TYPE>
135 template <
class 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 +
"'" );
147 << ( obj ?
"has been" :
"could not be" ) <<
" retrieved from TS at address '" << location
157 template <
class TYPE>
174 template <
class COMMON>
176 const bool checkData =
true )
const 180 DataObject*
object = this->getData( service, location );
183 typedef typename TYPE::Selection Selection_;
184 const Selection_*
sel =
dynamic_cast<Selection_*
>( object );
188 <<
"' has been retrieved from TS at address '" << location <<
"'" <<
endmsg;
193 typedef typename TYPE::Container Container_;
194 const Container_* cnt =
dynamic_cast<Container_*
>( object );
198 <<
"' has been retrieved from TS at address '" << location <<
"'" <<
endmsg;
203 if ( checkData ) common.Assert(
false,
"get():: No valid data at '" + location +
"'" );
206 if ( checkData ) common.Assert(
false,
"get():: No data at '" + location +
"'" );
214 return_type
make_range(
const typename TYPE::Container* cnt )
const 219 return_type
make_range(
const typename TYPE::Selection* cnt )
const 238 template <
class ITERATOR>
239 return_type
make_range( ITERATOR first, ITERATOR last )
const 241 auto _begin =
reinterpret_cast<typename return_type::const_iterator*
>( &first );
242 auto _end =
reinterpret_cast<typename return_type::const_iterator*
>( &last );
249 template <
class TYPE>
266 template <
class COMMON>
268 const bool checkData =
true )
const 270 return return_type( m_range( common, service, location, checkData ), location );
276 return_type
make_range(
const typename TYPE::Container* cnt )
const 286 return_type
make_range(
const typename TYPE::Selection* cnt )
const 303 return m_range.getData( service, location );
314 template <
class TYPE>
319 template <
class TYPE>
324 template <
class TYPE>
336 template <
class TYPE>
349 return getFromTS<TYPE>( service,
location );
355 template <
class TYPE>
367 DataObject*
object = this->getData( service, location );
371 return dynamic_cast<typename TYPE::Selection*
>( object ) || dynamic_cast<typename TYPE::Container*>(
object );
391 template <
class TYPE>
393 :
public CheckData<Gaudi::Range_<std::vector<const TYPE*>>> {
397 template <
class TYPE>
402 template <
class TYPE>
407 template <
class TYPE>
419 template <
class TYPE,
class TYPE2>
440 template <
class COMMON>
446 auto o = std::make_unique<TYPE2>();
448 common.put( service,
std::move( o ), location2 );
451 <<
"' has been created from TS at address '" << location2 <<
"'" <<
endmsg;
455 auto ret = obj.
ptr();
457 common.Assert( !( !ret ),
"get():: No valid data at '" + location +
"'" );
460 <<
"' has been retrieved from TS at address '" << location <<
"'" <<
endmsg;
468 template <
class TYPE,
class TYPE2>
492 template <
class COMMON>
496 DataObject* obj = m_getter.getData( service, location );
498 common.put( service, std::make_unique<TYPE2>(), location2 );
501 <<
"' has been created from TS at address '" << location2 <<
"'" <<
endmsg;
504 return m_getter( common, service, location );
515 template <
class TYPE,
class TYPE2>
539 template <
class COMMON>
543 return return_type( m_range( common, service, location, location2 ), location );
553 template <
class TYPE,
class TYPE2>
556 template <
class TYPE,
class TYPE2>
559 template <
class TYPE,
class TYPE2>
563 template <
class TYPE,
class TYPE2>
566 template <
class TYPE,
class TYPE2>
569 template <
class TYPE,
class TYPE2>
573 template <
class TYPE,
class TYPE2>
576 template <
class TYPE,
class TYPE2>
579 template <
class TYPE,
class TYPE2>
589 #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