00001 00002 #ifndef _COSTBASE_INT_H_ 00003 #define _COSTBASE_INT_H_ 00004 00005 #include "packnode.h" 00006 00039 00040 00065 00066 class costbase_int 00067 { 00068 private: 00070 costbase_int( const costbase_int &rhs ) {} 00071 00072 protected: 00077 void traverse( packnode<int> *node ) 00078 { 00079 if (node != 0) { 00080 int cost = costCalc( node ); 00081 node->cost( cost ); 00082 00083 traverse( node->lhsChild() ); 00084 traverse( node->rhsChild() ); 00085 } 00086 } // traverse 00087 00089 virtual int costCalc(packnode<int> *node) = 0; 00090 00091 public: 00093 costbase_int() {} 00094 00095 }; // costbase_int 00096 00097 #endif