The Gaudi Framework  master (37c0b60a)
SmartRefBase.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 // ====================================================================
12 // SmartRefBase.h
13 // --------------------------------------------------------------------
14 //
15 // Package : Gaudi/Kernel
16 // Base class for SmartReference objects
17 //
18 // Author : Markus Frank
19 //
20 // ====================================================================
21 #ifndef KERNEL_SMARTREFBASE_H
22 #define KERNEL_SMARTREFBASE_H 1
23 
24 // Framework include files
26 
28 class SmartRefBase;
29 class ContainedObject;
30 class DataObject;
31 
58 public:
60  mutable long m_hintID;
62  mutable long m_linkID;
64  mutable const DataObject* m_data;
66  mutable const ContainedObject* m_contd;
67 
68  mutable long m_type;
69 
70  enum { DATAOBJECT, CONTAINEDOBJECT };
71 
73  const ContainedObject* accessData( const ContainedObject* typ ) const;
75  const DataObject* accessData( const DataObject* typ ) const;
76 
78  bool isEqualEx( const DataObject* pObj, const SmartRefBase& c ) const;
80  bool isEqualEx( const ContainedObject* pObj, const SmartRefBase& c ) const;
82  bool isEqual( const ContainedObject* /* pObj */, const SmartRefBase& c ) const {
83  return ( m_hintID == c.m_hintID && m_linkID == c.m_linkID && m_data == c.m_data && m_contd == c.m_contd );
84  }
86  bool isEqual( const DataObject* /* pObj */, const SmartRefBase& c ) const {
87  return m_linkID == c.m_linkID && m_data == c.m_data;
88  }
90  void writeObject( const DataObject* pObject, StreamBuffer& s ) const { s.addIdentifiedLink( pObject, m_hintID ); }
92  void writeObject( const ContainedObject* pObject, StreamBuffer& s ) const {
93  s.addContainedLink( pObject, m_hintID, m_linkID );
94  }
96  DataObject* readObject( const DataObject* /* pObject */, StreamBuffer& s ) const {
97  DataObject* pObj = 0;
98  s.getIdentifiedLink( pObj, m_hintID );
99  return pObj;
100  }
102  ContainedObject* readObject( const ContainedObject* /* pObject */, StreamBuffer& s ) const {
103  ContainedObject* pObj = 0;
104  s.getContainedLink( pObj, m_hintID, m_linkID );
105  return pObj;
106  }
107  void setObjectType( const ContainedObject* /* pobj */ ) const { m_type = CONTAINEDOBJECT; }
108  void setObjectType( const DataObject* /* pobj */ ) const { m_type = DATAOBJECT; }
109 
111  const std::string& path() const;
112 
113 public:
114  long objectType() const { return m_type; }
116  void set( DataObject* pObj, long hint_id, long link_id );
117 };
118 #endif // KERNEL_SMARTREFBASE_H
SmartRefBase::setObjectType
void setObjectType(const DataObject *) const
Definition: SmartRefBase.h:108
std::string
STL class.
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
gaudirun.s
string s
Definition: gaudirun.py:346
SmartRefBase::writeObject
void writeObject(const ContainedObject *pObject, StreamBuffer &s) const
Output streamer for ContainedObject like references.
Definition: SmartRefBase.h:92
gaudirun.c
c
Definition: gaudirun.py:525
StreamBuffer.h
SmartRefBase::isEqual
bool isEqual(const DataObject *, const SmartRefBase &c) const
Equality operator for DataObject like references.
Definition: SmartRefBase.h:86
SmartRefBase::readObject
ContainedObject * readObject(const ContainedObject *, StreamBuffer &s) const
Output streamer for ContainedObject like references.
Definition: SmartRefBase.h:102
SmartRefBase
User example objects: SmartRefBase.
Definition: SmartRefBase.h:57
StreamBuffer
Definition: StreamBuffer.h:52
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:62
SmartRefBase::readObject
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
Definition: SmartRefBase.h:96
SmartRefBase::writeObject
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
Definition: SmartRefBase.h:90
SmartRefBase::m_type
long m_type
Definition: SmartRefBase.h:68
SmartRefBase::DATAOBJECT
@ DATAOBJECT
Definition: SmartRefBase.h:70
SmartRefBase::m_data
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:64
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:60
SmartRefBase::objectType
long objectType() const
Definition: SmartRefBase.h:114
SmartRefBase::setObjectType
void setObjectType(const ContainedObject *) const
Definition: SmartRefBase.h:107
ObjectContainerBase
Definition: ObjectContainerBase.h:29
SmartRefBase::m_contd
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:66
DataObject
Definition: DataObject.h:36
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
SmartRefBase::isEqual
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
Definition: SmartRefBase.h:82
ContainedObject
Definition: ContainedObject.h:41