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_type > | item_ptr |
typedef object_ref< item_type > | item_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
-
S The type of the parent object. T The 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
typedef const_linked_object_list_iterator<item_type> oos::linked_object_list< S, T >::const_iterator |
Shortcut for the list const iterator.
typedef S oos::linked_object_list< S, T >::container_type |
Shortcut for the container type.
typedef object_ptr<item_type> oos::linked_object_list< S, T >::item_ptr |
Shortcut for the container item pointer.
typedef object_ref<item_type> oos::linked_object_list< S, T >::item_ref |
Shortcut for the container item reference.
typedef linked_object_list_item<value_type, container_type> oos::linked_object_list< S, T >::item_type |
Shortcut for the container item.
typedef linked_object_list_iterator<item_type> oos::linked_object_list< S, T >::iterator |
Shortcut for the list iterator.
typedef object_container::size_type oos::linked_object_list< S, T >::size_type |
Shortcut for size type.
typedef T oos::linked_object_list< S, T >::value_type |
Shortcut for the value type.
Constructor & Destructor Documentation
|
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
-
parent The containing list object.
Member Function Documentation
|
inline |
Return the begin iterator of the list.
- Returns
- The begin iterator.
|
inline |
Return the begin iterator of the list.
- Returns
- The begin iterator.
|
inlinevirtual |
Return the class name of the item.
- Returns
- The class name of the item.
|
inlinevirtual |
Clears the list.
All elements are removed from the list and also removed from the object_store.
|
inlinevirtual |
Returns wether the list is empty or not.
- Returns
- True if list is empty.
|
inline |
Return the end iterator of the list.
- Returns
- The end iterator.
|
inline |
Return the end iterator of the list.
- Returns
- The end iterator.
|
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
-
i The object to be erased containing iterator.
- Returns
- The next iterator position
|
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
-
first The first iterator of the range to erase. last The last iterator of the range to erase.
- Returns
- Returns the next iterator.
|
inlineprotectedvirtual |
Executes the given function object for all elements.
Executes the given function object for all elements.
- Parameters
-
nf Function object used to be executed on each element.
|
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
-
pos The position where to insert the new elemetnt. elem The element to be inserted.
|
inlineprotectedvirtual |
Sets the parent for the linked list
- Parameters
-
p The parent object of the linked list.
|
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
-
elem The element to be pushed back
|
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
-
elem The element to be pushed front
|
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