ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
Athena::DataBucketBranch Class Reference

#include <RootDataBucketBranch.h>

Inheritance diagram for Athena::DataBucketBranch:
Collaboration diagram for Athena::DataBucketBranch:

Public Member Functions

 DataBucketBranch (CLID clid, const std::string &type_name, void *ptr=NULL)
 
 DataBucketBranch (CLID clid, const std::type_info &ti, void *ptr=NULL)
 
 DataBucketBranch (CLID clid, const RootType &type, void *ptr)
 
virtual ~DataBucketBranch () override
 
virtual void * object () override
 
virtual void * cast (CLID clid, SG::IRegisterTransient *itr, 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, SG::IRegisterTransient *itr, bool isConst=true) override
 Return the contents of the DataBucket, converted to type given by std::type_info. 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...
 
virtual const CLIDclID () const override
 
virtual const std::type_info & tinfo () const override
 Return the type_info for the stored object. More...
 
template<class T >
T * cast (SG::IRegisterTransient *irt=0, bool isConst=true)
 Return the contents of the DataBucket, converted to type T. More...
 
virtual void * cast (CLID clid, SG::IRegisterTransient *irt=0, bool isConst=true)=0
 Return the contents of the DataBucket, converted to type given by clid. More...
 
virtual void * cast (const std::type_info &tinfo, SG::IRegisterTransient *irt=0, bool isConst=true)=0
 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)
 Return the contents of the DataBucket, converted to type given by clid. More...
 
template<class T >
T * cast (SG::IRegisterTransient *irt=0, bool isConst=true)
 Return the contents of the DataBucket, converted to type T. More...
 
virtual void * cast (CLID clid, const std::type_info &tinfo, SG::IRegisterTransient *irt=0, bool isConst=true)
 Return the contents of the DataBucket, converted to type given by clid. More...
 

Public Attributes

CLID m_clid
 
RootType m_type
 
void * m_ptr
 
bool allowMismatchCLID =false
 

Detailed Description

Definition at line 24 of file RootDataBucketBranch.h.

Constructor & Destructor Documentation

◆ DataBucketBranch() [1/3]

Athena::DataBucketBranch::DataBucketBranch ( CLID  clid,
const std::string &  type_name,
void *  ptr = NULL 
)
inline

Definition at line 28 of file RootDataBucketBranch.h.

30  :
31  m_clid(clid),
32  m_type(RootType(type_name)),
33  m_ptr(ptr)
34  {}

◆ DataBucketBranch() [2/3]

Athena::DataBucketBranch::DataBucketBranch ( CLID  clid,
const std::type_info &  ti,
void *  ptr = NULL 
)
inline

Definition at line 36 of file RootDataBucketBranch.h.

38  :
39  m_clid(clid),
40  m_type(RootType(ti)),
41  m_ptr(ptr)
42  {}

◆ DataBucketBranch() [3/3]

Athena::DataBucketBranch::DataBucketBranch ( CLID  clid,
const RootType type,
void *  ptr 
)
inline

Definition at line 44 of file RootDataBucketBranch.h.

44  :
45  m_clid(clid),
46  m_type(type),
47  m_ptr(ptr)
48  {}

◆ ~DataBucketBranch()

Athena::DataBucketBranch::~DataBucketBranch ( )
overridevirtual

Definition at line 21 of file RootDataBucketBranch.cxx.

22 {
23  //std::cerr << "::~DBB[" << m_clid << "," << name() << "]\n";
24 }

Member Function Documentation

◆ cast() [1/8]

virtual void* DataBucketBase::cast

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. By default, this uses type_info.

◆ cast() [2/8]

virtual void* DataBucketBase::cast ( CLID  clid,
const std::type_info &  tinfo,
SG::IRegisterTransient irt = 0,
bool  isConst = true 
)
virtualinherited

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. By default, this uses type_info.

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

◆ cast() [3/8]

virtual void* DataBucketBase::cast

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.

◆ cast() [4/8]

void * Athena::DataBucketBranch::cast ( CLID  clid,
SG::IRegisterTransient irt,
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.

Definition at line 27 of file RootDataBucketBranch.cxx.

29 {
30  // no conversion needed
31  if (allowMismatchCLID || clid == m_clid) {
32  return m_ptr;
33 
34  } else {
35  std::ostringstream err;
36  err << "cannot convert from clid ["
37  << this->clID()
38  << "] to requested ["
39  << clid
40  << "]";
41  throw std::runtime_error(err.str());
42  }
43  return 0;
44 }

◆ cast() [5/8]

virtual void* DataBucketBase::cast

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

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

Parameters
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.

◆ cast() [6/8]

void * Athena::DataBucketBranch::cast ( const std::type_info &  tinfo,
SG::IRegisterTransient irt,
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
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.

Implements DataBucketBase.

Definition at line 47 of file RootDataBucketBranch.cxx.

50 {
51  return m_ptr;
52 }

◆ cast() [7/8]

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.

◆ cast() [8/8]

template<class T >
T* DataBucketBase::cast ( class T  )

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.

◆ clID()

virtual const CLID& Athena::DataBucketBranch::clID ( ) const
inlineoverridevirtual

Definition at line 71 of file RootDataBucketBranch.h.

71 { return m_clid; }

◆ lock()

void Athena::DataBucketBranch::lock ( )
inlineoverridevirtual

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

Implements DataBucketBase.

Definition at line 101 of file RootDataBucketBranch.h.

102 {}

◆ object()

void * Athena::DataBucketBranch::object ( )
inlineoverridevirtual

Implements DataBucketBase.

Definition at line 89 of file RootDataBucketBranch.h.

90 {
91  return m_ptr;
92 }

◆ relinquish()

void Athena::DataBucketBranch::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 96 of file RootDataBucketBranch.h.

97 {}

◆ tinfo()

virtual const std::type_info& Athena::DataBucketBranch::tinfo ( ) const
inlineoverridevirtual

Return the type_info for the stored object.

Implements DataBucketBase.

Definition at line 73 of file RootDataBucketBranch.h.

74  {
75  return m_type.TypeInfo();
76  }

Member Data Documentation

◆ allowMismatchCLID

bool Athena::DataBucketBranch::allowMismatchCLID =false

Definition at line 83 of file RootDataBucketBranch.h.

◆ m_clid

CLID Athena::DataBucketBranch::m_clid

Definition at line 79 of file RootDataBucketBranch.h.

◆ m_ptr

void* Athena::DataBucketBranch::m_ptr

Definition at line 81 of file RootDataBucketBranch.h.

◆ m_type

RootType Athena::DataBucketBranch::m_type

Definition at line 80 of file RootDataBucketBranch.h.


The documentation for this class was generated from the following files:
Athena::DataBucketBranch::allowMismatchCLID
bool allowMismatchCLID
Definition: RootDataBucketBranch.h:83
Athena::DataBucketBranch::m_type
RootType m_type
Definition: RootDataBucketBranch.h:80
Athena::DataBucketBranch::m_clid
CLID m_clid
Definition: RootDataBucketBranch.h:79
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
RootType
TTypeAdapter RootType
Definition: RootType.h:211
TScopeAdapter::TypeInfo
const std::type_info & TypeInfo() const
Definition: RootType.cxx:679
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
Athena::DataBucketBranch::m_ptr
void * m_ptr
Definition: RootDataBucketBranch.h:81
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Athena::DataBucketBranch::clID
virtual const CLID & clID() const override
Definition: RootDataBucketBranch.h:71