The Gaudi Framework  v37r0 (b608885e)
Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 > Struct Template Reference

#include </builds/gaudi/Gaudi/GaudiAlg/include/GaudiAlg/GetData.h>

Inheritance diagram for Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >:

Public Types

typedef Getter::Type Type
 
typedef Getter::return_type return_type
 the actual return type More...
 

Public Member Functions

template<class COMMON >
return_type operator() (const COMMON &common, IDataProviderSvc *service, std::string_view location, std::string_view location2) const
 the only one essential method More...
 

Private Types

typedef GetData< TYPE > Getter
 the actual data getter More...
 

Detailed Description

template<class TYPE, class TYPE2>
struct Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >

Helper structure for implementation of "getOrCreate"-functions for GaudiCommon<BASE>

Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-07-22

Definition at line 393 of file GetData.h.

Member Typedef Documentation

◆ Getter

template<class TYPE , class TYPE2 >
typedef GetData<TYPE> Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::Getter
private

the actual data getter

Definition at line 397 of file GetData.h.

◆ return_type

template<class TYPE , class TYPE2 >
typedef Getter::return_type Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::return_type

the actual return type

Definition at line 403 of file GetData.h.

◆ Type

template<class TYPE , class TYPE2 >
typedef Getter::Type Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::Type

Definition at line 401 of file GetData.h.

Member Function Documentation

◆ operator()()

template<class TYPE , class TYPE2 >
template<class COMMON >
return_type Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::operator() ( const COMMON &  common,
IDataProviderSvc service,
std::string_view  location,
std::string_view  location2 
) const
inline

the only one essential method

Parameters
commonthe actual "worker"
servicepointer to Data Provider Service
locationlocation of objects in TES
Returns
the data

check the data

Definition at line 414 of file GetData.h.

415  {
416  SmartDataPtr<TYPE> obj( service, std::string{ location } );
417  if ( !obj ) {
418  auto o = std::make_unique<TYPE2>();
419  auto r = o.get();
420  common.put( service, std::move( o ), location2 );
421  if ( common.msgLevel( MSG::DEBUG ) ) {
422  common.debug() << "The object of type '" << System::typeinfoName( typeid( *r ) )
423  << "' has been created from TS at address '" << location2 << "'" << endmsg;
424  }
425  return r;
426  }
427  auto ret = obj.ptr();
429  common.Assert( !( !ret ), std::string{ "get():: No valid data at '" }.append( location ).append( "\'" ) );
430  if ( common.msgLevel( MSG::DEBUG ) ) {
431  common.debug() << "The object of type '" << System::typeinfoName( typeid( *ret ) )
432  << "' has been retrieved from TS at address '" << location << "'" << endmsg;
433  }
434  // return *VALID* data
435  return ret;
436  // ====================================================================
437  }

The documentation for this struct was generated from the following file:
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
std::string
STL class.
std::move
T move(T... args)
GaudiAlg.HistoUtils.location
location
Definition: HistoUtils.py:965
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:313
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
std::string::append
T append(T... args)
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores.
Definition: SmartDataPtr.h:57