- Added some source code

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@304 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
fpaparel 2006-02-09 18:51:26 +00:00
parent d56fd53f2d
commit e8b28cc2ec
15 changed files with 486 additions and 33 deletions

View file

@ -25,6 +25,8 @@
#include "parseopts.hh"
#include "startgui.hh"
#include "templates/smartp.hh"
#include "backend/history.hh"
#include "backend/slice.hh"
#include "backend/schedulable.hh"
#include "backend/schedulableStatus.hh"
@ -32,12 +34,12 @@
#include "backend/process.hh"
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
using namespace sgpem;
using namespace memory;
int
main(int argc, char* argv[])
@ -48,7 +50,7 @@ main(int argc, char* argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
/*
// Parses options and prepares vector with
// filenames of documents to be opened
vector<string> filenames;
@ -58,23 +60,60 @@ main(int argc, char* argv[])
parse_options(a_count, a_ptr);
filenames.insert(filenames.begin(), a_ptr, a_ptr+a_count);
}
start_gui(argc, argv);
*/
//start_gui(argc, argv);
//SMOKE-TEST for backend classes
cout << "\n\n********************************";
Process p("P1", 0,10,5);
SchedulableStatus ss(p);
SchedulableStatus ss2(ss);
SimulationStatus sim;
sim.setRunning(ss);
Process p1("P1", 0,10,1);
Process p2("P2", 0,30,2);
Process p3("P3", 5,15,3);
Slice sl(0,5, sim);
SchedulableStatus ss1(p1);
SchedulableStatus ss2(p2);
SchedulableStatus ss3(p3);
SimulationStatus sim1; sim1.setRunning(p1);
SimulationStatus sim2; sim2.setRunning(p2);
SimulationStatus sim3; sim3.setRunning(p3);
History h(History::getInstance());
h.enqueueSlice(sim1);
h.enqueueSlice(sim1);
h.enqueueSlice(sim2);
h.enqueueSlice(sim1);
h.enqueueSlice(sim2);
h.enqueueSlice(sim1);
h.enqueueSlice(sim2);
h.enqueueSlice(sim3);
h.enqueueSlice(sim3);
h.enqueueSlice(sim1);
h.enqueueSlice(sim3);
h.enqueueSlice(sim1);
h.truncateAt(3);
smart_ptr<const sgpem::SimulationStatus> quale;
quale = h.getSimulationStatusAt(0);
if (quale) cout << "\n" << quale->getRunning()->getSchedulable()->getName(); else cout << "NO";
quale = h.getSimulationStatusAt(1);
if (quale) cout << "\n" << quale->getRunning()->getSchedulable()->getName(); else cout << "NO";
quale = h.getSimulationStatusAt(2);
if (quale) cout << "\n" << quale->getRunning()->getSchedulable()->getName(); else cout << "NO";
h.truncateAt(2);
smart_ptr<const sgpem::SchedulableStatus> quale2;
quale2 = h.getScheduledAt(0);
if (quale2) cout << "\n" << quale2->getSchedulable()->getName(); else cout << "NO";
quale2 = h.getScheduledAt(1);
if (quale2) cout << "\n" << quale2->getSchedulable()->getName(); else cout << "NO";
quale2 = h.getScheduledAt(2);
if (quale2) cout << "\n" << quale2->getSchedulable()->getName(); else cout << "NO";
cout << "\n\n";
cout << "AAA " <<sl.getSimulationStatus().getRunning()->getSchedulable()->getName();
cout << "\n\n";
return 0;
}