Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

SmartRef Class Template Reference

Kernel objects: SmartRef. More...

#include <SmartRef.h>

Inheritance diagram for SmartRef:

SmartRefBase List of all members.

Public Types

typedef TYPE entry_type
 Entry type definition. More...

enum  { VALID = StreamBuffer::VALID, INVALID = StreamBuffer::INVALID }

Public Methods

 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* typ) const
 Check if link should be followed: link must be valid and object not yet loaded. More...

bool shouldFollowLink (const ContainedObject* typ) 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...

TYPE* data ()
const TYPE* data () const
const TYPE* target () const
 Access to the object. More...

TYPE* target ()
 Access to the object. More...

bool operator== (const SmartRef<TYPE>& c) const
 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

const TYPE* m_target
 Pointer to target data object. More...


Friends

class  SmartRefArray< TYPE >
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> template class SmartRef

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     |
    +---------+----------------------------------------------+--------+
    
Author: M.Frank Version: 1.0

Definition at line 58 of file SmartRef.h.


Member Typedef Documentation

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

Entry type definition.

Definition at line 67 of file SmartRef.h.


Member Enumeration Documentation

template<classTYPE>
anonymous enum
 

Enumeration values:
VALID  
INVALID  

Definition at line 65 of file SmartRef.h.


Constructor & Destructor Documentation

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( ) [inline]
 

Standard Constructor.

Definition at line 74 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( TYPE * pObject ) [inline]
 

Standard Constructor with initialisation.

Definition at line 81 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( const TYPE * pObject ) [inline]
 

Standard Constructor with initialisation from const object.

Definition at line 88 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( const SmartRef<TYPE> & copy ) [inline]
 

Copy Constructor.

Definition at line 95 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( long hint,
long link,
TYPE * obj = 0 ) [inline]
 

Constructor.

Definition at line 102 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( const ContainedObject * pObj,
long hint,
long link,
TYPE * obj = 0 ) [inline]
 

Constructor for references to contained objects passing environment.

Definition at line 109 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( const DataObject * pObj,
long hint,
long link,
TYPE * obj = 0 ) [inline]
 

Constructor for references to contained objects passing environment.

Definition at line 117 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::SmartRef<TYPE> ( const DataObject * pObj,
long hint,
TYPE * obj = 0 ) [inline]
 

Constructor for references to DataObjects passing environment.

Definition at line 124 of file SmartRef.h.


Member Function Documentation

template<classTYPE>
SmartRef< TYPE >& SmartRef<TYPE>::_setEnvironment ( const DataObject * pObj,
const ContainedObject * pContd ) [inline]
 

Set the environment (CONST).

Definition at line 170 of file SmartRef.h.

template<classTYPE>
const SmartRef< TYPE >& SmartRef<TYPE>::_setEnvironment ( const DataObject * pObj,
const ContainedObject * pContd ) const [inline]
 

Set the environment (CONST).

Definition at line 164 of file SmartRef.h.

Referenced by SmartRef().

template<classTYPE>
const TYPE * SmartRef<TYPE>::data ( ) const [inline]
 

Definition at line 152 of file SmartRef.h.

template<classTYPE>
TYPE * SmartRef<TYPE>::data ( ) [inline]
 

Definition at line 149 of file SmartRef.h.

template<classTYPE>
long SmartRef<TYPE>::hintID ( ) const [inline]
 

Access hint id:.

Definition at line 142 of file SmartRef.h.

template<classTYPE>
long SmartRef<TYPE>::linkID ( ) const [inline]
 

Access link id:.

Definition at line 146 of file SmartRef.h.

template<classTYPE>
const TYPE & SmartRef<TYPE>::operator * ( ) const [inline]
 

Dereference operator.

Definition at line 205 of file SmartRef.h.

template<classTYPE>
TYPE & SmartRef<TYPE>::operator * ( ) [inline]
 

Dereference operator.

Definition at line 203 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::operator TYPE * ( ) [inline]
 

Implicit type conversion.

Definition at line 213 of file SmartRef.h.

template<classTYPE>
SmartRef<TYPE>::operator const TYPE * ( ) const [inline]
 

Implicit type conversion to const object.

Definition at line 211 of file SmartRef.h.

template<classTYPE>
const SmartRef< TYPE >& SmartRef<TYPE>::operator() ( const DataObject * pObj ) const [inline]
 

operator() const: assigns parent object for serialisation.

Definition at line 190 of file SmartRef.h.

template<classTYPE>
SmartRef< TYPE >& SmartRef<TYPE>::operator() ( DataObject * pObj ) [inline]
 

operator(): assigns parent object for serialisation.

Definition at line 186 of file SmartRef.h.

template<classTYPE>
const SmartRef< TYPE >& SmartRef<TYPE>::operator() ( const ContainedObject * pObj ) const [inline]
 

operator() const: assigns parent object for serialisation.

Definition at line 181 of file SmartRef.h.

template<classTYPE>
SmartRef< TYPE >& SmartRef<TYPE>::operator() ( ContainedObject * pObj ) [inline]
 

operator(): assigns parent object for serialisation.

Definition at line 176 of file SmartRef.h.

template<classTYPE>
const TYPE * SmartRef<TYPE>::operator-> ( ) const [inline]
 

Dereference operator to const object.

Definition at line 209 of file SmartRef.h.

template<classTYPE>
TYPE * SmartRef<TYPE>::operator-> ( ) [inline]
 

Dereference operator.

Definition at line 207 of file SmartRef.h.

template<classTYPE>
SmartRef< TYPE >& SmartRef<TYPE>::operator= ( TYPE * pObject ) [inline]
 

Assignment.

Definition at line 201 of file SmartRef.h.

template<classTYPE>
SmartRef< TYPE >& SmartRef<TYPE>::operator= ( const SmartRef< TYPE >& c ) [inline]
 

Assignment.

Definition at line 194 of file SmartRef.h.

template<classTYPE>
bool SmartRef<TYPE>::operator== ( const SmartRef< TYPE >& c ) const [inline]
 

Equality operator.

Definition at line 160 of file SmartRef.h.

template<classTYPE>
StreamBuffer & SmartRef< TYPE >::readRef ( StreamBuffer & s ) [inline]
 

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

Definition at line 264 of file SmartRef.h.

Referenced by operator>>().

template<classTYPE>
bool SmartRef<TYPE>::shouldFollowLink ( const ContainedObject * typ ) const [inline]
 

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

Definition at line 138 of file SmartRef.h.

template<classTYPE>
bool SmartRef<TYPE>::shouldFollowLink ( const DataObject * typ ) const [inline]
 

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

Definition at line 134 of file SmartRef.h.

template<classTYPE>
TYPE * SmartRef< TYPE >::target ( ) [inline]
 

Access to the object.

Definition at line 239 of file SmartRef.h.

template<classTYPE>
const TYPE * SmartRef< TYPE >::target ( ) const [inline]
 

Access to the object.

Definition at line 248 of file SmartRef.h.

Referenced by operator *(), operator TYPE *(), operator const TYPE *(), and operator->().

template<classTYPE>
StreamBuffer & SmartRef< TYPE >::writeRef ( StreamBuffer & s ) const [inline]
 

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

Definition at line 257 of file SmartRef.h.


Friends And Related Function Documentation

template<classTYPE>
class SmartRefArray [friend]
 

The container must be a friend.

Definition at line 60 of file SmartRef.h.

template<classTYPE>
class SmartRefList [friend]
 

Definition at line 61 of file SmartRef.h.

template<classTYPE>
class SmartRefMap [friend]
 

Definition at line 62 of file SmartRef.h.

template<classTYPE>
StreamBuffer & operator<< ( StreamBuffer & s,
const SmartRef< TYPE >& ptr ) [friend]
 

Output Streamer operator.

Definition at line 219 of file SmartRef.h.

template<classTYPE>
StreamBuffer & operator>> ( StreamBuffer & s,
SmartRef< TYPE >& ptr ) [friend]
 

Input Streamer operator.

Definition at line 223 of file SmartRef.h.


Member Data Documentation

template<classTYPE>
const TYPE * SmartRef<TYPE>::m_target [mutable, protected]
 

Pointer to target data object.

Definition at line 70 of file SmartRef.h.


The documentation for this class was generated from the following file:
Generated at Wed Nov 21 12:22:16 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000