// file: $isip/class/stat/StatisticalModel/sm_03.cc // version: $Id: sm_03.cc 8598 2002-08-15 03:03:25Z alphonso $ // // isip include files // #include "StatisticalModel.h" // method: readAccumulator // // arguments: // Sof& sof: (input) sof file object // int32 tag: (input) sof object instance tag // const String& name: (input) sof object instance name // // return: a bool8 value indicating status // // this method has the object accumulators form an Sof file // bool8 StatisticalModel::readAccumulator(Sof& sof_a, int32 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 // if (!readAccumulatorData(sof_a)) { return false; } // exit gracefully // return true; } // method: readAccumulatorData // // arguments: // Sof& sof: (input) sof file object // const String& pname: (input) parameter name // int32 size: (input) size in bytes of object (or full_size) // bool8 param: (input) is the parameter name in the file? // bool8 nested: (input) are we nested? // // return: a bool8 value indicating status // // this method has the object read itself from an Sof file. it assumes // that the Sof file is already positioned correctly. // bool8 StatisticalModel::readAccumulatorData(Sof& sof_a, const String& pname_a, int32 size_a, bool8 param_a, bool8 nested_a) { Integral::DEBUG debug_level = Integral::NONE; SofParser parser; parser.setDebug(debug_level); // ignore implicit parameter setting // // are we nested? // if (nested_a) { parser.setNest(); } int32 pos = sof_a.tell(); // load the parse // if (!parser.load(sof_a, size_a)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } if (sof_a.isText()) { sof_a.seek(pos, File::POS); } // read the data // if (!virtual_model_d->readAccumulatorData(sof_a, pname_a, size_a, param_a, nested_a)) { return Error::handle(name(), L"readAccumulatorData", Error::ARG, __FILE__, __LINE__); } // exit gracefully // return true; } // method: read // // arguments: // Sof& sof: (input) sof file object // int32 tag: (input) sof object instance tag // const String& name: (input) sof object instance name // // return: a bool8 value indicating status // // this method has the object read itself from an Sof file // bool8 StatisticalModel::read(Sof& sof_a, int32 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 // 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 // int32 size: (input) size in bytes of object (or full_size) // bool8 param: (input) is the parameter name in the file? // bool8 nested: (input) are we nested? // // return: a bool8 value indicating status // // this method has the object read itself from an Sof file. it assumes // that the Sof file is already positioned correctly. // bool8 StatisticalModel::readData(Sof& sof_a, const String& pname_a, int32 size_a, bool8 param_a, bool8 nested_a) { Integral::DEBUG debug_level = Integral::NONE; SofParser parser; parser.setDebug(debug_level); // ignore implicit parameter setting // // are we nested? // if (nested_a) { parser.setNest(); } int32 pos = sof_a.tell(); // load the parse // if (!parser.load(sof_a, size_a)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // read the type // TYPE type; TYPE_MAP.readElementData((int32&)type, sof_a, PARAM_TYPE, parser.getEntry(sof_a, PARAM_TYPE)); if (sof_a.isText()) { sof_a.seek(pos, File::POS); } // set the type // clear(); setType(type); // read the data // if (!virtual_model_d->readData(sof_a, pname_a, size_a, param_a, nested_a)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // exit gracefully // return true; } // method: readOccupancies // // arguments: // Sof& sof: (input) sof file object // int32 tag: (input) sof object instance tag // const String& name: (input) sof object instance name // // return: a bool8 value indicating status // // this method has the object occupancies from accumlators in an Sof file // bool8 StatisticalModel::readOccupancies(Sof& sof_a, int32 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 // if (!readOccupanciesData(sof_a)) { return false; } // exit gracefully // return true; } // method: readOccupanciesData // // arguments: // Sof& sof: (input) sof file object // const String& pname: (input) parameter name // int32 size: (input) size in bytes of object (or full_size) // bool8 param: (input) is the parameter name in the file? // bool8 nested: (input) are we nested? // // return: a bool8 value indicating status // // this method has the object read itself from an Sof file. it assumes // that the Sof file is already positioned correctly. // bool8 StatisticalModel::readOccupanciesData(Sof& sof_a, const String& pname_a, int32 size_a, bool8 param_a, bool8 nested_a) { Integral::DEBUG debug_level = Integral::NONE; SofParser parser; parser.setDebug(debug_level); // ignore implicit parameter setting // // are we nested? // if (nested_a) { parser.setNest(); } int32 pos = sof_a.tell(); // load the parse // if (!parser.load(sof_a, size_a)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } if (sof_a.isText()) { sof_a.seek(pos, File::POS); } // read the data // if (!virtual_model_d->readOccupanciesData(sof_a, pname_a, size_a, param_a, nested_a)) { return Error::handle(name(), L"readOccupanciesData", Error::ARG, __FILE__, __LINE__); } // exit gracefully // return true; }