00001 #include "../StrobeDelayTestResult.h"
00002 #include "StrobeDelayTestResultStreamer.h"
00003 #include <vector>
00004
00005 using namespace Sct;
00006
00007 namespace SctData {
00008 namespace IO {
00009
00010 StrobeDelayTestResultStreamer::StrobeDelayTestResultStreamer() throw() {
00011 }
00012
00013 bool StrobeDelayTestResultStreamer::inMap = IOManager::addToMap("SctData::StrobeDelayTestResult", auto_ptr<Streamer>(new StrobeDelayTestResultStreamer()));
00014
00015 shared_ptr<Streamable> StrobeDelayTestResultStreamer::read(IStream& in, const IOManager& manager) const throw(LogicError, IoError) {
00016 shared_ptr<Streamable> ad (new StrobeDelayTestResult());
00017 read(in, *ad, manager);
00018 return ad;
00019 }
00020
00021 void StrobeDelayTestResultStreamer::write(OStream& out, const Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00022
00023 TestResultStreamer::write(out, ob, manager);
00024
00025 const StrobeDelayTestResult& mytest = dynamic_cast<const StrobeDelayTestResult&>(ob);
00026
00027 out << mytest.getFraction();
00028
00029 unsigned int nopt=mytest.getNOptima();
00030 out << nopt;
00031 for (unsigned int i=0; i<nopt; ++i) {
00032 out << mytest.getOptimum(i);
00033 }
00034 }
00035
00036 void StrobeDelayTestResultStreamer::read(IStream& in, Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00037 TestResultStreamer::read(in, ob, manager);
00038
00039 StrobeDelayTestResult& mytest = dynamic_cast<StrobeDelayTestResult&>(ob);
00040 double fraction;
00041 in >> fraction;
00042 mytest.setFraction(fraction);
00043 unsigned int nopt;
00044 in >> nopt;
00045 mytest.setNOptima(nopt);
00046 for (unsigned int ichip=0; ichip<nopt; ++ichip) {
00047 double opt;
00048 in >> opt ;
00049 mytest.setOptimum(ichip, opt);
00050 }
00051 }
00052
00053 }
00054 }