Open
Graph Drawing
Framework

 v.2012.05
 

HeapBase.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author:klein $ 
00006  *   $Date:2007-10-18 17:23:28 +0200 (Thu, 18 Oct 2007) $ 
00007  ***************************************************************/
00008  
00044 #ifdef _MSC_VER
00045 #pragma once
00046 #endif
00047 
00048 #ifndef OREAS_HEAP_BASE_H
00049 #define OREAS_HEAP_BASE_H
00050 
00051 
00052 
00053 #include <ogdf/basic/GraphCopy.h>
00054 
00055 
00056 
00057 
00058 namespace ogdf {
00059 
00060 
00083 class HeapEntry;
00084 
00085 class HeapEntryPointer;
00086 
00087 template <class Priority, class HeapObject>
00088 class HeapBase {
00089 
00090 public:
00092        HeapBase() {};
00093        
00094        virtual ~HeapBase() {}
00095 
00096       
00098        virtual void makeHeap() = 0;
00099 
00100        HeapObject minRet() {}
00101 
00102        //*******************************************************
00103        //Modification
00104 
00106        virtual void insert(HeapObject, Priority /* key */) {};
00107         //extractMin
00108        //derived classes should decide themselves if they have 
00109        //a specific delete function
00110        //virtual void delete() = 0;
00111         
00113        //TODO: Does not make much sense without an object parameter
00114        virtual void decreaseKey() {};
00115 
00116        //*******************************************************
00117        //constant functions
00118        int size() const {return m_size;}
00119 
00120        bool empty() const {return m_size==0;}
00121 
00122 
00123 protected:
00124     int m_size; //number of elements stored in heap
00125 
00126 };
00127 
00128 
00129 
00130 } //namespace oreas
00131 
00132 #endif
00133 /*
00134        //return and deletes the object with minimum priority
00135        objects extractMin()
00136        {
00137          objects theMin = minRet();
00138          deleteMin();
00139          return theMin;
00140        }
00141 
00142        //deletes the object with minimum priority
00143        void deleteMin() {deleteObject(minPointer); size--;}
00144 */