| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ObjectVector< TYPE > Class Template Reference

`#include <GaudiKernel/ObjectVector.h>`

Inheritance diagram for ObjectVector< TYPE >:

[legend]
Collaboration diagram for ObjectVector< TYPE >:

[legend]
List of all members.

## Detailed Description

### template<class TYPE>
class ObjectVector< TYPE >

ObjectVector is one of the basic Gaudi container classes capable of being registered in Data Stores.

It is based on Standard Library (STL) std::vector (see STL Programmer's Guide) ObjectVector has all functions of the std::vector interface, and in addition a number of Gaudi specific functions.

Each object is allowed to belong into a single container only. After inserting the object into the container, it takes over all responsibilities for the object. E.g. erasing the object from its container causes removing the object's pointer from the container and deleting the object itself.

Author:
  Pavel Binko

  Pere Mato

Date:
  19/10/1999, 30/11/2000

Definition at line 39 of file ObjectVector.h.

## Public Types
typedef TYPE | contained_type
typedef std::vector< TYPE * >::value_type | value_type
typedef std::vector< TYPE * >::reference | reference
typedef std::vector< TYPE * >::const_reference | const_reference
typedef std::vector< TYPE * >::size_type | size_type
typedef std::vector< TYPE * >::iterator | iterator
typedef std::vector< TYPE * >::const_iterator | const_iterator
typedef std::vector< TYPE * >::reverse_iterator | reverse_iterator
typedef std::vector< TYPE * >::const_reverse_iterator | const_reverse_iterator
typedef std::vector< TYPE * >::pointer | pointer
typedef std::vector< TYPE * >::const_pointer | const_pointer
## Public Member Functions
| ObjectVector ()
| Constructors.
| ObjectVector (const char *)
| ObjectVector (const ObjectVector< TYPE > &value)
| Copy constructor.
virtual | ~ObjectVector ()
| Destructor.
virtual const CLID & | clID () const
| Retrieve class ID.
const ObjectVector< TYPE > & | operator= (const ObjectVector< TYPE > &right)
| Clone operator.
ObjectVector< TYPE >::iterator | begin ()
| Return an iterator pointing to the beginning of the container.
ObjectVector< TYPE >::const_iterator | begin () const
| Return a const_iterator pointing to the beginning of the container.
ObjectVector< TYPE >::iterator | end ()
| Return an iterator pointing to the end of the container.
ObjectVector< TYPE >::const_iterator | end () const
| Return a const_iterator pointing to the end of the container.
ObjectVector< TYPE >::reverse_iterator | rbegin ()
| Return a reverse_iterator pointing to the beginning of the reversed container.
ObjectVector< TYPE >::const_reverse_iterator | rbegin () const
| Return a const_reverse_iterator pointing to the beginning of the reversed container.
ObjectVector< TYPE >::reverse_iterator | rend ()
| Return a reverse_iterator pointing to the end of the reversed container.
ObjectVector< TYPE >::const_reverse_iterator | rend () const
| Return a const_reverse_iterator pointing to the end of the reversed container.
ObjectVector< TYPE >::size_type | size () const
| Return the size of the container.
virtual long | numberOfObjects () const
| The same as size(), return number of objects in the container.
ObjectVector< TYPE >::size_type | max_size () const
| Return the largest possible size of the container.
ObjectVector< TYPE >::size_type | capacity () const
| Return number of elements for which memory has been allocated It is always greater than or equal to size().
void | reserve (typename ObjectVector< TYPE >::size_type value)
| Reserve place for "value" objects in the container.
bool | empty () const
| Return true if the size of the container is 0.
ObjectVector< TYPE >::reference | front ()
| Return reference to the first element.
ObjectVector< TYPE >::const_reference | front () const
| Return const_reference to the first element.
ObjectVector< TYPE >::reference | back ()
| Return reference to the last element.
ObjectVector< TYPE >::const_reference | back () const
| Return const_reference to the last element.
void | push_back (typename ObjectVector< TYPE >::const_reference value)
| push_back = append = insert a new element at the end of the container
virtual long | add (ContainedObject *pObject)
| Add an object to the container.
void | pop_back ()
| pop_back = remove the last element from the container The removed object will be deleted (see the method release)
virtual long | remove (ContainedObject *value)
| Release object from the container (the poiter will be removed from the container, but the object itself will remain alive) (see the method pop_back).
ObjectVector< TYPE >::iterator | insert (typename ObjectVector< TYPE >::iterator position, typename ObjectVector< TYPE >::const_reference value)
| Insert "value" before "position".
void | erase (typename ObjectVector< TYPE >::iterator position)
| Erase the object at "position" from the container. The removed object will be deleted.
void | erase (typename ObjectVector< TYPE >::iterator first, typename ObjectVector< TYPE >::iterator last)
| Erase the range [first, last) from the container. The removed object will be deleted.
void | clear ()
| Clear the entire content of the container and delete all contained objects.
ObjectVector< TYPE >::reference | operator[] (typename ObjectVector< TYPE >::size_type n)
| Return the reference to the n'th object in the container.
ObjectVector< TYPE >::const_reference | operator[] (typename ObjectVector< TYPE >::size_type n) const
| Return the const_reference to the n'th object in the container.
virtual long | index (const ContainedObject *obj) const
| Return distance of a given object from the beginning of its container It correcponds to the "index" ( from 0 to size()-1 ) If "obj" not fount, return -1.
virtual ContainedObject * | containedObject (long dist) const
| Return const pointer to an object of a given distance (index).
virtual std::ostream & | fillStream (std::ostream &s) const
| Fill the output stream (ASCII).
## Static Public Member Functions
static const CLID & | classID ()
| Retrieve class ID.
## Private Attributes
std::vector< TYPE * > | m_vector
| The STL vector itself.

## Member Typedef Documentation

template<class TYPE>

typedef TYPE ObjectVector< TYPE >::contained_type

Definition at line 42 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::value_type ObjectVector< TYPE >::value_type

Definition at line 43 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::reference ObjectVector< TYPE >::reference

Definition at line 45 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::const_reference ObjectVector< TYPE >::const_reference

Definition at line 46 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::size_type ObjectVector< TYPE >::size_type

Definition at line 48 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::iterator ObjectVector< TYPE >::iterator

Definition at line 50 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::const_iterator ObjectVector< TYPE >::const_iterator

Definition at line 51 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::reverse_iterator ObjectVector< TYPE >::reverse_iterator

Definition at line 53 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::const_reverse_iterator ObjectVector< TYPE >::const_reverse_iterator

Definition at line 54 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::pointer ObjectVector< TYPE >::pointer

Definition at line 59 of file ObjectVector.h.

template<class TYPE>

typedef std::vector<TYPE*>::const_pointer ObjectVector< TYPE >::const_pointer

Definition at line 60 of file ObjectVector.h.

## Constructor & Destructor Documentation

template<class TYPE>

ObjectVector< TYPE >::ObjectVector | ( |  | ) | `[inline]`

Constructors.

Definition at line 65 of file ObjectVector.h.

    00066     : m_vector(0) { }

template<class TYPE>

ObjectVector< TYPE >::ObjectVector | ( | const char * |  | ) | `[inline]`

Definition at line 67 of file ObjectVector.h.

    00068     : m_vector(0) { }

template<class TYPE>

ObjectVector< TYPE >::ObjectVector | ( | const ObjectVector< TYPE > & | value | ) | `[inline]`

Copy constructor.

Definition at line 70 of file ObjectVector.h.

    00071     : ObjectContainerBase(), m_vector(value.m_vector) { }

template<class TYPE>

virtual ObjectVector< TYPE >::~ObjectVector | ( |  | ) | `[inline, virtual]`

Destructor.

Definition at line 74 of file ObjectVector.h.

References ObjectVector< TYPE >::begin(), and ObjectVector< TYPE >::end().

    00074                           {
    00075     for( typename ObjectVector<TYPE>::iterator i = begin(); i != end(); i++ ) {
    00076       // Set the back pointer to 0 to avoid repetitional searching
    00077       // for the object in the container, and deleting the object
    00078       (*i)->setParent (0);
    00079       delete *i;
    00080     }
    00081   }

## Member Function Documentation

template<class TYPE>

virtual const CLID& ObjectVector< TYPE >::clID | ( |  | ) | const`[inline, virtual]`

Retrieve class ID.

Reimplemented from DataObject.

Definition at line 84 of file ObjectVector.h.

References ObjectVector< TYPE >::classID().

    00084                                    {
    00085     return ObjectVector<TYPE>::classID();
    00086   }

template<class TYPE>

static const CLID& ObjectVector< TYPE >::classID | ( |  | ) | `[inline, static]`

Retrieve class ID.

Reimplemented from DataObject.

Definition at line 88 of file ObjectVector.h.

References CLID_ObjectVector.

Referenced by ObjectVector< TYPE >::clID().

    00088                                {
    00089     static CLID clid = TYPE::classID() + CLID_ObjectVector;
    00090     return clid;
    00091   }

template<class TYPE>

const ObjectVector<TYPE>& ObjectVector< TYPE >::operator= | ( | const ObjectVector< TYPE > & | right | ) | `[inline]`

Clone operator.

Definition at line 94 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector.

    00094                                                                          {
    00095     m_vector = right.m_vector;
    00096     return *this;
    00097   }

template<class TYPE>

ObjectVector<TYPE>::iterator ObjectVector< TYPE >::begin | ( |  | ) | `[inline]`

Return an iterator pointing to the beginning of the container.

Definition at line 100 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::begin(), and ObjectVector< TYPE >::m_vector.

Referenced by ObjectVector< TYPE >::clear(), ObjectVector< TYPE >::remove(), and ObjectVector< TYPE >::~ObjectVector().

    00100                                                {
    00101     return m_vector.begin();
    00102   }

template<class TYPE>

ObjectVector<TYPE>::const_iterator ObjectVector< TYPE >::begin | ( |  | ) | const`[inline]`

Return a const_iterator pointing to the beginning of the container.

Definition at line 105 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::begin(), and ObjectVector< TYPE >::m_vector.

    00105                                                            {
    00106     return m_vector.begin();
    00107   }

template<class TYPE>

ObjectVector<TYPE>::iterator ObjectVector< TYPE >::end | ( |  | ) | `[inline]`

Return an iterator pointing to the end of the container.

Definition at line 110 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::end(), and ObjectVector< TYPE >::m_vector.

Referenced by ObjectVector< TYPE >::clear(), ObjectVector< TYPE >::remove(), and ObjectVector< TYPE >::~ObjectVector().

    00110                                              {
    00111     return m_vector.end();
    00112   }

template<class TYPE>

ObjectVector<TYPE>::const_iterator ObjectVector< TYPE >::end | ( |  | ) | const`[inline]`

Return a const_iterator pointing to the end of the container.

Definition at line 115 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::end(), and ObjectVector< TYPE >::m_vector.

    00115                                                          {
    00116     return m_vector.end();
    00117   }

template<class TYPE>

ObjectVector<TYPE>::reverse_iterator ObjectVector< TYPE >::rbegin | ( |  | ) | `[inline]`

Return a reverse_iterator pointing to the beginning of the reversed container.

Definition at line 120 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::rbegin().

    00120                                                         {
    00121     return m_vector.rbegin();
    00122   }

template<class TYPE>

ObjectVector<TYPE>::const_reverse_iterator ObjectVector< TYPE >::rbegin | ( |  | ) | const`[inline]`

Return a const_reverse_iterator pointing to the beginning of the reversed container.

Definition at line 126 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::rbegin().

    00126                                                                     {
    00127     return m_vector.rbegin();
    00128   }

template<class TYPE>

ObjectVector<TYPE>::reverse_iterator ObjectVector< TYPE >::rend | ( |  | ) | `[inline]`

Return a reverse_iterator pointing to the end of the reversed container.

Definition at line 131 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::rend().

    00131                                                       {
    00132     return m_vector.rend();
    00133   }

template<class TYPE>

ObjectVector<TYPE>::const_reverse_iterator ObjectVector< TYPE >::rend | ( |  | ) | const`[inline]`

Return a const_reverse_iterator pointing to the end of the reversed container.

Definition at line 136 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::rend().

    00136                                                                   {
    00137     return m_vector.rend();
    00138   }

template<class TYPE>

ObjectVector<TYPE>::size_type ObjectVector< TYPE >::size | ( |  | ) | const`[inline]`

Return the size of the container.

Size means the number of objects stored in the container, independently on the amount of information stored in each object

Definition at line 144 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::size().

Referenced by ObjectVector< TYPE >::fillStream().

    00144                                                      {
    00145     return m_vector.size();
    00146   }

template<class TYPE>

virtual long ObjectVector< TYPE >::numberOfObjects | ( |  | ) | const`[inline, virtual]`

The same as size(), return number of objects in the container.

Implements ObjectContainerBase.

Definition at line 149 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::size().

    00149                                        {
    00150     return m_vector.size();
    00151   }

template<class TYPE>

ObjectVector<TYPE>::size_type ObjectVector< TYPE >::max_size | ( |  | ) | const`[inline]`

Return the largest possible size of the container.

Definition at line 154 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::max_size().

    00154                                                          {
    00155     return m_vector.max_size();
    00156   }

template<class TYPE>

ObjectVector<TYPE>::size_type ObjectVector< TYPE >::capacity | ( |  | ) | const`[inline]`

Return number of elements for which memory has been allocated It is always greater than or equal to size().

Definition at line 160 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::capacity(), and ObjectVector< TYPE >::m_vector.

    00160                                                          {
    00161     return m_vector.capacity();
    00162   }

template<class TYPE>

void ObjectVector< TYPE >::reserve | ( | typename ObjectVector< TYPE >::size_type | value | ) | `[inline]`

Reserve place for "value" objects in the container.

If "value" is less than or equal to capacity(), this call has no effect, otherwise, it is a request for allocation of additional memory. If the request is successful, then capacity() is >= n, otherwise, capacity() is unchanged. In either case, size() is unchanged

Definition at line 171 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::reserve().

    00171                                                              {
    00172     m_vector.reserve( value );
    00173   }

template<class TYPE>

bool ObjectVector< TYPE >::empty | ( |  | ) | const`[inline]`

Return true if the size of the container is 0.

Definition at line 176 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::empty(), and ObjectVector< TYPE >::m_vector.

    00176                       {
    00177     return m_vector.empty();
    00178   }

template<class TYPE>

ObjectVector<TYPE>::reference ObjectVector< TYPE >::front | ( |  | ) | `[inline]`

Return reference to the first element.

Definition at line 181 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::front(), and ObjectVector< TYPE >::m_vector.

    00181                                                 {
    00182     return m_vector.front();
    00183   }

template<class TYPE>

ObjectVector<TYPE>::const_reference ObjectVector< TYPE >::front | ( |  | ) | const`[inline]`

Return const_reference to the first element.

Definition at line 186 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::front(), and ObjectVector< TYPE >::m_vector.

    00186                                                             {
    00187     return m_vector.front();
    00188   }

template<class TYPE>

ObjectVector<TYPE>::reference ObjectVector< TYPE >::back | ( |  | ) | `[inline]`

Return reference to the last element.

Definition at line 191 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::back(), and ObjectVector< TYPE >::m_vector.

    00191                                                {
    00192     return m_vector.back();
    00193   }

template<class TYPE>

ObjectVector<TYPE>::const_reference ObjectVector< TYPE >::back | ( |  | ) | const`[inline]`

Return const_reference to the last element.

Definition at line 196 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::back(), and ObjectVector< TYPE >::m_vector.

    00196                                                            {
    00197     return m_vector.back();
    00198   }

template<class TYPE>

void ObjectVector< TYPE >::push_back | ( | typename ObjectVector< TYPE >::const_reference | value | ) | `[inline]`

push_back = append = insert a new element at the end of the container

Definition at line 201 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, std::vector< _Tp, _Alloc >::push_back(), and ObjectVector< TYPE >::remove().

Referenced by ObjectVector< TYPE >::add().

    00201                                                                       {
    00202     if( 0 != value->parent() ) {
    00203       const_cast<ObjectContainerBase*>(value->parent())->remove(value);
    00204     }
    00205     value->setParent(this);
    00206     m_vector.push_back(value);
    00207   }

template<class TYPE>

virtual long ObjectVector< TYPE >::add | ( | ContainedObject * | pObject | ) | `[inline, virtual]`

Add an object to the container.

Implements ObjectContainerBase.

Definition at line 210 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, ObjectVector< TYPE >::push_back(), and std::vector< _Tp, _Alloc >::size().

    00210                                              {
    00211     try {
    00212       typename ObjectVector<TYPE>::value_type ptr =
    00213             dynamic_cast<typename ObjectVector<TYPE>::value_type>(pObject);
    00214       if ( 0 != ptr ) {
    00215         push_back(ptr);
    00216         return m_vector.size()-1;
    00217       }
    00218     }
    00219     catch(...) {
    00220     }
    00221     return -1;
    00222   }

template<class TYPE>

void ObjectVector< TYPE >::pop_back | ( |  | ) | `[inline]`

pop_back = remove the last element from the container The removed object will be deleted (see the method release)

Definition at line 226 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::back(), ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::pop_back().

    00226                    {
    00227     typename ObjectVector<TYPE>::value_type position = m_vector.back();
    00228     // Set the back pointer to 0 to avoid repetitional searching
    00229     // for the object in the container, and deleting the object
    00230     position->setParent (0);
    00231     delete position;
    00232     // Removing from the container itself
    00233     m_vector.pop_back();
    00234   }

template<class TYPE>

virtual long ObjectVector< TYPE >::remove | ( | ContainedObject * | value | ) | `[inline, virtual]`

Release object from the container (the poiter will be removed from the container, but the object itself will remain alive) (see the method pop_back).

Implements ObjectContainerBase.

Definition at line 238 of file ObjectVector.h.

References ObjectVector< TYPE >::begin(), ObjectVector< TYPE >::end(), ObjectVector< TYPE >::erase(), StatusCode::FAILURE, and StatusCode::SUCCESS.

Referenced by ObjectVector< TYPE >::push_back().

    00238                                               {
    00239     // Find the object of the value value
    00240     typename ObjectVector<TYPE>::iterator i;
    00241     for( i = begin(); i != end(); i++ ) {
    00242       if( value == *i ) {
    00243         break;
    00244       }
    00245     }
    00246     if( end() == i )  {
    00247       // Object cannot be released from the conatiner,
    00248       // as it is not contained in it
    00249       return StatusCode::FAILURE;
    00250     }
    00251     else  {
    00252       // Set the back pointer to 0 to avoid repetitional searching
    00253       // for the object in the container and deleting the object
    00254       (*i)->setParent (0);
    00255       erase(i);
    00256       return StatusCode::SUCCESS;
    00257     }
    00258   }

template<class TYPE>

ObjectVector<TYPE>::iterator ObjectVector< TYPE >::insert | ( | typename ObjectVector< TYPE >::iterator | position,
|  | typename ObjectVector< TYPE >::const_reference | value |
| ) |  |  | `[inline]`

Insert "value" before "position".

Definition at line 261 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::insert(), and ObjectVector< TYPE >::m_vector.

    00262                                                                                                    {
    00263     value->setParent(this);
    00264     typename ObjectVector<TYPE>::iterator i = m_vector.insert(position, value);
    00265     return i;
    00266   }

template<class TYPE>

void ObjectVector< TYPE >::erase | ( | typename ObjectVector< TYPE >::iterator | position | ) | `[inline]`

Erase the object at "position" from the container. The removed object will be deleted.

Definition at line 269 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::erase(), and ObjectVector< TYPE >::m_vector.

Referenced by ObjectVector< TYPE >::clear(), and ObjectVector< TYPE >::remove().

    00269                                                              {
    00270     if( 0 != (*position)->parent() ) {
    00271       // Set the back pointer to 0 to avoid repetitional searching
    00272       // for the object in the container, and deleting the object
    00273       (*position)->setParent (0);
    00274       delete *position;
    00275     }
    00276     // Removing from the container itself
    00277     m_vector.erase(position);
    00278   }

template<class TYPE>

void ObjectVector< TYPE >::erase | ( | typename ObjectVector< TYPE >::iterator | first,
|  | typename ObjectVector< TYPE >::iterator | last |
| ) |  |  | `[inline]`

Erase the range [first, last) from the container. The removed object will be deleted.

Definition at line 281 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::erase(), and ObjectVector< TYPE >::m_vector.

    00282                                                          {
    00283     for(typename ObjectVector<TYPE>::iterator i = first; i != last; i++ ) {
    00284       // Set the back pointer to 0 to avoid repetitional searching
    00285       // for the object in the container, and deleting the object
    00286       (*i)->setParent(0);
    00287       delete *i;
    00288     }
    00289     // Removing from the container itself
    00290     m_vector.erase(first, last);
    00291   }

template<class TYPE>

void ObjectVector< TYPE >::clear | ( |  | ) | `[inline]`

Clear the entire content of the container and delete all contained objects.

Definition at line 294 of file ObjectVector.h.

References ObjectVector< TYPE >::begin(), ObjectVector< TYPE >::end(), and ObjectVector< TYPE >::erase().

    00294                   {
    00295     erase(begin(), end());
    00296   }

template<class TYPE>

ObjectVector<TYPE>::reference ObjectVector< TYPE >::operator[] | ( | typename ObjectVector< TYPE >::size_type | n | ) | `[inline]`

Return the reference to the n'th object in the container.

Definition at line 300 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector.

    00300                                                         {
    00301     return m_vector[n];
    00302   }

template<class TYPE>

ObjectVector<TYPE>::const_reference ObjectVector< TYPE >::operator[] | ( | typename ObjectVector< TYPE >::size_type | n | ) | const`[inline]`

Return the const_reference to the n'th object in the container.

Definition at line 306 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector.

    00306                                                               {
    00307     return m_vector[n];
    00308   }

template<class TYPE>

virtual long ObjectVector< TYPE >::index | ( | const ContainedObject * | obj | ) | const`[inline, virtual]`

Return distance of a given object from the beginning of its container It correcponds to the "index" ( from 0 to size()-1 ) If "obj" not fount, return -1.

Implements ObjectContainerBase.

Definition at line 313 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector, and std::vector< _Tp, _Alloc >::size().

    00313                                                          {
    00314     long i;
    00315     for( i = 0; i < (long)m_vector.size(); i++ ) {
    00316       if( m_vector[i] == obj ) {
    00317         return i;
    00318       }
    00319     }
    00320     return -1;
    00321   }

template<class TYPE>

virtual ContainedObject* ObjectVector< TYPE >::containedObject | ( | long | dist | ) | const`[inline, virtual]`

Return const pointer to an object of a given distance (index).

Implements ObjectContainerBase.

Definition at line 324 of file ObjectVector.h.

References ObjectVector< TYPE >::m_vector.

    00324                                                               {
    00325     return m_vector[dist];
    00326   }

template<class TYPE>

virtual std::ostream& ObjectVector< TYPE >::fillStream | ( | std::ostream & | s | ) | const`[inline, virtual]`

Fill the output stream (ASCII).

Reimplemented from DataObject.

Definition at line 329 of file ObjectVector.h.

References std::vector< _Tp, _Alloc >::begin(), count(), std::vector< _Tp, _Alloc >::end(), ObjectVector< TYPE >::m_vector, Gaudi::Units::s, std::setw(), and ObjectVector< TYPE >::size().

    00329                                                         {
    00330     s << "class ObjectVector :    size = "
    00331       << std::setw(12)
    00332       << size() << "\n";
    00333     // Output the base class
    00334     //ObjectContainerBase::fillStream(s);
    00335     if ( 0 != size() ) {
    00336       s << "\nContents of the STL vector :";
    00337       long   count = 0;
    00338       typename ObjectVector<TYPE>::const_iterator iter;
    00339       for( iter = m_vector.begin(); iter != m_vector.end(); iter++, count++ ) {
    00340         s << "\nIndex "
    00341           << std::setw(12)
    00342           << count
    00343           << " of object of type " << **iter;
    00344       }
    00345     }
    00346     return s;
    00347   }

## Member Data Documentation

template<class TYPE>

std::vector<TYPE*> ObjectVector< TYPE >::m_vector`[private]`

The STL vector itself.

Definition at line 351 of file ObjectVector.h.

Referenced by ObjectVector< TYPE >::add(), ObjectVector< TYPE >::back(), ObjectVector< TYPE >::begin(), ObjectVector< TYPE >::capacity(), ObjectVector< TYPE >::containedObject(), ObjectVector< TYPE >::empty(), ObjectVector< TYPE >::end(), ObjectVector< TYPE >::erase(), ObjectVector< TYPE >::fillStream(), ObjectVector< TYPE >::front(), ObjectVector< TYPE >::index(), ObjectVector< TYPE >::insert(), ObjectVector< TYPE >::max_size(), ObjectVector< TYPE >::numberOfObjects(), ObjectVector< TYPE >::operator=(), ObjectVector< TYPE >::operator[](), ObjectVector< TYPE >::pop_back(), ObjectVector< TYPE >::push_back(), ObjectVector< TYPE >::rbegin(), ObjectVector< TYPE >::rend(), ObjectVector< TYPE >::reserve(), and ObjectVector< TYPE >::size().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/GaudiKernel/ObjectVector.h