All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SmartRef< TYPE > Class Template Reference

Kernel objects: SmartRef. More...

#include <GaudiKernel/SmartRef.h>

Collaboration diagram for SmartRef< TYPE >:

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=0)
 Constructor. More...
 
 SmartRef (const ContainedObject *pObj, long hint, long link, TYPE *obj=0)
 Constructor for references to contained objects passing environment. More...
 
 SmartRef (const DataObject *pObj, long hint, long link, TYPE *obj=0)
 Constructor for references to contained objects passing environment. More...
 
 SmartRef (const DataObject *pObj, long hint, TYPE *obj=0)
 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...
 
StreamBufferwriteRef (StreamBuffer &s) const
 Write the reference to the stream buffer (needed due to stupid G++ compiler) More...
 
StreamBufferreadRef (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
 Pointer to target data object. More...
 

Friends

class SmartRefArray< TYPE >
 The container must be a friend. More...
 
class SmartRefList< TYPE >
 
class SmartRefMap< TYPE >
 
StreamBufferoperator<< (StreamBuffer &_s, const SmartRef< TYPE > &ptr)
 Output Streamer operator. More...
 
StreamBufferoperator>> (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:

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 62 of file SmartRef.h.

Member Typedef Documentation

template<class TYPE>
typedef TYPE SmartRef< TYPE >::entry_type

Entry type definition.

Definition at line 71 of file SmartRef.h.

Member Enumeration Documentation

template<class TYPE>
anonymous enum

Constructor & Destructor Documentation

template<class TYPE>
SmartRef< TYPE >::SmartRef ( )
inline

Standard Constructor.

Definition at line 79 of file SmartRef.h.

79  {
82  m_target = 0;
83  _setEnvironment(0, 0);
84  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef< TYPE >::SmartRef ( TYPE *  pObject)
inline

Standard Constructor with initialisation.

Definition at line 86 of file SmartRef.h.

86  {
89  m_target = pObject;
90  _setEnvironment(0, 0);
91  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef< TYPE >::SmartRef ( const TYPE *  pObject)
inline

Standard Constructor with initialisation from const object.

Definition at line 93 of file SmartRef.h.

93  {
96  m_target = const_cast<TYPE*>(pObject);
97  _setEnvironment(0, 0);
98  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef< TYPE >::SmartRef ( const SmartRef< TYPE > &  copy)
inline

Copy Constructor.

Definition at line 100 of file SmartRef.h.

100  {
103  m_target = copy.m_target;
105  }
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:54
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:56
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef< TYPE >::SmartRef ( long  hint,
long  link,
TYPE *  obj = 0 
)
inline

Constructor.

Definition at line 107 of file SmartRef.h.

107  {
108  m_base.m_hintID = hint;
109  m_base.m_linkID = link;
110  m_target = obj;
111  _setEnvironment(0, 0);
112  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef< TYPE >::SmartRef ( const ContainedObject pObj,
long  hint,
long  link,
TYPE *  obj = 0 
)
inline

Constructor for references to contained objects passing environment.

Definition at line 114 of file SmartRef.h.

114  {
115  m_base.m_hintID = hint;
116  m_base.m_linkID = link;
117  m_target = obj;
118  const DataObject* src = (0==pObj) ? 0 : pObj->parent();
119  _setEnvironment(src, pObj);
120  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
const ObjectContainerBase * parent() const
Access to parent object.
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef< TYPE >::SmartRef ( const DataObject pObj,
long  hint,
long  link,
TYPE *  obj = 0 
)
inline

Constructor for references to contained objects passing environment.

Definition at line 122 of file SmartRef.h.

122  {
123  m_base.m_hintID = hint;
124  m_base.m_linkID = link;
125  m_target = obj;
126  _setEnvironment(pObj, 0);
127  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef< TYPE >::SmartRef ( const DataObject pObj,
long  hint,
TYPE *  obj = 0 
)
inline

Constructor for references to DataObjects passing environment.

Definition at line 129 of file SmartRef.h.

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

Member Function Documentation

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

Set the environment (CONST)

Definition at line 196 of file SmartRef.h.

196  {
197  m_base.m_data = pObj;
198  m_base.m_contd = pContd;
200  return *this;
201  }
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:54
void setObjectType(const ContainedObject *) const
Definition: SmartRefBase.h:100
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:56
TYPE * data()
Access to raw data pointer.
Definition: SmartRef.h:163
SmartRefBase m_base
Definition: SmartRef.h:73
template<class TYPE>
SmartRef<TYPE>& SmartRef< TYPE >::_setEnvironment ( const DataObject pObj,
const ContainedObject pContd 
)
inline

Set the environment (CONST)

Definition at line 203 of file SmartRef.h.

203  {
204  m_base.m_data = pObj;
205  m_base.m_contd = pContd;
207  return *this;
208  }
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:54
void setObjectType(const ContainedObject *) const
Definition: SmartRefBase.h:100
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:56
TYPE * data()
Access to raw data pointer.
Definition: SmartRef.h:163
SmartRefBase m_base
Definition: SmartRef.h:73
template<class TYPE>
TYPE* SmartRef< TYPE >::data ( )
inline

Access to raw data pointer.

Definition at line 163 of file SmartRef.h.

163  {
164  return const_cast<TYPE*>(m_target);
165  }
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
template<class TYPE>
const TYPE* SmartRef< TYPE >::data ( ) const
inline

Definition at line 166 of file SmartRef.h.

166  {
167  return m_target;
168  }
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
template<class TYPE>
long SmartRef< TYPE >::hintID ( ) const
inline

Access hint id:

Definition at line 147 of file SmartRef.h.

147  {
148  return m_base.m_hintID;
149  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
template<class TYPE>
long SmartRef< TYPE >::linkID ( ) const
inline

Access link id:

Definition at line 151 of file SmartRef.h.

151  {
152  return m_base.m_linkID;
153  }
SmartRefBase m_base
Definition: SmartRef.h:73
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
template<class TYPE>
SmartRef< TYPE >::operator const TYPE * ( ) const
inline

Implicit type conversion to const object.

Definition at line 249 of file SmartRef.h.

249 { return SmartRef<TYPE>::target(); }
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:288
template<class TYPE>
SmartRef< TYPE >::operator TYPE * ( )
inline

Implicit type conversion.

Definition at line 251 of file SmartRef.h.

251 { return SmartRef<TYPE>::target(); }
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:288
template<class TYPE>
bool SmartRef< TYPE >::operator!= ( const SmartRef< TYPE > &  c) const
inline

NON-Equality operator.

Definition at line 192 of file SmartRef.h.

192  {
193  return !(this->operator==(c));
194  }
bool operator==(const SmartRef< TYPE > &c) const
Equality operator.
Definition: SmartRef.h:176
template<class TYPE>
SmartRef<TYPE>& SmartRef< TYPE >::operator() ( ContainedObject pObj)
inline

operator(): assigns parent object for serialisation

Definition at line 210 of file SmartRef.h.

210  {
211  const DataObject* src = (0==pObj) ? 0 : pObj->parent();
212  return _setEnvironment(src, pObj);
213  }
const ObjectContainerBase * parent() const
Access to parent object.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
const SmartRef<TYPE>& SmartRef< TYPE >::operator() ( const ContainedObject pObj) const
inline

operator() const: assigns parent object for serialisation

Definition at line 215 of file SmartRef.h.

215  {
216  const DataObject* src = (0==pObj) ? 0 : pObj->parent();
217  return _setEnvironment(src, pObj);
218  }
const ObjectContainerBase * parent() const
Access to parent object.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef<TYPE>& SmartRef< TYPE >::operator() ( DataObject pObj)
inline

operator(): assigns parent object for serialisation

Definition at line 220 of file SmartRef.h.

220  {
221  return _setEnvironment(pObj,0);
222  }
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
const SmartRef<TYPE>& SmartRef< TYPE >::operator() ( const DataObject pObj) const
inline

operator() const: assigns parent object for serialisation

Definition at line 224 of file SmartRef.h.

224  {
225  return _setEnvironment(pObj,0);
226  }
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
TYPE& SmartRef< TYPE >::operator* ( )
inline

Dereference operator.

Definition at line 241 of file SmartRef.h.

241 { return *SmartRef<TYPE>::target(); }
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:288
template<class TYPE>
const TYPE& SmartRef< TYPE >::operator* ( ) const
inline

Dereference operator.

Definition at line 243 of file SmartRef.h.

243 { return *SmartRef<TYPE>::target(); }
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:288
template<class TYPE>
TYPE* SmartRef< TYPE >::operator-> ( )
inline

Dereference operator.

Definition at line 245 of file SmartRef.h.

245 { return SmartRef<TYPE>::target(); }
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:288
template<class TYPE>
const TYPE* SmartRef< TYPE >::operator-> ( ) const
inline

Dereference operator to const object.

Definition at line 247 of file SmartRef.h.

247 { return SmartRef<TYPE>::target(); }
const TYPE * target() const
Access to the object.
Definition: SmartRef.h:288
template<class TYPE>
SmartRef<TYPE>& SmartRef< TYPE >::operator= ( const SmartRef< TYPE > &  c)
inline

Assignment.

Definition at line 228 of file SmartRef.h.

228  {
229  m_target = c.m_target;
232  return _setEnvironment(c.m_base.m_data, c.m_base.m_contd); }
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.
Definition: SmartRefBase.h:54
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
Definition: SmartRefBase.h:56
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
const SmartRef< TYPE > & _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment (CONST)
Definition: SmartRef.h:196
template<class TYPE>
SmartRef<TYPE>& SmartRef< TYPE >::operator= ( TYPE *  pObject)
inline

Assignment.

Definition at line 234 of file SmartRef.h.

234  {
235  m_target = pObject;
238  return *this;
239  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
template<class TYPE>
bool SmartRef< TYPE >::operator== ( const SmartRef< TYPE > &  c) const
inline

Equality operator.

Definition at line 176 of file SmartRef.h.

176  {
177  if ( 0 != m_target && 0 != c.m_target ) {
178  return m_target == c.m_target;
179  }
180  else if ( 0 == m_target && 0 == c.m_target ) {
181  return m_base.isEqual(m_target,c.m_base);
182  }
183  else if ( 0 != m_target && 0 == c.m_target ) {
184  return m_base.isEqualEx(m_target, c.m_base);
185  }
186  else if ( 0 == m_target && 0 != c.m_target ) {
187  return c.m_base.isEqualEx(c.m_target, m_base);
188  }
189  return false;
190  }
bool isEqual(const ContainedObject *, const SmartRefBase &c) const
Equality operator for ContainedObject like references.
Definition: SmartRefBase.h:72
bool isEqualEx(const DataObject *pObj, const SmartRefBase &c) const
Extended equality check.
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
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 174 of file SmartRef.h.

174 { return m_base.path(); }
const std::string & path() const
Shortcut to access the path to the linked object.
SmartRefBase m_base
Definition: SmartRef.h:73
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 304 of file SmartRef.h.

304  {
305  m_target = dynamic_cast<TYPE*>( m_base.readObject(m_target, s) );
306  return s;
307 }
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
string s
Definition: gaudirun.py:210
DataObject * readObject(const DataObject *, StreamBuffer &s) const
Input streamer for DataObject like references.
Definition: SmartRefBase.h:89
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 155 of file SmartRef.h.

155  {
156  m_base.set(pObj, hint_id, link_id);
157  }
SmartRefBase m_base
Definition: SmartRef.h:73
void set(DataObject *pObj, long hint_id, long link_id)
Setup smart reference when reading. Must be allowed from external sources.
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 139 of file SmartRef.h.

139  {
140  return (0 == m_target && m_base.m_hintID != INVALID );
141  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
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 143 of file SmartRef.h.

143  {
144  return (0 == m_target && m_base.m_hintID != INVALID && m_base.m_linkID != INVALID );
145  }
long m_hintID
Object data: ID of the link hint to the identifiable object.
Definition: SmartRefBase.h:50
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
long m_linkID
Object data: ID of the object within the identifiable container (if any)
Definition: SmartRefBase.h:52
template<class TYPE >
const TYPE * SmartRef< TYPE >::target ( ) const
inline

Access to the object.

Access to the object (CONST)

Definition at line 288 of file SmartRef.h.

288  {
289  if ( 0 == m_target ) {
290  m_target = dynamic_cast<const TYPE*>(m_base.accessData(m_target));
291  }
292  return m_target;
293 }
const ContainedObject * accessData(const ContainedObject *typ) const
Load on demand of ContainedObject like references.
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
template<class TYPE >
TYPE * SmartRef< TYPE >::target ( )
inline

Access to the object.

Definition at line 279 of file SmartRef.h.

279  {
280  if ( 0 == m_target ) {
281  m_target = dynamic_cast<const TYPE*>(m_base.accessData(m_target));
282  }
283  return const_cast<TYPE*>(m_target);
284 }
const ContainedObject * accessData(const ContainedObject *typ) const
Load on demand of ContainedObject like references.
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
template<class TYPE>
const std::type_info* SmartRef< TYPE >::type ( ) const
inline

Access to embedded type.

Definition at line 159 of file SmartRef.h.

159  {
160  return &typeid(TYPE);
161  }
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 297 of file SmartRef.h.

297  {
299  return s;
300 }
void writeObject(const DataObject *pObject, StreamBuffer &s) const
Output streamer for DataObject like references.
Definition: SmartRefBase.h:81
SmartRefBase m_base
Definition: SmartRef.h:73
const TYPE * m_target
Pointer to target data object.
Definition: SmartRef.h:75
string s
Definition: gaudirun.py:210

Friends And Related Function Documentation

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

Output Streamer operator.

Definition at line 258 of file SmartRef.h.

258  {
259  return ptr.writeRef(_s);
260  }
StreamBuffer & writeRef(StreamBuffer &s) const
Write the reference to the stream buffer (needed due to stupid G++ compiler)
Definition: SmartRef.h:297
template<class TYPE>
StreamBuffer& operator>> ( StreamBuffer _s,
SmartRef< TYPE > &  ptr 
)
friend

Input Streamer operator.

Definition at line 263 of file SmartRef.h.

263  {
264  return ptr.readRef(_s);
265  }
StreamBuffer & readRef(StreamBuffer &s)
Read the reference from the stream buffer (needed due to stupid G++ compiler)
Definition: SmartRef.h:304
template<class TYPE>
friend class SmartRefArray< TYPE >
friend

The container must be a friend.

Definition at line 64 of file SmartRef.h.

template<class TYPE>
friend class SmartRefList< TYPE >
friend

Definition at line 65 of file SmartRef.h.

template<class TYPE>
friend class SmartRefMap< TYPE >
friend

Definition at line 66 of file SmartRef.h.

Member Data Documentation

template<class TYPE>
SmartRefBase SmartRef< TYPE >::m_base
protected

Definition at line 73 of file SmartRef.h.

template<class TYPE>
const TYPE* SmartRef< TYPE >::m_target
mutableprotected

Pointer to target data object.

Definition at line 75 of file SmartRef.h.


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