ATLAS Offline Software
|
A DataBucket
specialized for DataVector/
More...DataList
.
#include <DVLDataBucket.h>
Public Member Functions | |
DVLDataBucket () | |
Default constructor. More... | |
DVLDataBucket (T *data) | |
Constructor from a payload object. More... | |
template<class U > | |
DVLDataBucket (std::unique_ptr< U > data) | |
Constructor from a payload object. More... | |
DVLDataBucket (const DVLDataBucket &other) | |
Copy constructor. More... | |
virtual | ~DVLDataBucket () override |
Destructor. More... | |
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 const CLID & | clID () const override |
The CLID for the class of object we're holding. More... | |
virtual const std::type_info & | tinfo () const override |
The std::type_info for the class of object we're holding. More... | |
virtual void * | object () override |
operator T* () | |
operator const T * () const | |
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 | 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... | |
Static Public Member Functions | |
static const CLID & | classID () |
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< DataModel_detail::DVLInfoBase *, void * > | ent_t |
typedef std::vector< ent_t > | vec_t |
Private Member Functions | |
DVLDataBucket & | operator= (const DVLDataBucket &) |
Private Attributes | |
vec_t | m_copies |
const std::type_info * | m_ti |
The std::type_info for the class of object we're holding. More... | |
CLID | m_clid |
The CLID for the class of object we're holding. More... | |
T * | m_ptr |
vec_t | m_cnvcopies |
A DataBucket
specialized for DataVector/
DataList
.
DataVector
and DataList
have some special conversion requirements.
In particular, we may have a situation where we're asked to convert from DataVector<D>
to DataVector<B>
, where these two classes are not related by inheritance, but D
derived from B
. (In practice, this arises when one has multiple inheritance, and can't mirror both arms with DataVector/
)DataList
.
This DataBucket
allows such conversions to happen by making a copy of the container (as a view container) and converting the contained pointers. The new instance remains owned by the DataBucket
.
We may also try to create a bucket for a ViewVector<DV>
object given a pointer to its DV
base class. In such a case, we detect that we actually have a ViewVector
and adjust appropriately the CLID and type_info that we return.
Definition at line 47 of file DVLDataBucket.h.
|
private |
Definition at line 150 of file DVLDataBucket.h.
|
private |
Definition at line 151 of file DVLDataBucket.h.
|
inline |
Default constructor.
Definition at line 54 of file DVLDataBucket.h.
SG::DVLDataBucket< T >::DVLDataBucket | ( | T * | data | ) |
Constructor from a payload object.
data | Object to hold in the bucket. |
SG::DVLDataBucket< T >::DVLDataBucket | ( | std::unique_ptr< U > | data | ) |
Constructor from a payload object.
data | Object to hold in the bucket. |
SG::DVLDataBucket< T >::DVLDataBucket | ( | const DVLDataBucket< T > & | other | ) |
Copy constructor.
other | Bucket to copy. |
|
overridevirtual |
Destructor.
|
overridevirtual |
Return the contents of the DataBucket
, converted to type given by clid.
Note that only derived->base conversions are allowed here.
clid | The class ID to which to convert. |
tinfo | The std::type_info of the type to which to convert. |
irt | To be called if we make a new instance. |
isConst | True 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 SG::DataBucket< T >.
|
overridevirtual |
Return the contents of the DataBucket
, converted to type given by clid.
Note that only derived->base conversions are allowed here.
clid | The class ID to which to convert. |
irt | To be called if we make a new instance. |
isConst | True if the object being converted is regarded as const. |
Reimplemented from SG::DataBucket< T >.
|
overridevirtual |
Return the contents of the DataBucket
, converted to type given by std::type_info.
Note that only derived->base conversions are allowed here.
clid | The std::type_info of the type to which to convert. |
irt | To be called if we make a new instance. |
isConst | True if the object being converted is regarded as const. |
Reimplemented from SG::DataBucket< T >.
|
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.
irt | To be called if we make a new instance. |
isConst | True if the object being converted is regarded as const. |
|
staticinherited |
|
overridevirtual |
The CLID for the class of object we're holding.
May be different from that of the base DataVector
in the case of a ViewVector
.
Reimplemented from SG::DataBucket< T >.
|
inlineprotectedinherited |
Definition at line 131 of file DataBucket.h.
|
overridevirtualinherited |
If the held object derives from ILockable
, call lock()
on it.
Implements DataBucketBase.
|
inlineoverridevirtualinherited |
Implements DataBucketBase.
Definition at line 49 of file DataBucket.h.
|
inlineinherited |
Definition at line 72 of file DataBucket.h.
|
inlineinherited |
Definition at line 71 of file DataBucket.h.
|
private |
|
inlineprotectedinherited |
Definition at line 130 of file DataBucket.h.
|
inlineoverridevirtualinherited |
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.
|
overridevirtual |
The std::type_info for the class of object we're holding.
May be different from that of the base DataVector
in the case of a ViewVector
.
Reimplemented from SG::DataBucket< T >.
|
protectedinherited |
Try a conversion using static SG_BASES information.
clid | The 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.
|
protectedinherited |
Try a conversion using static SG_BASES information.
tinfo | The 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.
|
private |
The CLID for the class of object we're holding.
May be different from that of the base DataVector
in the case of a ViewVector
.
Definition at line 162 of file DVLDataBucket.h.
|
privateinherited |
Definition at line 160 of file DataBucket.h.
|
private |
Definition at line 152 of file DVLDataBucket.h.
|
privateinherited |
Definition at line 155 of file DataBucket.h.
|
private |
The std::type_info for the class of object we're holding.
May be different from that of the base DataVector
in the case of a ViewVector
.
Definition at line 157 of file DVLDataBucket.h.