| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

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 * | containedObject (long dist) const override
| Return const pointer to an object of a given distance (index) More...
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 11 of file ContainedObject.h.

## Member Typedef Documentation

template<class TYPE>

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

Definition at line 48 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 57 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 45 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 51 of file ObjectVector.h.

template<class TYPE>

typedef TYPE ObjectVector< TYPE >::contained_type

Definition at line 41 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 47 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 56 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 44 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 50 of file ObjectVector.h.

template<class TYPE>

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

Definition at line 42 of file ObjectVector.h.

## Constructor & Destructor Documentation

template<class TYPE>

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

Constructors.

template<class TYPE>

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

template<class TYPE>

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

Definition at line 65 of file ObjectVector.h.

66 : ObjectContainerBase(std::move(rhs))
67 , m_vector{std::move(rhs.m_vector)}
68 {
69 std::for_each(begin(), end(), [this](TYPE* obj) {obj->setParent(this);});
70 }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:104
ObjectVector::begin
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:94
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::move
T move(T...args)
std::for_each
T for_each(T...args)
ObjectContainerBase::ObjectContainerBase
ObjectContainerBase()=default
Constructor.
template<class TYPE>

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

Destructor.

Definition at line 73 of file ObjectVector.h.

73 {
74 for( auto& i : m_vector ) {
75 // Set the back pointer to 0 to avoid repetitional searching
76 // for the object in the container, and deleting the object
77 i->setParent (nullptr);
78 delete i;
79 }
80 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331

## Member Function Documentation

template<class TYPE>

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

Add an object to the container.

Implements ObjectContainerBase.

Definition at line 204 of file ObjectVector.h.

204 {
205 try {
206 auto ptr = dynamic_cast<typename ObjectVector<TYPE>::value_type>(pObject);
207 if ( ptr ) {
208 push_back(ptr);
209 return m_vector.size()-1;
210 }
211 }
212 catch(...) {
213 }
214 return -1;
215 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
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:195
std::vector::size
T size(T...args)
ObjectVector::value_type
std::vector< TYPE * >::value_type value_type
Definition: ObjectVector.h:42
template<class TYPE>

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

Return reference to the last element.

Definition at line 185 of file ObjectVector.h.

185 {
186 return m_vector.back();
187 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::back
T back(T...args)
template<class TYPE>

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

Return const_reference to the last element.

Definition at line 190 of file ObjectVector.h.

190 {
191 return m_vector.back();
192 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::back
T back(T...args)
template<class TYPE>

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

Return an iterator pointing to the beginning of the container.

Definition at line 94 of file ObjectVector.h.

94 {
95 return m_vector.begin();
96 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::begin
T begin(T...args)
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 99 of file ObjectVector.h.

99 {
100 return m_vector.begin();
101 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::begin
T begin(T...args)
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 154 of file ObjectVector.h.

154 {
155 return m_vector.capacity();
156 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::capacity
T capacity(T...args)
template<class TYPE>

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

Retrieve class ID.

Definition at line 87 of file ObjectVector.h.

87 {
88 static const CLID clid = TYPE::classID() + CLID_ObjectVector;
89 return clid;
90 }
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
template<class TYPE>

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

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

Definition at line 279 of file ObjectVector.h.

279 {
280 erase(begin(), end());
281 }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:104
ObjectVector::begin
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:94
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:254
template<class TYPE>

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

Retrieve class ID.

Reimplemented from DataObject.

Definition at line 83 of file ObjectVector.h.

83 {
84 return ObjectVector<TYPE>::classID();
85 }
ObjectVector::classID
static const CLID & classID()
Retrieve class ID.
Definition: ObjectVector.h:87
template<class TYPE>

ContainedObject* 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 305 of file ObjectVector.h.

305 {
306 return m_vector[dist];
307 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
template<class TYPE>

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

Return true if the size of the container is 0.

Definition at line 170 of file ObjectVector.h.

170 {
171 return m_vector.empty();
172 }
std::vector::empty
T empty(T...args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
template<class TYPE>

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

Return an iterator pointing to the end of the container.

Definition at line 104 of file ObjectVector.h.

104 {
105 return m_vector.end();
106 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::end
T end(T...args)
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 109 of file ObjectVector.h.

109 {
110 return m_vector.end();
111 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::end
T end(T...args)
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 254 of file ObjectVector.h.

254 {
255 if( (*position)->parent() ) {
256 // Set the back pointer to 0 to avoid repetitional searching
257 // for the object in the container, and deleting the object
258 (*position)->setParent (nullptr);
259 delete *position;
260 }
261 // Removing from the container itself
262 m_vector.erase(position);
263 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::erase
T erase(T...args)
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 266 of file ObjectVector.h.

267 {
268 for(auto i = first; i != last; i++ ) {
269 // Set the back pointer to 0 to avoid repetitional searching
270 // for the object in the container, and deleting the object
271 (*i)->setParent(nullptr);
272 delete *i;
273 }
274 // Removing from the container itself
275 m_vector.erase(first, last);
276 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::erase
T erase(T...args)
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 310 of file ObjectVector.h.

310 {
311 s << "class ObjectVector : size = "
312 << std::setw(12)
313 << size() << "\n";
314 // Output the base class
315 //ObjectContainerBase::fillStream(s);
316 if ( !empty() ) {
317 s << "\nContents of the STL vector :";
318 long count = 0;
319 for(const auto& i : m_vector) {
320 s << "\nIndex "
321 << std::setw(12)
322 << count++
323 << " of object of type " << *i;
324 }
325 }
326 return s;
327 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::setw
T setw(T...args)
ObjectVector::empty
bool empty() const
Return true if the size of the container is 0.
Definition: ObjectVector.h:170
std::count
T count(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245
ObjectVector::size
ObjectVector< TYPE >::size_type size() const
Return the size of the container.
Definition: ObjectVector.h:138
template<class TYPE>

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

Return reference to the first element.

Definition at line 175 of file ObjectVector.h.

175 {
176 return m_vector.front();
177 }
std::vector::front
T front(T...args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
template<class TYPE>

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

Return const_reference to the first element.

Definition at line 180 of file ObjectVector.h.

180 {
181 return m_vector.front();
182 }
std::vector::front
T front(T...args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
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 298 of file ObjectVector.h.

298 {
299 auto i = std::find_if( begin(), end(), [&](const ContainedObject *o)
300 { return o == obj; } );
301 return i!=end() ? std::distance( begin(), i ) : -1 ;
302 }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:104
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:94
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:29
std::find_if
T find_if(T...args)
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 247 of file ObjectVector.h.

248 {
249 value->setParent(this);
250 return m_vector.insert(position, value);
251 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::insert
T insert(T...args)
template<class TYPE>

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

Return the largest possible size of the container.

Definition at line 148 of file ObjectVector.h.

148 {
149 return m_vector.max_size();
150 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::max_size
T max_size(T...args)
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 143 of file ObjectVector.h.

143 {
144 return m_vector.size();
145 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::size
T size(T...args)
template<class TYPE>

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

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

285 {
286 return m_vector[n];
287 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:217
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 291 of file ObjectVector.h.

291 {
292 return m_vector[n];
293 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:217
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 219 of file ObjectVector.h.

219 {
220 auto position = m_vector.back();
221 // Set the back pointer to 0 to avoid repetitional searching
222 // for the object in the container, and deleting the object
223 position->setParent(nullptr);
224 delete position;
225 // Removing from the container itself
226 m_vector.pop_back();
227 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::pop_back
T pop_back(T...args)
std::vector::back
T back(T...args)
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 195 of file ObjectVector.h.

195 {
196 if( value->parent() ) {
197 const_cast<ObjectContainerBase*>(value->parent())->remove(value);
198 }
199 value->setParent(this);
200 m_vector.push_back(value);
201 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::push_back
T push_back(T...args)
ObjectContainerBase
ObjectContainerBase is the base class for Gaudi container classes.
Definition: ObjectContainerBase.h:19
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 114 of file ObjectVector.h.

114 {
115 return m_vector.rbegin();
116 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::rbegin
T rbegin(T...args)
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 120 of file ObjectVector.h.

120 {
121 return m_vector.rbegin();
122 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::rbegin
T rbegin(T...args)
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 231 of file ObjectVector.h.

231 {
232 // Find the object of the value value
233 auto i = std::find_if( begin(), end(), [&](const ContainedObject* j) { return j==value; } );
234 if( i == end() ) {
235 // Object cannot be released from the conatiner,
236 // as it is not contained in it
237 return StatusCode::FAILURE;
238 }
239 // Set the back pointer to 0 to avoid repetitional searching
240 // for the object in the container and deleting the object
241 (*i)->setParent (nullptr);
242 erase(i);
243 return StatusCode::SUCCESS;
244 }
ObjectVector::end
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:104
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
ObjectVector::begin
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:94
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:254
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:29
std::find_if
T find_if(T...args)
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 125 of file ObjectVector.h.

125 {
126 return m_vector.rend();
127 }
std::vector::rend
T rend(T...args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
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 130 of file ObjectVector.h.

130 {
131 return m_vector.rend();
132 }
std::vector::rend
T rend(T...args)
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
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 165 of file ObjectVector.h.

165 {
166 m_vector.reserve( value );
167 }
ObjectVector::m_vector
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:331
std::vector::reserve
T reserve(T...args)
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 138 of file ObjectVector.h.

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

## Member Data Documentation

template<class TYPE>

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

The STL vector itself.

Definition at line 331 of file ObjectVector.h.

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

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