00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __linklist_h__
00020 #define __linklist_h__
00021
00022 #include <pthread.h>
00023
00024 class Entry;
00025
00026 class Linklist {
00027 public:
00028 Linklist();
00029 virtual ~Linklist();
00030
00031 Entry *begin() { return(first); };
00032 Entry *end() { return(last); };
00033 int len() { return(length); };
00034
00035 void append(Entry *addr);
00036 void add(Entry *addr) { append(addr); };
00037 void prepend(Entry *addr);
00038 void insert(Entry *addr, int pos);
00039
00040 bool rem(int pos);
00041 bool sel(int pos);
00042 bool clear();
00043 bool moveup(int pos);
00044 bool movedown(int pos);
00045 bool moveto(int num, int pos);
00046 Entry *pick(int pos);
00047 Entry *Linklist::selected();
00048
00049 Entry *operator[](int pos) { return pick(pos); };
00050
00051
00052 Entry *first;
00053 Entry *last;
00054 int length;
00055
00056
00057 Entry *pick_id(int id);
00058 int selected_pos();
00059
00060
00061 void lock();
00062 void unlock();
00063 private:
00064 pthread_mutex_t _mutex;
00065
00066 };
00067
00068 class Entry {
00069 public:
00070 Entry();
00071 ~Entry();
00072
00073 Entry *next;
00074 Entry *prev;
00075
00076 Linklist *list;
00077
00078 bool up();
00079 bool down();
00080 bool move(int pos);
00081 void rem();
00082 void sel(bool on);
00083
00084 int id;
00085 bool select;
00086 };
00087
00088 #endif