00001 #include "TxCurrentTestResultStreamer_v1.h"
00002
00003 using namespace Sct;
00004
00005 namespace SctData {
00006 namespace IO {
00007
00008
00009 unsigned TxCurrentTestResultStreamer_v1::s_version=1;
00010
00011 TxCurrentTestResultStreamer_v1::TxCurrentTestResultStreamer_v1() throw() {}
00012
00013 bool TxCurrentTestResultStreamer_v1::inMap = IOManager::addToMap("SctData::TxCurrentTestResult", auto_ptr<Streamer>(new TxCurrentTestResultStreamer_v1()));
00014
00015 shared_ptr<Streamable> TxCurrentTestResultStreamer_v1::read(IStream& in, const IOManager& manager) const throw(LogicError, IoError){
00016 boost::shared_ptr<Streamable> ad (new TxCurrentTestResult());
00017 read(in, *ad, manager);
00018 return ad;
00019 }
00020
00021 void TxCurrentTestResultStreamer_v1::write(OStream& out, const Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00022
00023 manager.writeImpl(out, ob, "SctData::TestResult");
00024
00025
00026 const TxCurrentTestResult& mytest = dynamic_cast<const TxCurrentTestResult&>(ob);
00027
00028 for (unsigned int iStream=0; iStream<nLinkModule; iStream++) {
00029 writeStreamResult(out, mytest.getStreamResult(iStream), manager);
00030 }
00031 }
00032
00033 void TxCurrentTestResultStreamer_v1::read(IStream& in, Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00034 manager.readImpl(in, ob, "SctData::TestResult");
00035
00036 TxCurrentTestResult& mytest = dynamic_cast<TxCurrentTestResult&>(ob);
00037
00038 for (unsigned int iStream=0; iStream<nLinkModule; iStream++) {
00039 readStreamResult(in, mytest.getStreamResult(iStream), manager);
00040 }
00041 }
00042
00043 void TxCurrentTestResultStreamer_v1::writeStreamResult(OStream& out, const TxCurrentTestResult::StreamResult& c, const IOManager& manager) const throw (LogicError, IoError) {
00044 out << c.minErrorFreeTxCurrent()
00045 << c.maxErrorFreeTxCurrent()
00046 << c.bestTxCurrent();
00047 }
00048
00049 void TxCurrentTestResultStreamer_v1::readStreamResult(IStream& in, TxCurrentTestResult::StreamResult& c, const IOManager& manager) const throw(LogicError, IoError) {
00050 typedef TxCurrentTestResult::StreamResult::ThresholdType ThresholdType;
00051 ThresholdType minTmp,maxTmp,bestTmp;
00052 in >> minTmp >> maxTmp >> bestTmp;
00053 c.setMinErrorFreeTxCurrent(minTmp);
00054 c.setMaxErrorFreeTxCurrent(maxTmp);
00055 c.setBestTxCurrent(bestTmp);
00056 }
00057
00058 }
00059 }