// file: $isip/class/pr/PhoneticDecisionTreeNode/PhoneticDecisionTreeNode.h // version: $Id: PhoneticDecisionTreeNode.h 9263 2003-07-08 13:50:41Z alphonso $ // // make sure definitions are only made once // #ifndef ISIP_PHONETIC_DECISION_TREE_NODE #define ISIP_PHONETIC_DECISION_TREE_NODE #ifndef ISIP_SINGLE_LINKED_LIST #include #endif #ifndef ISIP_TRIPLE #include #endif #ifndef ISIP_LONG #include #endif #ifndef ISIP_BOOLEAN #include #endif #ifndef ISIP_STATISTICAL_MODEL #include #endif #ifndef ISIP_HASH_TABLE #include #endif #ifndef ISIP_STRING #include #endif // PhoneticDecisionTreeNode: A class to store phonetic information for // each statistical-model // class PhoneticDecisionTreeNode { //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; static const String PARAM_DATAPOINTS; static const String PARAM_BEST_ATTRIBUTE; static const String PARAM_TYPICAL_INDEX; static const String PARAM_ACTUAL_INDEX; static const String PARAM_TYPICAL_STAT_MODEL; static const String PARAM_FLAG_EXISTS; //---------------------------------------- // // other important constants // //---------------------------------------- typedef Triple > DataPoint; typedef SingleLinkedList Data; //---------------------------------------- // // default values and arguments // //---------------------------------------- // define default values for the typical statistical-model index // static const int32 DEF_TYPICAL_INDEX = -1; // define default values for the actual statistical-model index // static const int32 DEF_ACTUAL_INDEX = -1; // define default values for this flag // static const bool DEF_FLAG_EXISTS = true; //--------------------------------------- // // error codes // //--------------------------------------- static const int32 ERR = 00100400; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // define the datapoints // Data datapoints_d; // define the best attribute that is used to split this node // String best_attribute_d; // define the typical statistical-mode index that represents this // node. this gets update during merging // Long typical_index_d; // define the actual statistical-mode index that represents this node // Long actual_index_d; // define the typical statistical-model that represents this node // StatisticalModel typical_stat_model_d; // define flag represents if this node exists or it is merged with // some other node // Boolean flag_exists_d; // define a static debug level // static Integral::DEBUG debug_level_d; // define a static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } // method: diagnose // static bool8 diagnose(Integral::DEBUG debug_level); // method: debug // bool8 debug(const unichar* message) const; // method: setDebug // static bool8 setDebug(Integral::DEBUG debug_level) { debug_level_d = debug_level; return true; } // method: destructor // ~PhoneticDecisionTreeNode() { if (debug_level_d >= Integral::ALL) { String out(L" Destructor of phonetic-decision-tree node: "); out.concat(this); out.concat("\n"); Console::put(out); } } // constructor(s) // PhoneticDecisionTreeNode(); PhoneticDecisionTreeNode(const PhoneticDecisionTreeNode& copy_node); // assign methods // bool8 assign(const PhoneticDecisionTreeNode& copy_node); // method: sofSize // int32 sofSize() const; // method: read // bool8 read(Sof& sof, int32 tag, const String& cname = CLASS_NAME); // method: write // bool8 write(Sof& sof, int32 tag, const String& cname = CLASS_NAME) const; // method: readData // bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false); // method: writeData // bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const; // equality method // bool8 eq(const PhoneticDecisionTreeNode& compare_node) const; // 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 methods // bool8 clear(Integral::CMODE ctype = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: setDataPoints // bool8 setDataPoints(Data& arg) { datapoints_d = arg; return true; } // method: getDataPoints // Data& getDataPoints() const { return const_cast(datapoints_d); } // method: setBestAttribute // bool8 setBestAttribute(String& arg) { best_attribute_d = arg; return true; } // method: getBestAttribute // String& getBestAttribute() const { return const_cast(best_attribute_d); } // method: setTypicalIndex // bool8 setTypicalIndex(Long arg) { typical_index_d = arg; return true; } // method: getTypicalIndex // Long getTypicalIndex() const { return typical_index_d; } // method: setActualIndex // bool8 setActualIndex(Long arg) { actual_index_d = arg; return true; } // method: getActualIndex // Long getActualIndex() const { return actual_index_d; } // method: setTypicalStatModel // bool8 setTypicalStatModel(StatisticalModel& arg) { typical_stat_model_d = arg; return true; } // method: getTypicalStatModel // StatisticalModel& getTypicalStatModel() const { return const_cast(typical_stat_model_d); } // method: setFlagExists // bool8 setFlagExists(Boolean arg) { flag_exists_d = arg; return true; } // method: getFlagExists // Boolean getFlagExists() const { return flag_exists_d; } //--------------------------------------------------------------------------- // // class-specific public methods: // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; // end of include file // #endif