00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _EYEDBLIB_LINKLIST_H
00026 #define _EYEDBLIB_LINKLIST_H
00027
00028 #ifndef NO_IDB_LINKED_LIST
00029
00030 namespace eyedb {
00031
00032 class LinkedListCursor;
00033 class Link;
00034
00035 class LinkedList {
00036
00037
00038
00039
00040 public:
00041
00045 LinkedList();
00046
00052 int insertObject(void *o);
00053
00059 int insertObjectLast(void *o);
00060
00066 int insertObjectFirst(void *o);
00067
00073 void *getObject(int pos) const;
00074
00080 int deleteObject(void *o);
00081
00087 int deleteObject(int pos);
00088
00094 int getPos(void *o) const;
00095
00100 int getCount() const;
00101
00106 void *getFirstObject() const;
00107
00112 void *getLastObject() const;
00113
00118 LinkedListCursor *startScan() const;
00119
00126 int getNextObject(LinkedListCursor *cursor, void* &o) const;
00127
00132 void endScan(LinkedListCursor *cursor) const;
00133
00139 void applyToObjects(void (*f)(void *, void *), void *user_arg) const;
00140
00145 void empty();
00146
00147 ~LinkedList();
00148
00149
00150
00151
00152 private:
00153 int link_cnt;
00154 Link *f_link, *l_link;
00155 void delete_realize(Link *);
00156
00157 friend class LinkedListCursor;
00158 };
00159
00160 class LinkedListCursor {
00161
00162
00163
00164
00165 public:
00166 LinkedListCursor(const LinkedList &);
00167 LinkedListCursor(const LinkedList *);
00168
00169 int getNext(void* &);
00170
00171 void restart();
00172
00173 ~LinkedListCursor() {}
00174
00175 private:
00176 friend class LinkedList;
00177 Link *link;
00178 LinkedList *list;
00179 };
00180
00181 }
00182
00183 #endif
00184
00185 #endif