ATLAS Offline Software
Loading...
Searching...
No Matches
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.
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.
virtual void relinquish () override
 Give up ownership of the DataBucket contents.
virtual void lock () override
 If the held object derives from ILockable, call lock() on it.
virtual const CLIDclID () const override
virtual const std::type_info & tinfo () const override
 Return the type_info for the stored object.
template<class T>
T * cast (SG::IRegisterTransient *irt=0, bool isConst=true)
 Return the contents of the DataBucket, converted to type T.
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.

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 {}
TTypeAdapter RootType
Definition RootType.h:211

◆ 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/4]

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

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 from DataBucketBase.

◆ cast() [2/4]

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}
virtual const CLID & clID() const override

◆ cast() [3/4]

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() [4/4]

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

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: