The Gaudi Framework  v30r3 (a5ef0a68)
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 >:
Collaboration diagram for ObjectVector< TYPE >:

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
 
ObjectVectoroperator= (const ObjectVector< TYPE > &)=delete
 
 ObjectVector (ObjectVector &&rhs)
 
 ~ObjectVector () override
 Destructor. More...
 
const CLIDclID () 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...
 
ContainedObjectcontainedObject (long dist) const override
 Return const pointer to an object of a given distance (index) More...
 
std::ostreamfillStream (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...
 
DataObjectoperator= (const DataObject &rhs)
 Assignment Operator. More...
 
 DataObject (DataObject &&rhs)
 Move Constructor. More...
 
DataObjectoperator= (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::stringname () 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...
 
IRegistryregistry () const
 Get pointer to Registry. More...
 
LinkManagerlinkMgr () 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 CLIDclassID ()
 Retrieve class ID. More...
 
- Static Public Member Functions inherited from DataObject
static const CLIDclassID ()
 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
 
ObjectContainerBaseoperator= (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

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

Definition at line 47 of file ObjectVector.h.

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

Definition at line 56 of file ObjectVector.h.

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

Definition at line 44 of file ObjectVector.h.

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

Definition at line 50 of file ObjectVector.h.

template<class TYPE>
typedef TYPE ObjectVector< TYPE >::contained_type

Definition at line 40 of file ObjectVector.h.

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

Definition at line 46 of file ObjectVector.h.

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

Definition at line 55 of file ObjectVector.h.

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

Definition at line 43 of file ObjectVector.h.

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

Definition at line 49 of file ObjectVector.h.

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

Definition at line 41 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 64 of file ObjectVector.h.

65  {
66  std::for_each( begin(), end(), [this]( TYPE* obj ) { obj->setParent( this ); } );
67  }
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:96
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:90
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T move(T...args)
T for_each(T...args)
ObjectContainerBase()=default
Constructor.
template<class TYPE>
ObjectVector< TYPE >::~ObjectVector ( )
inlineoverride

Destructor.

Definition at line 70 of file ObjectVector.h.

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

Member Function Documentation

template<class TYPE>
long ObjectVector< TYPE >::add ( ContainedObject pObject)
inlineoverridevirtual

Add an object to the container.

Implements ObjectContainerBase.

Definition at line 165 of file ObjectVector.h.

166  {
167  try {
168  auto ptr = dynamic_cast<typename ObjectVector<TYPE>::value_type>( pObject );
169  if ( ptr ) {
170  push_back( ptr );
171  return m_vector.size() - 1;
172  }
173  } catch ( ... ) {
174  }
175  return -1;
176  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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:155
T size(T...args)
std::vector< TYPE * >::value_type value_type
Definition: ObjectVector.h:41
template<class TYPE>
ObjectVector<TYPE>::reference ObjectVector< TYPE >::back ( )
inline

Return reference to the last element.

Definition at line 149 of file ObjectVector.h.

149 { return m_vector.back(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 152 of file ObjectVector.h.

152 { return m_vector.back(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 90 of file ObjectVector.h.

90 { return m_vector.begin(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 93 of file ObjectVector.h.

93 { return m_vector.begin(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 128 of file ObjectVector.h.

128 { return m_vector.capacity(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T capacity(T...args)
template<class TYPE>
static const CLID& ObjectVector< TYPE >::classID ( )
inlinestatic

Retrieve class ID.

Definition at line 83 of file ObjectVector.h.

84  {
85  static const CLID clid = TYPE::classID() + CLID_ObjectVector;
86  return clid;
87  }
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 245 of file ObjectVector.h.

245 { erase( begin(), end() ); }
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:96
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:90
void erase(typename ObjectVector< TYPE >::iterator position)
Erase the object at "position" from the container. The removed object will be deleted.
Definition: ObjectVector.h:219
template<class TYPE>
const CLID& ObjectVector< TYPE >::clID ( ) const
inlineoverridevirtual

Retrieve class ID.

Reimplemented from DataObject.

Definition at line 81 of file ObjectVector.h.

81 { return ObjectVector<TYPE>::classID(); }
static const CLID & classID()
Retrieve class ID.
Definition: ObjectVector.h:83
template<class TYPE>
ContainedObject* ObjectVector< TYPE >::containedObject ( long  dist) const
inlineoverridevirtual

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

Implements ObjectContainerBase.

Definition at line 266 of file ObjectVector.h.

266 { return m_vector[dist]; }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
template<class TYPE>
bool ObjectVector< TYPE >::empty ( ) const
inline

Return true if the size of the container is 0.

Definition at line 140 of file ObjectVector.h.

140 { return m_vector.empty(); }
T empty(T...args)
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
template<class TYPE>
ObjectVector<TYPE>::iterator ObjectVector< TYPE >::end ( )
inline

Return an iterator pointing to the end of the container.

Definition at line 96 of file ObjectVector.h.

96 { return m_vector.end(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 99 of file ObjectVector.h.

99 { return m_vector.end(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 219 of file ObjectVector.h.

220  {
221  if ( ( *position )->parent() ) {
222  // Set the back pointer to 0 to avoid repetitional searching
223  // for the object in the container, and deleting the object
224  ( *position )->setParent( nullptr );
225  delete *position;
226  }
227  // Removing from the container itself
228  m_vector.erase( position );
229  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 232 of file ObjectVector.h.

233  {
234  for ( auto i = first; i != last; i++ ) {
235  // Set the back pointer to 0 to avoid repetitional searching
236  // for the object in the container, and deleting the object
237  ( *i )->setParent( nullptr );
238  delete *i;
239  }
240  // Removing from the container itself
241  m_vector.erase( first, last );
242  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T erase(T...args)
template<class TYPE>
std::ostream& ObjectVector< TYPE >::fillStream ( std::ostream s) const
inlineoverridevirtual

Fill the output stream (ASCII)

Reimplemented from DataObject.

Definition at line 269 of file ObjectVector.h.

270  {
271  s << "class ObjectVector : size = " << std::setw( 12 ) << size() << "\n";
272  // Output the base class
273  // ObjectContainerBase::fillStream(s);
274  if ( !empty() ) {
275  s << "\nContents of the STL vector :";
276  long count = 0;
277  for ( const auto& i : m_vector ) {
278  s << "\nIndex " << std::setw( 12 ) << count++ << " of object of type " << *i;
279  }
280  }
281  return s;
282  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T setw(T...args)
bool empty() const
Return true if the size of the container is 0.
Definition: ObjectVector.h:140
T count(T...args)
string s
Definition: gaudirun.py:253
ObjectVector< TYPE >::size_type size() const
Return the size of the container.
Definition: ObjectVector.h:118
template<class TYPE>
ObjectVector<TYPE>::reference ObjectVector< TYPE >::front ( )
inline

Return reference to the first element.

Definition at line 143 of file ObjectVector.h.

143 { return m_vector.front(); }
T front(T...args)
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
template<class TYPE>
ObjectVector<TYPE>::const_reference ObjectVector< TYPE >::front ( ) const
inline

Return const_reference to the first element.

Definition at line 146 of file ObjectVector.h.

146 { return m_vector.front(); }
T front(T...args)
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
template<class TYPE>
long ObjectVector< TYPE >::index ( const ContainedObject obj) const
inlineoverridevirtual

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

260  {
261  auto i = std::find_if( begin(), end(), [&]( const ContainedObject* o ) { return o == obj; } );
262  return i != end() ? std::distance( begin(), i ) : -1;
263  }
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:96
T distance(T...args)
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:90
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
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 211 of file ObjectVector.h.

213  {
214  value->setParent( this );
215  return m_vector.insert( position, value );
216  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 124 of file ObjectVector.h.

124 { return m_vector.max_size(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T max_size(T...args)
template<class TYPE>
ObjectVector<TYPE>::size_type ObjectVector< TYPE >::numberOfObjects ( ) const
inlineoverridevirtual

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

Implements ObjectContainerBase.

Definition at line 121 of file ObjectVector.h.

121 { return m_vector.size(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 248 of file ObjectVector.h.

248 { return m_vector[n]; }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 251 of file ObjectVector.h.

252  {
253  return m_vector[n];
254  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 180 of file ObjectVector.h.

181  {
182  auto position = m_vector.back();
183  // Set the back pointer to 0 to avoid repetitional searching
184  // for the object in the container, and deleting the object
185  position->setParent( nullptr );
186  delete position;
187  // Removing from the container itself
188  m_vector.pop_back();
189  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T pop_back(T...args)
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 155 of file ObjectVector.h.

156  {
157  if ( value->parent() ) {
158  const_cast<ObjectContainerBase*>( value->parent() )->remove( value );
159  }
160  value->setParent( this );
161  m_vector.push_back( value );
162  }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T push_back(T...args)
ObjectContainerBase is the base class for Gaudi container classes.
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 102 of file ObjectVector.h.

102 { return m_vector.rbegin(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 106 of file ObjectVector.h.

106 { return m_vector.rbegin(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
T rbegin(T...args)
template<class TYPE>
long ObjectVector< TYPE >::remove ( ContainedObject value)
inlineoverridevirtual

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

194  {
195  // Find the object of the value value
196  auto i = std::find_if( begin(), end(), [&]( const ContainedObject* j ) { return j == value; } );
197  if ( i == end() ) {
198  // Object cannot be released from the conatiner,
199  // as it is not contained in it
200  return 0;
201  }
202  long idx = std::distance( begin(), i );
203  // Set the back pointer to 0 to avoid repetitional searching
204  // for the object in the container and deleting the object
205  ( *i )->setParent( nullptr );
206  erase( i );
207  return idx;
208  }
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
Definition: ObjectVector.h:96
T distance(T...args)
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
Definition: ObjectVector.h:90
void erase(typename ObjectVector< TYPE >::iterator position)
Erase the object at "position" from the container. The removed object will be deleted.
Definition: ObjectVector.h:219
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
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 109 of file ObjectVector.h.

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

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

137 { m_vector.reserve( value ); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 118 of file ObjectVector.h.

118 { return m_vector.size(); }
std::vector< TYPE * > m_vector
The STL vector itself.
Definition: ObjectVector.h:286
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 286 of file ObjectVector.h.


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