IOManagerDummy.cpp

00001 #include "IOManagerDummy.h"
00002 #include "LogicErrors.h"
00003 #include "Streamable.h"
00004 #include "Streamer.h"
00005 #include "XmlStyleStream.h"
00006 #include <sstream>
00007 
00008 namespace Sct {
00009   IOManagerDummy::IOManagerDummy() throw(){}
00010 
00011   IOManagerDummy& IOManagerDummy::instance() throw(){
00012     static IOManagerDummy man;
00013     return man;
00014   }
00015   void IOManagerDummy::write(const Serializable& ob, const IOParams* params) const {
00016     throw IllegalStateError("Should not be used!",__FILE__,__LINE__);
00017   }
00018   
00019   shared_ptr<Serializable> IOManagerDummy::read(const string& name, const IOParams* params) const {
00020     throw IllegalStateError("Should not be used!",__FILE__,__LINE__);
00021   }
00022   
00023   
00024   std::string IOManagerDummy::testStreaming1(const Streamable& ob) const {
00025      Streamer& streamer = getStreamer(ob.getClassName());
00026     std::ostringstream ostr; 
00027     XmlStyleOStream ad1(ostr);
00028     streamer.write(ad1, ob, *this);
00029     return ostr.str();
00030   }
00031 
00032   std::string IOManagerDummy::testStreaming2(const Streamable& ob) const {
00033     Streamer& streamer = getStreamer(ob.getClassName());
00034     std::ostringstream ostr; 
00035     XmlStyleOStream ad1(ostr);
00036     streamer.write(ad1, ob, *this);
00037     
00038     std::istringstream istr(ostr.str());
00039     XmlStyleIStream ad2(istr);
00040     shared_ptr<Streamable> testob = streamer.read(ad2, *this);
00041 
00042     std::ostringstream ostr2;
00043     XmlStyleOStream ad3(ostr2);
00044     streamer.write(ad3, *testob, *this);
00045 
00046     return ostr2.str();
00047   }
00048   
00049 }

Generated on Mon Feb 6 14:01:21 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6