📄 ftrb_03.cc
字号:
// file: $isip/class/sp/FtrBuffer/ftrb_03.cc// version: $Id: ftrb_03.cc,v 1.7 2002/07/13 02:06:29 picone Exp $//// isip include files//#include "FtrBuffer.h"// method: read//// arguments:// Sof& sof: (input) sof file object// long tag: (input) sof object instance tag// const String& name: (input) sof object instance name//// return: a boolean value indicating status//// this method has the object read itself from an Sof file according// to the specified name and tag//boolean FtrBuffer::read(Sof& sof_a, long tag_a, const String& name_a) { // read the instance of the object from the Sof file // if (!sof_a.find(name_a, tag_a)) { return false; } // read the actual data from the sof file // return readData(sof_a);}// method: readData//// arguments:// Sof& sof: (input) sof file object// const String& pname: (input) parameter name// long size: (input) size in bytes of object (or FULL_OBJECT)// boolean param: (input) is the parameter name in the file?// boolean nested: (input) are we nested?//// return: a boolean value indicating status//// this method has the object read itself from an Sof file. it assumes// that the Sof file is already positioned correctly//boolean FtrBuffer::readData(Sof& sof_a, const String& pname_a, long size_a, boolean param_a, boolean nested_a) { // declare local variable // SofParser parser; // set the debug level of the parser // parser.setDebug(debug_level_d); // are we nested? // if (nested_a) { parser.setNest(); } // load the parse // if (!parser.load(sof_a, size_a)) { // return a warning message // return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the hash table // if (parser.isPresent(sof_a, PARAM_HASH)) { if (!hash_d.readData(sof_a, PARAM_HASH, parser.getEntry(sof_a, PARAM_HASH), false, true)) { // return a warning message // return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { hash_d.clear(); } // get the length // if (parser.isPresent(sof_a, PARAM_LENGTH)) { if (!length_d.readData(sof_a, PARAM_LENGTH, parser.getEntry(sof_a, PARAM_LENGTH), false, true)) { // return a warning message // return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { length_d.clear(); } // get the frame index // if (parser.isPresent(sof_a, PARAM_FRAME_INDEX)) { if (!frame_index_d.readData(sof_a, PARAM_FRAME_INDEX, parser.getEntry(sof_a, PARAM_FRAME_INDEX))) { // return a warning message // return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { frame_index_d = 0; } // get the last index // if (parser.isPresent(sof_a, PARAM_LAST_INDEX)) { if (!last_index_d.readData(sof_a, PARAM_LAST_INDEX, parser.getEntry(sof_a, PARAM_LAST_INDEX))) { // return a warning message // return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { last_index_d = 0; } // get the coefficient name // if (parser.isPresent(sof_a, PARAM_COEF_NAME)) { if (!coef_name_d.readData(sof_a, PARAM_COEF_NAME, parser.getEntry(sof_a, PARAM_COEF_NAME))) { // return a warning message // return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { coef_name_d.clear(); } // get the the number of samples in the last frame // if (parser.isPresent(sof_a, PARAM_LEFTOVER)) { if (!leftover_samps_d.readData(sof_a, PARAM_LEFTOVER, parser.getEntry(sof_a, PARAM_LEFTOVER))) { // return a warning message // return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { leftover_samps_d = 0; } // check that all parameters are accounted for // if (!parser.checkParams(sof_a)) { // return a warning message // return Error::handle(name(), L"readData", Error::IO, __FILE__, __LINE__, Error::WARNING); } // exit gracefully // return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -