ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaKernel
AthenaKernel
DataBucket.h
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#ifndef ATHENAKERNEL_DATABUCKET_H
8
#define ATHENAKERNEL_DATABUCKET_H
9
10
#include "
AthenaKernel/DataBucketBase.h
"
11
12
//FIXME CLID is a tdef and can't be forward declared
13
#include "GaudiKernel/ClassID.h"
14
#include <memory>
15
#include <type_traits>
16
23
24
namespace
SG
{
25
class
IRegisterTransient;
26
class
CopyConversionBase;
27
28
template
<
class
T>
29
class
DataBucket
:
public
DataBucketBase
{
30
31
public
:
32
33
// CONSTRUCTORS:
34
35
DataBucket
():
m_ptr
(0) {}
//needed by the generic converters
36
DataBucket
(T* data);
37
template
<
class
U>
38
DataBucket
(std::unique_ptr<U> data);
39
40
// DESTRUCTOR:
41
42
virtual
~DataBucket
();
43
44
// DATAOBJECT METHODS
45
virtual
const
CLID
&
clID
()
const override
;
46
static
CLID
classID
();
47
48
// return the pointer as a void*
49
virtual
void
*
object
()
override
50
{
51
typedef
typename
std::remove_const<T>::type T_nc;
52
return
const_cast<
T_nc*
>
(
m_ptr
);
53
}
54
58
virtual
const
std::type_info&
tinfo
()
const override
59
{
60
return
typeid
(T);
61
}
62
63
// Serialize the object for reading
64
// StreamBuffer& serialize(StreamBuffer& s);
65
// Serialize the object for writing
66
// StreamBuffer& serialize(StreamBuffer& s) const;
67
68
69
70
// AUTOMATIC CONVERSION OF TYPES
71
operator
T*() {
return
ptr
(); }
//FIXME can we do without?
72
operator
const
T*()
const
{
return
cptr
(); }
73
82
virtual
void
*
cast
(
CLID
clid,
83
IRegisterTransient
* irt = 0,
84
bool
isConst =
true
)
override
;
85
86
95
virtual
void
*
cast
(
const
std::type_info&
tinfo
,
96
IRegisterTransient
* irt = 0,
97
bool
isConst =
true
)
override
;
98
111
virtual
void
*
cast
(
CLID
clid,
112
const
std::type_info&
tinfo
,
113
SG::IRegisterTransient
* irt = 0,
114
bool
isConst =
true
)
override
;
115
116
121
virtual
void
relinquish
()
override
{
m_ptr
=0;}
//LEAKS m_ptr
122
126
virtual
void
lock
()
override
;
127
128
129
protected
:
130
T*
ptr
() {
return
m_ptr
; }
131
const
T*
cptr
()
const
{
return
m_ptr
; }
132
133
141
void
*
tryStaticConversion
(
CLID
clid);
142
143
151
void
*
tryStaticConversion
(
const
std::type_info&
tinfo
);
152
153
154
private
:
155
T*
m_ptr
;
//we own the thing now!
156
158
typedef
std::pair<const CopyConversionBase*, void*>
ent_t
;
159
typedef
std::vector<ent_t>
vec_t
;
160
vec_t
m_cnvcopies
;
161
162
DataBucket
(
const
DataBucket
&);
163
DataBucket
&
operator=
(
const
DataBucket
&);
164
};
165
}
//end namespace SG
166
#include "
AthenaKernel/DataBucket.icc
"
167
168
#endif
// ATHENAKERNEL_DATABUCKET_H
DataBucketBase.h
DataBucket.icc
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
DataBucketBase::DataBucketBase
DataBucketBase()
Definition
DataBucketBase.h:28
SG::DataBucket::DataBucket
DataBucket(std::unique_ptr< U > data)
SG::DataBucket::classID
static CLID classID()
SG::DataBucket::DataBucket
DataBucket()
Definition
DataBucket.h:35
SG::DataBucket::cast
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.
SG::DataBucket::tinfo
virtual const std::type_info & tinfo() const override
Return the type_info for the stored object.
Definition
DataBucket.h:58
SG::DataBucket::m_ptr
T * m_ptr
Definition
DataBucket.h:155
SG::DataBucket::cast
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.
SG::DataBucket::lock
virtual void lock() override
If the held object derives from ILockable, call lock() on it.
SG::DataBucket::ptr
T * ptr()
Definition
DataBucket.h:130
SG::DataBucket::object
virtual void * object() override
Definition
DataBucket.h:49
SG::DataBucket::tryStaticConversion
void * tryStaticConversion(CLID clid)
Try a conversion using static SG_BASES information.
SG::DataBucket::m_cnvcopies
vec_t m_cnvcopies
Definition
DataBucket.h:160
SG::DataBucket::cptr
const T * cptr() const
Definition
DataBucket.h:131
SG::DataBucket::clID
virtual const CLID & clID() const override
SG::DataBucket::DataBucket
DataBucket(T *data)
SG::DataBucket::tryStaticConversion
void * tryStaticConversion(const std::type_info &tinfo)
Try a conversion using static SG_BASES information.
SG::DataBucket::operator=
DataBucket & operator=(const DataBucket &)
SG::DataBucket::vec_t
std::vector< ent_t > vec_t
Definition
DataBucket.h:159
SG::DataBucket::cast
virtual void * cast(CLID clid, IRegisterTransient *irt=0, bool isConst=true) override
Return the contents of the DataBucket, converted to type given by clid.
SG::DataBucket::relinquish
virtual void relinquish() override
Give up ownership of the DataBucket contents.
Definition
DataBucket.h:121
SG::DataBucket::DataBucket
DataBucket(const DataBucket &)
SG::DataBucket::ent_t
std::pair< const CopyConversionBase *, void * > ent_t
Objects made by copy conversion.
Definition
DataBucket.h:158
SG::DataBucket::~DataBucket
virtual ~DataBucket()
SG::IRegisterTransient
Interface for registering a transient object in t2p map.
Definition
IRegisterTransient.h:28
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
Generated on
for ATLAS Offline Software by
1.17.0