The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
SmartRefVector< TYPE > Class Template Reference

Kernel objects: SmartRefVector. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/SmartRefVector.h>

Inheritance diagram for SmartRefVector< TYPE >:
Collaboration diagram for SmartRefVector< TYPE >:

Public Member Functions

 SmartRefVector ()
 
template<class ITERATOR>
 SmartRefVector (ITERATOR first, ITERATOR last)
 
 SmartRefVector (const SmartRefVector &copy)
 
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 > &copy)
 Assignment.
 
const std::type_info * type () const
 Access to embedded type.
 
StreamBufferreadRefs (StreamBuffer &s)
 Helper to read references.
 
StreamBufferwriteRefs (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 DataObjectm_data
 Object data: Pointer to the identifiable object the link originates.
 
const ContainedObjectm_contd
 Object data: Pointer to the Contained object (if applicable)
 

Friends

StreamBufferoperator<< (StreamBuffer &_s, const SmartRefVector< TYPE > &ptr)
 Output Streamer operator.
 
StreamBufferoperator>> (StreamBuffer &_s, SmartRefVector< TYPE > &ptr)
 Input Streamer operator.
 

Additional Inherited Members

- Static Private Member Functions inherited from SmartRefVectorImpl::SmartRefVectorPythonizer
static void __cppyy_pythonize__ (PyObject *klass, const std::string &name)
 

Detailed Description

template<class TYPE>
class SmartRefVector< TYPE >

Kernel objects: SmartRefVector.

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:

  • Base class: vector
  • SmartRef constructs: Gaudi/Kernel/SmartRef.h

History :

+---------+----------------------------------------------+--------+
|    Date |                 Comment                      | Who    |
+---------+----------------------------------------------+--------+
| 12/07/99| Initial version.                             | MF     |
+---------+----------------------------------------------+--------+

Author: M.Frank Version: 1.0

Definition at line 66 of file SmartRefVector.h.

Member Typedef Documentation

◆ _Base

template<class TYPE>
typedef std::vector<_Entry> SmartRefVector< TYPE >::_Base
protected

Object types: typedef myself as Base.

Definition at line 71 of file SmartRefVector.h.

◆ _BaseConstIter

template<class TYPE>
typedef std::vector<_Entry>::const_iterator SmartRefVector< TYPE >::_BaseConstIter
protected

Definition at line 72 of file SmartRefVector.h.

◆ _BaseValueType

template<class TYPE>
typedef std::vector<_Entry>::value_type SmartRefVector< TYPE >::_BaseValueType
protected

Definition at line 73 of file SmartRefVector.h.

◆ _Entry

template<class TYPE>
typedef SmartRef<TYPE> SmartRefVector< TYPE >::_Entry
protected

That's the type of crap I am hosting.

Definition at line 69 of file SmartRefVector.h.

Constructor & Destructor Documentation

◆ SmartRefVector() [1/3]

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

Definition at line 90 of file SmartRefVector.h.

90 {
91 m_contd = 0;
92 m_data = 0;
93 }
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.

◆ SmartRefVector() [2/3]

template<class TYPE>
template<class ITERATOR>
SmartRefVector< TYPE >::SmartRefVector ( ITERATOR first,
ITERATOR last )
inline

Definition at line 95 of file SmartRefVector.h.

Kernel objects: SmartRefVector.

◆ SmartRefVector() [3/3]

template<class TYPE>
SmartRefVector< TYPE >::SmartRefVector ( const SmartRefVector< TYPE > & copy)
inline

Definition at line 97 of file SmartRefVector.h.

97: std::vector<SmartRef<TYPE>>( copy ) { *this = copy; }

Member Function Documentation

◆ _setEnvironment()

template<class TYPE>
void SmartRefVector< TYPE >::_setEnvironment ( const DataObject * pObj,
const ContainedObject * pContd ) const
inlineprotected

Set the environment for the vector and all contained objects references.

Definition at line 81 of file SmartRefVector.h.

81 {
82 m_data = pObj;
84 for ( _BaseConstIter i = _Base::begin(); i != _Base::end(); ++i ) { ( *i )._setEnvironment( pObj, pContd ); }
85 }
std::vector< _Entry >::const_iterator _BaseConstIter

◆ operator()() [1/4]

template<class TYPE>
const SmartRefVector< TYPE > & SmartRefVector< TYPE >::operator() ( const ContainedObject * pObj) const
inline

operator() const: assigns parent object for serialisation

Definition at line 105 of file SmartRefVector.h.

105 {
106 _setEnvironment( ( 0 == pObj ) ? 0 : pObj->parent(), pObj );
107 return *this;
108 }
void _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment for the vector and all contained objects references.

◆ operator()() [2/4]

template<class TYPE>
const SmartRefVector< TYPE > & SmartRefVector< TYPE >::operator() ( const DataObject * pObj) const
inline

operator() const: assigns parent object for serialisation

Definition at line 115 of file SmartRefVector.h.

115 {
116 _setEnvironment( pObj, 0 );
117 return *this;
118 }

◆ operator()() [3/4]

template<class TYPE>
SmartRefVector< TYPE > & SmartRefVector< TYPE >::operator() ( ContainedObject * pObj)
inline

operator(): assigns parent object for serialisation

Definition at line 100 of file SmartRefVector.h.

100 {
101 _setEnvironment( ( 0 == pObj ) ? 0 : pObj->parent(), pObj );
102 return *this;
103 }

◆ operator()() [4/4]

template<class TYPE>
SmartRefVector< TYPE > & SmartRefVector< TYPE >::operator() ( DataObject * pObj)
inline

operator(): assigns parent object for serialisation

Definition at line 110 of file SmartRefVector.h.

110 {
111 _setEnvironment( pObj, 0 );
112 return *this;
113 }

◆ operator=()

template<class TYPE>
SmartRefVector< TYPE > & SmartRefVector< TYPE >::operator= ( const SmartRefVector< TYPE > & copy)
inline

Assignment.

Definition at line 120 of file SmartRefVector.h.

120 {
122 // Harms.... MF
123 // on copy we MUST make a 1 to 1 copy
124 // _setEnvironment( copy.m_data, copy.m_contd );
125 // use instead:
128 return *this;
129 }

◆ readRefs()

template<class TYPE>
StreamBuffer & SmartRefVector< TYPE >::readRefs ( StreamBuffer & s)
inline

Helper to read references.

Definition at line 156 of file SmartRefVector.h.

156 {
157 long len;
159 s >> len;
160 for ( long i = 0; i < len; i++ ) {
163 entry.readRef( s );
165 }
166 return s;
167}
std::vector< _Entry >::value_type _BaseValueType

◆ type()

template<class TYPE>
const std::type_info * SmartRefVector< TYPE >::type ( ) const
inline

Access to embedded type.

Definition at line 131 of file SmartRefVector.h.

131{ return &typeid( TYPE ); }

◆ writeRefs()

template<class TYPE>
StreamBuffer & SmartRefVector< TYPE >::writeRefs ( StreamBuffer & s) const
inline

Helper to write references.

Definition at line 145 of file SmartRefVector.h.

145 {
146 long len = _Base::size();
147 s << len;
148 for ( _BaseConstIter i = _Base::begin(); i != _Base::end(); i++ ) {
149 ( *i )._setEnvironment( m_data, m_contd );
150 ( *i ).writeRef( s );
151 }
152 return s;
153}

Friends And Related Symbol Documentation

◆ operator<<

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

Output Streamer operator.

Definition at line 138 of file SmartRefVector.h.

138{ return ptr.writeRefs( _s ); }
StreamBuffer & writeRefs(StreamBuffer &s) const
Helper to write references.

◆ operator>>

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

Input Streamer operator.

Definition at line 141 of file SmartRefVector.h.

141{ return ptr.readRefs( _s ); }
StreamBuffer & readRefs(StreamBuffer &s)
Helper to read references.

Member Data Documentation

◆ m_contd

template<class TYPE>
const ContainedObject* SmartRefVector< TYPE >::m_contd
mutableprotected

Object data: Pointer to the Contained object (if applicable)

Definition at line 78 of file SmartRefVector.h.

◆ m_data

template<class TYPE>
const DataObject* SmartRefVector< TYPE >::m_data
mutableprotected

Object data: Pointer to the identifiable object the link originates.

Definition at line 76 of file SmartRefVector.h.


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