NEURON
htlist.h
Go to the documentation of this file.
1 /*
2 from Unidraw but UList changed to HTList (head tail list)
3 for fast insertion, deletion, iteration
4 */
5 
6 /*
7  * Copyright (c) 1990, 1991 Stanford University
8  *
9  * Permission to use, copy, modify, distribute, and sell this software and its
10  * documentation for any purpose is hereby granted without fee, provided
11  * that the above copyright notice appear in all copies and that both that
12  * copyright notice and this permission notice appear in supporting
13  * documentation, and that the name of Stanford not be used in advertising or
14  * publicity pertaining to distribution of the software without specific,
15  * written prior permission. Stanford makes no representations about
16  * the suitability of this software for any purpose. It is provided "as is"
17  * without express or implied warranty.
18  *
19  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
21  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
23  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
25  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26  */
27 
28 /*
29  * UList - list object.
30  */
31 
32 #ifndef htlist_h
33 #define htlist_h
34 
35 class HTList {
36 public:
37  HTList(void* = NULL);
38  virtual ~HTList();
39 
40  bool IsEmpty();
41  void Append(HTList*);
42  void Prepend(HTList*);
43  void Remove(HTList*);
44  void Remove();
45  void RemoveAll();
46  void Delete(void*);
47  HTList* Find(void*);
48  HTList* First();
49  HTList* Last();
50  HTList* End();
51  HTList* Next();
52  HTList* Prev();
53 
54  void* vptr();
55  void* operator()();
56  HTList* operator[](int count);
57 protected:
58  void* _object;
61 };
62 
63 inline bool HTList::IsEmpty () { return _next == this; }
64 inline HTList* HTList::First () { return _next; }
65 inline HTList* HTList::Last () { return _prev; }
66 inline HTList* HTList::End () { return this; }
67 inline HTList* HTList::Next () { return _next; }
68 inline HTList* HTList::Prev () { return _prev; }
69 inline void* HTList::operator() () { return _object; }
70 inline void* HTList::vptr() { return _object; }
71 #endif
HTList * Next()
Definition: htlist.h:67
HTList * End()
Definition: htlist.h:66
HTList(void *=NULL)
Definition: htlist.cpp:41
void Delete(void *)
Definition: htlist.cpp:81
HTList * Prev()
Definition: htlist.h:68
HTList * Find(void *)
Definition: htlist.cpp:91
void * vptr()
Definition: htlist.h:70
HTList * First()
Definition: htlist.h:64
HTList * _next
Definition: htlist.h:59
virtual ~HTList()
Definition: htlist.cpp:43
void Remove()
Definition: htlist.cpp:71
HTList * _prev
Definition: htlist.h:60
void * _object
Definition: htlist.h:58
HTList * operator[](int count)
Definition: htlist.cpp:102
Definition: htlist.h:35
HTList * Last()
Definition: htlist.h:65
bool IsEmpty()
Definition: htlist.h:63
void Append(HTList *)
Definition: htlist.cpp:51
void * operator()()
Definition: htlist.h:69
void Prepend(HTList *)
Definition: htlist.cpp:58
return NULL
Definition: cabcode.cpp:461
void RemoveAll()
Definition: htlist.cpp:76