📄 cont_03.cc
字号:
// file: $isip/class/search/Context/cont_03.cc// version: $Id: cont_03.cc,v 1.2 2002/08/15 19:54:09 alphonso Exp $//// isip include files//#include "Context.h"#include <Sof.h>// method: read//// arguments:// Sof& sof: (input) sof file object// const 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//boolean Context::read(Sof& sof_a, const long tag_a, const String& name_a) { // get 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 // if (!readData(sof_a)) { return false; } // exit gracefully // return true;}// method: readData//// arguments:// Sof& sof: (input) sof file object// const String& pname: (input) parameter name// long size: (input) number of bytes in file// boolean param: (input) is the parameter specified?// boolean nested: (input) is this 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 Context::readData(Sof& sof_a, const String& pname_a, long size_a, boolean param_a, boolean nested_a) { // if ascii, parse the start bracket // SofParser parser; Long value; nested_a = true; if (nested_a) { parser.setNest(); } // set the debug level // parser.setDebug(debug_level_d); 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); } // read the data // if (parser.isPresent(sof_a, PARAM_CENTRAL)) { if (!value.readData(sof_a, PARAM_CENTRAL, parser.getEntry(sof_a, PARAM_CENTRAL))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } central_d = value; } else { central_d = DEF_CENTRAL_INDEX; } if (parser.isPresent(sof_a, PARAM_EXTENSION_LENGTH)) { if (!value.readData(sof_a, PARAM_EXTENSION_LENGTH, parser.getEntry(sof_a, PARAM_EXTENSION_LENGTH))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } ext_length_d = value; } else { ext_length_d = DEF_EXTENSION_LENGTH; } // get the index // if (parser.isPresent(sof_a, PARAM_INDEX)) { if (!index_d.readData(sof_a, PARAM_INDEX, parser.getEntry(sof_a, PARAM_INDEX), false, false)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { index_d = DEF_INDEX; } // get the buffer // if (parser.isPresent(sof_a, PARAM_BUFFER)) { if (!v_d.readData(sof_a, PARAM_BUFFER, parser.getEntry(sof_a, PARAM_BUFFER), false, false)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } } else { v_d.clear(); } // make sure all coefficients have been accessed // if (!parser.checkParams(sof_a)) { 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 + -