54 #include "EST_common.h"
55 #include "EST_UList.h"
56 #include "EST_TSortable.h"
57 #include "EST_TIterator.h"
59 #include "instantiate/EST_TListI.h"
67 static void *
operator new(
size_t not_used,
void *place)
68 {(void)not_used;
return place;}
69 static void *
operator new(
size_t size)
71 p = (
void *)walloc(
char,size);
73 static void operator delete(
void *p)
77 static unsigned int s_nfree;
78 static unsigned int s_maxFree;
121 void init() { EST_UList::init(); };
130 ~
EST_TList() { clear_and_free(free_item); }
148 {
return item(nth_pointer(n)); };
151 {
return item(nth_pointer(n)); };
155 {
return item(head()); };
158 {
return item(tail()); };
163 {
return item(head()); };
166 {
return item(tail()); };
170 {
return item(ptr); };
173 {
return item(ptr); };
183 {
return EST_UList::remove(ptr, free_item); };
187 {
return EST_UList::remove(n, free_item); };
222 { EST_UList::exchange(a, b); };
225 { EST_UList::exchange(i,j); };
238 friend ostream& operator << (ostream &st, EST_TList<T>
const &list) {
240 for (ptr = list.head(); ptr != 0; ptr = ptr->next())
241 st << list.item(ptr) <<
" ";
247 { clear_and_free(free_item); };
255 void point_to_first(
IPointer &ip)
const { ip.p = head(); }
256 void move_pointer_forwards(IPointer &ip)
const { ip.p = ip.p->next(); }
257 bool points_to_something(
const IPointer &ip)
const {
return ip.p != NULL; }
258 T &points_at(
const IPointer &ip) {
return item(ip.p); }
317 EST_UList::sort_unique(l,
326 EST_UList::merge_sort_unique(l, m,
333 const char *error_name(
EST_TList<T> val) { (void)val;
return "<<TLIST>>"; }
const T & first() const
return const reference to first item in list
void exchange(int i, int j)
exchange 2
const T & nth(int n) const
return a const Nth value
EST_Litem * remove_nth(int n)
remove nth item, return pointer to previous item
EST_Litem * insert_after(EST_Litem *ptr, const T &item)
EST_UItem EST_Litem
A pretty name for EST_UItem.
const T & last() const
return const reference to last item in list
T & last()
return reference to last item in list
void clear(void)
remove all items in list
T & nth(int n)
return the Nth value
EST_TList()
default constructor
EST_Litem * insert_before(EST_Litem *ptr, const T &item)
void append(const T &item)
add item onto end of list
void prepend(const T &item)
add item onto start of list
void exchange(EST_Litem *a, EST_Litem *b)
exchange 1
const T & item(const EST_Litem *p) const
T & item(const EST_Litem *p)