| The Gaudi Framework v32r1 (f65d50dc)

Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
SmartRef< TYPE > Class Template Reference

Kernel objects: SmartRef. More...

`#include <GaudiKernel/SmartRef.h>`

Collaboration diagram for SmartRef< TYPE >:
[legend]

## Public Types
enum | { VALID = StreamBuffer::VALID, INVALID = StreamBuffer::INVALID }
typedef TYPE | entry_type
| Entry type definition. More...

## Public Member Functions
| SmartRef ()
| Standard Constructor. More...
| SmartRef (TYPE *pObject)
| Standard Constructor with initialisation. More...
| SmartRef (const TYPE *pObject)
| Standard Constructor with initialisation from const object. More...
| SmartRef (const SmartRef &copy)
| Copy Constructor. More...
| SmartRef (long hint, long link, TYPE *obj=nullptr)
| Constructor. More...
| SmartRef (const ContainedObject *pObj, long hint, long link, TYPE *obj=nullptr)
| Constructor for references to contained objects passing environment. More...
| SmartRef (const DataObject *pObj, long hint, long link, TYPE *obj=nullptr)
| Constructor for references to contained objects passing environment. More...
| SmartRef (const DataObject *pObj, long hint, TYPE *obj=nullptr)
| Constructor for references to DataObjects passing environment. More...
bool | shouldFollowLink (const DataObject *) const
| Standard destructor. More...
bool | shouldFollowLink (const ContainedObject *) const
| Check if link should be followed: link must be valid and object not yet loaded. More...
long | hintID () const
| Access hint id: More...
long | linkID () const
| Access link id: More...
void | set (DataObject *pObj, long hint_id, long link_id)
| Setup smart reference when reading. Must be allowed from external sources. More...
const std::type_info * | type () const
| Access to embedded type. More...
TYPE * | data ()
| Access to raw data pointer. More...
const TYPE * | data () const
const TYPE * | target () const
| Access to the object. More...
TYPE * | target ()
| Access to the object. More...
const std::string & | path () const
| Return the path of the linked object inside the data store. More...
bool | operator== (const SmartRef< TYPE > &c) const
| Equality operator. More...
bool | operator!= (const SmartRef< TYPE > &c) const
| NON-Equality operator. More...
const SmartRef< TYPE > & | _setEnvironment (const DataObject *pObj, const ContainedObject *pContd) const
| Set the environment (CONST) More...
SmartRef< TYPE > & | _setEnvironment (const DataObject *pObj, const ContainedObject *pContd)
| Set the environment (CONST) More...
SmartRef< TYPE > & | operator() (ContainedObject *pObj)
| operator(): assigns parent object for serialisation More...
const SmartRef< TYPE > & | operator() (const ContainedObject *pObj) const
| operator() const: assigns parent object for serialisation More...
SmartRef< TYPE > & | operator() (DataObject *pObj)
| operator(): assigns parent object for serialisation More...
const SmartRef< TYPE > & | operator() (const DataObject *pObj) const
| operator() const: assigns parent object for serialisation More...
SmartRef< TYPE > & | operator= (const SmartRef< TYPE > &c)
| Assignment. More...
SmartRef< TYPE > & | operator= (TYPE *pObject)
| Assignment. More...
TYPE & | operator * ()
| Dereference operator. More...
const TYPE & | operator * () const
| Dereference operator. More...
TYPE * | operator-> ()
| Dereference operator. More...
const TYPE * | operator-> () const
| Dereference operator to const object. More...
| operator const TYPE * () const
| Implicit type conversion to const object. More...
| operator TYPE * ()
| Implicit type conversion. More...
StreamBuffer & | writeRef (StreamBuffer &s) const
| Write the reference to the stream buffer (needed due to stupid G++ compiler) More...
StreamBuffer & | readRef (StreamBuffer &s)
| Read the reference from the stream buffer (needed due to stupid G++ compiler) More...

## Protected Attributes
SmartRefBase | m_base
const TYPE * | m_target = nullptr
| Pointer to target data object. More...

## Friends
class | SmartRefArray< TYPE >
| The container must be a friend. More...
class | SmartRefList< TYPE >
class | SmartRefMap< TYPE >
StreamBuffer & | operator<< (StreamBuffer &_s, const SmartRef< TYPE > &ptr)
| Output Streamer operator. More...
StreamBuffer & | operator>> (StreamBuffer &_s, SmartRef< TYPE > &ptr)
| Input Streamer operator. More...

## Detailed Description

### template<class TYPE>
class SmartRef< TYPE >

Kernel objects: SmartRef.

Description: The SmartRef class allows transparent handling of object links within the data store. Links are unloaded a priori and will only be loaded "on demand", i.e. when dereferenced.

SmartRefs should behave in the same way as normal pointers; The SmartRef object in fact is a smart pointer construct intercepting the dereference operators.

When loading, the executed code resides in the non templated base class. This ensures, that the templated code is minimized and code blow up is inhibited.

Using SmartRefs StreamBuffers are able to also save the references on data conversion requests.

Base Class: SmartRefBase

Dependencies:

- Base class: GaudiKernel/SmartRefBase.h

History :

    +---------+----------------------------------------------+--------+
    |    Date |                 Comment                      | Who    |
    +---------+----------------------------------------------+--------+
    | 21/04/99| Initial version.                             | MF     |
    | 16/01/04| Move base class into aggregation.            | MF     |
    +---------+----------------------------------------------+--------+

Author: M.Frank Version: 1.0

Definition at line 66 of file SmartRef.h.

## Member Typedef Documentation

## ◆ entry_type

template<class TYPE>

typedef TYPE SmartRef< TYPE >::entry_type

Entry type definition.

Definition at line 75 of file SmartRef.h.

## Member Enumeration Documentation

## ◆ anonymous enum

template<class TYPE>

anonymous enum

Enumerator
VALID |
INVALID |

Definition at line 73 of file SmartRef.h.

73 { VALID = StreamBuffer::VALID, INVALID = StreamBuffer::INVALID };
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::VALID
Definition: SmartRef.h:73
StreamBuffer::VALID
Definition: StreamBuffer.h:111
StreamBuffer::INVALID
Definition: StreamBuffer.h:111

## Constructor & Destructor Documentation

## ◆ SmartRef() [1/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( |  | ) |
| inline

Standard Constructor.

Definition at line 84 of file SmartRef.h.

84 {
85 m_base.m_hintID = INVALID;
86 m_base.m_linkID = INVALID;
87 _setEnvironment( 0, 0 );
88 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ SmartRef() [2/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( | TYPE * | pObject | ) |
| inline

Standard Constructor with initialisation.

Definition at line 90 of file SmartRef.h.

90 {
91 m_base.m_hintID = INVALID;
92 m_base.m_linkID = INVALID;
93 m_target = pObject;
94 _setEnvironment( 0, 0 );
95 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ SmartRef() [3/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( | const TYPE * | pObject | ) |
| inline

Standard Constructor with initialisation from const object.

Definition at line 97 of file SmartRef.h.

97 {
98 m_base.m_hintID = INVALID;
99 m_base.m_linkID = INVALID;
100 m_target = const_cast<TYPE*>( pObject );
101 _setEnvironment( 0, 0 );
102 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ SmartRef() [4/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( | const SmartRef< TYPE > & | copy | ) |
| inline

Copy Constructor.

Definition at line 104 of file SmartRef.h.

104 {
105 m_base.m_hintID = copy.m_base.m_hintID;
106 m_base.m_linkID = copy.m_base.m_linkID;
107 m_target = copy.m_target;
108 _setEnvironment( copy.m_base.m_data, copy.m_base.m_contd );
109 }
std::copy
T copy(T... args)
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ SmartRef() [5/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( | long | hint,
|  | long | link,
|  | TYPE * | obj = `nullptr`
| ) |  |
| inline

Constructor.

Definition at line 111 of file SmartRef.h.

111 {
112 m_base.m_hintID = hint;
113 m_base.m_linkID = link;
114 m_target = obj;
115 _setEnvironment( 0, 0 );
116 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ SmartRef() [6/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( | const ContainedObject * | pObj,
|  | long | hint,
|  | long | link,
|  | TYPE * | obj = `nullptr`
| ) |  |
| inline

Constructor for references to contained objects passing environment.

Definition at line 118 of file SmartRef.h.

118 {
119 m_base.m_hintID = hint;
120 m_base.m_linkID = link;
121 m_target = obj;
122 const DataObject* src = ( 0 == pObj ) ? 0 : pObj->parent();
123 _setEnvironment( src, pObj );
124 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:51
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

## ◆ SmartRef() [7/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( | const DataObject * | pObj,
|  | long | hint,
|  | long | link,
|  | TYPE * | obj = `nullptr`
| ) |  |
| inline

Constructor for references to contained objects passing environment.

Definition at line 126 of file SmartRef.h.

126 {
127 m_base.m_hintID = hint;
128 m_base.m_linkID = link;
129 m_target = obj;
130 _setEnvironment( pObj, 0 );
131 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ SmartRef() [8/8]

template<class TYPE>

SmartRef< TYPE >::SmartRef | ( | const DataObject * | pObj,
|  | long | hint,
|  | TYPE * | obj = `nullptr`
| ) |  |
| inline

Constructor for references to DataObjects passing environment.

Definition at line 133 of file SmartRef.h.

133 {
134 m_base.m_hintID = hint;
135 m_base.m_linkID = INVALID;
136 m_target = obj;
137 _setEnvironment( pObj, 0 );
138 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## Member Function Documentation

## ◆ _setEnvironment() [1/2]

template<class TYPE>

const SmartRef<TYPE>& SmartRef< TYPE >::_setEnvironment | ( | const DataObject * | pObj,
|  | const ContainedObject * | pContd
| ) |  | const
| inline

Set the environment (CONST)

Definition at line 176 of file SmartRef.h.

176 {
177 m_base.m_data = pObj;
178 m_base.m_contd = pContd;
179 m_base.setObjectType( data() );
180 return *this;
181 }
SmartRefBase::m_data
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:54
SmartRefBase::m_contd
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:56
SmartRef::data
TYPE * data()
Access to raw data pointer.
Definition: SmartRef.h:157
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRefBase::setObjectType
void setObjectType(const ContainedObject *) const
Definition: SmartRefBase.h:97

## ◆ _setEnvironment() [2/2]

template<class TYPE>

SmartRef<TYPE>& SmartRef< TYPE >::_setEnvironment | ( | const DataObject * | pObj,
|  | const ContainedObject * | pContd
| ) |  |
| inline

Set the environment (CONST)

Definition at line 183 of file SmartRef.h.

183 {
184 m_base.m_data = pObj;
185 m_base.m_contd = pContd;
186 m_base.setObjectType( data() );
187 return *this;
188 }
SmartRefBase::m_data
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:54
SmartRefBase::m_contd
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:56
SmartRef::data
TYPE * data()
Access to raw data pointer.
Definition: SmartRef.h:157
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRefBase::setObjectType
void setObjectType(const ContainedObject *) const
Definition: SmartRefBase.h:97

## ◆ data() [1/2]

template<class TYPE>

TYPE* SmartRef< TYPE >::data | ( |  | ) |
| inline

Access to raw data pointer.

Definition at line 157 of file SmartRef.h.

157 { return const_cast<TYPE*>( m_target ); }
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80

## ◆ data() [2/2]

template<class TYPE>

const TYPE* SmartRef< TYPE >::data | ( |  | ) | const
| inline

Definition at line 158 of file SmartRef.h.

158 { return m_target; }
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80

## ◆ hintID()

template<class TYPE>

long SmartRef< TYPE >::hintID | ( |  | ) | const
| inline

Access hint id:

Definition at line 149 of file SmartRef.h.

149 { return m_base.m_hintID; }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78

## ◆ linkID()

template<class TYPE>

long SmartRef< TYPE >::linkID | ( |  | ) | const
| inline

Access link id:

Definition at line 151 of file SmartRef.h.

151 { return m_base.m_linkID; }
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ operator *() [1/2]

template<class TYPE>

TYPE& SmartRef< TYPE >::operator * | ( |  | ) |
| inline

Dereference operator.

Definition at line 218 of file SmartRef.h.

218 { return *SmartRef<TYPE>::target(); }
SmartRef::target
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:259

## ◆ operator *() [2/2]

template<class TYPE>

const TYPE& SmartRef< TYPE >::operator * | ( |  | ) | const
| inline

Dereference operator.

Definition at line 220 of file SmartRef.h.

220 { return *SmartRef<TYPE>::target(); }
SmartRef::target
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:259

## ◆ operator const TYPE *()

template<class TYPE>

SmartRef< TYPE >::operator const TYPE * | ( |  | ) | const
| inline

Implicit type conversion to const object.

Definition at line 226 of file SmartRef.h.

226 { return SmartRef<TYPE>::target(); }
SmartRef::target
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:259

## ◆ operator TYPE *()

template<class TYPE>

SmartRef< TYPE >::operator TYPE * | ( |  | ) |
| inline

Implicit type conversion.

Definition at line 228 of file SmartRef.h.

228 { return SmartRef<TYPE>::target(); }
SmartRef::target
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:259

## ◆ operator!=()

template<class TYPE>

bool SmartRef< TYPE >::operator!= | ( | const SmartRef< TYPE > & | c | ) | const
| inline

NON-Equality operator.

Definition at line 174 of file SmartRef.h.

174 { return !( this->operator==( c ) ); }
SmartRef::operator==
bool operator==(const SmartRef< TYPE > &c) const
Equality operator.
Definition: SmartRef.h:166

## ◆ operator()() [1/4]

template<class TYPE>

SmartRef<TYPE>& SmartRef< TYPE >::operator() | ( | ContainedObject * | pObj | ) |
| inline

operator(): assigns parent object for serialisation

Definition at line 190 of file SmartRef.h.

190 {
191 const DataObject* src = ( pObj ? pObj->parent() : nullptr );
192 return _setEnvironment( src, pObj );
193 }
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:51
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

## ◆ operator()() [2/4]

template<class TYPE>

const SmartRef<TYPE>& SmartRef< TYPE >::operator() | ( | const ContainedObject * | pObj | ) | const
| inline

operator() const: assigns parent object for serialisation

Definition at line 195 of file SmartRef.h.

195 {
196 const DataObject* src = ( pObj ? pObj->parent() : nullptr );
197 return _setEnvironment( src, pObj );
198 }
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:51
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

## ◆ operator()() [3/4]

template<class TYPE>

SmartRef<TYPE>& SmartRef< TYPE >::operator() | ( | DataObject * | pObj | ) |
| inline

operator(): assigns parent object for serialisation

Definition at line 200 of file SmartRef.h.

200 { return _setEnvironment( pObj, nullptr ); }
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176

## ◆ operator()() [4/4]

template<class TYPE>

const SmartRef<TYPE>& SmartRef< TYPE >::operator() | ( | const DataObject * | pObj | ) | const
| inline

operator() const: assigns parent object for serialisation

Definition at line 202 of file SmartRef.h.

202 { return _setEnvironment( pObj, nullptr ); }
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176

## ◆ operator->() [1/2]

template<class TYPE>

TYPE* SmartRef< TYPE >::operator-> | ( |  | ) |
| inline

Dereference operator.

Definition at line 222 of file SmartRef.h.

222 { return SmartRef<TYPE>::target(); }
SmartRef::target
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:259

## ◆ operator->() [2/2]

template<class TYPE>

const TYPE* SmartRef< TYPE >::operator-> | ( |  | ) | const
| inline

Dereference operator to const object.

Definition at line 224 of file SmartRef.h.

224 { return SmartRef<TYPE>::target(); }
SmartRef::target
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:259

## ◆ operator=() [1/2]

template<class TYPE>

SmartRef<TYPE>& SmartRef< TYPE >::operator= | ( | const SmartRef< TYPE > & | c | ) |
| inline

Assignment.

Definition at line 204 of file SmartRef.h.

204 {
205 m_target = c.m_target;
206 m_base.m_hintID = c.m_base.m_hintID;
207 m_base.m_linkID = c.m_base.m_linkID;
208 return _setEnvironment( c.m_base.m_data, c.m_base.m_contd );
209 }
gaudirun.c
c
Definition: gaudirun.py:487
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::_setEnvironment
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:176
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ operator=() [2/2]

template<class TYPE>

SmartRef<TYPE>& SmartRef< TYPE >::operator= | ( | TYPE * | pObject | ) |
| inline

Assignment.

Definition at line 211 of file SmartRef.h.

211 {
212 m_target = pObject;
213 m_base.m_hintID = INVALID;
214 m_base.m_linkID = INVALID;
215 return *this;
216 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ operator==()

template<class TYPE>

bool SmartRef< TYPE >::operator== | ( | const SmartRef< TYPE > & | c | ) | const
| inline

Equality operator.

Definition at line 166 of file SmartRef.h.

166 {
167 if ( m_target && c.m_target ) return m_target == c.m_target;
168 if ( !m_target && !c.m_target ) return m_base.isEqual( m_target, c.m_base );
169 if ( m_target && !c.m_target ) return m_base.isEqualEx( m_target, c.m_base );
170 if ( !m_target && c.m_target ) return c.m_base.isEqualEx( c.m_target, m_base );
171 return false;
172 }
gaudirun.c
c
Definition: gaudirun.py:487
SmartRefBase::isEqualEx
bool isEqualEx(const DataObject *pObj, const SmartRefBase &c) const
Extended equality check.
Definition: SmartRefBase.cpp:67
SmartRefBase::isEqual
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
Definition: SmartRefBase.h:72
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80

## ◆ path()

template<class TYPE>

const std::string& SmartRef< TYPE >::path | ( |  | ) | const
| inline

Return the path of the linked object inside the data store.

Definition at line 164 of file SmartRef.h.

164 { return m_base.path(); }
SmartRefBase::path
const std::string & path() const
Shortcut to access the path to the linked object.
Definition: SmartRefBase.cpp:89
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78

## ◆ readRef()

template<class TYPE >

StreamBuffer & SmartRef< TYPE >::readRef | ( | StreamBuffer & | s | ) |
| inline

Read the reference from the stream buffer (needed due to stupid G++ compiler)

Definition at line 273 of file SmartRef.h.

273 {
274 m_target = dynamic_cast<TYPE*>( m_base.readObject( m_target, s ) );
275 return s;
276 }
SmartRefBase::readObject
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
Definition: SmartRefBase.h:86
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ set()

template<class TYPE>

void SmartRef< TYPE >::set | ( | DataObject * | pObj,
|  | long | hint_id,
|  | long | link_id
| ) |  |
| inline

Setup smart reference when reading. Must be allowed from external sources.

Definition at line 153 of file SmartRef.h.

153 { m_base.set( pObj, hint_id, link_id ); }
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRefBase::set
void set(DataObject *pObj, long hint_id, long link_id)
Setup smart reference when reading. Must be allowed from external sources.
Definition: SmartRefBase.cpp:26

## ◆ shouldFollowLink() [1/2]

template<class TYPE>

bool SmartRef< TYPE >::shouldFollowLink | ( | const DataObject * |  | ) | const
| inline

Standard destructor.

Check if link should be followed: link must be valid and object not yet loaded

Definition at line 143 of file SmartRef.h.

143 { return ( !m_target && m_base.m_hintID != INVALID ); }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80

## ◆ shouldFollowLink() [2/2]

template<class TYPE>

bool SmartRef< TYPE >::shouldFollowLink | ( | const ContainedObject * |  | ) | const
| inline

Check if link should be followed: link must be valid and object not yet loaded.

Definition at line 145 of file SmartRef.h.

145 {
146 return ( !m_target && m_base.m_hintID != INVALID && m_base.m_linkID != INVALID );
147 }
SmartRefBase::m_hintID
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRef::INVALID
Definition: SmartRef.h:73
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::m_linkID
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52

## ◆ target() [1/2]

template<class TYPE >

const TYPE * SmartRef< TYPE >::target | ( |  | ) | const
| inline

Access to the object.

Access to the object (CONST)

Definition at line 259 of file SmartRef.h.

259 {
260 if ( !m_target ) { m_target = dynamic_cast<const TYPE*>( m_base.accessData( m_target ) ); }
261 return m_target;
262 }
SmartRefBase::accessData
const ContainedObject * accessData(const ContainedObject *typ) const
Load on demand of ContainedObject like references.
Definition: SmartRefBase.cpp:33
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80

## ◆ target() [2/2]

template<class TYPE >

TYPE * SmartRef< TYPE >::target | ( |  | ) |
| inline

Access to the object.

Definition at line 252 of file SmartRef.h.

252 {
253 if ( !m_target ) { m_target = dynamic_cast<const TYPE*>( m_base.accessData( m_target ) ); }
254 return const_cast<TYPE*>( m_target );
255 }
SmartRefBase::accessData
const ContainedObject * accessData(const ContainedObject *typ) const
Load on demand of ContainedObject like references.
Definition: SmartRefBase.cpp:33
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80

## ◆ type()

template<class TYPE>

const std::type_info* SmartRef< TYPE >::type | ( |  | ) | const
| inline

Access to embedded type.

Definition at line 155 of file SmartRef.h.

155 { return &typeid( TYPE ); }

## ◆ writeRef()

template<class TYPE >

StreamBuffer & SmartRef< TYPE >::writeRef | ( | StreamBuffer & | s | ) | const
| inline

Write the reference to the stream buffer (needed due to stupid G++ compiler)

Definition at line 266 of file SmartRef.h.

266 {
267 m_base.writeObject( m_target, s );
268 return s;
269 }
SmartRef::m_base
SmartRefBase m_base
Definition: SmartRef.h:78
SmartRef::m_target
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:80
SmartRefBase::writeObject
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
Definition: SmartRefBase.h:80
gaudirun.s
string s
Definition: gaudirun.py:316

## Friends And Related Function Documentation

## ◆ operator<<

template<class TYPE>

StreamBuffer& operator<< | ( | StreamBuffer & | _s,
|  | const SmartRef< TYPE > & | ptr
| ) |  |
| friend

Output Streamer operator.

Definition at line 235 of file SmartRef.h.

235 { return ptr.writeRef( _s ); }
SmartRef::writeRef
StreamBuffer & writeRef(StreamBuffer &s) const
Write the reference to the stream buffer (needed due to stupid G++ compiler)
Definition: SmartRef.h:266

## ◆ operator>>

template<class TYPE>

StreamBuffer& operator>> | ( | StreamBuffer & | _s,
|  | SmartRef< TYPE > & | ptr
| ) |  |
| friend

Input Streamer operator.

Definition at line 238 of file SmartRef.h.

238 { return ptr.readRef( _s ); }
SmartRef::readRef
StreamBuffer & readRef(StreamBuffer &s)
Read the reference from the stream buffer (needed due to stupid G++ compiler)
Definition: SmartRef.h:273

## ◆ SmartRefArray< TYPE >

template<class TYPE>

friend class SmartRefArray< TYPE >
| friend

The container must be a friend.

Definition at line 68 of file SmartRef.h.

## ◆ SmartRefList< TYPE >

template<class TYPE>

friend class SmartRefList< TYPE >
| friend

Definition at line 69 of file SmartRef.h.

## ◆ SmartRefMap< TYPE >

template<class TYPE>

friend class SmartRefMap< TYPE >
| friend

Definition at line 70 of file SmartRef.h.

## Member Data Documentation

## ◆ m_base

template<class TYPE>

SmartRefBase SmartRef< TYPE >::m_base
| protected

Definition at line 78 of file SmartRef.h.

## ◆ m_target

template<class TYPE>

const TYPE* SmartRef< TYPE >::m_target = nullptr
| mutable protected

Pointer to target data object.

Definition at line 80 of file SmartRef.h.

The documentation for this class was generated from the following file:

- GaudiKernel/GaudiKernel/SmartRef.h