- 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:
parent
fcc9e93827
commit
dd4898ca55
|
@ -170,6 +170,7 @@ src_backend_libbackend_la_SOURCES = \
|
||||||
src/backend/resource.cc \
|
src/backend/resource.cc \
|
||||||
src/backend/schedulable.cc \
|
src/backend/schedulable.cc \
|
||||||
src/backend/scheduler.cc \
|
src/backend/scheduler.cc \
|
||||||
|
src/backend/serialize_visitor.cc \
|
||||||
src/backend/static_process.cc \
|
src/backend/static_process.cc \
|
||||||
src/backend/static_request.cc \
|
src/backend/static_request.cc \
|
||||||
src/backend/static_resource.cc \
|
src/backend/static_resource.cc \
|
||||||
|
@ -203,6 +204,7 @@ pkginclude_HEADERS += \
|
||||||
src/backend/process.hh \
|
src/backend/process.hh \
|
||||||
src/backend/schedulable.hh \
|
src/backend/schedulable.hh \
|
||||||
src/backend/scheduler.hh \
|
src/backend/scheduler.hh \
|
||||||
|
src/backend/serialize_visitor.cc \
|
||||||
src/backend/sub_request.hh \
|
src/backend/sub_request.hh \
|
||||||
src/backend/thread.hh \
|
src/backend/thread.hh \
|
||||||
src/backend/user_interrupt_exception.hh
|
src/backend/user_interrupt_exception.hh
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "dynamic_process.hh"
|
#include "dynamic_process.hh"
|
||||||
#include "static_process.hh"
|
#include "static_process.hh"
|
||||||
#include "dynamic_thread.hh"
|
#include "dynamic_thread.hh"
|
||||||
|
#include "serialize_visitor.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
@ -133,7 +134,7 @@ DynamicProcess::get_state() const
|
||||||
void
|
void
|
||||||
DynamicProcess::serialize(SerializeVisitor& translator) const
|
DynamicProcess::serialize(SerializeVisitor& translator) const
|
||||||
{
|
{
|
||||||
//FIXME write this code. I'm predictable, I know
|
translator.from_process(*_core);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticProcess&
|
StaticProcess&
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "static_request.hh"
|
#include "static_request.hh"
|
||||||
#include "dynamic_sub_request.hh"
|
#include "dynamic_sub_request.hh"
|
||||||
#include "dynamic_thread.hh"
|
#include "dynamic_thread.hh"
|
||||||
|
#include "serialize_visitor.hh"
|
||||||
|
|
||||||
#include "smartp.tcc"
|
#include "smartp.tcc"
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ DynamicRequest::get_state() const
|
||||||
void
|
void
|
||||||
DynamicRequest::serialize(SerializeVisitor& translator) const
|
DynamicRequest::serialize(SerializeVisitor& translator) const
|
||||||
{
|
{
|
||||||
// Let a drunk monkey write this code ;P
|
translator.from_request(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "dynamic_resource.hh"
|
#include "dynamic_resource.hh"
|
||||||
#include "static_resource.hh"
|
#include "static_resource.hh"
|
||||||
|
#include "serialize_visitor.hh"
|
||||||
|
|
||||||
#include "smartp.tcc"
|
#include "smartp.tcc"
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ DynamicResource::get_places() const
|
||||||
void
|
void
|
||||||
DynamicResource::serialize(SerializeVisitor& translator) const
|
DynamicResource::serialize(SerializeVisitor& translator) const
|
||||||
{
|
{
|
||||||
// Let a drunk monkey write this code ;P
|
translator.from_resource(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticResource&
|
StaticResource&
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "dynamic_sub_request.hh"
|
#include "dynamic_sub_request.hh"
|
||||||
#include "dynamic_request.hh"
|
#include "dynamic_request.hh"
|
||||||
|
#include "serialize_visitor.hh"
|
||||||
|
|
||||||
#include "smartp.tcc"
|
#include "smartp.tcc"
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ DynamicSubRequest::get_request()
|
||||||
void
|
void
|
||||||
DynamicSubRequest::serialize(SerializeVisitor& translator) const
|
DynamicSubRequest::serialize(SerializeVisitor& translator) const
|
||||||
{
|
{
|
||||||
//blah blah blah TODO
|
translator.from_subrequest(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "dynamic_thread.hh"
|
#include "dynamic_thread.hh"
|
||||||
#include "static_thread.hh"
|
#include "static_thread.hh"
|
||||||
#include "dynamic_request.hh"
|
#include "dynamic_request.hh"
|
||||||
|
#include "serialize_visitor.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
@ -89,7 +90,7 @@ DynamicThread::get_requests()
|
||||||
void
|
void
|
||||||
DynamicThread::serialize(SerializeVisitor& translator) const
|
DynamicThread::serialize(SerializeVisitor& translator) const
|
||||||
{
|
{
|
||||||
// TODO fill-in appropriate code
|
translator.from_thread(*_core);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticThread&
|
StaticThread&
|
||||||
|
|
|
@ -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()
|
||||||
|
{}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue