50 #include "EST_common.h" 51 #include "EST_UList.h" 52 #include "EST_TSortable.h" 53 #include "EST_TIterator.h" 55 #include "instantiate/EST_TListI.h" 63 static void *
operator new(
size_t not_used,
void *place)
64 {(void)not_used;
return place;}
65 static void *
operator new(
size_t size)
67 p = (
void *)walloc(
char,size);
69 static void operator delete(
void *p)
73 static unsigned int s_nfree;
74 static unsigned int s_maxFree;
113 void init() { EST_UList::init(); };
122 ~
EST_TList() { clear_and_free(free_item); }
140 {
return item(nth_pointer(n)); };
143 {
return item(nth_pointer(n)); };
147 {
return item(head()); };
150 {
return item(tail()); };
155 {
return item(head()); };
158 {
return item(tail()); };
162 {
return item(ptr); };
165 {
return item(ptr); };
176 {
return EST_UList::remove(ptr, free_item); };
180 {
return EST_UList::remove(n, free_item); };
215 { EST_UList::exchange(a, b); };
218 { EST_UList::exchange(i,j); };
231 friend ostream& operator << (ostream &st, EST_TList<T>
const &list) {
233 for (ptr = list.head(); ptr != 0; ptr = ptr->next())
234 st << list.item(ptr) <<
" ";
240 { clear_and_free(free_item); };
248 void point_to_first(
IPointer &ip)
const { ip.p = head(); }
249 void move_pointer_forwards(
IPointer &ip)
const { ip.p = ip.p->next(); }
250 bool points_to_something(
const IPointer &ip)
const {
return ip.p != NULL; }
251 T &points_at(
const IPointer &ip) {
return item(ip.p); }
310 EST_UList::sort_unique(l,
319 EST_UList::merge_sort_unique(l, m,
326 const char *error_name(
EST_TList<T> val) { (void)val;
return "<<TLIST>>"; }
T & last()
return reference to last item in list
EST_Litem * remove_nth(int n)
remove nth item, return pointer to previous item
EST_Litem * insert_before(EST_Litem *ptr, const T &item)
const T & last() const
return const reference to last item in list
EST_TList()
default constructor
T & nth(int n)
return the Nth value
const T & nth(int n) const
return a const Nth value
const T & first() const
return const reference to first item in list
void append(const T &item)
add item onto end of list
const T & item(const EST_Litem *p) const
T & item(const EST_Litem *p)
EST_Litem * insert_after(EST_Litem *ptr, const T &item)
void exchange(int i, int j)
exchange 2
void exchange(EST_Litem *a, EST_Litem *b)
exchange 1
void clear(void)
remove all items in list
void prepend(const T &item)
add item onto start of list