The Gaudi Framework  v33r1 (b1225454)
SmartRefVector< TYPE > Class Template Reference

Kernel objects: SmartRefVector. More...

#include <GaudiKernel/SmartRefVector.h>

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

Public Member Functions

 SmartRefVector ()
 Standard Constructor. More...
 
template<class ITERATOR >
 SmartRefVector (ITERATOR first, ITERATOR last)
 templated Constructor More...
 
 SmartRefVector (const SmartRefVector &copy)
 Copy Constructor. More...
 
SmartRefVector< TYPE > & operator() (ContainedObject *pObj)
 Standard destructor. More...
 
const SmartRefVector< TYPE > & operator() (const ContainedObject *pObj) const
 operator() const: assigns parent object for serialisation More...
 
SmartRefVector< TYPE > & operator() (DataObject *pObj)
 operator(): assigns parent object for serialisation More...
 
const SmartRefVector< TYPE > & operator() (const DataObject *pObj) const
 operator() const: assigns parent object for serialisation More...
 
SmartRefVector< TYPE > & operator= (const SmartRefVector< TYPE > &copy)
 Assignment. More...
 
const std::type_infotype () const
 Access to embedded type. More...
 
StreamBufferreadRefs (StreamBuffer &s)
 Helper to read references. More...
 
StreamBufferwriteRefs (StreamBuffer &s) const
 Helper to write references. More...
 
- Public Member Functions inherited from std::vector< SmartRef< TYPE > >
SmartRef< TYPE > push_back (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > crbegin (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > erase (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > data (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > insert (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > pop_back (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > shrink_to_fit (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > back (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > end (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > resize (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > emplace_back (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > size (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > cbegin (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > front (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > ~vector (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > rbegin (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > crend (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > assign (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > operator= (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > vector (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > reserve (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > capacity (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > empty (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > cend (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > swap (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > max_size (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > rend (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > get_allocator (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > clear (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > at (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > emplace (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > operator[] (SmartRef< TYPE > ... args)
 
SmartRef< TYPE > begin (SmartRef< TYPE > ... args)
 

Protected Types

typedef SmartRef< TYPE > _Entry
 That's the type of crap I am hosting. More...
 
typedef std::vector< _Entry_Base
 Object types: typedef myself as Base. More...
 
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. More...
 

Protected Attributes

const DataObjectm_data
 Object data: Pointer to the identifiable object the link originates. More...
 
const ContainedObjectm_contd
 Object data: Pointer to the Contained object (if applicable) More...
 

Friends

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

Additional Inherited Members

- Public Attributes inherited from std::vector< SmartRef< TYPE > >
SmartRef< TYPE > elements
 STL member. More...
 

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 65 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 70 of file SmartRefVector.h.

◆ _BaseConstIter

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

Definition at line 71 of file SmartRefVector.h.

◆ _BaseValueType

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

Definition at line 72 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 68 of file SmartRefVector.h.

Constructor & Destructor Documentation

◆ SmartRefVector() [1/3]

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

Standard Constructor.

Definition at line 88 of file SmartRefVector.h.

88  {
89  m_contd = 0;
90  m_data = 0;
91  }
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

templated Constructor

Definition at line 94 of file SmartRefVector.h.

95  : std::vector<SmartRef<TYPE>>( first, last ), m_data( 0 ), m_contd( 0 ) {}
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
STL class.
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.

◆ SmartRefVector() [3/3]

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

Copy Constructor.

Definition at line 97 of file SmartRefVector.h.

97 : std::vector<SmartRef<TYPE>>( copy ) { *this = copy; }
T copy(T... args)
STL class.

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 80 of file SmartRefVector.h.

80  {
81  m_data = pObj;
82  m_contd = pContd;
83  for ( _BaseConstIter i = _Base::begin(); i != _Base::end(); i++ ) { ( *i )._setEnvironment( pObj, pContd ); }
84  }
T end(T... args)
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
std::vector< _Entry >::const_iterator _BaseConstIter
T begin(T... args)
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.

◆ operator()() [1/4]

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

Standard destructor.

operator(): assigns parent object for serialisation

Definition at line 103 of file SmartRefVector.h.

103  {
104  _setEnvironment( ( 0 == pObj ) ? 0 : pObj->parent(), pObj );
105  return *this;
106  }
const ObjectContainerBase * parent() const
Access to parent object.
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 ContainedObject pObj) const
inline

operator() const: assigns parent object for serialisation

Definition at line 108 of file SmartRefVector.h.

108  {
109  _setEnvironment( ( 0 == pObj ) ? 0 : pObj->parent(), pObj );
110  return *this;
111  }
const ObjectContainerBase * parent() const
Access to parent object.
void _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment for the vector and all contained objects references.

◆ operator()() [3/4]

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

operator(): assigns parent object for serialisation

Definition at line 113 of file SmartRefVector.h.

113  {
114  _setEnvironment( pObj, 0 );
115  return *this;
116  }
void _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment for the vector and all contained objects references.

◆ operator()() [4/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 118 of file SmartRefVector.h.

118  {
119  _setEnvironment( pObj, 0 );
120  return *this;
121  }
void _setEnvironment(const DataObject *pObj, const ContainedObject *pContd) const
Set the environment for the vector and all contained objects references.

◆ operator=()

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

Assignment.

Definition at line 123 of file SmartRefVector.h.

123  {
124  _Base::operator=( copy );
125  // Harms.... MF
126  // on copy we MUST make a 1 to 1 copy
127  // _setEnvironment( copy.m_data, copy.m_contd );
128  // use instead:
129  m_data = copy.m_data;
130  m_contd = copy.m_contd;
131  return *this;
132  }
T copy(T... args)
T operator=(T... args)
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.

◆ readRefs()

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

Helper to read references.

Definition at line 159 of file SmartRefVector.h.

159  {
160  long len;
162  s >> len;
163  for ( long i = 0; i < len; i++ ) {
164  _BaseValueType entry;
165  entry._setEnvironment( m_data, m_contd );
166  entry.readRef( s );
167  _Base::push_back( entry );
168  }
169  return s;
170 }
std::vector< _Entry >::value_type _BaseValueType
T end(T... args)
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
T push_back(T... args)
T erase(T... args)
T begin(T... args)
string s
Definition: gaudirun.py:328
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.

◆ type()

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

Access to embedded type.

Definition at line 134 of file SmartRefVector.h.

134 { return &typeid( TYPE ); }

◆ writeRefs()

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

Helper to write references.

Definition at line 148 of file SmartRefVector.h.

148  {
149  long len = _Base::size();
150  s << len;
151  for ( _BaseConstIter i = _Base::begin(); i != _Base::end(); i++ ) {
152  ( *i )._setEnvironment( m_data, m_contd );
153  ( *i ).writeRef( s );
154  }
155  return s;
156 }
T end(T... args)
const ContainedObject * m_contd
Object data: Pointer to the Contained object (if applicable)
std::vector< _Entry >::const_iterator _BaseConstIter
T size(T... args)
T begin(T... args)
string s
Definition: gaudirun.py:328
const DataObject * m_data
Object data: Pointer to the identifiable object the link originates.

Friends And Related Function Documentation

◆ operator<<

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

Output Streamer operator.

Definition at line 141 of file SmartRefVector.h.

141 { 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 144 of file SmartRefVector.h.

144 { 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 77 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 75 of file SmartRefVector.h.


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