Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SmartRefBase.h
Go to the documentation of this file.
1 // ====================================================================
2 // SmartRefBase.h
3 // --------------------------------------------------------------------
4 //
5 // Package : Gaudi/Kernel
6 // Base class for SmartReference objects
7 //
8 // Author : Markus Frank
9 //
10 // ====================================================================
11 #ifndef KERNEL_SMARTREFBASE_H
12 #define KERNEL_SMARTREFBASE_H 1
13 
14 // Framework include files
16 
18 class SmartRefBase;
19 class ContainedObject;
20 class DataObject;
21 
48 public:
50  mutable long m_hintID;
52  mutable long m_linkID;
54  mutable const DataObject* m_data;
56  mutable const ContainedObject* m_contd;
57 
58  mutable long m_type;
59 
60  enum { DATAOBJECT, CONTAINEDOBJECT };
61 
63  const ContainedObject* accessData( const ContainedObject* typ ) const;
65  const DataObject* accessData( const DataObject* typ ) const;
66 
68  bool isEqualEx( const DataObject* pObj, const SmartRefBase& c ) const;
70  bool isEqualEx( const ContainedObject* pObj, const SmartRefBase& c ) const;
72  bool isEqual( const ContainedObject* /* pObj */, const SmartRefBase& c ) const {
73  return ( m_hintID == c.m_hintID && m_linkID == c.m_linkID && m_data == c.m_data && m_contd == c.m_contd );
74  }
76  bool isEqual( const DataObject* /* pObj */, const SmartRefBase& c ) const {
77  return m_linkID == c.m_linkID && m_data == c.m_data;
78  }
80  void writeObject( const DataObject* pObject, StreamBuffer& s ) const { s.addIdentifiedLink( pObject, m_hintID ); }
82  void writeObject( const ContainedObject* pObject, StreamBuffer& s ) const {
83  s.addContainedLink( pObject, m_hintID, m_linkID );
84  }
86  DataObject* readObject( const DataObject* /* pObject */, StreamBuffer& s ) const {
87  DataObject* pObj = 0;
88  s.getIdentifiedLink( pObj, m_hintID );
89  return pObj;
90  }
92  ContainedObject* readObject( const ContainedObject* /* pObject */, StreamBuffer& s ) const {
93  ContainedObject* pObj = 0;
94  s.getContainedLink( pObj, m_hintID, m_linkID );
95  return pObj;
96  }
97  void setObjectType( const ContainedObject* /* pobj */ ) const { m_type = CONTAINEDOBJECT; }
98  void setObjectType( const DataObject* /* pobj */ ) const { m_type = DATAOBJECT; }
99 
101  const std::string& path() const;
102 
103 public:
104  int objectType() const { return m_type; }
106  void set( DataObject* pObj, long hint_id, long link_id );
107 };
108 #endif // KERNEL_SMARTREFBASE_H
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
Definition: SmartRefBase.h:72
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:54
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:41
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
ContainedObject * readObject(const ContainedObject *, StreamBuffer &s) const
Output streamer for ContainedObject like references.
Definition: SmartRefBase.h:92
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
Definition: SmartRefBase.h:80
void writeObject(const ContainedObject *pObject, StreamBuffer &s) const
Output streamer for ContainedObject like references.
Definition: SmartRefBase.h:82
void setObjectType(const ContainedObject *) const
Definition: SmartRefBase.h:97
User example objects: SmartRefBase.
Definition: SmartRefBase.h:47
STL class.
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:56
bool isEqual(const DataObject *, const SmartRefBase &c) const
Equality operator for DataObject like references.
Definition: SmartRefBase.h:76
void setObjectType(const DataObject *) const
Definition: SmartRefBase.h:98
void addIdentifiedLink(const DataObject *pObject, long hint)
Definition: StreamBuffer.h:281
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
string s
Definition: gaudirun.py:312
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
Definition: SmartRefBase.h:86
ObjectContainerBase is the base class for Gaudi container classes.
#define GAUDI_API
Definition: Kernel.h:71
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
void addContainedLink(const ContainedObject *pObject, long hint, long link)
Definition: StreamBuffer.h:292
int objectType() const
Definition: SmartRefBase.h:104
void getContainedLink(ContainedObject *&pObject, long &hint, long &link)
Definition: StreamBuffer.h:285
void getIdentifiedLink(DataObject *&pObject, long &hint)
Definition: StreamBuffer.h:275