00001 00002 #ifndef _COSTBASE_H_ 00003 #define _COSTBASE_H_ 00004 00005 #include "packnode.h" 00006 00039 00040 00067 00068 class costbase 00069 { 00070 private: 00072 costbase( const costbase &rhs ) {} 00073 00074 protected: 00079 void traverse( packnode<double> *node ) 00080 { 00081 if (node != 0) { 00082 double cost = costCalc( node ); 00083 node->cost( cost ); 00084 00085 traverse( node->lhsChild() ); 00086 traverse( node->rhsChild() ); 00087 } 00088 } // traverse 00089 00091 virtual double costCalc(packnode<double> *node) = 0; 00092 00093 public: 00095 costbase() {} 00096 00097 }; // costbase 00098 00099 #endif