- Substitute the old SchedulableQueue with the new ReadyQueue

- Add interfaces for Process and Thread into the "sgpem.i" SWIG
interface file, change DynamicSchedulable into Schedulable
- Add dynamic_cast for the return value of ReadyQueue::get_item_at()
into the pyloader "sgpem.i" SWIG interface, so that a Schedulable
can be either recognized as a Thread or a Process
- TODO: wrap STL exceptions in SWIG interface
- Please note that code won't compile until the new History and
Scheduler::step_forward() will be in place. This is a known issue.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@689 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-02 13:51:03 +00:00
parent fa06e2f4f1
commit 759b90b017
24 changed files with 170 additions and 414 deletions

View file

@ -33,7 +33,7 @@
#include <iostream>
#include "backend/static_process.hh"
#include "backend/observed_subject.hh"
#include "backend/schedulable_queue.hh"
#include "backend/ready_queue.hh"
#include "backend/dynamic_schedulable.hh"
#include "scheduler.hh"
@ -81,7 +81,7 @@ namespace sgpem
virtual void sort_queue() const throw(UserInterruptException)
{ // here a lot of fun, exactly O(n^2) fun!
SchedulableQueue sl = History.get_instance().get_simulation_status_at(get_current_time());
ReadyQueue sl = History.get_instance().get_simulation_status_at(get_current_time());
for (int i = 0; i < sl.size(); i++)
{
for (int j = 0; j < sl.size() - 1; j++)
@ -184,9 +184,9 @@ namespace sgpem
public:
memory::smart_ptr<sgpem::DynamicSchedulable> get_scheduled_at(int time) const {}
memory::smart_ptr<sgpem::SchedulableQueue> get_simulation_status_at(int time) const;
memory::smart_ptr<sgpem::ReadyQueue> get_simulation_status_at(int time) const;
int get_current_time() const {return _total_time_elapsed;}
void enqueue_slice(const sgpem::SchedulableQueue& status);
void enqueue_slice(const sgpem::ReadyQueue& status);
void truncate_at(int instant) {}
static History& get_instance();
private:
@ -270,7 +270,7 @@ main(int argc, char** argv)
DynamicSchedulable ss18(p18);
DynamicSchedulable ss19(p19); // not used!
SchedulableQueue initial;
ReadyQueue initial;
initial.add_at_bottom(ss1);
initial.add_at_bottom(ss2);
initial.add_at_bottom(ss3);