The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
SmartRefBase.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 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#pragma once
12
14
16class SmartRefBase;
17class ContainedObject;
18class DataObject;
19
46public:
48 mutable long m_hintID;
50 mutable long m_linkID;
52 mutable const DataObject* m_data;
54 mutable const ContainedObject* m_contd;
55
56 mutable long m_type;
57
59
61 const ContainedObject* accessData( const ContainedObject* typ ) const;
63 const DataObject* accessData( const DataObject* typ ) const;
64
66 bool isEqualEx( const DataObject* pObj, const SmartRefBase& c ) const;
68 bool isEqualEx( const ContainedObject* pObj, const SmartRefBase& c ) const;
70 bool isEqual( const ContainedObject* /* pObj */, const SmartRefBase& c ) const {
71 return ( m_hintID == c.m_hintID && m_linkID == c.m_linkID && m_data == c.m_data && m_contd == c.m_contd );
72 }
73
74 bool isEqual( const DataObject* /* pObj */, const SmartRefBase& c ) const {
75 return m_linkID == c.m_linkID && m_data == c.m_data;
76 }
77
78 void writeObject( const DataObject* pObject, StreamBuffer& s ) const { s.addIdentifiedLink( pObject, m_hintID ); }
80 void writeObject( const ContainedObject* pObject, StreamBuffer& s ) const {
81 s.addContainedLink( pObject, m_hintID, m_linkID );
82 }
83
84 DataObject* readObject( const DataObject* /* pObject */, StreamBuffer& s ) const {
85 DataObject* pObj = 0;
86 s.getIdentifiedLink( pObj, m_hintID );
87 return pObj;
88 }
89
90 ContainedObject* readObject( const ContainedObject* /* pObject */, StreamBuffer& s ) const {
91 ContainedObject* pObj = 0;
92 s.getContainedLink( pObj, m_hintID, m_linkID );
93 return pObj;
94 }
95 void setObjectType( const ContainedObject* /* pobj */ ) const { m_type = CONTAINEDOBJECT; }
96 void setObjectType( const DataObject* /* pobj */ ) const { m_type = DATAOBJECT; }
97
99 const std::string& path() const;
100
101public:
102 long objectType() const { return m_type; }
104 void set( DataObject* pObj, long hint_id, long link_id );
105};
#define GAUDI_API
Definition Kernel.h:49
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
ObjectContainerBase is the base class for Gaudi container classes.
User example objects: SmartRefBase.
long m_linkID
Object data: ID of the object within the identifiable container (if any)
long m_hintID
Object data: ID of the link hint to the identifiable object.
void setObjectType(const DataObject *) const
ContainedObject * readObject(const ContainedObject *, StreamBuffer &s) const
Output streamer for ContainedObject like references.
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
void writeObject(const ContainedObject *pObject, StreamBuffer &s) const
Output streamer for ContainedObject like references.
long objectType() const
bool isEqual(const DataObject *, const SmartRefBase &c) const
Equality operator for DataObject like references.
void setObjectType(const ContainedObject *) const
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
The stream buffer is a small object collecting object data.