ATLAS Offline Software
Loading...
Searching...
No Matches
BareDataBucket Class Reference

Allows to insert void* returned from serialisation into the store. More...

#include <BareDataBucket.h>

Inheritance diagram for BareDataBucket:
Collaboration diagram for BareDataBucket:

Public Member Functions

 BareDataBucket ()=delete
 BareDataBucket (void *data, CLID clid, RootType type)
virtual ~BareDataBucket () override
 BareDataBucket (const BareDataBucket &)=delete
 BareDataBucket (BareDataBucket &&)=delete
BareDataBucketoperator= (const BareDataBucket &)=delete
BareDataBucketoperator= (BareDataBucket &&)=delete
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.
virtual void * cast (CLID clid, SG::IRegisterTransient *, 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 *, 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.
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.

Private Attributes

void * m_data = nullptr
CLID m_clid = 0
RootType m_type

Detailed Description

Allows to insert void* returned from serialisation into the store.

Definition at line 14 of file BareDataBucket.h.

Constructor & Destructor Documentation

◆ BareDataBucket() [1/4]

BareDataBucket::BareDataBucket ( )
delete

◆ BareDataBucket() [2/4]

BareDataBucket::BareDataBucket ( void * data,
CLID clid,
RootType type )
inline

Definition at line 18 of file BareDataBucket.h.

19 : m_data(data), m_clid(clid), m_type( std::move(type) ){}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11

◆ ~BareDataBucket()

virtual BareDataBucket::~BareDataBucket ( )
inlineoverridevirtual

Definition at line 21 of file BareDataBucket.h.

21 {
22 if ( m_data != nullptr )
23 m_type.Destruct( m_data );
24 }

◆ BareDataBucket() [3/4]

BareDataBucket::BareDataBucket ( const BareDataBucket & )
delete

◆ BareDataBucket() [4/4]

BareDataBucket::BareDataBucket ( BareDataBucket && )
delete

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]

virtual void * BareDataBucket::cast ( CLID clid,
SG::IRegisterTransient * irt,
bool isConst = true )
inlineoverridevirtual

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 47 of file BareDataBucket.h.

49 {
50 return ( m_clid == clid and isConst ) ? m_data : nullptr;
51 }

◆ cast() [3/4]

virtual void * BareDataBucket::cast ( const std::type_info & tinfo,
SG::IRegisterTransient * irt,
bool isConst = true )
inlineoverridevirtual

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 53 of file BareDataBucket.h.

55 {
56 return ( tinfo == m_type.TypeInfo() and isConst ) ? m_data : nullptr;
57 }
virtual const std::type_info & tinfo() const override
Return the type_info for the stored object.

◆ 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 & BareDataBucket::clID ( ) const
inlineoverridevirtual

Definition at line 32 of file BareDataBucket.h.

32 {
33 return m_clid;
34 }

◆ lock()

virtual void BareDataBucket::lock ( )
inlineoverridevirtual

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

Implements DataBucketBase.

Definition at line 63 of file BareDataBucket.h.

63{ /*not lockable I think */ };

◆ object()

virtual void * BareDataBucket::object ( )
inlineoverridevirtual

Implements DataBucketBase.

Definition at line 38 of file BareDataBucket.h.

38 {
39 return m_data;
40 }

◆ operator=() [1/2]

BareDataBucket & BareDataBucket::operator= ( BareDataBucket && )
delete

◆ operator=() [2/2]

BareDataBucket & BareDataBucket::operator= ( const BareDataBucket & )
delete

◆ relinquish()

virtual void BareDataBucket::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 59 of file BareDataBucket.h.

59 {
60 m_data = nullptr;
61 };

◆ tinfo()

virtual const std::type_info & BareDataBucket::tinfo ( ) const
inlineoverridevirtual

Return the type_info for the stored object.

Implements DataBucketBase.

Definition at line 42 of file BareDataBucket.h.

42 {
43 return m_type.TypeInfo();
44 };

Member Data Documentation

◆ m_clid

CLID BareDataBucket::m_clid = 0
private

Definition at line 67 of file BareDataBucket.h.

◆ m_data

void* BareDataBucket::m_data = nullptr
private

Definition at line 66 of file BareDataBucket.h.

◆ m_type

RootType BareDataBucket::m_type
private

Definition at line 68 of file BareDataBucket.h.


The documentation for this class was generated from the following file: