root/foundation-apps/grosview-maxx/pllist.h

Revision 2, 2.9 KB (checked in by emasson, 3 years ago)

initial import for the community edition

Line 
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// $Id: pllist.h,v 1.1.1.1 2008/05/04 15:53:48 emasson Exp $
8//
9#ifndef _pllist_h
10#define _pllist_h
11
12#define PLLIST_H_CVSID "$Id: pllist.h,v 1.1.1.1 2008/05/04 15:53:48 emasson Exp $"
13
14#include "llist.h"
15
16//-------------------------------------------------------------------------
17//
18// Pointer Linked list.  T is some pointer type.
19//
20//-------------------------------------------------------------------------
21
22template <class T>
23class PLList : public LList
24    {
25    public:
26        PLList(void) : LList(){}
27//        PLList(int(*cmp_fun)(T data, K key)) : LList(cmp_fun){}
28
29        int push(const T data) { return LList::push((void *)data); }
30        T pop(void) { return (T)LList::pop(); }
31
32        int enqueue(const T data) { return LList::enqueue((void *)data); }
33        T dequeue(void) { return (T)LList::dequeue(); }
34
35//        int insert(const T data, const K key)
36//          { return LList::insert((void *)data, (void *)key); }
37//        T find(const K key) { return (T)LList::find((void *)key); }
38//        T removematch(const K key)
39//          { return (T)LList::removematch((void *)key); }
40
41        int putontop(const T data) { return LList::putontop((void *)data); }
42        void remove(const T data) { LList::remove((void *)data); }
43        T findn(int n) { return (T)LList::findn(n); }
44        T operator[](int n) { return findn(n); }
45        int index(const T data) { return LList::index((void *)data); }
46
47        T findc(int which = 0) { return (T)LList::findc(which); }
48    };
49
50
51//-------------------------------------------------------------------------
52//
53// Sorted Pointer List.  T is some type of pointer and K is a pointer to
54// the key type for this list.
55//
56//-------------------------------------------------------------------------
57template <class T, class K>
58class PSLList : public LList
59    {
60    public:
61        PSLList(void) : LList(){}
62        PSLList(int(*cmp_fun)(T data, K key)) : LList(cmp_fun){}
63
64        int push(const T data) { return LList::push((void *)data); }
65        T pop(void) { return (T)LList::pop(); }
66
67        int enqueue(const T data) { return LList::enqueue((void *)data); }
68        T dequeue(void) { return (T)LList::dequeue(); }
69
70        int insert(const T data, const K key)
71          { return LList::insert((void *)data, (void *)key); }
72        T find(const K key) { return (T)LList::find((void *)key); }
73        T removematch(const K key)
74          { return (T)LList::removematch((void *)key); }
75
76        int putontop(const T data) { return LList::putontop((void *)data); }
77        void remove(const T data) { LList::remove((void *)data); }
78        T findn(int n) { return (T)LList::findn(n); }
79        T operator[](int n) { return findn(n); }
80        int index(const T data) { return LList::index((void *)data); }
81
82        T findc(int which = 0) { return (T)LList::findc(which); }
83    };
84
85
86#endif
Note: See TracBrowser for help on using the browser.