- Fixed compilation errors caused by latest changes to serialization code

- Setup makefile for xmlsave plugin. It still can`t be activated. why?
- Added a temporary command SAVE to commandline interface to try serialization

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@826 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-08-07 00:54:43 +00:00
parent 574723a35b
commit 96728edfce
14 changed files with 95 additions and 36 deletions

View file

@ -23,6 +23,8 @@
#include "backend/cpu_policy_manager.hh"
#include "backend/policy_parameters.hh"
#include "backend/history.hh"
#include "backend/serializers_gatekeeper.hh"
#include "backend/serializer.hh"
#include "backend/static_process.hh"
#include "backend/static_resource.hh"
#include "backend/static_thread.hh"
@ -1288,6 +1290,37 @@ TextSimulation::on_remove_subrequest(const Tokens& arguments)
h.remove(*r);
}
void
TextSimulation::on_save(const Tokens& arguments)
{
if(!check_arguments_num(arguments, 1))
return;
ustring filename = arguments[0];
try
{
vector<Serializer*> serializers =
SerializersGatekeeper::get_instance().get_registered();
Serializer& serializer = *serializers.at(0);
const History& history = Simulation::get_instance().get_history();
serializer.save_snapshot(filename, history);
}
catch(out_of_range e)
{
p_stderr(_("ERROR: No registered serializer available\n"));
}
catch(SerializerError e)
{
string msg = _("ERROR: ");
p_stderr(msg + e.what() + "\n");
}
}
void
TextSimulation::p_stdout(const ustring& str)
{
@ -1327,6 +1360,7 @@ TextSimulation::parse_command(TextSimulation& sim, const ustring& str)
command_handlers["SHOW"] = &TextSimulation::on_show;
command_handlers["ADD"] = &TextSimulation::on_add;
command_handlers["REMOVE"] = &TextSimulation::on_remove;
command_handlers["SAVE"] = &TextSimulation::on_save;
command_handlers["QUIT"] = &TextSimulation::on_quit;
Tokens arguments = tokenize(str);