xosview  1.23
About: xosview is an X Windows based system monitor (cpu, memory, swap and network usage; interrupt and serial activities; load average).
  Fossies Dox: xosview-1.23.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pllist.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 1994, 1995, 2006 by Mike Romberg ( mike.romberg@noaa.gov )
3 //
4 // This file may be distributed under terms of the GPL
5 //
6 
7 #ifndef _pllist_h
8 #define _pllist_h
9 
10 #include "llist.h"
11 
12 //-------------------------------------------------------------------------
13 //
14 // Pointer Linked list. T is some pointer type.
15 //
16 //-------------------------------------------------------------------------
17 
18 template <class T>
19 class PLList : public LList
20  {
21  public:
22  PLList(void) : LList(){}
23 // PLList(int(*cmp_fun)(T data, K key)) : LList(cmp_fun){}
24 
25  int push(const T data) { return LList::push((void *)data); }
26  T pop(void) { return (T)LList::pop(); }
27 
28  int enqueue(const T data) { return LList::enqueue((void *)data); }
29  T dequeue(void) { return (T)LList::dequeue(); }
30 
31 // int insert(const T data, const K key)
32 // { return LList::insert((void *)data, (void *)key); }
33 // T find(const K key) { return (T)LList::find((void *)key); }
34 // T removematch(const K key)
35 // { return (T)LList::removematch((void *)key); }
36 
37  int putontop(const T data) { return LList::putontop((void *)data); }
38  void remove(const T data) { LList::remove((void *)data); }
39  T findn(int n) { return (T)LList::findn(n); }
40  T operator[](int n) { return findn(n); }
41  int index(const T data) { return LList::index((void *)data); }
42 
43  T findc(int which = 0) { return (T)LList::findc(which); }
44  };
45 
46 
47 //-------------------------------------------------------------------------
48 //
49 // Sorted Pointer List. T is some type of pointer and K is a pointer to
50 // the key type for this list.
51 //
52 //-------------------------------------------------------------------------
53 template <class T, class K>
54 class PSLList : public LList
55  {
56  public:
57  PSLList(void) : LList(){}
58  PSLList(int(*cmp_fun)(T data, K key)) : LList(cmp_fun){}
59 
60  int push(const T data) { return LList::push((void *)data); }
61  T pop(void) { return (T)LList::pop(); }
62 
63  int enqueue(const T data) { return LList::enqueue((void *)data); }
64  T dequeue(void) { return (T)LList::dequeue(); }
65 
66  int insert(const T data, const K key)
67  { return LList::insert((void *)data, (void *)key); }
68  T find(const K key) { return (T)LList::find((void *)key); }
69  T removematch(const K key)
70  { return (T)LList::removematch((void *)key); }
71 
72  int putontop(const T data) { return LList::putontop((void *)data); }
73  void remove(const T data) { LList::remove((void *)data); }
74  T findn(int n) { return (T)LList::findn(n); }
75  T operator[](int n) { return findn(n); }
76  int index(const T data) { return LList::index((void *)data); }
77 
78  T findc(int which = 0) { return (T)LList::findc(which); }
79  };
80 
81 
82 #endif
Definition: llist.h:14
int enqueue(void *data)
Definition: llist.h:50
void * dequeue(void)
Definition: llist.cc:79
void * findc(int which=0)
Definition: llist.cc:228
void remove(void *data)
Definition: llist.cc:180
int push(void *data)
Definition: llist.cc:39
void * find(void *key)
Definition: llist.cc:150
void * pop(void)
Definition: llist.cc:56
int n(void) const
Definition: llist.h:102
int putontop(void *data)
Definition: llist.cc:168
int insert(void *data, void *key)
Definition: llist.cc:103
void * findn(int n)
Definition: llist.cc:195
int index(void *data)
Definition: llist.cc:203
void * removematch(void *key)
Definition: llist.cc:158
Definition: pllist.h:20
T pop(void)
Definition: pllist.h:26
T dequeue(void)
Definition: pllist.h:29
T findn(int n)
Definition: pllist.h:39
void remove(const T data)
Definition: pllist.h:38
int push(const T data)
Definition: pllist.h:25
int enqueue(const T data)
Definition: pllist.h:28
T findc(int which=0)
Definition: pllist.h:43
PLList(void)
Definition: pllist.h:22
T operator[](int n)
Definition: pllist.h:40
int putontop(const T data)
Definition: pllist.h:37
int index(const T data)
Definition: pllist.h:41
Definition: pllist.h:55
T pop(void)
Definition: pllist.h:61
T dequeue(void)
Definition: pllist.h:64
int enqueue(const T data)
Definition: pllist.h:63
int insert(const T data, const K key)
Definition: pllist.h:66
PSLList(int(*cmp_fun)(T data, K key))
Definition: pllist.h:58
T removematch(const K key)
Definition: pllist.h:69
int index(const T data)
Definition: pllist.h:76
void remove(const T data)
Definition: pllist.h:73
PSLList(void)
Definition: pllist.h:57
int putontop(const T data)
Definition: pllist.h:72
T findn(int n)
Definition: pllist.h:74
T operator[](int n)
Definition: pllist.h:75
int push(const T data)
Definition: pllist.h:60
T findc(int which=0)
Definition: pllist.h:78
T find(const K key)
Definition: pllist.h:68