Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

MCandidateHeapList.hpp

00001 #ifndef __MCandidateHeapList__
00002 #define __MCandidateHeapList__
00003 
00004 
00005 
00023 #include <stdio.h>
00024 #include "MPsi2DValue.hpp"
00025 
00026 class MCandidateHeapList
00027 {
00028 private:
00029 
00030 int                             nmax;                   // max number of elements
00031 int                             n;                              // current number of elements
00032 
00033 MPsi2DValue**   heap;
00034 
00035 protected:
00036 
00037 void reorderUp(int key);                        // used when moving out the first value
00038 void reorderDown(int key);                      // used insertion
00039 
00040 void reorder(int akey)                          // update combined operation
00041                                 {
00042                                 reorderUp(akey);
00043                                 reorderDown(akey);
00044                                 }
00045 
00046 public:
00047 
00048 MCandidateHeapList(int maxData);
00049 ~MCandidateHeapList(){ delete[] heap; }  // do not clear the data, but the container
00050         
00051 bool                    isEmpty(){ return n <= 0; }
00052 bool                    isFull(){ return n == nmax; }
00053 
00054 int                             numberOfData(){ return n; }
00055 
00056 MPsi2DValue*            getTop(){ return heap[0]; }
00057 MPsi2DValue*            get(int i){ return heap[i]; }
00058 
00059 void                    insertData(MPsi2DValue* data);
00060 void                    removeFirstValue();
00061 void                    updateData(MPsi2DValue* data);
00062 
00063 void                    output();
00064 };
00065 
00066 #endif
SourceForge.net Logo
Restoreinpaint sourceforge project `C++/Java Image Processing, Restoration, Inpainting Project'.

Bernard De Cuyper: Open Project Leader: Concept, design and development.
Bernard De Cuyper & Eddy Fraiha 2002, 2003. Bernard De Cuyper 2004. Open and free, for friendly usage only.
Modifications on Belgium ground of this piece of artistic work, by governement institutions or companies, must be notified to Bernard De Cuyper.
bern_bdc@hotmail.com