home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CTECHAPP.ZIP / CONTAINR.ZIP / DBLLIST.HPP < prev    next >
C/C++ Source or Header  |  1990-01-28  |  1KB  |  61 lines

  1. //  Header:     DblList  (Doubly-Linked Lists)
  2. //  Version:    3.20
  3. //
  4. //  Language:   C++ 2.0
  5. //  Environ:    Any
  6. //
  7. //  Purpose:    Provides a general doubly-linked list class
  8. //
  9. //  Written by: Scott Robert Ladd
  10.  
  11. #if !defined(__DBLLIST_HPP)
  12. #define __DBLLIST_HPP 1
  13.  
  14. #include "Containr.hpp"
  15.  
  16. class DoublyLinkedList : public Container
  17.     {
  18.     protected:
  19.         // structure of a node in a list
  20.         struct DListNode
  21.             {
  22.             DListNode * Prev;
  23.             DListNode * Next;
  24.             void      * DataPtr;
  25.             };
  26.  
  27.         // pointers to first and last nodes in list
  28.         DListNode * Head;
  29.         DListNode * Tail;
  30.  
  31.         // duplication method
  32.         void Copy(const DoublyLinkedList & sl);
  33.  
  34.     public:
  35.         // constructor
  36.         DoublyLinkedList();
  37.  
  38.         // copy contructor
  39.         DoublyLinkedList(const DoublyLinkedList & sl);
  40.  
  41.         // assignment operator
  42.         void operator = (const DoublyLinkedList & sl);
  43.  
  44.         // destructor
  45.         ~DoublyLinkedList();
  46.  
  47.         // store an item
  48.         virtual int Store(void * item) = 0;
  49.  
  50.         // examine an item
  51.         virtual void * Examine() = 0;
  52.  
  53.         // retrieve an item
  54.         virtual void * Retrieve() = 0;
  55.  
  56.         // remove all items from a list
  57.         virtual void Empty();
  58.     };
  59.  
  60. #endif
  61.