// file: $isip/class/search/NBestNode/NBestNode.h // version: $Id: NBestNode.h 9330 2003-10-30 22:03:17Z alphonso $ // // make sure definitions are only made once // #ifndef ISIP_NBEST_NODE #define ISIP_NBEST_NODE #ifndef ISIP_DOUBLE #include #endif #ifndef ISIP_SYMBOL_GRAPH_NODE #include #endif // NBestNode: a class to represent the location in the n-best search // class NBestNode { //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; //---------------------------------------- // // default values and arguments // //---------------------------------------- // default values // static const float32 DEF_PATH_SCORE = 0.0; //--------------------------------------- // // error codes // //--------------------------------------- //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // define the symbol graph node associated with this node // SymbolGraphNode* symbol_node_d; // define the backpointer // NBestNode* prev_node_d; // define the path score // Float path_score_d; // define a static memory manager // static MemoryManager mgr_d; // define a static debug level // static Integral::DEBUG debug_level_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } // other static methods // static bool8 diagnose(Integral::DEBUG debug_level); // method: setDebug // static bool8 setDebug(Integral::DEBUG debug_level) { debug_level_d = debug_level; return true; } // method: destructor // ~NBestNode() { clear(); } // method: default constructor // NBestNode() { symbol_node_d = (SymbolGraphNode*)NULL; prev_node_d = (NBestNode*)NULL; path_score_d = DEF_PATH_SCORE; } // method: constructor // NBestNode(SymbolGraphNode* sym_node, NBestNode* nbst_node, float32 score) { symbol_node_d = sym_node; prev_node_d = nbst_node; path_score_d = score; } // method: copy constructor // NBestNode(const NBestNode& copy_sym) { assign(copy_sym); } // method: assign // bool8 assign(const NBestNode& copy_node) { return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__); } // method: operator= // NBestNode& operator=(const NBestNode& arg) { assign(arg); return *this; } // method: sofSize // int32 sofSize() const { return Error::handle(name(), L"sofSize", Error::ARG, __FILE__, __LINE__); } // method: read // bool8 read(Sof& sof, int32 tag, const String& cname = CLASS_NAME) { return Error::handle(name(), L"read", Error::ARG, __FILE__, __LINE__); } // method: readData // bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false) { return Error::handle(name(), L"readData", Error::ARG, __FILE__, __LINE__); } // method: write // bool8 write(Sof& sof, int32 tag, const String& cname = CLASS_NAME) const { return Error::handle(name(), L"write", Error::ARG, __FILE__, __LINE__); } // method: writeData // bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const { return Error::handle(name(), L"writeData", Error::ARG, __FILE__, __LINE__); } // method: eq // bool8 eq(const NBestNode& obj) const { return (this == &obj); } // method: new // static void* operator new(size_t size) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t size) { return mgr_d.getBlock(size); } // method: delete // static void operator delete(void* ptr) { mgr_d.release(ptr); } // method: delete[] // static void operator delete[](void* ptr) { mgr_d.releaseBlock(ptr); } // method: setGrowSize // static bool8 setGrowSize(int32 grow_size) { return mgr_d.setGrow(grow_size); } // clear method // bool8 clear(Integral::CMODE ctype = Integral::DEF_CMODE) { symbol_node_d = (SymbolGraphNode*)NULL; prev_node_d = (NBestNode*)NULL; path_score_d = DEF_PATH_SCORE; return true; } //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: setSymbolNode // bool8 setSymbolNode(SymbolGraphNode* arg) { symbol_node_d = arg; return true; } // method: getSymbolNode // SymbolGraphNode* getSymbolNode() const { return symbol_node_d; } // method: setPrevNode // bool8 setPrevNode(NBestNode* arg) { prev_node_d = arg; return true; } // method: getPrevNode // NBestNode* getPrevNode() const { return prev_node_d; } // method: setPathScore // bool8 setPathScore(float32 arg) { path_score_d = arg; return true; } // method: getPathScore // float32 getPathScore() const { return path_score_d; } //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; // end of include file // #endif