ATLAS Offline Software
RootDataBucketBranch.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // RootDataBucketBranch.h
8 // Header file for class Athena::RootDataBucketBranch
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef ATHENAROOTCOMPS_ROOTDATABUCKETBRANCH_H
12 #define ATHENAROOTCOMPS_ROOTDATABUCKETBRANCH_H 1
13 
14 // STL includes
15 #include <string>
16 #include <stdexcept>
17 
19 
20 #include "DataModelRoot/RootType.h"
21 
22 namespace Athena {
23 
25  public ::DataBucketBase
26 {
27 public:
29  const std::string& type_name,
30  void *ptr = NULL) :
31  m_clid(clid),
32  m_type(RootType(type_name)),
33  m_ptr(ptr)
34  {}
35 
37  const std::type_info& ti,
38  void *ptr = NULL) :
39  m_clid(clid),
40  m_type(RootType(ti)),
41  m_ptr(ptr)
42  {}
43 
44  DataBucketBranch(CLID clid, const RootType& type, void* ptr) :
45  m_clid(clid),
46  m_type(type),
47  m_ptr(ptr)
48  {}
49 
50  virtual ~DataBucketBranch() override;
51 
52  virtual
53  void* object() override;
54 
56 
57  virtual
58  void* cast(CLID clid, SG::IRegisterTransient* itr,
59  bool isConst = true) override;
60 
61  virtual
62  void* cast(const std::type_info& tinfo,
64  bool isConst = true) override;
65 
66  virtual
67  void relinquish() override;
68 
69  virtual void lock() override;
70 
71  virtual const CLID& clID() const override { return m_clid; }
72 
73  virtual const std::type_info& tinfo() const override
74  {
75  return m_type.TypeInfo();
76  }
77 
78  //private:
81  void* m_ptr;
82 
83  bool allowMismatchCLID=false;
84 
85 };
86 
87 inline
88 void*
90 {
91  return m_ptr;
92 }
93 
94 inline
95 void
97 {}
98 
99 inline
100 void
102 {}
103 
104 } //> end namespace Athena
105 
106 #endif /* !ATHENAROOTCOMPS_ROOTDATABUCKETBRANCH_H */
107 
SG::IRegisterTransient
Interface for registering a transient object in t2p map.
Definition: IRegisterTransient.h:28
Athena::DataBucketBranch::DataBucketBranch
DataBucketBranch(CLID clid, const std::type_info &ti, void *ptr=NULL)
Definition: RootDataBucketBranch.h:36
DataBucketBase
A non-templated base class for DataBucket, allows to access the transient object address as a void*.
Definition: DataBucketBase.h:24
DataBucketBase.h
Athena::DataBucketBranch::allowMismatchCLID
bool allowMismatchCLID
Definition: RootDataBucketBranch.h:83
Athena::DataBucketBranch::relinquish
virtual void relinquish() override
Give up ownership of the DataBucket contents.
Definition: RootDataBucketBranch.h:96
Athena::DataBucketBranch::tinfo
virtual const std::type_info & tinfo() const override
Return the type_info for the stored object.
Definition: RootDataBucketBranch.h:73
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
DataBucketBase::cast
T * cast(SG::IRegisterTransient *irt=0, bool isConst=true)
Return the contents of the DataBucket, converted to type T.
TScopeAdapter::TypeInfo
const std::type_info & TypeInfo() const
Definition: RootType.cxx:679
Athena::DataBucketBranch::~DataBucketBranch
virtual ~DataBucketBranch() override
Definition: RootDataBucketBranch.cxx:21
Athena
Some weak symbol referencing magic...
Definition: AthLegacySequence.h:21
Athena::DataBucketBranch::lock
virtual void lock() override
If the held object derives from ILockable, call lock() on it.
Definition: RootDataBucketBranch.h:101
Athena::DataBucketBranch::DataBucketBranch
DataBucketBranch(CLID clid, const RootType &type, void *ptr)
Definition: RootDataBucketBranch.h:44
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
Athena::DataBucketBranch::cast
virtual void * cast(CLID clid, SG::IRegisterTransient *itr, bool isConst=true) override
Return the contents of the DataBucket, converted to type given by clid.
Definition: RootDataBucketBranch.cxx:27
Athena::DataBucketBranch::m_ptr
void * m_ptr
Definition: RootDataBucketBranch.h:81
Athena::DataBucketBranch::object
virtual void * object() override
Definition: RootDataBucketBranch.h:89
Athena::DataBucketBranch
Definition: RootDataBucketBranch.h:26
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RootType.h
Athena::DataBucketBranch::DataBucketBranch
DataBucketBranch(CLID clid, const std::string &type_name, void *ptr=NULL)
Definition: RootDataBucketBranch.h:28
Athena::DataBucketBranch::clID
virtual const CLID & clID() const override
Definition: RootDataBucketBranch.h:71
TScopeAdapter
Definition: RootType.h:119