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

📄 vectordiagnose.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 4 页
字号:
    write_null_vector.sofSize() + write_llist_vector.sofSize();    text_file.put(object, 0, -1);  bin_file.put(object, 0, obj_size);  text_file.writeLabelPrefix(String::EMPTY);  write_char_vector.writeData(text_file, pname0);  write_char_vector.writeData(bin_file, pname0);  write_null_vector.writeData(text_file, pname1);  write_null_vector.writeData(bin_file, pname1);  write_llist_vector.writeData(text_file, pname2);  write_llist_vector.writeData(bin_file, pname2);    text_file.writeLabelSuffix(String::EMPTY);  // clear methods are tested at the end of the diagnose method  //    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }  //--------------------------------------------------------------------------  //  // 2. class-specific public methods:  //     extensions to required methods  //  //--------------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: extensions to required methods...\n");    Console::increaseIndention();  }  text_file.put(write_str_vector.name(), 1, -1);  bin_file.put(write_str_vector.name(), 1, write_str_vector.sofSize());        long pos_text = write_str_vector.writeStart(text_file);  long pos_bin = write_str_vector.writeStart(bin_file);  write_str_vector.writePartialData(text_file, 0, 2);  write_str_vector.writePartialData(text_file, 2, 2);  write_str_vector.writeTerminate(text_file);  write_str_vector.writePartialData(bin_file, 0, 2);  write_str_vector.writePartialData(bin_file, 2, 1);  write_str_vector.writeTerminate(bin_file);    text_file.put(float_vec.name(), 7, -1);  pos_text = float_vec.writeStart(text_file);    float_vec.writePartialData(text_file, 0, 50);  for (long i = 0; i < 30; i++) {    float_vec.writePartialData(text_file, 50 + i * 100, 100);  }    float_vec.writeTerminate(text_file);    bin_file.put(float_vec.name(), 7, float_vec.sofSize());  pos_bin = float_vec.writeStart(bin_file);  float_vec.writePartialData(bin_file, 0, 50);  for (long i = 0; i < 30; i++) {    float_vec.writePartialData(bin_file, 50 + i * 100, 100);  }  float_vec.writeTerminate(bin_file);      text_file.put(float_vec.name(), 8, -1);  pos_text = float_vec.writeStart(text_file);    float_vec.writePartialData(text_file, 0, 50);  for (long i = 0; i < 30; i++) {    float_vec.writePartialData(text_file, 50 + i * 100, 100);  }    float_vec.writeTerminate(text_file);    bin_file.put(float_vec.name(), 8, float_vec.sofSize());  pos_bin = float_vec.writeStart(bin_file);    float_vec.writePartialData(bin_file, 0, 100);    for (long i = 1; i < 30; i++) {    float_vec.writePartialData(bin_file, i * 100, 100);  }    float_vec.writePartialData(bin_file, 3000, 50);  float_vec.writeTerminate(bin_file);    // close the files  //  text_file.close();  bin_file.close();  if (level_a > Integral::BRIEF) {    write_llist_vector.debug(L"write_llist_vector");  }    // open the files in read mode  //  text_file.open(text_filename);  bin_file.open(bin_filename);  // read the vector written by partial write   //  Vector<String> read_part_str_text;  read_part_str_text.read(text_file, (long)1);  if (level_a > Integral::BRIEF) {    read_part_str_text.debug(L"read_part_str");  }    Vector<String> read_part_str_bin;  read_part_str_bin.read(bin_file, (long)1);  if (level_a > Integral::BRIEF) {      read_part_str_bin.debug(L"read_part_bin");  }    // create objects for reading in  //  Vector<Char> read_null_vector_text;  Vector<Char> read_null_vector_bin;  Vector<Char> read_char_vector_text;  Vector<Char> read_char_vector_bin;  Vector<String> read_str_vector_text;  Vector<String> read_str_vector_bin;  Vector<Float> read_float_vec_text;  Vector<Float> read_float_vec_bin;  Vector< DoubleLinkedList<Char> > read_llist_vector_text;  Vector< DoubleLinkedList<Char> > read_llist_vector_bin;  Vector< Vector<Char> > read_char_vec_vector_text;  Vector< Vector<Char> > read_char_vec_vector_bin;  // read in the vectors and test for equivalence  // if there is error, print out the vectors  //  if (!read_null_vector_text.read(text_file, (long)10) ||      (read_null_vector_text.ne(write_null_vector))) {    read_null_vector_text.debug(L"read_null_vector_text");    return Error::handle(name(), L"read null char text", Error::TEST, __FILE__,			 __LINE__);  }    if (!read_null_vector_bin.read(bin_file, (long)10) ||      (read_null_vector_bin.ne(write_null_vector))) {    return Error::handle(name(), L"read null char bin", Error::TEST, __FILE__,			 __LINE__);  }    if (!read_char_vector_text.read(text_file, (long)0) ||      (read_char_vector_text.ne(write_char_vector))) {    return Error::handle(name(), L"read char text", Error::TEST, __FILE__,			 __LINE__);  }    if (!read_char_vector_bin.read(bin_file, (long)0) ||      (read_char_vector_bin.ne(write_char_vector))) {    return Error::handle(name(), L"read char bin", Error::TEST, __FILE__,			 __LINE__);  }    if (!read_str_vector_text.read(text_file, (long)0) ||      (read_str_vector_text.ne(write_str_vector))) {    return Error::handle(name(), L"read str text", Error::TEST, __FILE__, 			 __LINE__);  }      if (!read_str_vector_bin.read(bin_file, (long)0) ||      (read_str_vector_bin.ne(write_str_vector))) {    return Error::handle(name(), L"read str bin", Error::TEST, __FILE__,			 __LINE__);  }  if (!read_llist_vector_text.read(text_file, (long)0) ||      (read_llist_vector_text.ne(write_llist_vector))) {    return Error::handle(name(), L"read llist text", Error::TEST, __FILE__, 			 __LINE__);  }     if (!read_llist_vector_bin.read(bin_file, (long)0) ||      (read_llist_vector_bin.ne(write_llist_vector))) {    return Error::handle(name(), L"read llist bin", Error::TEST, __FILE__,			 __LINE__);  }         if (!read_char_vec_vector_text.read(text_file, (long)0) ||      (read_char_vec_vector_text.ne(write_char_vec_vector))) {    return Error::handle(name(), L"read str text", Error::TEST, __FILE__, 			 __LINE__);  }	    if (!read_char_vec_vector_bin.read(bin_file, (long)0) ||      (read_char_vec_vector_bin.ne(write_char_vec_vector))) {    return Error::handle(name(), L"read str bin", Error::TEST, __FILE__,			 __LINE__);  }  if (!read_float_vec_text.read(text_file, (long)0) ||      (read_float_vec_text.ne(float_vec))) {    return Error::handle(name(), L"read float text", Error::TEST, __FILE__, 			 __LINE__);  }  if (!read_float_vec_bin.read(bin_file, (long)0) ||      (read_float_vec_bin.ne(float_vec))) {    read_float_vec_bin.debug(L"float_vec");    return Error::handle(name(), L"read float bin", Error::TEST, __FILE__, 			 __LINE__);  }  // read the multi-vector object  //  if (!text_file.find(object, 0) || !bin_file.find(object, 0)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  // read the binary file first  //  read_char_vector_bin.clear();  if (!read_char_vector_bin.readData(bin_file, pname0) ||      read_char_vector_bin.ne(write_char_vector)) {    return Error::handle(name(), L"read", Error::TEST, __FILE__, __LINE__);  }  read_null_vector_bin.clear();  if (!read_null_vector_bin.readData(bin_file, pname1) ||      read_null_vector_bin.ne(write_null_vector)) {    return Error::handle(name(), L"read", Error::TEST, __FILE__, __LINE__);  }  read_llist_vector_bin.clear();  if (!read_llist_vector_bin.readData(bin_file, pname2) ||      read_llist_vector_bin.ne(write_llist_vector)) {    return Error::handle(name(), L"read", Error::TEST, __FILE__, __LINE__);  }  // now read the text file  //  SofParser obj_parser;  obj_parser.load(text_file, SofParser::FULL_OBJECT);  read_char_vector_text.clear();  if (!read_char_vector_text.readData(text_file, pname0,				      obj_parser.getEntry(text_file, pname0),				      false, false) ||      read_char_vector_text.ne(write_char_vector)) {    read_char_vector_text.debug(L"read_char_vector");    write_char_vector.debug(L"write_char_vector");    return Error::handle(name(), L"read", Error::TEST, __FILE__, __LINE__);  }  read_null_vector_text.clear();  if (!read_null_vector_text.readData(text_file, pname1,				      obj_parser.getEntry(text_file, pname1),				      false, false) ||      read_null_vector_text.ne(write_null_vector)) {    return Error::handle(name(), L"read", Error::TEST, __FILE__, __LINE__);  }  read_llist_vector_text.clear();  if (!read_llist_vector_text.readData(text_file, pname2,				       obj_parser.getEntry(text_file, pname2),				       false, false) ||      read_llist_vector_text.ne(write_llist_vector)) {    read_llist_vector_text.debug(L"read_llist_vector");    write_llist_vector.debug(L"write_llist_vector");    return Error::handle(name(), L"read", Error::TEST, __FILE__, __LINE__);  }  // read the output of the partial write  //  read_float_vec_bin.clear();  if (!read_float_vec_bin.read(bin_file, (long)7) ||      (read_float_vec_bin.ne(float_vec))) {    read_float_vec_bin.debug(L"float_vec");    return Error::handle(name(), L"read partial float bin", Error::TEST,			 __FILE__, __LINE__);  }  read_float_vec_bin.clear();  if (!read_float_vec_bin.read(bin_file, (long)8) ||      (read_float_vec_bin.ne(float_vec))) {    read_float_vec_bin.debug(L"float_vec");    return Error::handle(name(), L"read partial float bin", Error::TEST,			 __FILE__, __LINE__);  }  read_float_vec_text.clear();  if (!read_float_vec_text.read(text_file, (long)7) ||      (read_float_vec_text.ne(float_vec))) {    read_float_vec_text.debug(L"float_vec");    return Error::handle(name(), L"read partial float bin", Error::TEST,			 __FILE__, __LINE__);  }  read_float_vec_text.clear();  if (!read_float_vec_text.read(text_file, (long)8) ||      (read_float_vec_text.ne(float_vec))) {    read_float_vec_text.debug(L"float_vec");    return Error::handle(name(), L"read partial float bin", Error::TEST,			 __FILE__, __LINE__);  }  if (level_a > Integral::BRIEF) {    Console::put(L"testing partial read\n");  }    // create objects for reading partial data in  //  Vector<Char> read_partial_char_text;  Vector<Char> read_partial_char_bin;  Vector<String> read_partial_str_text;  Vector<String> read_partial_str_bin;    Vector< DoubleLinkedList<Char> > read_partial_llist_text;  Vector< DoubleLinkedList<Char> > read_partial_llist_bin;    Vector< Vector<Char> > read_partial_char_vec_text;  Vector< Vector<Char> > read_partial_char_vec_bin;  if (!text_file.find(read_partial_char_vec_text.name(), (long)0)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  if (!bin_file.find(read_partial_char_vec_text.name(), (long)0)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  read_partial_char_vec_text.readStart(text_file);    // partial read for Vector<Vector<Char>>  //  if (read_partial_char_vec_text.readPartialData(text_file, 0, 2) != 2) {    return Error::handle(name(), L"readPartialData", Error::TEST,			 __FILE__, __LINE__);  }    if (read_partial_char_vec_text.readPartialData(text_file, 0, 3) != 3) {    return Error::handle(name(), L"readPartialData", Error::TEST,			 __FILE__, __LINE__);  }    if (read_partial_char_vec_text.readPartialData(text_file, 1, 2) != 2) {    read_partial_char_vec_text.debug(L"read_partial_vec_char_text");    return Error::handle(name(), L"readPartialData", Error::TEST,			 __FILE__, __LINE__);  }  if (read_partial_char_vec_text.readPartialData(text_file, 2, 1) != 1) {    read_partial_char_vec_text.debug(L"read_partial_vec_char_text");    return Error::handle(name(), L"readPartialData", Error::TEST,			 __FILE__, __LINE__);  }    // call read terminate to clean  //  read_partial_char_vec_text.readTerminate(text_file);  // partial read for Vector<Char>  //  if (!text_file.find(read_partial_char_text.name(), (long)0)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  if (!read_partial_char_text.readStart(text_file)) {    return Error::handle(name(), L"readStart", Error::TEST, __FILE__,			 __LINE__);  }    if ((read_partial_char_text.readPartialData(text_file, 0, 1) != 1) ||      read_partial_char_text(0).ne(*chars[0])) {    read_partial_char_text.debug(L"read_partial_char_text");    return Error::handle(name(), L"readPartialData", Error::TEST,			 __FILE__, __LINE__);  }      // test readTerminate  //  read_partial_char_text.readTerminate(text_file);    if (!bin_file.find(read_partial_char_bin.name(), (long)0)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }    if (!read_partial_char_bin.readStart(bin_file)) {    return Error::handle(name(), L"readStart", Error::TEST, __FILE__,			 __LINE__);  }    if ((read_partial_char_bin.readPartialData(bin_file, 0, 1) != (long)1)      || (read_partial_char_bin(0).ne(*chars[0]))) {    read_partial_char_bin.debug(L"read_partial_char_bin");    return Error::handle(name(), L"read partial char bin", Error::TEST,			 __FILE__, __LINE__);  }  // call readTerminate  //    read_partial_char_bin.readTerminate(bin_file);    // partial read for Vector<String>  //  if (!text_file.find(read_partial_str_text.name(), (long)0)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  if (!bin_file.find(read_partial_str_text.name(), (long)0)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  if (!read_partial_str_text.readStart(text_file)) {    return Error::handle(name(), L"readStart", Error::TEST, __FILE__,			 __LINE__);

⌨️ 快捷键说明

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