#include <SmartRefVector.h>
Collaboration diagram for SmartRefVector< TYPE >:
Public Member Functions | |
SmartRefVector () | |
Standard Constructor. | |
template<class ITERATOR> | |
SmartRefVector (ITERATOR first, ITERATOR last) | |
templated Constructor | |
SmartRefVector (const SmartRefVector ©) | |
Copy Constructor. | |
SmartRefVector< TYPE > & | operator() (ContainedObject *pObj) |
operator(): assigns parent object for serialisation | |
const SmartRefVector< TYPE > & | operator() (const ContainedObject *pObj) const |
operator() const: assigns parent object for serialisation | |
SmartRefVector< TYPE > & | operator() (DataObject *pObj) |
operator(): assigns parent object for serialisation | |
const SmartRefVector< TYPE > & | operator() (const DataObject *pObj) const |
operator() const: assigns parent object for serialisation | |
SmartRefVector< TYPE > & | operator= (const SmartRefVector< TYPE > ©) |
Assignment. | |
const std::type_info * | type () const |
Access to embedded type. | |
StreamBuffer & | readRefs (StreamBuffer &s) |
Helper to read references. | |
StreamBuffer & | writeRefs (StreamBuffer &s) const |
Helper to write references. | |
Protected Types | |
typedef SmartRef< TYPE > | _Entry |
That's the type of crap I am hosting. | |
typedef std::vector< _Entry > | _Base |
Object types: typedef myself as Base. | |
typedef std::vector< _Entry >::const_iterator | _BaseConstIter |
typedef std::vector< _Entry >::value_type | _BaseValueType |
Protected Member Functions | |
void | _setEnvironment (const DataObject *pObj, const ContainedObject *pContd) const |
Set the environment for the vector and all contained objects references. | |
Protected Attributes | |
const DataObject * | m_data |
Object data: Pointer to the identifiable object the link originates. | |
const ContainedObject * | m_contd |
Object data: Pointer to the Contained object (if applicable). | |
Friends | |
StreamBuffer & | operator<< (StreamBuffer &s, const SmartRefVector< TYPE > &ptr) |
Output Streamer operator. | |
StreamBuffer & | operator>> (StreamBuffer &s, SmartRefVector< TYPE > &ptr) |
Input Streamer operator. |
Description: The SmartRefVector class allows transparent handling of multiple object links within the data store. Links are unloaded a priori and will only be loaded "on demand", i.e. when dereferenced.
SmartRefVectors should behave in the same way as normal vectors of pointers;
Using SmartRefVectors the environment of the vector is automatically propagated to each contained reference.
In order to speed things up, an attempt was made to avoid any virtual functions.
Base Class: STL vector
Dependencies:
History :
+---------+----------------------------------------------+--------+ | Date | Comment | Who | +---------+----------------------------------------------+--------+ | 12/07/99| Initial version. | MF | +---------+----------------------------------------------+--------+Author: M.Frank Version: 1.0
Definition at line 54 of file SmartRefVector.h.
typedef SmartRef<TYPE> SmartRefVector< TYPE >::_Entry [protected] |
typedef std::vector<_Entry> SmartRefVector< TYPE >::_Base [protected] |
typedef std::vector<_Entry>::const_iterator SmartRefVector< TYPE >::_BaseConstIter [protected] |
Definition at line 60 of file SmartRefVector.h.
typedef std::vector<_Entry>::value_type SmartRefVector< TYPE >::_BaseValueType [protected] |
Definition at line 61 of file SmartRefVector.h.
SmartRefVector< TYPE >::SmartRefVector | ( | ) | [inline] |
SmartRefVector< TYPE >::SmartRefVector | ( | ITERATOR | first, | |
ITERATOR | last | |||
) | [inline] |
templated Constructor
Definition at line 84 of file SmartRefVector.h.
00085 : std::vector< SmartRef<TYPE> >( first , last ) 00086 , m_data ( 0 ) 00087 , m_contd ( 0 ) 00088 { 00089 00090 }
SmartRefVector< TYPE >::SmartRefVector | ( | const SmartRefVector< TYPE > & | copy | ) | [inline] |
void SmartRefVector< TYPE >::_setEnvironment | ( | const DataObject * | pObj, | |
const ContainedObject * | pContd | |||
) | const [inline, protected] |
Set the environment for the vector and all contained objects references.
Definition at line 69 of file SmartRefVector.h.
00069 { 00070 m_data = pObj; 00071 m_contd = pContd; 00072 for ( _BaseConstIter i = _Base::begin(); i != _Base::end(); i++ ) { 00073 (*i)._setEnvironment(pObj, pContd); 00074 } 00075 }
SmartRefVector<TYPE>& SmartRefVector< TYPE >::operator() | ( | ContainedObject * | pObj | ) | [inline] |
operator(): assigns parent object for serialisation
Definition at line 101 of file SmartRefVector.h.
00101 { 00102 _setEnvironment((0==pObj) ? 0 : pObj->parent(), pObj); 00103 return *this; 00104 }
const SmartRefVector<TYPE>& SmartRefVector< TYPE >::operator() | ( | const ContainedObject * | pObj | ) | const [inline] |
operator() const: assigns parent object for serialisation
Definition at line 106 of file SmartRefVector.h.
00106 { 00107 _setEnvironment((0==pObj) ? 0 : pObj->parent(), pObj); 00108 return *this; 00109 }
SmartRefVector<TYPE>& SmartRefVector< TYPE >::operator() | ( | DataObject * | pObj | ) | [inline] |
operator(): assigns parent object for serialisation
Definition at line 111 of file SmartRefVector.h.
00111 { 00112 _setEnvironment(pObj,0); 00113 return *this; 00114 }
const SmartRefVector<TYPE>& SmartRefVector< TYPE >::operator() | ( | const DataObject * | pObj | ) | const [inline] |
operator() const: assigns parent object for serialisation
Definition at line 116 of file SmartRefVector.h.
00116 { 00117 _setEnvironment(pObj,0); 00118 return *this; 00119 }
SmartRefVector<TYPE>& SmartRefVector< TYPE >::operator= | ( | const SmartRefVector< TYPE > & | copy | ) | [inline] |
Assignment.
Definition at line 121 of file SmartRefVector.h.
00121 { 00122 _Base::operator=(copy); 00123 // Harms.... MF 00124 // on copy we MUST make a 1 to 1 copy 00125 // _setEnvironment( copy.m_data, copy.m_contd ); 00126 // use instead: 00127 m_data = copy.m_data; 00128 m_contd = copy.m_contd; 00129 return *this; 00130 }
const std::type_info* SmartRefVector< TYPE >::type | ( | ) | const [inline] |
StreamBuffer & SmartRefVector< TYPE >::readRefs | ( | StreamBuffer & | s | ) | [inline] |
Helper to read references.
Definition at line 161 of file SmartRefVector.h.
00161 { 00162 long len; 00163 _Base::erase( _Base::begin(), _Base::end() ); 00164 s >> len; 00165 for ( long i = 0; i < len; i++ ) { 00166 _BaseValueType entry; 00167 entry._setEnvironment(m_data, m_contd); 00168 entry.readRef(s); 00169 _Base::push_back( entry ); 00170 } 00171 return s; 00172 }
StreamBuffer & SmartRefVector< TYPE >::writeRefs | ( | StreamBuffer & | s | ) | const [inline] |
Helper to write references.
Definition at line 150 of file SmartRefVector.h.
00150 { 00151 long len = _Base::size(); 00152 s << len; 00153 for ( _BaseConstIter i = _Base::begin(); i != _Base::end(); i++ ) { 00154 (*i)._setEnvironment(m_data, m_contd); 00155 (*i).writeRef(s); 00156 } 00157 return s; 00158 }
StreamBuffer& operator<< | ( | StreamBuffer & | s, | |
const SmartRefVector< TYPE > & | ptr | |||
) | [friend] |
StreamBuffer& operator>> | ( | StreamBuffer & | s, | |
SmartRefVector< TYPE > & | ptr | |||
) | [friend] |
const DataObject* SmartRefVector< TYPE >::m_data [mutable, protected] |
Object data: Pointer to the identifiable object the link originates.
Definition at line 64 of file SmartRefVector.h.
const ContainedObject* SmartRefVector< TYPE >::m_contd [mutable, protected] |
Object data: Pointer to the Contained object (if applicable).
Definition at line 66 of file SmartRefVector.h.