The Gaudi Framework  v33r1 (b1225454)
SmartRefBase.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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  int objectType() const { return m_type; }
116  void set( DataObject* pObj, long hint_id, long link_id );
117 };
118 #endif // KERNEL_SMARTREFBASE_H
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
Definition: SmartRefBase.h:96
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:64
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:51
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:60
ContainedObject * readObject(const ContainedObject *, StreamBuffer &s) const
Output streamer for ContainedObject like references.
Definition: SmartRefBase.h:102
User example objects: SmartRefBase.
Definition: SmartRefBase.h:57
STL class.
bool isEqual(const DataObject *, const SmartRefBase &c) const
Equality operator for DataObject like references.
Definition: SmartRefBase.h:86
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:66
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
Definition: SmartRefBase.h:82
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:62
int objectType() const
Definition: SmartRefBase.h:114
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
Definition: SmartRefBase.h:90
string s
Definition: gaudirun.py:328
ObjectContainerBase is the base class for Gaudi container classes.
#define GAUDI_API
Definition: Kernel.h:81
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40
void setObjectType(const DataObject *) const
Definition: SmartRefBase.h:108
void setObjectType(const ContainedObject *) const
Definition: SmartRefBase.h:107
void writeObject(const ContainedObject *pObject, StreamBuffer &s) const
Output streamer for ContainedObject like references.
Definition: SmartRefBase.h:92