ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
SG::DataBucket< T > Class Template Reference

#include <DataBucket.h>

Inheritance diagram for SG::DataBucket< T >:
Collaboration diagram for SG::DataBucket< T >:

Public Member Functions

 DataBucket ()
 
 DataBucket (T *data)
 
template<class U >
 DataBucket (std::unique_ptr< U > data)
 
virtual ~DataBucket ()
 
virtual const CLIDclID () const override
 
virtual void * object () override
 
virtual const std::type_info & tinfo () const override
 Return the type_info for the stored object. More...
 
 operator T* ()
 
 operator const T * () const
 
virtual void * cast (CLID clid, IRegisterTransient *irt=0, bool isConst=true) override
 Return the contents of the DataBucket, converted to type given by clid. More...
 
virtual void * cast (const std::type_info &tinfo, IRegisterTransient *irt=0, bool isConst=true) override
 Return the contents of the DataBucket, converted to type given by std::type_info. More...
 
virtual void * cast (CLID clid, const std::type_info &tinfo, SG::IRegisterTransient *irt=0, bool isConst=true) override
 Return the contents of the DataBucket, converted to type given by clid. More...
 
virtual void relinquish () override
 Give up ownership of the DataBucket contents. More...
 
virtual void lock () override
 If the held object derives from ILockable, call lock() on it. More...
 
template<class T >
T * cast (SG::IRegisterTransient *irt=0, bool isConst=true)
 Return the contents of the DataBucket, converted to type T. More...
 

Static Public Member Functions

static const CLIDclassID ()
 

Protected Member Functions

T * ptr ()
 
const T * cptr () const
 
void * tryStaticConversion (CLID clid)
 Try a conversion using static SG_BASES information. More...
 
void * tryStaticConversion (const std::type_info &tinfo)
 Try a conversion using static SG_BASES information. More...
 

Private Types

typedef std::pair< const CopyConversionBase *, void * > ent_t
 Objects made by copy conversion. More...
 
typedef std::vector< ent_tvec_t
 

Private Member Functions

 DataBucket (const DataBucket &)
 
DataBucketoperator= (const DataBucket &)
 

Private Attributes

T * m_ptr
 
vec_t m_cnvcopies
 

Detailed Description

template<class T>
class SG::DataBucket< T >

Definition at line 29 of file DataBucket.h.

Member Typedef Documentation

◆ ent_t

template<class T >
typedef std::pair<const CopyConversionBase*, void*> SG::DataBucket< T >::ent_t
private

Objects made by copy conversion.

Definition at line 158 of file DataBucket.h.

◆ vec_t

template<class T >
typedef std::vector<ent_t> SG::DataBucket< T >::vec_t
private

Definition at line 159 of file DataBucket.h.

Constructor & Destructor Documentation

◆ DataBucket() [1/4]

template<class T >
SG::DataBucket< T >::DataBucket ( )
inline

Definition at line 35 of file DataBucket.h.

35 : m_ptr(0) {} //needed by the generic converters

◆ DataBucket() [2/4]

template<class T >
SG::DataBucket< T >::DataBucket ( T *  data)

◆ DataBucket() [3/4]

template<class T >
template<class U >
SG::DataBucket< T >::DataBucket ( std::unique_ptr< U >  data)

◆ ~DataBucket()

template<class T >
virtual SG::DataBucket< T >::~DataBucket ( )
virtual

◆ DataBucket() [4/4]

template<class T >
SG::DataBucket< T >::DataBucket ( const DataBucket< T > &  )
private

Member Function Documentation

◆ cast() [1/4]

template<class T >
virtual void* SG::DataBucket< T >::cast ( CLID  clid,
const std::type_info &  tinfo,
SG::IRegisterTransient irt = 0,
bool  isConst = true 
)
overridevirtual

Return the contents of the DataBucket, converted to type given by clid.

Note that only derived->base conversions are allowed here.

Parameters
clidThe class ID to which to convert.
tinfoThe std::type_info of the type to which to convert.
irtTo be called if we make a new instance.
isConstTrue if the object being converted is regarded as const.

This allows the callee to choose whether to use clid or tinfo. Here we use clid.

Reimplemented from DataBucketBase.

Reimplemented in SG::DVLDataBucket< T >, SG::DVLDataBucket< DV >, and SG::MetaContDataBucket< T >.

◆ cast() [2/4]

template<class T >
virtual void* SG::DataBucket< T >::cast ( CLID  clid,
IRegisterTransient irt = 0,
bool  isConst = true 
)
overridevirtual

Return the contents of the DataBucket, converted to type given by clid.

Note that only derived->base conversions are allowed here.

Parameters
clidThe class ID to which to convert.
irtTo be called if we make a new instance.
isConstTrue if the object being converted is regarded as const.

Implements DataBucketBase.

Reimplemented in SG::DVLDataBucket< T >, SG::DVLDataBucket< DV >, and SG::MetaContDataBucket< T >.

◆ cast() [3/4]

template<class T >
virtual void* SG::DataBucket< T >::cast ( const std::type_info &  tinfo,
IRegisterTransient irt = 0,
bool  isConst = true 
)
overridevirtual

Return the contents of the DataBucket, converted to type given by std::type_info.

Note that only derived->base conversions are allowed here.

Parameters
clidThe std::type_info of the type to which to convert.
irtTo be called if we make a new instance.
isConstTrue if the object being converted is regarded as const.

Implements DataBucketBase.

Reimplemented in SG::DVLDataBucket< T >, SG::DVLDataBucket< DV >, and SG::MetaContDataBucket< T >.

◆ cast() [4/4]

template<class T >
T* DataBucketBase::cast ( SG::IRegisterTransient irt = 0,
bool  isConst = true 
)
inherited

Return the contents of the DataBucket, converted to type T.

Note that only derived->base conversions are allowed here. T must have a valid Class ID for this to work.

Parameters
irtTo be called if we make a new instance.
isConstTrue if the object being converted is regarded as const.

◆ classID()

template<class T >
static const CLID& SG::DataBucket< T >::classID ( )
static

◆ clID()

template<class T >
virtual const CLID& SG::DataBucket< T >::clID ( ) const
overridevirtual

◆ cptr()

template<class T >
const T* SG::DataBucket< T >::cptr ( ) const
inlineprotected

Definition at line 131 of file DataBucket.h.

131 { return m_ptr; }

◆ lock()

template<class T >
virtual void SG::DataBucket< T >::lock ( )
overridevirtual

If the held object derives from ILockable, call lock() on it.

Implements DataBucketBase.

◆ object()

template<class T >
virtual void* SG::DataBucket< T >::object ( )
inlineoverridevirtual

Implements DataBucketBase.

Definition at line 49 of file DataBucket.h.

50  {
51  typedef typename std::remove_const<T>::type T_nc;
52  return const_cast<T_nc*>(m_ptr);
53  }

◆ operator const T *()

template<class T >
SG::DataBucket< T >::operator const T * ( ) const
inline

Definition at line 72 of file DataBucket.h.

72 { return cptr(); }

◆ operator T*()

template<class T >
SG::DataBucket< T >::operator T* ( )
inline

Definition at line 71 of file DataBucket.h.

71 { return ptr(); } //FIXME can we do without?

◆ operator=()

template<class T >
DataBucket& SG::DataBucket< T >::operator= ( const DataBucket< T > &  )
private

◆ ptr()

template<class T >
T* SG::DataBucket< T >::ptr ( )
inlineprotected

Definition at line 130 of file DataBucket.h.

130 { return m_ptr; }

◆ relinquish()

template<class T >
virtual void SG::DataBucket< T >::relinquish ( )
inlineoverridevirtual

Give up ownership of the DataBucket contents.

This leaks the contents and it is useful mainly for error handling.

Implements DataBucketBase.

Definition at line 121 of file DataBucket.h.

121 { m_ptr=0;} //LEAKS m_ptr

◆ tinfo()

template<class T >
virtual const std::type_info& SG::DataBucket< T >::tinfo ( ) const
inlineoverridevirtual

Return the type_info for the stored object.

Implements DataBucketBase.

Reimplemented in SG::DVLDataBucket< T >, and SG::DVLDataBucket< DV >.

Definition at line 58 of file DataBucket.h.

59  {
60  return typeid(T);
61  }

◆ tryStaticConversion() [1/2]

template<class T >
void* SG::DataBucket< T >::tryStaticConversion ( CLID  clid)
protected

Try a conversion using static SG_BASES information.

Parameters
clidThe class ID to which to convert.

This can all be unfolded at compile time, so is fast, but doesn't take into account SG_ADD_BASES.

◆ tryStaticConversion() [2/2]

template<class T >
void* SG::DataBucket< T >::tryStaticConversion ( const std::type_info &  tinfo)
protected

Try a conversion using static SG_BASES information.

Parameters
tinfoThe std::type_info of the type to which to convert.

This can all be unfolded at compile time, so is fast, but doesn't take into account SG_ADD_BASES.

Member Data Documentation

◆ m_cnvcopies

template<class T >
vec_t SG::DataBucket< T >::m_cnvcopies
private

Definition at line 160 of file DataBucket.h.

◆ m_ptr

template<class T >
T* SG::DataBucket< T >::m_ptr
private

Definition at line 155 of file DataBucket.h.


The documentation for this class was generated from the following file:
SG::DataBucket::cptr
const T * cptr() const
Definition: DataBucket.h:131
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::DataBucket::ptr
T * ptr()
Definition: DataBucket.h:130
SG::DataBucket::m_ptr
T * m_ptr
Definition: DataBucket.h:155
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35