#include <ParmParse.H>
Inheritance diagram for PP_List< T >:
Public Member Functions | |
PP_List () | |
: Construct an empty PP_List<T>. | |
PP_List (const PP_List< T > &rhs) | |
: The copy constructor. | |
PP_List< T > & | operator= (const PP_List< T > &rhs) |
: The assignment operator. | |
~PP_List () | |
: The destructor. | |
void | prepend (const T &value) |
: Adds a copy of the value to the beginning of the PP_List<T>. | |
void | append (const T &value) |
: Adds a copy of the value to the end of the PP_List<T>. | |
void | add (const T &value) |
: Adds a copy of the value to the end of the PP_List<T>. | |
void | join (const PP_List< T > &src) |
: Appends a copy of all items in PP_List<T> src to this PP_List<T>. | |
void | catenate (PP_List< T > &src) |
void | clear () |
: Removes all objects from the PP_List<T>. | |
T & | firstElement () const |
: Returns a reference to the first element in the PP_List<T>. | |
T & | lastElement () const |
: Returns a reference to the last element in the PP_List<T>. | |
bool | includes (const T &value) const |
bool | operator== (const PP_List< T > &rhs) const |
bool | operator!= (const PP_List< T > &rhs) const |
: Returns true if the this and rhs are not equal. | |
bool | isEmpty () const |
: Returns true if the PP_List<T> is empty. | |
bool | isNotEmpty () const |
: Returns true if the PP_List<T> is not empty. | |
int | length () const |
: Returns the number of objects in the PP_List<T>. | |
void | removeFirst () |
: Removes the first element in the PP_List<T>. | |
void | removeLast () |
: Removes the last element in the PP_List<T>. | |
const T & | operator[] (const PP_ListIterator< T > &li) const |
: Returns reference to object pointed to by the PP_ListIterator<T>. | |
T & | operator[] (const PP_ListIterator< T > &li) |
: Returns reference to object pointed to by the PP_ListIterator<T>. | |
void | remove (const T &value) |
: Removes all objects in the PP_List<T> equal to value. | |
void | remove (const PP_List< T > &lst) |
void | remove (PP_ListIterator< T > &lit) |
: Removes the object pointed to by the PP_ListIterator<T>. | |
void | replace (PP_ListIterator< T > &li, const T &val) |
: Replace the value pointed to by the PP_ListIterator<T> by val. | |
void | addAfter (PP_ListIterator< T > &lit, const T &val) |
void | addBefore (PP_ListIterator< T > &lit, const T &val) |
PP_ListIterator< T > | first () const |
: Returns a PP_ListIterator<T> to the first object in this PP_List<T>. | |
PP_ListIterator< T > | last () const |
: Returns a PP_ListIterator<T> to the last object in this PP_List<T>. | |
Protected Member Functions | |
void | remove (PP_ListLink< T > *ln) |
PP_ListLink< T > * | addBefore (PP_ListLink< T > *ln, const T &val) |
PP_ListLink< T > * | addAfter (PP_ListLink< T > *ln, const T &val) |
Protected Attributes | |
PP_ListLink< T > * | head |
PP_ListLink< T > * | tail |
Friends | |
class | PP_ListIterator< T > |
The PP_List<T> class is a template class that implements a doubly-linked list of objects. A PP_List<T> is a useful container class when the number of objects in the collection is not known ahead of time. A PP_List<T> can contain an arbitrary number of elements; operations such as insertion, deletion, and catenation are easily implemented and inexpensive.
The only difficulty when defining a list class is devising a mechanism to access the elements. In an array, an element is accessed using an integer index. Since the elements in a PP_List<T> are ordered by position, we could define an integer indexing operation that walks along the PP_List<T> links from the beginning until the numbered element is found. Unfortunately, this would be very inefficient when accessing elements near the end of a long list. Another solution is to allow user access to the individual link objects that contain the element as well as the forward and backward pointers. This is not a satisfactory solution since it allows user access to the internal representation of the class. The solution chosen is to define a PP_ListIterator<T> template class.
Think of a PP_ListIterator<T> as a pointer to an object in the PP_List<T>. You can access the element currently pointed to by the iterator, move the iterator forward and backward through the PP_List<T>, and use it as a mechanism to define where elements should be inserted and deleted. If the iterator is moved off the end of the list it behaves as a null pointer.
This is a concrete class, not a polymorphic one.
This is a convenience class for ParmParse and will not be in any way supported by anyone at ANAG.
|
: Construct an empty PP_List<T>.
|
|
: The copy constructor.
|
|
: The destructor.
|
|
: Adds a copy of the value to the end of the PP_List<T>.
|
|
|
|
: Insert val into PP_List<T> after the object pointed to by PP_ListIterator<T>. |
|
|
|
: Insert val into PP_List<T> before the object pointed to by PP_ListIterator<T>. |
|
: Adds a copy of the value to the end of the PP_List<T>.
|
|
: Appends a copy of all items in PP_List<T> src to this PP_List<T>. This differs from join() in that it unlinks the objects from the PP_List<T> src and glues them to the end of this PP_List<T>, leaving PP_List<T> src empty. This is more efficient that join() if src is no longer needed. |
|
: Removes all objects from the PP_List<T>.
|
|
: Returns a PP_ListIterator<T> to the first object in this PP_List<T>.
|
|
: Returns a reference to the first element in the PP_List<T>.
|
|
: Returns true if the PP_List<T> contains an object identical to value. Type T must have an operator==() defined, or be an intrinsic type. |
|
: Returns true if the PP_List<T> is empty.
|
|
: Returns true if the PP_List<T> is not empty.
|
|
: Appends a copy of all items in PP_List<T> src to this PP_List<T>.
|
|
: Returns a PP_ListIterator<T> to the last object in this PP_List<T>.
|
|
: Returns a reference to the last element in the PP_List<T>.
|
|
: Returns the number of objects in the PP_List<T>.
|
|
: Returns true if the this and rhs are not equal.
|
|
: The assignment operator.
|
|
: Returns true if the this and rhs are memberwise equal; i.e. the two lists are the same size and each of the elements in the list compare equal. Type T must have an operator==() defined, or be an intrinsic type. |
|
: Returns reference to object pointed to by the PP_ListIterator<T>.
|
|
: Returns reference to object pointed to by the PP_ListIterator<T>.
|
|
: Adds a copy of the value to the beginning of the PP_List<T>.
|
|
|
|
: Removes the object pointed to by the PP_ListIterator<T>.
|
|
: Removes all objects in the PP_List<T> equal to any of the values in lst. |
|
: Removes all objects in the PP_List<T> equal to value.
|
|
: Removes the first element in the PP_List<T>.
|
|
: Removes the last element in the PP_List<T>.
|
|
: Replace the value pointed to by the PP_ListIterator<T> by val.
|
|
|
|
|
|
|