// file: $isip/class/asr/Machine/mach_03.cc // // isip include files // #include "Machine.h" // 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 Machine::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 Machine::readData(Sof& sof_a, const String& pname_a, int32 size_a, bool8 param_a, bool8 nested_a) { // set i/o parameters // Integral::DEBUG debug_level = Integral::NONE; SofParser parser; parser.setDebug(debug_level); // ignore implicit parameter setting // // clear the object // clear(); // are we nested? // if (nested_a) { parser.setNest(); } // load the parse // if (!parser.load(sof_a, size_a)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the protocol // if (!PROTOCOL_MAP.readElementData((int32&)protocol_d, sof_a, PARAM_PROTOCOL, parser.getEntry(sof_a, PARAM_PROTOCOL))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the node name // if (!node_name_d.readData(sof_a, PARAM_NODE_NAME, parser.getEntry(sof_a, PARAM_NODE_NAME))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the architecture // if (!architecture_d.readData(sof_a, PARAM_ARCHITECTURE, parser.getEntry(sof_a, PARAM_ARCHITECTURE))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the number of processors // if (!num_processors_d.readData(sof_a, PARAM_NUM_PROCESSORS, parser.getEntry(sof_a, PARAM_NUM_PROCESSORS))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the speed // if (!speed_d.readData(sof_a, PARAM_PROCESSOR_SPEED, parser.getEntry(sof_a, PARAM_PROCESSOR_SPEED), false, false)) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the main memory // if (!main_memory_d.readData(sof_a, PARAM_MAIN_MEMORY, parser.getEntry(sof_a, PARAM_MAIN_MEMORY))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the swap memory // if (!swap_memory_d.readData(sof_a, PARAM_SWAP_MEMORY, parser.getEntry(sof_a, PARAM_SWAP_MEMORY))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the OS // if (!os_d.readData(sof_a, PARAM_OS_NAME, parser.getEntry(sof_a, PARAM_OS_NAME))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // get the OS version // if (!os_version_d.readData(sof_a, PARAM_OS_VERSION, parser.getEntry(sof_a, PARAM_OS_VERSION))) { return Error::handle(name(), L"readData", Error::READ, __FILE__, __LINE__, Error::WARNING); } // exit gracefully // return true; }