// file: $isip/class/search/SearchNode/snod_08.cc // version: $Id: snod_08.cc 8444 2002-07-24 17:06:49Z huang $ // // isip include files // #include "SearchNode.h" #include #include #include // method: setSymbolId // // arguments: // int32 symbol_id: (input) the input symbol id // // return: a bool8 value indicating status // // this method sets the symbol id for this node // bool8 SearchNode::setSymbolId(int32 symbol_id_a) { // make sure the search level has been initialized // if (level_d == (SearchLevel*)NULL) { return Error::handle(name(), L"setSymbolId", Error::ARG, __FILE__, __LINE__); } // check with the search level to make sure this is a valid symbol and // assign the symbol id // if ( !level_d->isDummySymbol(symbol_id_a) ){ return (level_d->isValidSymbol(symbol_id_a) && symbol_id_d.assign(symbol_id_a)); } // if this is a dummy symbol index // if ( symbol_id_a >= 0 ){ symbol_id_a = DEF_DUMMY_SYMBOL_ID - symbol_id_a; } return symbol_id_d.assign(symbol_id_a); } // method: setSymbol // // arguments: // const SearchSymbol& symbol: (input) the input symbol // // return: a bool8 indicating status // // this method sets the symbol for this node // bool8 SearchNode::setSymbol(const SearchSymbol& symbol_a) { // make sure the search level has been initialized // if (level_d == (SearchLevel*)NULL) { return Error::handle(name(), L"setSymbol", Error::ARG, __FILE__, __LINE__); } // get symbol id first // int32 symbol_id = level_d->getSymbolIndex(symbol_a); return setSymbolId(symbol_id); } // method: getSymbol // // arguments: // SearchSymbol& output_symbol: (output) the symbol to lookup // // return: logical error status // // this method gets the symbol from this node // bool8 SearchNode::getSymbol(SearchSymbol& output_symbol_a) const { // make sure the search level has been initialized // if (level_d == (SearchLevel*)NULL) { return Error::handle(name(), L"getSymbol", Error::ARG, __FILE__, __LINE__); } int32 index = getSymbolId(); // return the symbol // return level_d->getSymbol(output_symbol_a, index); }