#include <List.h>
Public Member Functions | |
| List (const bool resp=true) | |
| ~List () | |
| const List & | operator= (const List &) |
| void | print_list (ostream &) const |
| bool | is_empty () const |
| bool | find (const T *, ListIterator< T > &) |
| T * | get_nth (const int n) const |
| int | number_of_elements () const |
| void | first (ListIterator< T > &li) const |
| void | last (ListIterator< T > &li) const |
| void | remove (ListIterator< T > &) |
| bool | remove (const T *) |
| void | insert_first (T *) |
| void | insert_last (T *) |
| void | delete_list () |
| void | set_deletion_responsibility (const bool r) |
Private Attributes | |
| ListNode< T > * | list_head |
| bool | responsible_for_deletion |
|
||||||||||
|
Definition at line 34 of file List.cc. 00035 : list_head(new ListNode<T>), responsible_for_deletion(resp) 00036 { 00037 }
|
|
|||||||||
|
Definition at line 40 of file List.cc. References List< T >::delete_list(). 00041 {
00042 delete_list(); // delete the actual list
00043 delete list_head; // delet the header node
00044 }
|
Here is the call graph for this function:

|
|||||||||
|
Definition at line 48 of file List.cc. References ListNode< T >::element, List< T >::list_head, ListNode< T >::next, ListNode< T >::prev, and List< T >::responsible_for_deletion. Referenced by ArenaBase::delete_lists(), StartTournamentWindow::new_tournament(), List< T >::operator=(), read_dirs_from_system(), and List< T >::~List(). 00049 {
00050 ListNode<T>* p = list_head->next; // keep the header node
00051 ListNode<T>* temp;
00052
00053 while ( p != NULL )
00054 {
00055 temp = p->next;
00056 if( responsible_for_deletion && p->element ) delete p->element;
00057 delete p;
00058 p = temp;
00059 }
00060
00061 list_head->next = NULL;
00062 list_head->prev = NULL;
00063 }
|
|
||||||||||||||||
|
Definition at line 127 of file List.cc. References List< T >::first(), and ListIterator< T >::ok(). Referenced by List< T >::remove(). 00128 {
00129 for( first(li); li.ok(); li++ )
00130 {
00131 if ( li() == x )
00132 {
00133 return true;
00134 }
00135 }
00136
00137 return false;
00138 }
|
Here is the call graph for this function:

|
||||||||||
|
||||||||||
|
Definition at line 95 of file List.cc. References ListNode< T >::element, Error(), List< T >::list_head, and ListNode< T >::next. Referenced by ArenaRealTime::start_game(). 00096 {
00097 ListNode<T>* p;
00098 int index = 1;
00099
00100 if( n < 1 ) Error(true, "n < 1", "List::get_nth");
00101
00102 for( p=list_head->next; p != NULL && index < n; p=p->next ) index++;
00103
00104 if( p == NULL ) Error(true, "No such element", "List::get_nth");
00105
00106 return p->element;
00107 }
|
Here is the call graph for this function:

|
||||||||||
|
Definition at line 201 of file List.cc. References Error(), List< T >::list_head, ListNode< T >::next, and ListNode< T >::prev. Referenced by ArenaBase::parse_arena_line(). 00202 {
00203 ListNode<T>* p = new ListNode<T>(x, list_head->next, NULL);
00204
00205 if( p == NULL ) Error(true, "Out of memory", "List::insert_first");
00206
00207 if( list_head->next == NULL ) list_head->prev = p;
00208 if( p->next ) p->next->prev = p;
00209 list_head->next = p;
00210 }
|
Here is the call graph for this function:

|
||||||||||
Here is the call graph for this function:

|
|||||||||
|
Definition at line 67 of file List.h. Referenced by StartTournamentWindow::save_tournament_file(), and Robot::set_values_at_process_start_up(). 00067 { return list_head->next == NULL; }
|
|
||||||||||
|
Definition at line 73 of file List.h. Referenced by Robot::get_last_position(), Robot::get_total_points(), and Robot::set_stats().
|
|
|||||||||
|
Definition at line 143 of file List.cc. References List< T >::list_head, and ListNode< T >::next. Referenced by parse_tournament_file(), StartTournamentWindow::save_tournament_file(), and StartTournamentWindow::set_entry(). 00144 {
00145 ListNode<T>* p;
00146 int index=0;
00147
00148 for( p=list_head->next; p != NULL; p=p->next ) index++;
00149
00150 return(index);
00151 }
|
|
||||||||||
|
Definition at line 71 of file List.cc. References List< T >::delete_list(), ListNode< T >::element, List< T >::insert_last(), List< T >::list_head, and ListNode< T >::next. 00072 {
00073 if( this == &old ) return *this; // don't copy yourself!
00074
00075 if( list_head != NULL )
00076 delete_list(); // delete all nodes but the header node.
00077 else
00078 list_head = new ListNode<T>;
00079
00080
00081 ListNode<T>* p;
00082
00083 for( p=old.list_head->next; p != NULL; p=p->next )
00084 insert_last(p->element);
00085
00086 return *this;
00087 }
|
Here is the call graph for this function:

|
||||||||||
|
Definition at line 112 of file List.cc. References List< T >::list_head, and ListNode< T >::next. 00113 {
00114 ListNode<T>* p;
00115
00116 for( p=list_head->next; p != NULL; p=p->next );
00117 // os << *(p->element) << " ";
00118 }
|
|
||||||||||
|
Definition at line 186 of file List.cc. References List< T >::find(), and List< T >::remove(). 00187 {
00188 ListIterator<T> li;
00189 if ( find(x, li) )
00190 {
00191 remove(li);
00192 return true;
00193 }
00194
00195 return false;
00196 }
|
Here is the call graph for this function:

|
||||||||||
Here is the call graph for this function:

|
||||||||||
|
Definition at line 85 of file List.h. Referenced by ArenaBase::ArenaBase(). 00085 { responsible_for_deletion = r; }
|
|
|||||
|
Definition at line 89 of file List.h. Referenced by List< T >::delete_list(), List< T >::get_nth(), List< T >::insert_first(), List< T >::insert_last(), List< T >::number_of_elements(), List< T >::operator=(), List< T >::print_list(), and List< T >::remove(). |
|
|||||
|
Definition at line 90 of file List.h. Referenced by List< T >::delete_list(), and List< T >::remove(). |
1.3.9.1