// file: $isip/class/pr/RegressionDecisionTreeNode/rdtnod_04.cc // version: $Id: rdtnod_04.cc 9459 2004-04-19 16:06:08Z gao $ // // isip include files // #include "RegressionDecisionTreeNode.h" // method: sofSize // // arguments: none // // return: size of object // // this method returns the size of the object in the Sof file and is // used for binary write // int32 RegressionDecisionTreeNode::sofSize() const { // start with the space required for the datapoints // int32 bytes = gaussian_models_d.sofSize(); // add the space required for the average mean // bytes += average_mean_d.sofSize(); // add the space required for average mean // bytes += average_mean_d.sofSize(); // add the space required for the culster score // bytes += cluster_score_d.sofSize(); // add the space required for the culster accumulation // bytes += cluster_accumulate_d.sofSize(); // add the space required for the number of components // bytes += number_components_d.sofSize(); // add the space required for the node index // bytes += node_index_d.sofSize(); // add the space required for the average covariance // bytes += average_covariance_d.sofSize(); // add the space required for the speech flag // bytes += speech_flag_d.sofSize(); // add the space required for the split flag // bytes += split_flag_d.sofSize(); // add the space required for the parent node index // bytes += parent_node_index_d.sofSize(); // add the space required for the transform flag // bytes += transform_flag_d.sofSize(); // add the space required for the debug level // bytes += debug_level_d.sofSize(); // return the size // return bytes; } // method: write // // arguments: // Sof& sof: (input) sof file object // int32 tag: (input) sof object instance tag // const String& name: (input) sof object instance name // // return: bool8 value indicating status // // this method has the object write itself to an Sof file // bool8 RegressionDecisionTreeNode::write(Sof& sof_a, int32 tag_a, const String& name_a) const { int32 obj_size = 0; // write the instance of the object into the Sof file // if (sof_a.isText()) { // set the size to by dynamic // obj_size = Sof::ANY_SIZE; } else { // the size index and the size of each element // obj_size = sofSize(); } // write the object into the sof file's index // if (!sof_a.put(name_a, tag_a, obj_size)) { return false; } // exit gracefully // return writeData(sof_a); } // method: writeData // // arguments: // Sof& sof: (input) sof file object // const String& pname: (input) parameter name // // return: bool8 value indicating status // // this method has the object write itself to an Sof file. it assumes // that the Sof file is already positioned correctly. // bool8 RegressionDecisionTreeNode::writeData(Sof& sof_a, const String& pname_a) const { // write a start string if necessary // sof_a.writeLabelPrefix(pname_a); // write the datapoints // gaussian_models_d.writeData(sof_a, PARAM_DATAPOINTS); // write the average mean for this node // average_mean_d.writeData(sof_a, PARAM_AVERAGE_MEAN); // write the cluster score for this node // cluster_score_d.writeData(sof_a, PARAM_CLUSTER_SCORE); // write the cluster accumulation value for this node // cluster_accumulate_d.writeData(sof_a, PARAM_CLUSTER_ACCUMULATE); // write the node number of components // number_components_d.writeData(sof_a, PARAM_NUMBER_COMPONENTS); // write the node index // node_index_d.writeData(sof_a, PARAM_NODE_INDEX); // write the node average covariance // average_covariance_d.writeData(sof_a, PARAM_AVERAGE_COVARIANCE); // write the node speech flag // speech_flag_d.writeData(sof_a, PARAM_SPEECH_FLAG); // write the node split flag // split_flag_d.writeData(sof_a, PARAM_SPLIT_FLAG); // write the parent node index // parent_node_index_d.writeData(sof_a, PARAM_PARENT_NODE_INDEX); // write the node transform flag // transform_flag_d.writeData(sof_a, PARAM_TRANSFORM_FLAG); // write the node statistical models // stat_models_d.writeData(sof_a, PARAM_STAT_MODELS); // write the node w transform matrix // w_transform_d.writeData(sof_a, PARAM_W_TRANSFORM); // put an end string if necessary // sof_a.writeLabelSuffix(pname_a); // write the debug level // debug_level_d.writeData(sof_a, PARAM_DBGL); // exit gracefully // return true; }