46 typedef typename std::list<TYPE*>::value_type
value_type;
48 typedef typename std::list<TYPE*>::reference
reference;
51 typedef typename std::list<TYPE*>::iterator
iterator;
57 typedef typename std::vector<TYPE*>::pointer
pointer;
70 static CLID clid = TYPE::classID() + CLID_ObjectList;
129 if ( value->parent() ) {
const_cast<ObjectContainerBase*
>( value->parent() )->remove( value ); }
130 value->setParent(
this );
131 m_list.push_back( value );
149 auto position =
m_list.back();
152 position->setParent(
nullptr );
164 if ( iter ==
end() ) {
172 ( *iter )->setParent(
nullptr );
180 value->setParent(
this );
181 return m_list.insert( position, value );
186 if ( ( *position )->parent() ) {
189 ( *position )->setParent(
nullptr );
198 for (
auto iter = first; iter != last; ++iter ) {
201 ( *iter )->setParent(
nullptr );
205 m_list.erase( first, last );
215 return i !=
end() ? std::distance(
begin(), i ) : -1;
220 return dist <
size() ? *std::next(
begin(), dist ) :
nullptr;
224 return dist <
size() ? *std::next(
begin(), dist ) :
nullptr;
229 s <<
"class ObjectList : size = " << std::setw( 12 ) <<
size() <<
"\n";
233 s <<
"\nContents of the STL list :";
235 for (
const auto& iter :
m_list ) {
236 s <<
"\nIndex " << std::setw( 12 ) << count++ <<
" of object of type " << *iter;
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
ObjectList< TYPE >::const_iterator end() const
Return a const_iterator pointing to the end of the container.
ObjectList< TYPE >::size_type size() const
Return the size of the container Size means the number of objects stored in the container,...
ObjectList(const ObjectList< TYPE > &)=delete
const ContainedObject * containedObject(long dist) const override
Return const pointer to an object of a given distance.
std::list< ContainedObject * >::reverse_iterator reverse_iterator
ObjectList< TYPE >::reverse_iterator rend()
Return a reverse_iterator pointing to the end of the reversed container.
ObjectList< TYPE >::reference front()
Return reference to the first element.
void erase(typename ObjectList< TYPE >::iterator position)
Erase the object at "position" from the container. The removed object will be deleted.
std::list< ContainedObject * >::reference reference
const CLID & clID() const override
Retrieve pointer to class definition structure.
ObjectList & operator=(const ObjectList< TYPE > &)=delete
ContainedObject * containedObject(long dist) override
Return const pointer to an object of a given distance.
std::list< ContainedObject * > m_list
std::vector< ContainedObject * >::const_pointer const_pointer
ObjectList< TYPE >::const_reverse_iterator rend() const
Return a const_reverse_iterator pointing to the end of the reversed container.
bool empty() const
Return true if the size of the container is 0.
std::ostream & fillStream(std::ostream &s) const override
Fill the output stream (ASCII)
ObjectList< TYPE >::iterator insert(typename ObjectList< TYPE >::iterator position, typename ObjectList< TYPE >::const_reference value)
Insert "value" before "position".
std::vector< ContainedObject * >::pointer pointer
ObjectList< TYPE >::reverse_iterator rbegin()
Return a reverse_iterator pointing to the beginning of the reversed container.
void push_back(typename ObjectList< TYPE >::const_reference value)
push_back = append = insert a new element at the end of the container
ContainedObject contained_type
ObjectList< TYPE >::iterator begin()
Return an iterator pointing to the beginning of the container.
void clear()
Clear the entire content of the container and delete all contained objects.
ObjectList< TYPE >::size_type numberOfObjects() const override
The same as size(), return number of objects in the container.
std::list< ContainedObject * >::iterator iterator
void erase(typename ObjectList< TYPE >::iterator first, typename ObjectList< TYPE >::iterator last)
Erase the range [first, last) from the container. The removed object will be deleted.
std::list< ContainedObject * >::const_iterator const_iterator
ObjectList< TYPE >::reference back()
Return reference to the last element.
ObjectList< TYPE >::const_reference front() const
Return const_reference to the first element.
long index(const ContainedObject *obj) const override
Return distance of a given object from the beginning of its container It corresponds to the "index" (...
ObjectList< TYPE >::size_type max_size() const
Return the largest possible size of the container.
ObjectList< TYPE >::iterator end()
Return an iterator pointing to the end of the container.
std::list< ContainedObject * >::value_type value_type
ObjectList< TYPE >::const_iterator begin() const
Return a const_iterator pointing to the beginning of the container.
std::list< ContainedObject * >::const_reverse_iterator const_reverse_iterator
long remove(ContainedObject *value) override
Release object from the container (the pointer will be removed from the container,...
ObjectList< TYPE >::const_reverse_iterator rbegin() const
Return a const_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...
long add(ContainedObject *pObject) override
Add an object to the container.
std::list< ContainedObject * >::const_reference const_reference
ObjectList< TYPE >::const_reference back() const
Return const_reference to the last element.
static const CLID & classID()