00001 #include "IOManagerFile.h"
00002 #include "IStreamFile.h"
00003 #include "OStreamFile.h"
00004 #include "IONameFile.h"
00005 #include "../Serializable.h"
00006
00007 namespace Sct {
00008 namespace File {
00009
00010 IOManagerFile::IOManagerFile() throw() {
00011 }
00012
00013 IOManagerFile& IOManagerFile::instance() {
00014 static IOManagerFile man;
00015 return man;
00016 }
00017
00018 void IOManagerFile::write(const Serializable& ob, const IOParams* params) const throw(LogicError, IoError) {
00019 IONameFile name(ob.getUniqueID(), ob.getClassName());
00020 OStreamFile out(name.getIOName());
00021 writeImpl(out, ob, true);
00022 }
00023
00024 shared_ptr<Serializable> IOManagerFile::read(const string& name, const IOParams* params) const throw(LogicError, IoError) {
00025 IStreamFile in(name);
00026 return boost::dynamic_pointer_cast<Serializable>(readImpl(in));
00027 }
00028
00029
00030
00031 }
00032 }