The Gaudi Framework  master (37c0b60a)
RootObjAddress.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef ROOTHISTCNV_ROOTOBJADDRESS_H
12 #define ROOTHISTCNV_ROOTOBJADDRESS_H 1
13 
15 #include <string_view>
16 
17 class TObject;
18 
19 namespace RootHistCnv {
20 
21  class RootObjAddress : public IOpaqueAddress {
22 
23  protected:
24  unsigned long m_refCount = 0;
26  long m_svcType = 0;
28  CLID m_clID = 0;
32  unsigned long m_ipar[2] = { 0xFFFFFFFF, 0xFFFFFFFF };
34  IRegistry* m_pRegistry = nullptr;
36  TObject* m_tObj = nullptr;
37 
38  public:
40  RootObjAddress() = default;
41 
43  : IOpaqueAddress( copy )
44  , m_refCount( 0 )
45  , m_svcType( copy.m_svcType )
46  , m_clID( copy.m_clID )
47  , m_pRegistry( copy.m_pRegistry )
48  , m_tObj( copy.m_tObj ) {
49  m_par[0] = copy.m_par[0];
50  m_par[1] = copy.m_par[1];
51  m_ipar[0] = copy.m_ipar[0];
52  m_ipar[1] = copy.m_ipar[1];
53  }
54 
56  RootObjAddress( long svc, const CLID& clid, std::string_view p1 = {}, std::string_view p2 = {},
57  unsigned long ip1 = 0, unsigned long ip2 = 0, TObject* tObj = nullptr )
58  : m_svcType( svc ), m_clID( clid ), m_tObj( tObj ) {
59  m_par[0] = std::string{ p1 };
60  m_par[1] = std::string{ p2 };
61  m_ipar[0] = ip1;
62  m_ipar[1] = ip2;
63  }
64 
66  unsigned long addRef() override { return ++m_refCount; }
67 
68  unsigned long release() override {
69  unsigned long cnt = --m_refCount;
70  if ( 0 == cnt ) delete this;
71  return cnt;
72  }
74  IRegistry* registry() const override { return m_pRegistry; }
76  void setRegistry( IRegistry* pRegistry ) override { m_pRegistry = pRegistry; }
78  const CLID& clID() const override { return m_clID; }
80  virtual void setClID( const CLID& clid ) { m_clID = clid; }
82  long svcType() const override { return m_svcType; }
84  virtual void setSvcType( long typ ) { m_svcType = typ; }
86  const std::string* par() const override { return m_par; }
88  const unsigned long* ipar() const override { return m_ipar; }
89 
91  virtual TObject* tObj() const { return m_tObj; }
92  };
93 } // namespace RootHistCnv
94 
95 #endif
RootHistCnv::RootObjAddress::release
unsigned long release() override
release reference to object
Definition: RootObjAddress.h:68
std::string
STL class.
RootHistCnv::RootObjAddress::tObj
virtual TObject * tObj() const
Retrieve TObject* ptr.
Definition: RootObjAddress.h:91
AlgSequencer.p2
p2
Definition: AlgSequencer.py:30
RootHistCnv::RootObjAddress::m_pRegistry
IRegistry * m_pRegistry
Pointer to corresponding directory.
Definition: RootObjAddress.h:34
IOpaqueAddress
Definition: IOpaqueAddress.h:33
RootHistCnv::RootObjAddress::ipar
const unsigned long * ipar() const override
Retrieve integer parameters.
Definition: RootObjAddress.h:88
RootHistCnv::RootObjAddress::setClID
virtual void setClID(const CLID &clid)
Access : Set class ID of the link.
Definition: RootObjAddress.h:80
RootHistCnv::RootObjAddress::m_clID
CLID m_clID
Class id.
Definition: RootObjAddress.h:28
IRegistry
Definition: IRegistry.h:32
RootHistCnv::RootObjAddress::m_ipar
unsigned long m_ipar[2]
Integer parameters to be accessed.
Definition: RootObjAddress.h:32
RootHistCnv::RootObjAddress::par
const std::string * par() const override
Retrieve string parameters.
Definition: RootObjAddress.h:86
RootHistCnv::RootObjAddress::setRegistry
void setRegistry(IRegistry *pRegistry) override
Set pointer to directory.
Definition: RootObjAddress.h:76
RootHistCnv::RootObjAddress
Definition: RootObjAddress.h:21
RootHistCnv::RootObjAddress::m_par
std::string m_par[2]
String parameters to be accessed.
Definition: RootObjAddress.h:30
RootHistCnv
Definition: DirectoryCnv.h:27
RootHistCnv::RootObjAddress::setSvcType
virtual void setSvcType(long typ)
Access : set the storage type of the class id.
Definition: RootObjAddress.h:84
IOpaqueAddress.h
RootHistCnv::RootObjAddress::RootObjAddress
RootObjAddress()=default
Dummy constructor.
RootHistCnv::RootObjAddress::RootObjAddress
RootObjAddress(const RootObjAddress &copy)
Definition: RootObjAddress.h:42
RootHistCnv::RootObjAddress::RootObjAddress
RootObjAddress(long svc, const CLID &clid, std::string_view p1={}, std::string_view p2={}, unsigned long ip1=0, unsigned long ip2=0, TObject *tObj=nullptr)
Standard Constructor.
Definition: RootObjAddress.h:56
AlgSequencer.p1
p1
Definition: AlgSequencer.py:29
GaudiPython.Bindings.nullptr
nullptr
Definition: Bindings.py:87
RootHistCnv::RootObjAddress::clID
const CLID & clID() const override
Access : Retrieve class ID of the link.
Definition: RootObjAddress.h:78
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
RootHistCnv::RootObjAddress::registry
IRegistry * registry() const override
Pointer to directory.
Definition: RootObjAddress.h:74
RootHistCnv::RootObjAddress::m_tObj
TObject * m_tObj
Pointer to TObject.
Definition: RootObjAddress.h:36
RootHistCnv::RootObjAddress::m_svcType
long m_svcType
Storage type.
Definition: RootObjAddress.h:26
RootHistCnv::RootObjAddress::m_refCount
unsigned long m_refCount
Definition: RootObjAddress.h:24
RootHistCnv::RootObjAddress::addRef
unsigned long addRef() override
Add reference to object.
Definition: RootObjAddress.h:66
RootHistCnv::RootObjAddress::svcType
long svcType() const override
Access : retrieve the storage type of the class id.
Definition: RootObjAddress.h:82