"Fossies" - the Fresh Open Source Software Archive

Member "xosview-1.23/pllist.h" (11 Jul 2020, 2855 Bytes) of package /linux/misc/xosview-1.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "pllist.h" see the Fossies "Dox" file reference documentation.

    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