- Write interface for History and ConcreteHistory
- Write interface for HistoryObserver - Remove obsolete interfaces git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@690 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
759b90b017
commit
b8f7083bfc
13 changed files with 236 additions and 431 deletions
106
src/backend/concrete_history.hh
Normal file
106
src/backend/concrete_history.hh
Normal file
|
@ -0,0 +1,106 @@
|
|||
// src/backend/concrete_history.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 CONCRETE_HISTORY_HH
|
||||
#define CONCRETE_HISTORY_HH 1
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "concrete_environment.hh"
|
||||
#include "dynamic_process.hh"
|
||||
#include "dynamic_request.hh"
|
||||
#include "dynamic_resource.hh"
|
||||
#include "dynamic_sub_request.hh"
|
||||
#include "dynamic_thread.hh"
|
||||
#include "history.hh"
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
class ConcreteHistory;
|
||||
|
||||
class SG_DLLLOCAL ConcreteHistory : public History
|
||||
{
|
||||
public:
|
||||
typedef const std::pair<resource_key_t, DynamicResource&> DynamicResourcePair;
|
||||
|
||||
ConcreteHistory();
|
||||
ConcreteHistory(const ConcreteHistory&);
|
||||
virtual ~ConcreteHistory();
|
||||
|
||||
virtual void append_new_environment(ConcreteEnvironment* environment);
|
||||
virtual size_t get_size();
|
||||
virtual const ConcreteEnvironment& get_last_environment() const;
|
||||
virtual const ConcreteEnvironment& get_environment_at() const throw(std::out_of_range);
|
||||
|
||||
virtual void remove(const Resource& resource);
|
||||
virtual void remove(const Process& process);
|
||||
virtual void remove(const Thread& thread);
|
||||
virtual void remove(const Request& request);
|
||||
virtual void remove(const SubRequest& subrequest);
|
||||
|
||||
|
||||
virtual ResourcePair& add_resource(const Glib::ustring& name,
|
||||
bool preemptable = false,
|
||||
size_t places = 1,
|
||||
size_t availability = 0);
|
||||
|
||||
virtual DynamicProcess& add_process(const Glib::ustring& name,
|
||||
time_t arrival_time,
|
||||
prio_t base_priority = 0);
|
||||
|
||||
virtual DynamicThread& add_thread(const Glib::ustring& name,
|
||||
Process& parent,
|
||||
time_t arrival_time = 0,
|
||||
prio_t base_priority = 0);
|
||||
|
||||
virtual DynamicRequest& add_request(Thread& owner,
|
||||
time_t instant);
|
||||
|
||||
virtual DynamicSubRequest& add_subrequest(Request& request,
|
||||
resource_key_t resource_key,
|
||||
time_t duration,
|
||||
size_t places = 1);
|
||||
|
||||
virtual void reset(bool notify = true);
|
||||
|
||||
protected:
|
||||
typedef std::vector<ConcreteEnvironment*> Snapshots;
|
||||
Snapshots _snapshots;
|
||||
|
||||
virtual void notify_change();
|
||||
|
||||
private:
|
||||
// Disable assignment, implement it only if needed
|
||||
ConcreteHistory& operator=(const ConcreteHistory& op2);
|
||||
|
||||
}; //~ class ConcreteHistory
|
||||
|
||||
}//~ namespace sgpem
|
||||
|
||||
#endif //~ CONCRETE_HISTORY_HH
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue