Open
Graph Drawing
Framework

 v.2010.10
 

HeapBase.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 2027 $
00003  * 
00004  * last checkin:
00005  *   $Author:klein $ 
00006  *   $Date:2007-10-18 17:23:28 +0200 (Thu, 18 Oct 2007) $ 
00007  ***************************************************************/
00008  
00054 #ifdef _MSC_VER
00055 #pragma once
00056 #endif
00057 
00058 #ifndef OREAS_HEAP_BASE_H
00059 #define OREAS_HEAP_BASE_H
00060 
00061 
00062 
00063 #include <ogdf/basic/GraphCopy.h>
00064 
00065 
00066 
00067 
00068 namespace ogdf {
00069 
00070 
00093 class HeapEntry;
00094 
00095 class HeapEntryPointer;
00096 
00097 template <class Priority, class HeapObject>
00098 class HeapBase {
00099 
00100 public:
00102        HeapBase() {};
00103        
00104        virtual ~HeapBase() {}
00105 
00106       
00108        virtual void makeHeap() = 0;
00109 
00110        HeapObject minRet() {}
00111 
00112        //*******************************************************
00113        //Modification
00114 
00116        virtual void insert(HeapObject, Priority /* key */) {};
00117         //extractMin
00118        //derived classes should decide themselves if they have 
00119        //a specific delete function
00120        //virtual void delete() = 0;
00121         
00123        //TODO: Does not make much sense without an object parameter
00124        virtual void decreaseKey() {};
00125 
00126        //*******************************************************
00127        //constant functions
00128        int size() const {return m_size;}
00129 
00130        bool empty() const {return m_size==0;}
00131 
00132 
00133 protected:
00134     int m_size; //number of elements stored in heap
00135 
00136 };
00137 
00138 
00139 
00140 } //namespace oreas
00141 
00142 #endif
00143 /*
00144        //return and deletes the object with minimum priority
00145        objects extractMin()
00146        {
00147          objects theMin = minRet();
00148          deleteMin();
00149          return theMin;
00150        }
00151 
00152        //deletes the object with minimum priority
00153        void deleteMin() {deleteObject(minPointer); size--;}
00154 */