- TODO-- in SchedulablesTreeWidget

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@932 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-08-23 00:06:29 +00:00
parent 2ff804ecbe
commit 94452ca972
1 changed files with 17 additions and 13 deletions

View File

@ -58,7 +58,7 @@ SchedulablesTreeWidget::SchedulablesTreeWidget() :
//invisible
// append_column("handles", _types_column);
// append_column("handles", _handles_column);
/** DIALOGS **/
_add_process_dialog_glade->get_widget("AddProcessDialog", _add_process_dialog);
_add_thread_dialog_glade->get_widget("AddThreadDialog", _add_thread_dialog);
@ -232,27 +232,30 @@ SchedulablesTreeWidget::on_button_press_event(GdkEventButton* event)
void
SchedulablesTreeWidget::update(const History& history)
{
using std::vector;
typedef Environment::Processes::const_iterator ProcessIt;
const Environment::Processes& processes =
Simulation::get_instance().get_history().get_last_environment().get_processes();
_model->clear();
// TODO use the new sequence iterator, it's been made for
// something!!!
for(unsigned int pi = 0; pi < processes.size(); ++pi)
for(Iseq<ProcessIt> pit = const_iseq(processes); pit; ++pit)
{
Process& p = *processes[pi];
Process& p = *(*pit);
TreeModel::Row prow = *(_model->append());
prow[_main_column] = p.get_name();
prow[_types_column] = htype_process;
prow[_handles_column] = &p;
std::vector<Thread*> threads = p.get_threads();
vector<Thread*> threads = p.get_threads();
for(unsigned int ti = 0; ti < threads.size(); ++ti)
for(Iseq<vector<Thread*>::iterator> tit = iseq(threads); tit; ++tit)
{
Thread& t = *threads[ti];
Thread& t = *(*tit);
TreeModel::Row trow = *(_model->append(prow.children()));
@ -260,7 +263,7 @@ SchedulablesTreeWidget::update(const History& history)
trow[_types_column] = htype_thread;
trow[_handles_column] = &t;
std::vector<Request*> requests = t.get_requests();
vector<Request*> requests = t.get_requests();
for(unsigned int ri = 0; ri < requests.size(); ++ri)
{
@ -275,16 +278,17 @@ SchedulablesTreeWidget::update(const History& history)
rrow[_types_column] = htype_request;
rrow[_handles_column] = &r;
std::vector<SubRequest*> subrequests = r.get_subrequests();
vector<SubRequest*> subrequests = r.get_subrequests();
for(unsigned int sri = 0; sri < subrequests.size(); ++sri)
for(Iseq<vector<SubRequest*>::iterator> srit = iseq(subrequests); srit; ++srit)
{
SubRequest& sr = *subrequests[sri];
SubRequest& sr = *(*srit);
TreeModel::Row srrow = *(_model->append(rrow.children()));
// we are sure the key is valid, or no?
Resource& res = *(history.get_last_environment().get_resources().find(sr.get_resource_key())->second);
const Environment& env = history.get_last_environment();
Resource& res = *(env.get_resources().find(sr.get_resource_key())->second);
srrow[_main_column] = res.get_name();
srrow[_types_column] = htype_subrequest;