- Added SerializeVisitor class and written various serialize() methods

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@716 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-07-04 22:34:39 +00:00
parent fcc9e93827
commit dd4898ca55
8 changed files with 94 additions and 5 deletions

View File

@ -170,6 +170,7 @@ src_backend_libbackend_la_SOURCES = \
src/backend/resource.cc \
src/backend/schedulable.cc \
src/backend/scheduler.cc \
src/backend/serialize_visitor.cc \
src/backend/static_process.cc \
src/backend/static_request.cc \
src/backend/static_resource.cc \
@ -203,6 +204,7 @@ pkginclude_HEADERS += \
src/backend/process.hh \
src/backend/schedulable.hh \
src/backend/scheduler.hh \
src/backend/serialize_visitor.cc \
src/backend/sub_request.hh \
src/backend/thread.hh \
src/backend/user_interrupt_exception.hh

View File

@ -21,6 +21,7 @@
#include "dynamic_process.hh"
#include "static_process.hh"
#include "dynamic_thread.hh"
#include "serialize_visitor.hh"
#include <algorithm>
#include <functional>
@ -133,7 +134,7 @@ DynamicProcess::get_state() const
void
DynamicProcess::serialize(SerializeVisitor& translator) const
{
//FIXME write this code. I'm predictable, I know
translator.from_process(*_core);
}
StaticProcess&

View File

@ -22,6 +22,7 @@
#include "static_request.hh"
#include "dynamic_sub_request.hh"
#include "dynamic_thread.hh"
#include "serialize_visitor.hh"
#include "smartp.tcc"
@ -92,7 +93,7 @@ DynamicRequest::get_state() const
void
DynamicRequest::serialize(SerializeVisitor& translator) const
{
// Let a drunk monkey write this code ;P
translator.from_request(*this);
}

View File

@ -20,6 +20,7 @@
#include "dynamic_resource.hh"
#include "static_resource.hh"
#include "serialize_visitor.hh"
#include "smartp.tcc"
@ -55,7 +56,7 @@ DynamicResource::get_places() const
void
DynamicResource::serialize(SerializeVisitor& translator) const
{
// Let a drunk monkey write this code ;P
translator.from_resource(*this);
}
StaticResource&

View File

@ -20,6 +20,7 @@
#include "dynamic_sub_request.hh"
#include "dynamic_request.hh"
#include "serialize_visitor.hh"
#include "smartp.tcc"
@ -92,7 +93,7 @@ DynamicSubRequest::get_request()
void
DynamicSubRequest::serialize(SerializeVisitor& translator) const
{
//blah blah blah TODO
translator.from_subrequest(*this);
}

View File

@ -21,6 +21,7 @@
#include "dynamic_thread.hh"
#include "static_thread.hh"
#include "dynamic_request.hh"
#include "serialize_visitor.hh"
#include <algorithm>
#include <functional>
@ -89,7 +90,7 @@ DynamicThread::get_requests()
void
DynamicThread::serialize(SerializeVisitor& translator) const
{
// TODO fill-in appropriate code
translator.from_thread(*_core);
}
StaticThread&

View File

@ -0,0 +1,27 @@
// src/backend/serialize_visitor.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "serialize_visitor.hh"
using namespace sgpem;
SerializeVisitor::~SerializeVisitor()
{}

View File

@ -0,0 +1,55 @@
// src/backend/serialize_visitor.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef SERIALIZE_VISITOR_HH
#define SERIALIZE_VISITOR_HH 1
namespace sgpem
{
class Resource;
class StaticProcess;
class StaticThread;
class Request;
class SubRequest;
}
#include "config.h"
#include <glibmm/ustring.h>
namespace sgpem
{
class SerializeVisitor;
class SerializeVisitor
{
public:
virtual ~SerializeVisitor() = 0;
virtual void from_resource(const Resource& obj) = 0;
virtual void from_process(const StaticProcess& obj) = 0;
virtual void from_thread(const StaticThread& obj) = 0;
virtual void from_request(const Request& obj) = 0;
virtual void from_subrequest(const SubRequest& obj) = 0;
};
}
#endif