47 typedef typename std::vector<TYPE*>::value_type
value_type;
49 typedef typename std::vector<TYPE*>::reference
reference;
52 typedef typename std::vector<TYPE*>::iterator
iterator;
58 typedef typename std::vector<TYPE*>::pointer
pointer;
66 std::for_each(
begin(),
end(), [
this]( TYPE* obj ) { obj->setParent(
this ); } );
73 i->setParent(
nullptr );
82 static const CLID clid = TYPE::classID() + CLID_ObjectVector;
153 if ( value->parent() ) {
const_cast<ObjectContainerBase*
>( value->parent() )->remove( value ); }
154 value->setParent(
this );
176 position->setParent(
nullptr );
192 long idx = std::distance(
begin(), i );
195 ( *i )->setParent(
nullptr );
203 value->setParent(
this );
204 return m_vector.insert( position, value );
209 if ( ( *position )->parent() ) {
212 ( *position )->setParent(
nullptr );
221 for (
auto i = first; i != last; i++ ) {
224 ( *i )->setParent(
nullptr );
247 return i !=
end() ? std::distance(
begin(), i ) : -1;
256 s <<
"class ObjectVector : size = " << std::setw( 12 ) <<
size() <<
"\n";
260 s <<
"\nContents of the STL vector :";
262 for (
const auto& i :
m_vector ) { s <<
"\nIndex " << std::setw( 12 ) << count++ <<
" of object of type " << *i; }
unsigned int CLID
Class ID definition.
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
ObjectContainerBase()=default
Constructor.
size_t size_type
size_type, to conform the STL container interface
ObjectVector< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
ObjectVector< TYPE >::reference operator[](typename ObjectVector< TYPE >::size_type n)
Return the reference to the n'th object in the container.
void push_back(typename ObjectVector< TYPE >::const_reference value)
push_back = append = insert a new element at the end of the container
ObjectVector< TYPE >::iterator insert(typename ObjectVector< TYPE >::iterator position, typename ObjectVector< TYPE >::const_reference value)
Insert "value" before "position".
ObjectVector< TYPE >::reference front()
Return reference to the first element.
ObjectVector< TYPE >::const_iterator begin() const
Return a const_iterator pointing to the beginning of the container.
std::vector< ContainedObject * >::reverse_iterator reverse_iterator
std::vector< ContainedObject * >::iterator iterator
long remove(ContainedObject *value) override
Release object from the container (the poiter will be removed from the container, but the object itse...
std::vector< ContainedObject * >::const_reverse_iterator const_reverse_iterator
ObjectVector & operator=(const ObjectVector< TYPE > &)=delete
std::vector< ContainedObject * >::reference reference
std::vector< ContainedObject * >::const_reference const_reference
std::ostream & fillStream(std::ostream &s) const override
Fill the output stream (ASCII)
ObjectVector< TYPE >::const_reference front() const
Return const_reference to the first element.
long add(ContainedObject *pObject) override
Add an object to the container.
ObjectVector< TYPE >::reverse_iterator rbegin()
Return a reverse_iterator pointing to the beginning of the reversed container.
void pop_back()
pop_back = remove the last element from the container The removed object will be deleted (see the met...
ContainedObject contained_type
ObjectVector< TYPE >::size_type size() const
Return the size of the container.
std::vector< ContainedObject * >::const_pointer const_pointer
ObjectVector< TYPE >::reference back()
Return reference to the last element.
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 erase(typename ObjectVector< TYPE >::iterator position)
Erase the object at "position" from the container. The removed object will be deleted.
const CLID & clID() const override
Retrieve class ID.
void clear()
Clear the entire content of the container and delete all contained objects.
ObjectVector(ObjectVector &&rhs)
ObjectVector< TYPE >::const_reverse_iterator rbegin() const
Return a const_reverse_iterator pointing to the beginning of the reversed container.
std::vector< ContainedObject * >::pointer pointer
ContainedObject * containedObject(long dist) override
ObjectVector< TYPE >::const_reference back() const
Return const_reference to the last element.
bool empty() const
Return true if the size of the container is 0.
std::vector< ContainedObject * >::value_type value_type
ObjectVector< TYPE >::size_type max_size() const
Return the largest possible size of the container.
void reserve(typename ObjectVector< TYPE >::size_type value)
Reserve place for "value" objects in the container.
ObjectVector(const ObjectVector< TYPE > &)=delete
ObjectVector< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
ObjectVector< TYPE >::size_type numberOfObjects() const override
The same as size(), return number of objects in the container.
long index(const ContainedObject *obj) const override
Return distance of a given object from the beginning of its container It correcponds to the "index" (...
ObjectVector< TYPE >::reverse_iterator rend()
Return a reverse_iterator pointing to the end of the reversed 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 s...
ObjectVector< TYPE >::const_iterator end() const
Return a const_iterator pointing to the end of the container.
std::vector< ContainedObject * > m_vector
ContainedObject const * containedObject(long dist) const override
Return const pointer to an object of a given distance (index)
ObjectVector< TYPE >::const_reverse_iterator rend() const
Return a const_reverse_iterator pointing to the end of the reversed container.
static const CLID & classID()
Retrieve class ID.
std::vector< ContainedObject * >::const_iterator const_iterator
ObjectVector< TYPE >::const_reference operator[](typename ObjectVector< TYPE >::size_type n) const
Return the const_reference to the n'th object in the container.