| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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
15 #include "GaudiKernel/StreamBuffer.h"
16
17 class ObjectContainerBase;
18 class SmartRefBase;
19 class ContainedObject;
20 class DataObject;
21
47 class GAUDI_API SmartRefBase {
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 &&
74 m_data == c.m_data && m_contd == c.m_contd);
75 }
77 bool isEqual (const DataObject* /* pObj */, const SmartRefBase& c) const {
78 return m_linkID == c.m_linkID && m_data == c.m_data;
79 }
81 void writeObject (const DataObject* pObject, StreamBuffer& s) const {
82 s.addIdentifiedLink(pObject, m_hintID);
83 }
85 void writeObject (const ContainedObject* pObject, StreamBuffer& s) const {
86 s.addContainedLink(pObject, m_hintID, m_linkID);
87 }
89 DataObject* readObject (const DataObject* /* pObject */, StreamBuffer& s) const {
90 DataObject* pObj = 0;
91 s.getIdentifiedLink(pObj, m_hintID);
92 return pObj;
93 }
95 ContainedObject* readObject(const ContainedObject* /* pObject */, StreamBuffer& s) const {
96 ContainedObject* pObj = 0;
97 s.getContainedLink(pObj, m_hintID, m_linkID);
98 return pObj;
99 }
100 void setObjectType(const ContainedObject* /* pobj */) const {
101 m_type = CONTAINEDOBJECT;
102 }
103 void setObjectType(const DataObject* /* pobj */) const {
104 m_type = DATAOBJECT;
105 }
106
108 const std::string &path () const;
109
110 public:
111 int objectType() const {
112 return m_type;
113 }
115 void set(DataObject* pObj, long hint_id, long link_id);
116
117 };
118 #endif // KERNEL_SMARTREFBASE_H