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

📄 queuediagnose.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 4 页
字号:
// file: $isip/class/dstr/Queue/QueueDiagnose.h// version: $Id: QueueDiagnose.h,v 1.13 2000/12/16 22:05:59 duncan Exp $//// make sure definitions are only made once//#ifndef ISIP_QUEUE_DIAGNOSE#define ISIP_QUEUE_DIAGNOSE// isip include files//#ifndef ISIP_QUEUE#include <Queue.h>#endif// QueueDiagnose: a class that contains the diagnose method of Queue class.//template<class TObject>class QueueDiagnose : public Queue<TObject> {  //---------------------------------------------------------------------------  //  // public constants  //  //---------------------------------------------------------------------------public:    // define the class name  //    //----------------------------------------  //  // i/o related constants  //  //----------------------------------------      //----------------------------------------  //  // default values and arguments  //  //----------------------------------------  // default values  //      // default arguments to methods  //    //----------------------------------------  //  // error codes  //  //----------------------------------------      //---------------------------------------------------------------------------  //  // protected data  //  //---------------------------------------------------------------------------protected:  //---------------------------------------------------------------------------  //  // required public methods  //  //---------------------------------------------------------------------------public:  // method: name  //  static const String& name() {    return Queue<TObject>::name();  }  // other static methods  //  static boolean diagnose(Integral::DEBUG debug_level);  // debug methods  //  these methods are omitted since this class does not have data  //  members and operations    //    // destructor/constructor(s):  //  these methods are omitted since this class does not have data  //  members and operations  //  // assign methods:  //  these methods are omitted since this class does not have data  //  members and operations  //  // operator= methods:  //  these methods are omitted since this class does not have data  //  members and operations  //    // i/o methods:  //  these methods are omitted since this class does not have data  //  members and operations  //  // equality methods:  //  these methods are omitted since this class does not have data  //  members and operations  //  // memory-management methods:  //  these methods are omitted since this class does not have data  //  members and operations  //    //---------------------------------------------------------------------------  //  // class-specific public methods  //  //---------------------------------------------------------------------------  //  these methods are omitted since this class does not have data  //  members and operations  //    //---------------------------------------------------------------------------  //  // private methods  //  //---------------------------------------------------------------------------private:}; // below are all the methods for the QueueDiagnose template class////-----------------------------------------------------------------------------//// required static methods////-----------------------------------------------------------------------------// method: diagnose//// arguments://  Integral::DEBUG level: (input) debug level for diagnostics//// return: a boolean value indicating status//template<class TObject>boolean QueueDiagnose<TObject>::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/consturctor(s) in refernece mode  //  prepare all of the character items to use in this queue diagnose  //  we will use the letters of the english alphabet  //  long num_elem = 26;  Char** items = new Char*[num_elem];  for (long i = 0; i < num_elem; i++) {    items[i] = new Char((unichar)((long)(L'a') + i));  }  // check the constructors for allocating on the queue  //  Queue<Char> def_queue;                // default constructor  def_queue.add(items[0]);  def_queue.add(items[1]);  def_queue.add(items[2]);  setDebug(debug_level_d);    Queue<Char> copy_queue(def_queue);     // copy constructor  if (copy_queue.getAllocationMode() != SYSTEM) {    return Error::handle(name(), L"getAllocationMode", Error::TEST, __FILE__,			 __LINE__);  }    // the two constructed queues should have the same items in them now  //  if (def_queue.ne(copy_queue)) {    return Error::handle(name(), L"copy constructor", Error::TEST, __FILE__,			 __LINE__);  }  // check the constructors and destructors for allocating on the dynamic  // memory heap  //  Queue<Char>* def_dyn_queue = new Queue<Char>;  def_dyn_queue->add(items[0]);  def_dyn_queue->add(items[1]);  def_dyn_queue->add(items[2]);    Queue<Char>* copy_dyn_queue = new Queue<Char>(*def_dyn_queue);    // the two constructed queues should have the same items in them now  //  if (def_dyn_queue->ne(copy_queue)) {    return Error::handle(name(), L"copy constructor", Error::TEST, __FILE__,			 __LINE__);  }    // see if we can dynamically delete  //  delete def_dyn_queue;  delete copy_dyn_queue;  {    // test destructor/consturctor(s) in self-allocation mode    //  prepare all of the character items to use in this queue diagnose    //  we will use the letters of the english alphabet    //    Queue<Char> def_queue(USER);          // default constructor    def_queue.add(items[0]);    def_queue.add(items[1]);    def_queue.add(items[2]);        Queue<Char> copy_queue(def_queue);     // copy constructor        // the two constructed queues should have the same items in them now    //    if (def_queue.ne(copy_queue)) {      return Error::handle(name(), L"copy constructor", Error::TEST, __FILE__,			   __LINE__);    }        // check the constructors and destructors for allocating on the dynamic    // memory heap    //    Queue<Char>* def_dyn_queue = new Queue<Char>(USER);    def_dyn_queue->add(items[0]);    def_dyn_queue->add(items[1]);    def_dyn_queue->add(items[2]);        Queue<Char>* copy_dyn_queue = new Queue<Char>(*def_dyn_queue);        // the two constructed queues should have the same items in them now    //    if (def_dyn_queue->ne(copy_queue)) {      return Error::handle(name(), L"copy constructor", Error::TEST, __FILE__,			   __LINE__);    }        // see if we can dynamically delete    //    delete def_dyn_queue;    delete copy_dyn_queue;  }    // test large allocation construction and deletion in reference mode  //  if (level_a >= Integral::ALL) {        // output an informative message    //    Console::put(L"testing large chunk memory allocation and deletion\n");        // set the memory to a strange block size so we can hopefully catch any    // frame overrun errors    //    Queue<TObject>::setGrowSize((long)731);        // loop for a large number of times creating and deleting a large number    // of Queues at each loop    //    for (long j = 1; j <= 100; j++) {      Queue<Char>** queues = new Queue<Char>*[j * 100];            // create the items      //      for (long i = 0; i < j * 100; i++) {	queues[i] =  new Queue<Char>();      }            // delete lists      //      for (long i = (j * 100) - 1; i >= 0; i--) {	delete queues[i];      }            // clean up memory      //      delete [] queues;    }  }  {    // test large allocation construction and deletion in self-allocation mode    //    if (level_a >= Integral::ALL) {            // output an informative message      //      Console::put(L"testing large chunk memory allocation and deletion\n");            // set the memory to a strange block size so we can hopefully catch any      // frame overrun errors      //      Queue<TObject>::setGrowSize((long)731);            // loop for a large number of times creating and deleting a large number      // of Queues at each loop      //      for (long j = 1; j <= 100; j++) {	Queue<Char>** queues = new Queue<Char>*[j * 100];		// create the items	//	for (long i = 0; i < j * 100; i++) {	  queues[i] =  new Queue<Char>(USER);	}		// delete lists	//	for (long i = (j * 100) - 1; i >= 0; i--) {	  delete queues[i];	}		// clean up memory	//	delete [] queues;      }    }      }    // test assign methods in reference mode  //  Queue<Char> tmp_queue;  Queue<Char>* tmp_dyn_queue = new Queue<Char>;    // add all items onto the queue  //  tmp_queue.add(items, num_elem);    // try the list assign method  //  tmp_dyn_queue->assign(tmp_queue);    if (tmp_dyn_queue->ne(tmp_queue)) {    return Error::handle(name(), L"list assign", Error::TEST, __FILE__,			 __LINE__);  }  // clean up memory  //  delete tmp_dyn_queue;      {    // test assign methods in self-allocation mode    //    Queue<Char> tmp_queue(USER);    Queue<Char>* tmp_dyn_queue = new Queue<Char>(USER);        // add all items onto the queue    //    tmp_queue.add(items, num_elem);        // try the list assign method    //    tmp_dyn_queue->assign(tmp_queue);        if (tmp_dyn_queue->ne(tmp_queue)) {      return Error::handle(name(), L"list assign", Error::TEST, __FILE__,			   __LINE__);    }        // clean up memory    //    delete tmp_dyn_queue;  }    // testing i/o methods in self-allocation mode  //  String text_filename;  Integral::makeTemp(text_filename);  String bin_filename;  Integral::makeTemp(bin_filename);    // open files in write mode  //  Sof text_file;  text_file.open(text_filename, File::WRITE_ONLY, File::TEXT);  Sof bin_file;  bin_file.open(bin_filename, File::WRITE_ONLY, File::BINARY);    // prepare items for the lists  //  Char** write_chars = new Char*[5];  String** write_strings = new String*[5];    unichar tmp_char = L'a';    for (long i = 0; i < 5; i++) {    write_chars[i] = new Char(tmp_char);    write_strings[i] = new String();    tmp_char++;  }    write_strings[0]->assign(L"this ");

⌨️ 快捷键说明

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