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 
58  protected:
59  void* _object;
62 };
63 
64 inline bool HTList::IsEmpty() {
65  return _next == this;
66 }
67 inline HTList* HTList::First() {
68  return _next;
69 }
70 inline HTList* HTList::Last() {
71  return _prev;
72 }
73 inline HTList* HTList::End() {
74  return this;
75 }
76 inline HTList* HTList::Next() {
77  return _next;
78 }
79 inline HTList* HTList::Prev() {
80  return _prev;
81 }
82 inline void* HTList::operator()() {
83  return _object;
84 }
85 inline void* HTList::vptr() {
86  return _object;
87 }
88 #endif
Definition: htlist.h:35
void Remove()
Definition: htlist.cpp:75
HTList * Find(void *)
Definition: htlist.cpp:99
void * _object
Definition: htlist.h:59
void Prepend(HTList *)
Definition: htlist.cpp:62
HTList * Prev()
Definition: htlist.h:79
bool IsEmpty()
Definition: htlist.h:64
void * vptr()
Definition: htlist.h:85
HTList * Last()
Definition: htlist.h:70
HTList * First()
Definition: htlist.h:67
void * operator()()
Definition: htlist.h:82
virtual ~HTList()
Definition: htlist.cpp:47
HTList * Next()
Definition: htlist.h:76
HTList(void *=NULL)
Definition: htlist.cpp:41
void Append(HTList *)
Definition: htlist.cpp:55
HTList * _next
Definition: htlist.h:60
HTList * _prev
Definition: htlist.h:61
HTList * operator[](int count)
Definition: htlist.cpp:110
HTList * End()
Definition: htlist.h:73
void RemoveAll()
Definition: htlist.cpp:84
void Delete(void *)
Definition: htlist.cpp:89
#define NULL
Definition: sptree.h:16