simple.cc - generated code example
[prop.git] / include / AD / contain / dheap.h
blob4b59f9028c5f9ee2c27788e6851402195140cb68
1 //////////////////////////////////////////////////////////////////////////////
2 // NOTICE:
3 //
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are free to incorporate any part of ADLib and Prop into
9 // your programs.
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
16 // code.
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
21 // Allen Leung
22 // 1994
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef double_ended_heap_h
26 #define double_ended_heap_h
28 #include <A/generic/ordering.h>
30 template <class T, class Array>
31 class DHeap : public Array {
32 public:
34 //////////////////////////////////////////////////////////////////////
35 // Constructors and destructor
36 //////////////////////////////////////////////////////////////////////
37 DHeap();
38 DHeap(const DHeap&);
39 ~DHeap();
41 //////////////////////////////////////////////////////////////////////
42 // Assignment
43 //////////////////////////////////////////////////////////////////////
44 DHeap& operator = (const DHeap&);
46 //////////////////////////////////////////////////////////////////////
47 // Selectors
48 //////////////////////////////////////////////////////////////////////
49 int size() const;
50 int capacity() const;
51 Bool is_empty() const;
52 Bool is_full() const;
53 T& min() const;
54 T& max() const;
56 //////////////////////////////////////////////////////////////////////
57 // Mutators
58 //////////////////////////////////////////////////////////////////////
59 Ix insert(const T&);
60 Ix enque(const T&);
61 Bool delete_min();
62 Bool delete_max();
64 //////////////////////////////////////////////////////////////////////
65 // Iterators
66 //////////////////////////////////////////////////////////////////////
67 // Inherited from class Array
70 #endif