00001 #include "ArchivePutCommand.h"
00002 #include "Archiver.h"
00003 #include "Sct/Archive/IOManagerArchive.h"
00004 #include "boost/timer.hpp"
00005
00006 namespace SctArchiving{
00007 ArchivePutCommand::ArchivePutCommand(boost::shared_ptr<Sct::Serializable> ob)
00008 : PutCommand(ob)
00009 {}
00010
00011 ArchivePutCommand::~ArchivePutCommand(){}
00012
00013 ArchivePutCommand::ArchivePutCommand() {
00014 }
00015
00016 void ArchivePutCommand::execute(){
00017 boost::timer t;
00018 if (!m_ob.get()) throw Sct::IllegalStateError("Null pointer", __FILE__, __LINE__);
00019 Archiver::instance().getIOManagerArchive().write(*m_ob, m_params.get());
00020 Archiver::instance().addFileTime(t.elapsed());
00021 Archiver::instance().incrimentNArchived();
00022 }
00023
00024 shared_ptr<ArchivingCommand> ArchivePutCommand::create() const{
00025 return shared_ptr<ArchivingCommand> (new ArchivePutCommand() );
00026 }
00027 }