Puma Reference Manual Puma: Puma::List Class Reference



Puma::List Class Reference

Double-linked list implementation. More...

#include <Puma/List.h>

Inherited by Puma::ManipulatorSequence, Puma::PrePredicate, Puma::RuleTable, and Puma::Unit.

List of all members.

Public Member Functions

 List ()
 Constructor.
 List (const List &copy)
 Copy-constructor.
 ~List ()
 Destructor.
Listoperator= (const List &copy)
 Assignment operator.
Listoperator+= (const List &list)
 Append the given list.
List operator+ (const List &list)
 Create a new list containing the elements of this list followed by the elements of the given list.
void clear ()
 Destroy the list elements.
void append (ListElement &element)
 Append an element to the list.
void prepend (ListElement &element)
 Prepend an element to the list.
void insert (ListElement *at, ListElement &element)
 Insert an element at the given list position.
void remove (ListElement *element)
 Remove the given element from the list.
void kill (ListElement *from, ListElement *to=(ListElement *) 0)
 Remove and destroy all elements between the given list elements.
void cut (List &out, ListElement *from, ListElement *to=(ListElement *) 0)
 Cut all elements between the given list elements.
Listcopy (ListElement *from=(ListElement *) 0, ListElement *to=(ListElement *) 0)
 Copy all elements between the given list elements.
void paste (ListElement *at, const List &l)
 Insert copies of the elements of the given list at the given list position.
void paste_before (ListElement *at, const List &l)
 Insert copies of the elements of the given list before the given list position.
void move (ListElement *at, List &l)
 Insert the elements of the given list at the given list position.
void move_before (ListElement *at, List &l)
 Insert the elements of the given list before the given list position.
bool empty () const
 Check if the list is empty.
const ListElementfirst () const
 Get the first element in the list.
const ListElementlast () const
 Get the last element in the list.
const ListElementnext (const ListElement *element) const
 Get the next element of the given element.
const ListElementprev (const ListElement *element) const
 Get the previous element of the given element.

Detailed Description

Double-linked list implementation.


Constructor & Destructor Documentation

Puma::List::List (  )  [inline]

Constructor.

Puma::List::List ( const List copy  ) 

Copy-constructor.

Parameters:
copy The list to copy.
Puma::List::~List (  ) 

Destructor.

Destroys the list elements.


Member Function Documentation

void Puma::List::append ( ListElement element  ) 

Append an element to the list.

Parameters:
element The element.
void Puma::List::clear (  ) 

Destroy the list elements.

List* Puma::List::copy ( ListElement from = (ListElement *) 0,
ListElement to = (ListElement *) 0 
)

Copy all elements between the given list elements.

Parameters:
from The first list element to cut.
to The last list element to cut.
Returns:
A new list containing the copied elements.
void Puma::List::cut ( List out,
ListElement from,
ListElement to = (ListElement *) 0 
)

Cut all elements between the given list elements.

Parameters:
out The container for the cutted elements (are appended).
from The first list element to cut.
to The last list element to cut.
bool Puma::List::empty (  )  const [inline]

Check if the list is empty.

const ListElement* Puma::List::first (  )  const [inline]

Get the first element in the list.

Returns:
The element or NULL if list is empty.

Reimplemented in Puma::Unit.

void Puma::List::insert ( ListElement at,
ListElement element 
)

Insert an element at the given list position.

Parameters:
at A list element where to insert the element.
element The element.
void Puma::List::kill ( ListElement from,
ListElement to = (ListElement*)0 
) [inline]

Remove and destroy all elements between the given list elements.

Parameters:
from The first list element to kill.
to The last list element to kill.
const ListElement* Puma::List::last (  )  const [inline]

Get the last element in the list.

Returns:
The element or NULL if list is empty.

Reimplemented in Puma::Unit.

void Puma::List::move ( ListElement at,
List l 
)

Insert the elements of the given list at the given list position.

The elements are removed from the source list.

Parameters:
at The list element at which to insert the list elements.
l The list containing the elements to insert.
void Puma::List::move_before ( ListElement at,
List l 
)

Insert the elements of the given list before the given list position.

The elements are removed from the source list.

Parameters:
at The list element before which to insert the list elements.
l The list containing the elements to insert.
const ListElement* Puma::List::next ( const ListElement element  )  const [inline]

Get the next element of the given element.

Returns:
The element or NULL if the given element is NULL.
List Puma::List::operator+ ( const List list  ) 

Create a new list containing the elements of this list followed by the elements of the given list.

Parameters:
list The other list.
List& Puma::List::operator+= ( const List list  ) 

Append the given list.

Parameters:
list The list to append.
List& Puma::List::operator= ( const List copy  ) 

Assignment operator.

Parameters:
copy The list to copy.
void Puma::List::paste ( ListElement at,
const List l 
)

Insert copies of the elements of the given list at the given list position.

Parameters:
at The list element at which to paste the list elements.
l The list containing the elements to paste.
void Puma::List::paste_before ( ListElement at,
const List l 
)

Insert copies of the elements of the given list before the given list position.

Parameters:
at The list element before which to paste the list elements.
l The list containing the elements to paste.
void Puma::List::prepend ( ListElement element  ) 

Prepend an element to the list.

Parameters:
element The element.
const ListElement* Puma::List::prev ( const ListElement element  )  const [inline]

Get the previous element of the given element.

Returns:
The element or NULL if the given element is NULL.
void Puma::List::remove ( ListElement element  ) 

Remove the given element from the list.

Parameters:
element The list element.



Puma Reference Manual. Created on 24 Nov 2009.