00001 #include "../SingleVariableTestResult.h"
00002 #include "SingleVariableTestResultStreamer_v2.h"
00003 #include <vector>
00004
00005 using namespace Sct;
00006
00007 namespace SctData {
00008 namespace IO {
00009
00010
00011 unsigned SingleVariableTestResultStreamer_v2::s_version=2;
00012
00013 SingleVariableTestResultStreamer_v2::SingleVariableTestResultStreamer_v2() throw() {
00014 }
00015
00016 bool SingleVariableTestResultStreamer_v2::inMap = IOManager::addToMap("SctData::SingleVariableTestResult", auto_ptr<Streamer>(new SingleVariableTestResultStreamer_v2()));
00017
00018 shared_ptr<Streamable> SingleVariableTestResultStreamer_v2::read(IStream& in, const IOManager& manager) const throw(LogicError, IoError) {
00019 throw Sct::IllegalStateError("Request to make a SingleVariableTestResult, which is an abstract class", __FILE__, __LINE__);
00020 }
00021
00022 void SingleVariableTestResultStreamer_v2::write(OStream& out, const Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00023
00024 manager.writeImpl(out, ob, "SctData::TestResult");
00025
00026 const SingleVariableTestResult& mytest = dynamic_cast<const SingleVariableTestResult&>(ob);
00027
00028 unsigned int nopt=mytest.getNOptima();
00029 out << nopt;
00030 for (unsigned int i=0; i<nopt; ++i) {
00031 out << mytest.getOptimum(i);
00032 }
00033 }
00034
00035 void SingleVariableTestResultStreamer_v2::read(IStream& in, Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00036 manager.readImpl(in, ob, "SctData::TestResult");
00037
00038 SingleVariableTestResult& mytest = dynamic_cast<SingleVariableTestResult&>(ob);
00039 unsigned int nopt;
00040 in >> nopt;
00041 mytest.setNOptima(nopt);
00042 for (unsigned int ichip=0; ichip<nopt; ++ichip) {
00043 double opt;
00044 in >> opt ;
00045 mytest.setOptimum(ichip, opt);
00046 }
00047 }
00048
00049 }
00050 }