oos::linked_object_list< S, T > Class Template Reference

An linked object list class. More...

#include <linked_object_list.hpp>

Inherits object_container.

Public Types

typedef T value_type
 
typedef S container_type
 
typedef
linked_object_list_item
< value_type, container_type
item_type
 
typedef object_ptr< item_typeitem_ptr
 
typedef object_ref< item_typeitem_ref
 
typedef object_container::size_type size_type
 
typedef
linked_object_list_iterator
< item_type
iterator
 
typedef
const_linked_object_list_iterator
< item_type
const_iterator
 

Public Member Functions

 linked_object_list (S *parent)
 Creates an empty linked list. More...
 
virtual const char * classname () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
virtual bool empty () const
 
virtual void clear ()
 Clears the list. More...
 
virtual size_type size () const
 
virtual void insert (iterator pos, const value_type &elem)
 Insert a new object before the given iterator. More...
 
virtual void push_front (const value_type &elem)
 Push a new object to the front of the list. More...
 
virtual void push_back (const value_type &elem)
 Push a new object to the end of the list. More...
 
iterator erase (iterator i)
 Erase the object at iterators position. 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 parent (object *p)
 

Friends

class object_store
 
class linked_object_list_iterator< T >
 
class const_linked_object_list_iterator< T >
 

Detailed Description

template<class S, class T>
class oos::linked_object_list< S, T >

An linked object list class.

Template Parameters
SThe type of the parent object.
TThe concrete object type.

The linked_object_list class stores object of type T where T must be derived from linked_object_list_node. This base class contains the previous and next links as well as the first and last element of the linked list. Therefor the order of the elements is persistent and reliable.

Member Typedef Documentation

template<class S , class T >
typedef const_linked_object_list_iterator<item_type> oos::linked_object_list< S, T >::const_iterator

Shortcut for the list const iterator.

template<class S , class T >
typedef S oos::linked_object_list< S, T >::container_type

Shortcut for the container type.

template<class S , class T >
typedef object_ptr<item_type> oos::linked_object_list< S, T >::item_ptr

Shortcut for the container item pointer.

template<class S , class T >
typedef object_ref<item_type> oos::linked_object_list< S, T >::item_ref

Shortcut for the container item reference.

template<class S , class T >
typedef linked_object_list_item<value_type, container_type> oos::linked_object_list< S, T >::item_type

Shortcut for the container item.

template<class S , class T >
typedef linked_object_list_iterator<item_type> oos::linked_object_list< S, T >::iterator

Shortcut for the list iterator.

template<class S , class T >
typedef object_container::size_type oos::linked_object_list< S, T >::size_type

Shortcut for size type.

template<class S , class T >
typedef T oos::linked_object_list< S, T >::value_type

Shortcut for the value type.

Constructor & Destructor Documentation

template<class S , class T >
oos::linked_object_list< S, T >::linked_object_list ( S *  parent)
inline

Creates an empty linked list.

A new linked_object_list is created. The list is part of the given parent object and therefor a reference to the parent object must be found inside the value type object with the given list_ref_name.

Parameters
parentThe containing list object.

Member Function Documentation

template<class S , class T >
iterator oos::linked_object_list< S, T >::begin ( )
inline

Return the begin iterator of the list.

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

Return the begin iterator of the list.

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

Return the class name of the item.

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

Clears the list.

All elements are removed from the list and also removed from the object_store.

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

Returns wether the list is empty or not.

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

Return the end iterator of the list.

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

Return the end iterator of the list.

Returns
The end iterator.
template<class S , class T >
iterator oos::linked_object_list< S, T >::erase ( iterator  i)
inline

Erase the object at iterators position.

The object inside the iterator will first be removed from the object_store and second be unlinked and erased from the list. The next iterator position is returned.

Parameters
iThe object to be erased containing iterator.
Returns
The next iterator position
template<class S , class T >
iterator oos::linked_object_list< S, T >::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 >
virtual void oos::linked_object_list< S, T >::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 >
virtual void oos::linked_object_list< S, T >::insert ( iterator  pos,
const value_type elem 
)
inlinevirtual

Insert a new object before the given iterator.

An object not inserted into the object_store will be pushed front to the list and inserted to the object_store. Furthermore the reference link to the list object and the links between the surrounding nodes is done automatilcally.

Parameters
posThe position where to insert the new elemetnt.
elemThe element to be inserted.
template<class S , class T >
virtual void oos::linked_object_list< S, T >::parent ( object p)
inlineprotectedvirtual

Sets the parent for the linked list

Parameters
pThe parent object of the linked list.
template<class S , class T >
virtual void oos::linked_object_list< S, T >::push_back ( const value_type elem)
inlinevirtual

Push a new object to the end of the list.

An object not inserted into the object_store will be pushed back to the list and inserted to the object_store. Furthermore the reference link to the list object and the links between the surrounding nodes is done automatilcally.

Parameters
elemThe element to be pushed back
template<class S , class T >
virtual void oos::linked_object_list< S, T >::push_front ( const value_type elem)
inlinevirtual

Push a new object to the front of the list.

An object not inserted into the object_store will be pushed front to the list and inserted to the object_store. Furthermore the reference link to the list object and the links between the surrounding nodes is done automatilcally.

Parameters
elemThe element to be pushed front
template<class S , class T >
virtual size_type oos::linked_object_list< S, T >::size ( ) const
inlinevirtual

Return the size of the list.

Returns
The size of the list.

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