⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdtnod_02.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
字号:
// file: $isip/class/pr/PhoneticDecisionTreeNode/pdtnod_02.cc// version: $Id: pdtnod_02.cc,v 1.2 2002/12/05 21:22:52 parihar Exp $//// isip include files//#include "PhoneticDecisionTreeNode.h"// method: diagnose//// arguments://  Integral::DEBUG level: (input) debug level for diagnostics//// return: logical error status//// this is the diagnostics method//boolean PhoneticDecisionTreeNode::diagnose(Integral::DEBUG level_a) {  //----------------------------------------------------------------------  //  // 0. preliminaries  //  //----------------------------------------------------------------------  // output the class name  //  if (level_a > Integral::NONE) {    SysString output(L"diagnosing class ");    output.concat(CLASS_NAME);    output.concat(L": ");    Console::put(output);    Console::increaseIndention();  }  //---------------------------------------------------------------------  //  // 1. required public methods  //  //---------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing required public methods...\n");    Console::increaseIndention();  }  // test destructor/constructor(s) and memory management  //  PhoneticDecisionTreeNode pdtn0;  PhoneticDecisionTreeNode pdtn1(pdtn0);    if (!pdtn1.eq(pdtn0)) {    return Error::handle(name(), L"copy constructor", Error::TEST,			 __FILE__, __LINE__);  }    // test large allocation construction and deletion  //  if (level_a == Integral::ALL) {        Console::put(L"\ntesting large chunk memory allocation and deletion:\n");        // set the memory to a strange block size so we can hopefully catch any    // frame overrun errors    //    PhoneticDecisionTreeNode::setGrowSize((long)500);        PhoneticDecisionTreeNode* pdtn = new PhoneticDecisionTreeNode();    for (long j = 1; j <= 100; j++) {      PhoneticDecisionTreeNode** pdtns	= new PhoneticDecisionTreeNode*[j * 100];            // create the objects      //      for (long i = 0; i < j * 100; i++) {	pdtns[i] = new PhoneticDecisionTreeNode();      }            // delete objects      //      for (long i = (j * 100) - 1; i >= 0; i--) {	delete pdtns[i];      }            delete [] pdtns;    }        delete pdtn;  }  // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }  //---------------------------------------------------------------------  //  // 2. class-specific public methods  //  //---------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods...\n");    Console::increaseIndention();   }  // we need binary and text sof files  //  String tmp_filename0;  Integral::makeTemp(tmp_filename0);  String tmp_filename1;  Integral::makeTemp(tmp_filename1);  // open files in write mode  //  Sof tmp_file0;  tmp_file0.open(tmp_filename0, File::WRITE_ONLY, File::TEXT);  Sof tmp_file1;  tmp_file1.open(tmp_filename1, File::WRITE_ONLY, File::BINARY);  pdtn0.write(tmp_file0, (long)0);    // close the files  //  tmp_file0.close();  tmp_file1.close();  // open the files in read mode  //  tmp_file0.open(tmp_filename0);  tmp_file1.open(tmp_filename1);  // read the object back  //  pdtn1.read(tmp_file0, (long)0);  if (!pdtn0.eq(pdtn1)) {    return Error::handle(name(), L"i/o", Error::TEST,			 __FILE__, __LINE__);  }      pdtn1.read(tmp_file1, (long)0);  if (!pdtn0.eq(pdtn1)) {    return Error::handle(name(), L"i/o", Error::TEST,			 __FILE__, __LINE__);  }    // close and delete the temporary files  //  tmp_file0.close();  tmp_file1.close();  File::remove(tmp_filename0);  File::remove(tmp_filename1);  // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    //---------------------------------------------------------------------  //  // 3. print completion message  //  //---------------------------------------------------------------------  // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    if (level_a > Integral::NONE) {    SysString output(L"diagnostics passed for class");    output.concat(name());    output.concat(L"\n");    Console::put(output);  }    // exit gracefully  //  return true;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -