| The Gaudi Framework v32r1 (f65d50dc)

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ObjectVector< TYPE > Class Template Reference

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

`#include <GaudiKernel/ObjectVector.h>`

Inheritance diagram for ObjectVector< TYPE >:
[legend]
Collaboration diagram for ObjectVector< TYPE >:
[legend]

## 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 * >::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 Types inherited from ObjectContainerBase
typedef size_t | size_type
| size_type, to conform the STL container interface More...

## Public Member Functions
| ObjectVector ()=default
| Constructors. More...
| ObjectVector (const ObjectVector< TYPE > &)=delete
ObjectVector & | operator= (const ObjectVector< TYPE > &)=delete
| ObjectVector (ObjectVector &&rhs)
| ~ObjectVector () override
| Destructor. More...
const CLID & | clID () const override
| Retrieve class ID. More...
ObjectVector< TYPE >::iterator | begin ()
| Return an iterator pointing to the beginning of the container. More...
ObjectVector< TYPE >::const_iterator | begin () const
| Return a const_iterator pointing to the beginning of the container. More...
ObjectVector< TYPE >::iterator | end ()
| Return an iterator pointing to the end of the container. More...
ObjectVector< TYPE >::const_iterator | end () const
| Return a const_iterator pointing to the end of the container. More...
ObjectVector< TYPE >::reverse_iterator | rbegin ()
| Return a reverse_iterator pointing to the beginning of the reversed container. More...
ObjectVector< TYPE >::const_reverse_iterator | rbegin () const
| Return a const_reverse_iterator pointing to the beginning of the reversed container. More...
ObjectVector< TYPE >::reverse_iterator | rend ()
| Return a reverse_iterator pointing to the end of the reversed container. More...
ObjectVector< TYPE >::const_reverse_iterator | rend () const
| Return a const_reverse_iterator pointing to the end of the reversed container. More...
ObjectVector< TYPE >::size_type | size () const
| Return the size of the container. More...
ObjectVector< TYPE >::size_type | numberOfObjects () const override
| The same as size(), return number of objects in the container. More...
ObjectVector< TYPE >::size_type | max_size () const
| Return the largest possible size of the container. More...
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() More...
void | reserve (typename ObjectVector< TYPE >::size_type value)
| Reserve place for "value" objects in the container. More...
bool | empty () const
| Return true if the size of the container is 0. More...
ObjectVector< TYPE >::reference | front ()
| Return reference to the first element. More...
ObjectVector< TYPE >::const_reference | front () const
| Return const_reference to the first element. More...
ObjectVector< TYPE >::reference | back ()
| Return reference to the last element. More...
ObjectVector< TYPE >::const_reference | back () const
| Return const_reference to the last element. More...
void | push_back (typename ObjectVector< TYPE >::const_reference value)
| push_back = append = insert a new element at the end of the container More...
long | add (ContainedObject *pObject) override
| Add an object to the container. More...
void | pop_back ()
| pop_back = remove the last element from the container The removed object will be deleted (see the method release) More...
long | remove (ContainedObject *value) override
| 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) More...
ObjectVector< TYPE >::iterator | insert (typename ObjectVector< TYPE >::iterator position, typename ObjectVector< TYPE >::const_reference value)
| Insert "value" before "position". More...
void | erase (typename ObjectVector< TYPE >::iterator position)
| Erase the object at "position" from the container. The removed object will be deleted. More...
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. More...
void | clear ()
| Clear the entire content of the container and delete all contained objects. More...
ObjectVector< TYPE >::reference | operator[] (typename ObjectVector< TYPE >::size_type n)
| Return the reference to the n'th object in the container. More...
ObjectVector< TYPE >::const_reference | operator[] (typename ObjectVector< TYPE >::size_type n) const
| Return the const_reference to the n'th object in the container. More...
long | index (const ContainedObject *obj) const override
| 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. More...
ContainedObject const * | containedObject (long dist) const override
| Return const pointer to an object of a given distance (index) More...
ContainedObject * | containedObject (long dist) override
std::ostream & | fillStream (std::ostream &s) const override
| Fill the output stream (ASCII) More...
Public Member Functions inherited from DataObject
| DataObject ()
| Standard Constructor. More...
| DataObject (const DataObject &rhs)
| Copy Constructor. More...
DataObject & | operator= (const DataObject &rhs)
| Assignment Operator. More...
| DataObject (DataObject &&rhs)
| Move Constructor. More...
DataObject & | operator= (DataObject &&rhs)
| Move Assignment Operator. More...
virtual | ~DataObject ()
| Standard Destructor. More...
virtual unsigned long | addRef ()
| Add reference to object. More...
virtual unsigned long | release ()
| release reference to object More...
const std::string & | name () const
| Retreive DataObject name. It is the name when registered in the store. More...
virtual StatusCode | update ()
| Provide empty placeholder for internal object reconfiguration callback. More...
void | setRegistry (IRegistry *pRegistry)
| Set pointer to Registry. More...
IRegistry * | registry () const
| Get pointer to Registry. More...
LinkManager * | linkMgr () const
| Retrieve Link manager. More...
unsigned char | version () const
| Retrieve version number of this object representation. More...
void | setVersion (unsigned char vsn)
| Set version number of this object representation. More...
unsigned long | refCount () const
| Return the refcount. More...

## Static Public Member Functions
static const CLID & | classID ()
| Retrieve class ID. More...
Static Public Member Functions inherited from DataObject
static const CLID & | classID ()
| Retrieve reference to class definition structure (static access) More...

## Private Attributes
std::vector< TYPE * > | m_vector
| The STL vector itself. More...

## Additional Inherited Members
Protected Member Functions inherited from ObjectContainerBase
| ObjectContainerBase ()=default
| Constructor. More...
| ObjectContainerBase (ObjectContainerBase &&)=default
ObjectContainerBase & | operator= (ObjectContainerBase &&)=default

## 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 12 of file ContainedObject.h.

## Member Typedef Documentation

## ◆ const_iterator

template<class TYPE>

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

Definition at line 46 of file ObjectVector.h.

## ◆ const_pointer

template<class TYPE>

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

Definition at line 55 of file ObjectVector.h.

## ◆ const_reference

template<class TYPE>

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

Definition at line 43 of file ObjectVector.h.

## ◆ const_reverse_iterator

template<class TYPE>

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

Definition at line 49 of file ObjectVector.h.

## ◆ contained_type

template<class TYPE>

typedef TYPE ObjectVector< TYPE >::contained_type

Definition at line 39 of file ObjectVector.h.

## ◆ iterator

template<class TYPE>

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

Definition at line 45 of file ObjectVector.h.

## ◆ pointer

template<class TYPE>

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

Definition at line 54 of file ObjectVector.h.

## ◆ reference

template<class TYPE>

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

Definition at line 42 of file ObjectVector.h.

## ◆ reverse_iterator

template<class TYPE>

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

Definition at line 48 of file ObjectVector.h.

## ◆ value_type

template<class TYPE>

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

Definition at line 40 of file ObjectVector.h.

## Constructor & Destructor Documentation

## ◆ ObjectVector() [1/3]

template<class TYPE>

ObjectVector< TYPE >::ObjectVector | ( |  | ) |
| default

Constructors.

## ◆ ObjectVector() [2/3]

template<class TYPE>

ObjectVector< TYPE >::ObjectVector | ( | const ObjectVector< TYPE > & |  | ) |
| delete

## ◆ ObjectVector() [3/3]

template<class TYPE>

ObjectVector< TYPE >::ObjectVector | ( | ObjectVector< TYPE > && | rhs | ) |
| inline

Definition at line 63 of file ObjectVector.h.

63 : ObjectContainerBase( std::move( rhs ) ), m_vector{std::move( rhs.m_vector )} {
64 std::for_each( begin(), end(), [this]( TYPE* obj ) { obj->setParent( this ); } );
65 }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:92
ObjectVector::begin
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:86
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::move
T move(T... args)
std::for_each
T for_each(T... args)
ObjectContainerBase::ObjectContainerBase
ObjectContainerBase()=default
Constructor.

## ◆ ~ObjectVector()

template<class TYPE>

ObjectVector< TYPE >::~ObjectVector | ( |  | ) |
| inline override

Destructor.

Definition at line 68 of file ObjectVector.h.

68 {
69 for ( auto& i : m_vector ) {
70 // Set the back pointer to 0 to avoid repetitional searching
71 // for the object in the container, and deleting the object
72 i->setParent( nullptr );
73 delete i;
74 }
75 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## Member Function Documentation

## ◆ add()

template<class TYPE>

long ObjectVector< TYPE >::add | ( | ContainedObject * | pObject | ) |
| inline override virtual

Add an object to the container.

Implements ObjectContainerBase.

Definition at line 158 of file ObjectVector.h.

158 {
159 try {
160 auto ptr = dynamic_cast<typename ObjectVector<TYPE>::value_type>( pObject );
161 if ( ptr ) {
162 push_back( ptr );
163 return m_vector.size() - 1;
164 }
165 } catch ( ... ) {}
166 return -1;
167 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
ObjectVector::push_back
void push_back(typename ObjectVector< TYPE >::const_reference value)
push_back = append = insert a new element at the end of the container
Definition: ObjectVector.h:151
std::vector::size
T size(T... args)
ObjectVector::value_type
std::vector< TYPE * >::value_type value_type
Definition: ObjectVector.h:40

## ◆ back() [1/2]

template<class TYPE>

ObjectVector<TYPE>::reference ObjectVector< TYPE >::back | ( |  | ) |
| inline

Return reference to the last element.

Definition at line 145 of file ObjectVector.h.

145 { return m_vector.back(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::back
T back(T... args)

## ◆ back() [2/2]

template<class TYPE>

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

Return const_reference to the last element.

Definition at line 148 of file ObjectVector.h.

148 { return m_vector.back(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::back
T back(T... args)

## ◆ begin() [1/2]

template<class TYPE>

ObjectVector<TYPE>::iterator ObjectVector< TYPE >::begin | ( |  | ) |
| inline

Return an iterator pointing to the beginning of the container.

Definition at line 86 of file ObjectVector.h.

86 { return m_vector.begin(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::begin
T begin(T... args)

## ◆ begin() [2/2]

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 89 of file ObjectVector.h.

89 { return m_vector.begin(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::begin
T begin(T... args)

## ◆ capacity()

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 124 of file ObjectVector.h.

124 { return m_vector.capacity(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::capacity
T capacity(T... args)

## ◆ classID()

template<class TYPE>

static const CLID& ObjectVector< TYPE >::classID | ( |  | ) |
| inline static

Retrieve class ID.

Definition at line 80 of file ObjectVector.h.

80 {
81 static const CLID clid = TYPE::classID() + CLID_ObjectVector;
82 return clid;
83 }
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8

## ◆ clear()

template<class TYPE>

void ObjectVector< TYPE >::clear | ( |  | ) |
| inline

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

Definition at line 231 of file ObjectVector.h.

231 { erase( begin(), end() ); }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:92
ObjectVector::begin
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:86
ObjectVector::erase
void erase(typename ObjectVector< TYPE >::iterator position)
Erase the object at "position" from the container. The removed object will be deleted.
Definition: ObjectVector.h:207

## ◆ clID()

template<class TYPE>

const CLID& ObjectVector< TYPE >::clID | ( |  | ) | const
| inline override virtual

Retrieve class ID.

Reimplemented from DataObject.

Definition at line 78 of file ObjectVector.h.

78 { return ObjectVector<TYPE>::classID(); }
ObjectVector::classID
static const CLID & classID()
Retrieve class ID.
Definition: ObjectVector.h:80

## ◆ containedObject() [1/2]

template<class TYPE>

ContainedObject const* ObjectVector< TYPE >::containedObject | ( | long | dist | ) | const
| inline override virtual

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

Implements ObjectContainerBase.

Definition at line 250 of file ObjectVector.h.

250 { return m_vector[dist]; }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## ◆ containedObject() [2/2]

template<class TYPE>

ContainedObject* ObjectVector< TYPE >::containedObject | ( | long | dist | ) |
| inline override virtual

Implements ObjectContainerBase.

Definition at line 251 of file ObjectVector.h.

251 { return m_vector[dist]; }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## ◆ empty()

template<class TYPE>

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

Return true if the size of the container is 0.

Definition at line 136 of file ObjectVector.h.

136 { return m_vector.empty(); }
std::vector::empty
T empty(T... args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## ◆ end() [1/2]

template<class TYPE>

ObjectVector<TYPE>::iterator ObjectVector< TYPE >::end | ( |  | ) |
| inline

Return an iterator pointing to the end of the container.

Definition at line 92 of file ObjectVector.h.

92 { return m_vector.end(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::end
T end(T... args)

## ◆ end() [2/2]

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 95 of file ObjectVector.h.

95 { return m_vector.end(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::end
T end(T... args)

## ◆ erase() [1/2]

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 207 of file ObjectVector.h.

207 {
208 if ( ( *position )->parent() ) {
209 // Set the back pointer to 0 to avoid repetitional searching
210 // for the object in the container, and deleting the object
211 ( *position )->setParent( nullptr );
212 delete *position;
213 }
214 // Removing from the container itself
215 m_vector.erase( position );
216 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::erase
T erase(T... args)

## ◆ erase() [2/2]

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 219 of file ObjectVector.h.

219 {
220 for ( auto i = first; i != last; i++ ) {
221 // Set the back pointer to 0 to avoid repetitional searching
222 // for the object in the container, and deleting the object
223 ( *i )->setParent( nullptr );
224 delete *i;
225 }
226 // Removing from the container itself
227 m_vector.erase( first, last );
228 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::erase
T erase(T... args)

## ◆ fillStream()

template<class TYPE>

std::ostream& ObjectVector< TYPE >::fillStream | ( | std::ostream & | s | ) | const
| inline override virtual

Fill the output stream (ASCII)

Reimplemented from DataObject.

Definition at line 254 of file ObjectVector.h.

254 {
255 s << "class ObjectVector : size = " << std::setw( 12 ) << size() << "\n";
256 // Output the base class
257 // ObjectContainerBase::fillStream(s);
258 if ( !empty() ) {
259 s << "\nContents of the STL vector :";
260 long count = 0;
261 for ( const auto& i : m_vector ) { s << "\nIndex " << std::setw( 12 ) << count++ << " of object of type " << *i; }
262 }
263 return s;
264 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::setw
T setw(T... args)
ObjectVector::size
ObjectVector< TYPE >::size_type size() const
Return the size of the container.
Definition: ObjectVector.h:114
ObjectVector::empty
bool empty() const
Return true if the size of the container is 0.
Definition: ObjectVector.h:136
std::count
T count(T... args)
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ front() [1/2]

template<class TYPE>

ObjectVector<TYPE>::reference ObjectVector< TYPE >::front | ( |  | ) |
| inline

Return reference to the first element.

Definition at line 139 of file ObjectVector.h.

139 { return m_vector.front(); }
std::vector::front
T front(T... args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## ◆ front() [2/2]

template<class TYPE>

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

Return const_reference to the first element.

Definition at line 142 of file ObjectVector.h.

142 { return m_vector.front(); }
std::vector::front
T front(T... args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## ◆ index()

template<class TYPE>

long ObjectVector< TYPE >::index | ( | const ContainedObject * | obj | ) | const
| inline override 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 244 of file ObjectVector.h.

244 {
245 auto i = std::find_if( begin(), end(), [&]( const ContainedObject* o ) { return o == obj; } );
246 return i != end() ? std::distance( begin(), i ) : -1;
247 }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:92
std::distance
T distance(T... args)
ObjectVector::begin
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:86
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:31
std::find_if
T find_if(T... args)

## ◆ insert()

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 200 of file ObjectVector.h.

201 {
202 value->setParent( this );
203 return m_vector.insert( position, value );
204 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::insert
T insert(T... args)

## ◆ max_size()

template<class TYPE>

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

Return the largest possible size of the container.

Definition at line 120 of file ObjectVector.h.

120 { return m_vector.max_size(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::max_size
T max_size(T... args)

## ◆ numberOfObjects()

template<class TYPE>

ObjectVector<TYPE>::size_type ObjectVector< TYPE >::numberOfObjects | ( |  | ) | const
| inline override virtual

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

Implements ObjectContainerBase.

Definition at line 117 of file ObjectVector.h.

117 { return m_vector.size(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::size
T size(T... args)

## ◆ operator=()

template<class TYPE>

ObjectVector& ObjectVector< TYPE >::operator= | ( | const ObjectVector< TYPE > & |  | ) |
| delete

## ◆ operator[]() [1/2]

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 234 of file ObjectVector.h.

234 { return m_vector[n]; }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210

## ◆ operator[]() [2/2]

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 237 of file ObjectVector.h.

237 {
238 return m_vector[n];
239 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210

## ◆ pop_back()

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 171 of file ObjectVector.h.

171 {
172 auto position = m_vector.back();
173 // Set the back pointer to 0 to avoid repetitional searching
174 // for the object in the container, and deleting the object
175 position->setParent( nullptr );
176 delete position;
177 // Removing from the container itself
178 m_vector.pop_back();
179 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::pop_back
T pop_back(T... args)
std::vector::back
T back(T... args)

## ◆ push_back()

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 151 of file ObjectVector.h.

151 {
152 if ( value->parent() ) { const_cast<ObjectContainerBase*>( value->parent() )->remove( value ); }
153 value->setParent( this );
154 m_vector.push_back( value );
155 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
ObjectVector::remove
long remove(ContainedObject *value) override
Release object from the container (the poiter will be removed from the container, but the object itse...
Definition: ObjectVector.h:183
std::vector::push_back
T push_back(T... args)

## ◆ rbegin() [1/2]

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 98 of file ObjectVector.h.

98 { return m_vector.rbegin(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::rbegin
T rbegin(T... args)

## ◆ rbegin() [2/2]

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 102 of file ObjectVector.h.

102 { return m_vector.rbegin(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::rbegin
T rbegin(T... args)

## ◆ remove()

template<class TYPE>

long ObjectVector< TYPE >::remove | ( | ContainedObject * | value | ) |
| inline override 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 183 of file ObjectVector.h.

183 {
184 // Find the object of the value value
185 auto i = std::find_if( begin(), end(), [&]( const ContainedObject* j ) { return j == value; } );
186 if ( i == end() ) {
187 // Object cannot be released from the conatiner,
188 // as it is not contained in it
189 return 0;
190 }
191 long idx = std::distance( begin(), i );
192 // Set the back pointer to 0 to avoid repetitional searching
193 // for the object in the container and deleting the object
194 ( *i )->setParent( nullptr );
195 erase( i );
196 return idx;
197 }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:92
std::distance
T distance(T... args)
ObjectVector::begin
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:86
ObjectVector::erase
void erase(typename ObjectVector< TYPE >::iterator position)
Erase the object at "position" from the container. The removed object will be deleted.
Definition: ObjectVector.h:207
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:31
std::find_if
T find_if(T... args)

## ◆ rend() [1/2]

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 105 of file ObjectVector.h.

105 { return m_vector.rend(); }
std::vector::rend
T rend(T... args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## ◆ rend() [2/2]

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 108 of file ObjectVector.h.

108 { return m_vector.rend(); }
std::vector::rend
T rend(T... args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268

## ◆ reserve()

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 133 of file ObjectVector.h.

133 { m_vector.reserve( value ); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::reserve
T reserve(T... args)

## ◆ size()

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 114 of file ObjectVector.h.

114 { return m_vector.size(); }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:268
std::vector::size
T size(T... args)

## Member Data Documentation

## ◆ m_vector

template<class TYPE>

std::vector<TYPE*> ObjectVector< TYPE >::m_vector
| private

The STL vector itself.

Definition at line 268 of file ObjectVector.h.

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

- GaudiKernel/GaudiKernel/ContainedObject.h
- GaudiKernel/GaudiKernel/ObjectVector.h