#include <source/toolbox/base/List.h>
Inheritance diagram for SAMRAI::tbox::List< TYPE >:
Public Types | |
typedef ListIterator< TYPE > | Iterator |
Public Member Functions | |
List () | |
List (const List< TYPE > &list) | |
List< TYPE > & | operator= (const List< TYPE > &list) |
virtual | ~List () |
bool | isEmpty () const |
int | getNumberOfItems () const |
int | size () const |
void | addItem (const TYPE &item) |
void | addItemBefore (ListIterator< TYPE > &iter, const TYPE &item) |
void | addItemAfter (ListIterator< TYPE > &iter, const TYPE &item) |
void | appendItem (const TYPE &item) |
void | copyItems (const List< TYPE > &list) |
void | catenateItems (List< TYPE > &list) |
void | catenateItemsAtFront (List< TYPE > &list) |
void | clearItems () |
TYPE & | getFirstItem () const |
TYPE & | getLastItem () const |
void | removeFirstItem () |
void | removeLastItem () |
void | removeItem (ListIterator< TYPE > &iter) |
void | reverse () |
List< TYPE >::Iterator | listStart () const |
List< TYPE >::Iterator | listEnd () const |
Static Public Member Functions | |
static void | freeCachedListItems () |
Friends | |
class | ListIterator< TYPE > |
The List item in the list must define the assignment operator "=" and the default const copy constructor. This list implementation uses copy to add the list item to the linked list. If this is too expensive for the object to be placed in the list, then a smart pointer to the object should be used instead.
typedef ListIterator<TYPE> SAMRAI::tbox::List< TYPE >::Iterator |
The iterator for class List. Because of problems with some compilers and nested templates, the iterator for List is a separate class called ListIterator<TYPE> that is typedef-ed to List<TYPE>::Iterator. Use the List<TYPE>::Iterator form, since the other form may disappear as compilers get better and can accept nested template classes.
Reimplemented in SAMRAI::hier::BoxList< DIM >.
SAMRAI::tbox::List< TYPE >::List | ( | ) | [inline] |
Create a list with no elements.
SAMRAI::tbox::List< TYPE >::List | ( | const List< TYPE > & | list | ) |
The const constructor copies list items from the source list to the newly constructed list. The source list is not modified.
SAMRAI::tbox::List< TYPE >::~List | ( | ) | [inline, virtual] |
Deallocate a list. If items remain in the list, they are deallocated.
void SAMRAI::tbox::List< TYPE >::freeCachedListItems | ( | ) | [inline, static] |
Free cached list nodes. A cached list of list nodes is used to speed allocation and deallocation of list items. This call will return this cached memory to the free memory pool.
List< TYPE > & SAMRAI::tbox::List< TYPE >::operator= | ( | const List< TYPE > & | list | ) |
The assignment operator copies the values from the right hand side list into the list on the left side of the equals sign. The source list is not modified. All previous values in the destination list are lost.
bool SAMRAI::tbox::List< TYPE >::isEmpty | ( | ) | const [inline] |
Check whether a list is empty (has no elements).
int SAMRAI::tbox::List< TYPE >::getNumberOfItems | ( | ) | const [inline] |
Return the number of items in the list.
int SAMRAI::tbox::List< TYPE >::size | ( | ) | const [inline] |
Return the number of items in the list. Identical to getNumberOfItems(), but this method is common to several container classes.
void SAMRAI::tbox::List< TYPE >::addItem | ( | const TYPE & | item | ) |
Add a new item to the head of the list.
void SAMRAI::tbox::List< TYPE >::addItemBefore | ( | ListIterator< TYPE > & | iter, | |
const TYPE & | item | |||
) |
Add a new item to the list before the item pointed to by the specified iterator.
void SAMRAI::tbox::List< TYPE >::addItemAfter | ( | ListIterator< TYPE > & | iter, | |
const TYPE & | item | |||
) |
Add a new item to the list after the item pointed to by the specified iterator.
void SAMRAI::tbox::List< TYPE >::appendItem | ( | const TYPE & | item | ) |
Add a new item to the tail of the list.
void SAMRAI::tbox::List< TYPE >::copyItems | ( | const List< TYPE > & | list | ) |
Copy list items from the argument list. The new items are appended to the end of the current list. The argument list is not modified.
void SAMRAI::tbox::List< TYPE >::catenateItems | ( | List< TYPE > & | list | ) |
Catenate list items from the argument list to the end of the current list. Unline copyItems(), the argument list is set to null.
void SAMRAI::tbox::List< TYPE >::catenateItemsAtFront | ( | List< TYPE > & | list | ) |
Catenate list items from the argument list to the front of the current list. Unline copyItems(), the argument list is set to null.
void SAMRAI::tbox::List< TYPE >::clearItems | ( | ) |
Empty the list. All list items are deallocated.
TYPE & SAMRAI::tbox::List< TYPE >::getFirstItem | ( | ) | const [inline] |
Return a reference to the first item in the list. This operation is not defined if the list is empty. This member function is const since it cannot change the list, although the item in the list may change.
TYPE & SAMRAI::tbox::List< TYPE >::getLastItem | ( | ) | const [inline] |
Return a reference to the last item in the list. This operation is not defined if the list is empty. This member function is const since it cannot change the list, although the item in the list may change.
void SAMRAI::tbox::List< TYPE >::removeFirstItem | ( | ) |
Remove (deallocate) the first item in the list.
void SAMRAI::tbox::List< TYPE >::removeLastItem | ( | ) |
Remove (deallocate) the last item in the list.
void SAMRAI::tbox::List< TYPE >::removeItem | ( | ListIterator< TYPE > & | iter | ) |
Remove (deallocate) the item pointed to by the iterator. After performing the remove, the iterator becomes invalid. Iterators that point to other elements in the list remain valid after the deletion of an item.
void SAMRAI::tbox::List< TYPE >::reverse | ( | ) |
Reverse all elements in the list. This operation is performed in-place by swapping next and previous list element pointers.
ListIterator< TYPE > SAMRAI::tbox::List< TYPE >::listStart | ( | ) | const [inline] |
Return a List<TYPE>::Iterator that points to the start of the list.
ListIterator< TYPE > SAMRAI::tbox::List< TYPE >::listEnd | ( | ) | const [inline] |
Return a List<TYPE>::Iterator that points to the end of the list.
friend class ListIterator< TYPE > [friend] |