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

📄 queuediagnose.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 4 页
字号:
  write_strings[1]->assign(L"is");  write_strings[2]->assign(L"a");  write_strings[3]->assign(L"Queue");  write_strings[4]->assign(L"String");    // create queues to write  //  Queue<Char> write_char_queue;  write_char_queue.add(write_chars, 5);    Queue<String> write_str_queue;  write_str_queue.add(write_strings, 5);    Queue<Queue<Char > > write_char_queue_queue;    Queue<Queue<Queue<Char > > > write_char_sss;    // create objects for reading in  //  Queue<Char> read_char_queue_text;  Queue<Char> read_char_queue_bin;  Queue<String> read_str_queue_text;  Queue<String> read_str_queue_bin;    Queue<Queue<Char > > read_char_queue_queue_bin;  Queue<Queue<Char > > read_char_queue_queue_text;    Queue<Queue<Queue<Char > > > read_char_sss_bin;  Queue<Queue<Queue<Char > > > read_char_sss_text;    Queue<Queue<Char > >* wc_ss_0 = new Queue<Queue<Char > >;  Queue<Queue<Char > >* wc_ss_1 = new Queue<Queue<Char > >;    long s1 = 2;  long s2 = 5;    for (long i = 0; i < s1; i++) {        Queue<Char>* temp = new Queue<Char>;        Queue<Char>* t1 = new Queue<Char>;    Queue<Char>* t2 = new Queue<Char>;        for (long j = 0; j < s2; j++) {      Char* c1 = new Char();      Char* c2 = new Char();      Char* c3 = new Char();            c1->assign((unichar)(i * (s2+1) + j + (int)'A'));      c2->assign((unichar)(i * (s2+1) + j + (int)'A'));      c3->assign((unichar)(i * (s2+1) + j + (int)'a'));            temp->add(c1);      t1->add(c2);      t2->add(c3);            delete c1;      delete c2;      delete c3;    }        write_char_queue_queue.add(temp);    wc_ss_0->add(t1);    wc_ss_1->add(t2);        delete temp;    delete t1;    delete t2;  }    // 10 channel vector data  //  s1 = 3;  s2 = 20;    write_char_sss.add(wc_ss_0);  write_char_sss.add(wc_ss_1);    // write the values  //  write_char_queue.write(text_file, (long)0);  write_char_queue.write(bin_file, (long)0);      write_str_queue.write(text_file, (long)0);  write_str_queue.write(bin_file, (long)0);      write_char_queue_queue.write(text_file, (long)0);  write_char_queue_queue.write(bin_file, (long)0);      write_char_sss.write(text_file, (long)0);  write_char_sss.write(bin_file, (long)0);      // close the files  //  text_file.close();  bin_file.close();    // open the files in read mode  //  text_file.open(text_filename);  bin_file.open(bin_filename);    // read in the lists and test for equivalence  //  if (!read_char_queue_text.read(text_file, (long)0) ||      (read_char_queue_text.ne(write_char_queue))) {    return Error::handle(name(), L"read char text", Error::TEST, __FILE__,			 __LINE__);  }    if (!read_str_queue_text.read(text_file, (long)0) ||      (read_str_queue_text.ne(write_str_queue))) {    return Error::handle(name(), L"read str text", Error::TEST, __FILE__, 			 __LINE__);  }    if (!read_char_queue_bin.read(bin_file, (long)0) ||      (read_char_queue_bin.ne(write_char_queue))) {    return Error::handle(name(), L"write char bin", Error::TEST, __FILE__,			 __LINE__);  }    if (!read_str_queue_bin.read(bin_file, (long)0) ||      (read_str_queue_bin.ne(write_str_queue))) {    return Error::handle(name(), L"write str bin", Error::TEST, __FILE__,			 __LINE__);  }    if (!read_char_queue_queue_text.read(text_file, (long)0) ||      (read_char_queue_queue_text.ne(write_char_queue_queue))) {    return Error::handle(name(), L"read chr chr text", Error::TEST, __FILE__, 			 __LINE__);  }    if (!read_char_queue_queue_bin.read(bin_file, (long)0) ||      (read_char_queue_queue_bin.ne(write_char_queue_queue))) {    return Error::handle(name(), L"read chr chr bin", Error::TEST, __FILE__, 			 __LINE__);  }    if (!read_char_sss_text.read(text_file, (long)0) ||      (read_char_sss_text.ne(write_char_sss))) {    return Error::handle(name(), L"read chr chr chr text", Error::TEST,			 __FILE__, __LINE__);  }    if (!read_char_sss_bin.read(bin_file, (long)0) ||      (read_char_sss_bin.ne(write_char_sss))) {    return Error::handle(name(), L"read chr chr bin", Error::TEST, __FILE__, 			 __LINE__);  }    // close and delete the temporary files  //  text_file.close();  bin_file.close();  File::remove(text_filename);  File::remove(bin_filename);    // cleanup the memory that was created by the Queue read  //  read_char_queue_text.clear(Integral::FREE);  read_char_queue_bin.clear(Integral::FREE);  read_str_queue_text.clear(Integral::FREE);  read_str_queue_bin.clear(Integral::FREE);    // delete things from the nested queues  //  Queue<Char> temp_queue2;  while (write_char_queue_queue.remove(&temp_queue2) != (Queue<Char>*)NULL) {    Char temp_char1;    while ((temp_queue2.remove(&temp_char1)) != (Char*)NULL) {    }  }    while (read_char_queue_queue_bin.remove(&temp_queue2)	!= (Queue<Char>*)NULL) {    Char temp_char1;    while ((temp_queue2.remove(&temp_char1)) != (Char*)NULL) {    }  }    while (read_char_queue_queue_text.remove(&temp_queue2)	!= (Queue<Char>*)NULL) {    Char temp_char1;    while ((temp_queue2.remove(&temp_char1)) != (Char*)NULL) {    }  }    // delete things from the triple-nested queues  //  Queue< Queue<Char> > temp_ss;  while(write_char_sss.remove(&temp_ss) != (Queue< Queue<Char> >*)NULL) {    Queue<Char> temp_s;    while (temp_ss.remove(&temp_s) != (Queue<Char>*)NULL) {      Char temp_char1;      while (temp_s.remove(&temp_char1) != (Char*)NULL) {      }    }  }    while(read_char_sss_text.remove(&temp_ss) != (Queue< Queue<Char> >*)NULL) {    Queue<Char> temp_s;    while (temp_ss.remove(&temp_s) != (Queue<Char>*)NULL) {      Char temp_char1;      while (temp_s.remove(&temp_char1) != (Char*)NULL) {      }    }  }    while(read_char_sss_bin.remove(&temp_ss) != (Queue< Queue<Char> >*)NULL) {    Queue<Char> temp_s;    while (temp_ss.remove(&temp_s) != (Queue<Char>*)NULL) {      Char temp_char1;      while (temp_s.remove(&temp_char1) != (Char*)NULL) {      }    }  }    // cleanup dynamically allocated memory  //  for (long i = 0; i < 5; i++) {    delete  write_chars[i];    delete write_strings[i];  }    delete [] write_chars;  delete [] write_strings;    delete wc_ss_0;  delete wc_ss_1;    {    // testing i/o methods for reference 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 ");    write_strings[1]->assign(L"is");    write_strings[2]->assign(L"a");    write_strings[3]->assign(L"Queue");    write_strings[4]->assign(L"String");        // create queues to write    //    Queue<Char> write_char_queue(USER);    write_char_queue.add(write_chars, 5);        Queue<String> write_str_queue(USER);    write_str_queue.add(write_strings, 5);        Queue<Queue<Char > > write_char_queue_queue(USER);        Queue<Queue<Queue<Char > > > write_char_sss(USER);        Queue<Queue<Char > >* wc_ss_0 = new Queue<Queue<Char > >(USER);    Queue<Queue<Char > >* wc_ss_1 = new Queue<Queue<Char > >(USER);        // create objects for reading in    //    Queue<Char> read_char_queue_text(USER);    Queue<Char> read_char_queue_bin(USER);    Queue<String> read_str_queue_text(USER);    Queue<String> read_str_queue_bin(USER);    Queue<Queue<Char > > read_char_queue_queue_bin(USER);        Queue<Queue<Char > > read_char_queue_queue_text(USER);        Queue<Queue<Queue<Char > > > read_char_sss_bin(USER);    Queue<Queue<Queue<Char > > > read_char_sss_text(USER);        long s1 = 2;    long s2 = 5;        for (long i = 0; i < s1; i++) {            Queue<Char>* temp = new Queue<Char>(USER);            Queue<Char>* t1 = new Queue<Char>(USER);      Queue<Char>* t2 = new Queue<Char>(USER);            for (long j = 0; j < s2; j++) {	Char* c1 = new Char();	Char* c2 = new Char();	Char* c3 = new Char();		c1->assign((unichar)(i * (s2+1) + j + (int)'A'));	c2->assign((unichar)(i * (s2+1) + j + (int)'A'));	c3->assign((unichar)(i * (s2+1) + j + (int)'a'));		temp->add(c1);		t1->add(c2);	t2->add(c3);      }            write_char_queue_queue.add(temp);      wc_ss_0->add(t1);      wc_ss_1->add(t2);    }        // 10 channel vector data    //    s1 = 3;    s2 = 20;        write_char_sss.add(wc_ss_0);    write_char_sss.add(wc_ss_1);        // write the values    //    write_char_queue.write(text_file, (long)0);    write_char_queue.write(bin_file, (long)0);          write_str_queue.write(text_file, (long)0);    write_str_queue.write(bin_file, (long)0);          write_char_queue_queue.write(text_file, (long)0);    write_char_queue_queue.write(bin_file, (long)0);          write_char_sss.write(text_file, (long)0);    write_char_sss.write(bin_file, (long)0);          // close the files    //    text_file.close();    bin_file.close();        // open the files in read mode    //    text_file.open(text_filename);    bin_file.open(bin_filename);        // read in the lists and test for equivalence    //    if (!read_char_queue_text.read(text_file, (long)0) ||	(read_char_queue_text.ne(write_char_queue))) {      return Error::handle(name(), L"read char text", Error::TEST, __FILE__,			   __LINE__);    }        if (!read_str_queue_text.read(text_file, (long)0) ||	(read_str_queue_text.ne(write_str_queue))) {      return Error::handle(name(), L"read str text", Error::TEST, __FILE__, 			   __LINE__);    }        if (!read_char_queue_bin.read(bin_file, (long)0) ||	(read_char_queue_bin.ne(write_char_queue))) {      return Error::handle(name(), L"write char bin", Error::TEST, __FILE__,			   __LINE__);    }        if (!read_str_queue_bin.read(bin_file, (long)0) ||	(read_str_queue_bin.ne(write_str_queue))) {      return Error::handle(name(), L"write str bin", Error::TEST, __FILE__,			   __LINE__);    }        if (!read_char_queue_queue_text.read(text_file, (long)0) ||	(read_char_queue_queue_text.ne(write_char_queue_queue))) {      return Error::handle(name(), L"read chr chr text", Error::TEST,			   __FILE__, __LINE__);    }        if (!read_char_queue_queue_bin.read(bin_file, (long)0) ||	(read_char_queue_queue_bin.ne(write_char_queue_queue))) {      return Error::handle(name(), L"read chr chr bin", Error::TEST, __FILE__, 			   __LINE__);    }        if (!read_char_sss_text.read(text_file, (long)0) ||	(read_char_sss_text.ne(write_char_sss))) {      return Error::handle(name(), L"read chr chr chr text", Error::TEST,			   __FILE__, __LINE__);    }        if (!read_char_sss_bin.read(bin_file, (long)0) ||	(read_char_sss_bin.ne(write_char_sss))) {      return Error::handle(name(), L"read chr chr bin", Error::TEST, __FILE__, 			   __LINE__);    }        // close and delete the temporary files    //    text_file.close();    bin_file.close();    File::remove(text_filename);    File::remove(bin_filename);        // cleanup the memory that was created by the Queue read    //    read_char_queue_text.clear(Integral::FREE);    read_char_queue_bin.clear(Integral::FREE);    read_str_queue_text.clear(Integral::FREE);    read_str_queue_bin.clear(Integral::FREE);        // delete things from the nested queues    //    Queue<Char>* temp_queue2;        while ((temp_queue2 = write_char_queue_queue.remove())	  != (Queue<Char>*)NULL) {            Char* temp_char;      

⌨️ 快捷键说明

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