Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

packnode.h

Go to the documentation of this file.
00001 
00002 #ifndef _PACKNODE_H_
00003 #define _PACKNODE_H_
00004 
00005 #include "packdata.h"
00006 
00038 
00062 template<class T>
00063 class packnode : public packdata<T> {
00064 
00065 private:
00066 
00068   packnode* leftChild;
00070   packnode* rightChild;
00071 
00073   T costVal;
00074 
00077   bool chosen;
00078 
00079 private:
00081   packnode( const packnode &rhs ) {};
00083   packnode() {};
00084 
00085 public:
00086 
00090   packnode( T *vec, 
00091             const size_t n, 
00092             const transformKind k ) : packdata<T>(vec, n, k)
00093   {
00094     leftChild = 0;
00095     rightChild = 0;
00096     costVal = 0.0;
00097     chosen = false;
00098   }
00099 
00100      
00102   T &operator[]( const size_t i )
00103   {
00104     assert( i < N );
00105     return data[i];
00106   }
00107 
00109   T operator[]( const size_t i ) const
00110   {
00111     assert( i < N );
00112     return data[i];
00113   }
00114 
00115 
00117   void prCost() const
00118   {
00119     printf("%7.4f\n", costVal );
00120   }
00121 
00122 
00126   void prBestBasis() const
00127   {
00128     for (int i = 0; i < N; i++) {
00129       printf("%7.4f ", data[i] );
00130     }
00131     if (chosen) {
00132       printf("  *");
00133     }
00134     printf("\n");
00135   } // prBestBasis
00136 
00137 
00139   void lhsChild( packnode *l ) { leftChild = l; }
00141   packnode *lhsChild(void) { return leftChild; }
00142 
00144   void rhsChild( packnode *r ) { rightChild = r; }
00146   packnode *rhsChild(void) { return rightChild; }
00147 
00149   void cost( T val ) { costVal = val; }
00151   T cost(void) { return costVal; }
00152 
00156   void mark( bool b ) { chosen = b; }
00158   bool mark() { return chosen; }
00159 
00160 }; // packnode
00161 
00162 #endif

Generated at Sat Aug 10 13:23:34 2002 for Wavelet Packet Transform and Lossless Compression by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001