oos::object_list_base< S, T, CT > Class Template Referenceabstract

Base class for all object list classes. More...

#include <object_list.hpp>

Inherits object_container.

Public Types

typedef T value_holder
 
typedef S parent_type
 
typedef CT item_holder
 
typedef CT::object_type item_type
 
typedef std::list< item_holderlist_type
 
typedef object_container::size_type size_type
 
typedef list_type::iterator iterator
 
typedef list_type::const_iterator const_iterator
 

Public Member Functions

 object_list_base (S *parent)
 
virtual const char * classname () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
virtual bool empty () const
 
virtual void clear ()
 
virtual size_type size () const
 
virtual iterator insert (iterator pos, const value_holder &x)=0
 Inserts a new element. More...
 
void push_front (const value_holder &x)
 
void push_back (const value_holder &x)
 
virtual iterator erase (iterator i)=0
 Interface to erase an element. More...
 
iterator erase (iterator first, iterator last)
 Erases a range defines by iterators. More...
 

Protected Member Functions

virtual void for_each (const node_func &nf) const
 Executes the given function object for all elements. More...
 
virtual void uninstall ()
 
virtual void parent (object *p)
 
S * parent ()
 
list_typelist ()
 

Detailed Description

template<class S, class T, class CT = T>
class oos::object_list_base< S, T, CT >

Base class for all object list classes.

Template Parameters
SThe type of the parent object.
TThe value of the list.
CTThe container item type.

The object_list class implements a list which can hold any type of object from builtin types as int, float to object_ptr or object_ref elements. The class provides STL like behaviour and the order of the elements is reliable.

Member Typedef Documentation

template<class S, class T, class CT = T>
typedef list_type::const_iterator oos::object_list_base< S, T, CT >::const_iterator

Shortcut for the list const iterator.

template<class S, class T, class CT = T>
typedef CT oos::object_list_base< S, T, CT >::item_holder

Shortcut for the value holder type.

template<class S, class T, class CT = T>
typedef CT::object_type oos::object_list_base< S, T, CT >::item_type

Shortcut for the item type.

template<class S, class T, class CT = T>
typedef list_type::iterator oos::object_list_base< S, T, CT >::iterator

Shortcut for the list iterator.

template<class S, class T, class CT = T>
typedef std::list<item_holder> oos::object_list_base< S, T, CT >::list_type

Shortcut for the list class member.

template<class S, class T, class CT = T>
typedef S oos::object_list_base< S, T, CT >::parent_type

Shortcut for the container type.

template<class S, class T, class CT = T>
typedef object_container::size_type oos::object_list_base< S, T, CT >::size_type

Shortcut for size type.

template<class S, class T, class CT = T>
typedef T oos::object_list_base< S, T, CT >::value_holder

Shortcut for the value type.

Constructor & Destructor Documentation

template<class S, class T, class CT = T>
oos::object_list_base< S, T, CT >::object_list_base ( S *  parent)
inlineexplicit

Create an empty object list with the given parent object.

Parameters
parentThe parent object of the list.

Member Function Documentation

template<class S, class T, class CT = T>
iterator oos::object_list_base< S, T, CT >::begin ( )
inline

Return the begin iterator of the list.

Returns
The begin iterator.
template<class S, class T, class CT = T>
const_iterator oos::object_list_base< S, T, CT >::begin ( ) const
inline

Return the begin iterator of the list.

Returns
The begin iterator.
template<class S, class T, class CT = T>
virtual const char* oos::object_list_base< S, T, CT >::classname ( ) const
inlinevirtual

Return the class name of the item.

Returns
The class name of the item.
template<class S, class T, class CT = T>
virtual void oos::object_list_base< S, T, CT >::clear ( )
inlinevirtual

Clears the list

template<class S, class T, class CT = T>
virtual bool oos::object_list_base< S, T, CT >::empty ( ) const
inlinevirtual

Returns true if the list is empty.

Returns
True if the list is empty.
template<class S, class T, class CT = T>
iterator oos::object_list_base< S, T, CT >::end ( )
inline

Return the end iterator of the list.

Returns
The end iterator.
template<class S, class T, class CT = T>
const_iterator oos::object_list_base< S, T, CT >::end ( ) const
inline

Return the end iterator of the list.

Returns
The end iterator.
template<class S, class T, class CT = T>
virtual iterator oos::object_list_base< S, T, CT >::erase ( iterator  i)
pure virtual

Interface to erase an element.

This is the interface for derived object_list classes to implement their erase element method. Erases a single element from the list.

Parameters
iThe iterator to erase.
Returns
Returns the next iterator.
template<class S, class T, class CT = T>
iterator oos::object_list_base< S, T, CT >::erase ( iterator  first,
iterator  last 
)
inline

Erases a range defines by iterators.

Erase a range of elements from the list. The range is defined by a first and a last iterator.

Parameters
firstThe first iterator of the range to erase.
lastThe last iterator of the range to erase.
Returns
Returns the next iterator.
template<class S, class T, class CT = T>
virtual void oos::object_list_base< S, T, CT >::for_each ( const node_func &  nf) const
inlineprotectedvirtual

Executes the given function object for all elements.

Executes the given function object for all elements.

Parameters
nfFunction object used to be executed on each element.
template<class S, class T, class CT = T>
virtual iterator oos::object_list_base< S, T, CT >::insert ( iterator  pos,
const value_holder x 
)
pure virtual

Inserts a new element.

Insert a new element at a given iterator position.

Parameters
posThe position where to insert.
xThe element to insert.
Returns
The new position iterator.
template<class S, class T, class CT = T>
list_type& oos::object_list_base< S, T, CT >::list ( )
inlineprotected

Return the underlying list object.

Returns
The list object.
template<class S, class T, class CT = T>
virtual void oos::object_list_base< S, T, CT >::parent ( object p)
inlineprotectedvirtual

Sets the parent for the list

Parameters
pThe parent object of the list.
template<class S, class T, class CT = T>
S* oos::object_list_base< S, T, CT >::parent ( )
inlineprotected

Returns the parent object.

Returns
The parent object.
template<class S, class T, class CT = T>
void oos::object_list_base< S, T, CT >::push_back ( const value_holder x)
inline

Adds an element to the end of the list.

Parameters
xThe element to be pushed back.
template<class S, class T, class CT = T>
void oos::object_list_base< S, T, CT >::push_front ( const value_holder x)
inline

Adds an element to the beginning of the list.

Parameters
xThe element to be pushed front.
template<class S, class T, class CT = T>
virtual size_type oos::object_list_base< S, T, CT >::size ( ) const
inlinevirtual

Returns the size of the list.

Returns
The size of the list.
template<class S, class T, class CT = T>
virtual void oos::object_list_base< S, T, CT >::uninstall ( )
inlineprotectedvirtual

Resets the object_store and clears the list.


The documentation for this class was generated from the following file:
  • object/object_list.hpp