VPTissue Reference Manual
|
Class describing the progress state of an exploration. More...
#include <ExplorationProgress.h>
Public Slots | |
void | HandleResult (const SimResult &result) |
Handles the result of a simulation task. More... | |
Signals | |
void | Updated () |
Signal called when Exploration has changed. | |
Public Member Functions | |
ExplorationProgress (const Exploration *exploration) | |
Constructor. More... | |
ExplorationProgress (const boost::property_tree::ptree &pt) | |
Construct an exploration progress with the given pt. More... | |
virtual | ~ExplorationProgress () |
Destructor. | |
void | CancelWaitingTask (unsigned int id) |
Cancels a waiting task. More... | |
const Exploration & | GetExploration () const |
Returns the exploration of this object. | |
const std::list< unsigned int > & | GetRunningTasks () const |
Returns the running tasks. | |
const ExplorationTask & | GetTask (unsigned int id) const |
Returns the state of the task with the specified id. More... | |
unsigned int | GetTaskCount (const TaskState &state) const |
Returns the number of tasks with the specified state. More... | |
void | GiveBack (const SimTask *task) |
Give a task back to exploration (when it could not have been sent). More... | |
bool | IsFinished () const |
Return true if the exploration has finished. More... | |
SimTask * | NextTask () |
Return the next task ready to be simulated. More... | |
void | ResendCancelledTask (unsigned int id) |
Resends a cancelled task. More... | |
boost::property_tree::ptree | ToPtree () const |
Convert the exploration and progress to a ptree. More... | |
Class describing the progress state of an exploration.
The tasks have ID's from 0 to the number of tasks minus 1.
The state diagram of a task looks like this:
Waiting ----—1--—> Running ----—6--—> Finished | ^ <---—2---— | ----—7--—> Failed 4 5 | v | | Cancelled <------------—3
Definition at line 58 of file ExplorationProgress.h.
SimPT_Parex::ExplorationProgress::ExplorationProgress | ( | const Exploration * | exploration | ) |
Constructor.
exploration | The exploration to track (this object takes ownership). |
Definition at line 37 of file ExplorationProgress.cpp.
SimPT_Parex::ExplorationProgress::ExplorationProgress | ( | const boost::property_tree::ptree & | pt | ) |
Construct an exploration progress with the given pt.
See ToPtree() for more information about the format of such a tree.
ptree_bad_data | When the ptree doesn't have the correct data. |
ptree_bad_path | When the ptree doesn't have the correct format. |
void SimPT_Parex::ExplorationProgress::CancelWaitingTask | ( | unsigned int | id | ) |
Cancels a waiting task.
id | The id of the task to cancel. |
Definition at line 59 of file ExplorationProgress.cpp.
References SimPT_Parex::Cancelled.
const ExplorationTask & SimPT_Parex::ExplorationProgress::GetTask | ( | unsigned int | id | ) | const |
Returns the state of the task with the specified id.
id | The id of which to get the task. |
Definition at line 77 of file ExplorationProgress.cpp.
unsigned int SimPT_Parex::ExplorationProgress::GetTaskCount | ( | const TaskState & | state | ) | const |
Returns the number of tasks with the specified state.
state | The state of which to get the number of tasks. |
Definition at line 84 of file ExplorationProgress.cpp.
void SimPT_Parex::ExplorationProgress::GiveBack | ( | const SimTask * | task | ) |
Give a task back to exploration (when it could not have been sent).
task | The given task. The ownership is transferred to this object, which will delete it. |
Definition at line 96 of file ExplorationProgress.cpp.
References SimPT_Parex::SimTask::GetId(), and SimPT_Parex::Running.
|
slot |
Handles the result of a simulation task.
result | The result of the task (this object takes ownership). |
Definition at line 108 of file ExplorationProgress.cpp.
References SimPT_Parex::Cancelled, SimPT_Parex::Failed, SimPT_Parex::Finished, SimPT_Parex::SimResult::GetNodeIP(), SimPT_Parex::SimResult::GetNodePort(), SimPT_Parex::ExplorationTask::GetNumberOfTries(), SimPT_Parex::SimResult::GetResult(), SimPT_Parex::SimResult::GetTaskId(), and SimPT_Parex::ExplorationTask::IncrementTries().
bool SimPT_Parex::ExplorationProgress::IsFinished | ( | ) | const |
Return true if the exploration has finished.
Definition at line 135 of file ExplorationProgress.cpp.
SimTask * SimPT_Parex::ExplorationProgress::NextTask | ( | ) |
Return the next task ready to be simulated.
Definition at line 140 of file ExplorationProgress.cpp.
References SimPT_Parex::Exploration::CreateTask(), and SimPT_Parex::Running.
void SimPT_Parex::ExplorationProgress::ResendCancelledTask | ( | unsigned int | id | ) |
Resends a cancelled task.
id | The id of the task to re-send. |
Definition at line 194 of file ExplorationProgress.cpp.
References SimPT_Parex::Cancelled.
ptree SimPT_Parex::ExplorationProgress::ToPtree | ( | ) | const |
Convert the exploration and progress to a ptree.
The format of such a ptree is: <exploration> m_exploration [see Exploration.h for more information about its format] </exploration> <tasks> (for each task in m_tasks) <task> task [see ExplorationTask.h for more information about their format] </task> [...] </tasks> <send_queue> (for every id in m_send_queue, the order will be kept) <task_id>id</task_id> [...] </send_queue>
Definition at line 203 of file ExplorationProgress.cpp.
References SimPT_Parex::ExplorationTask::ToPtree(), and SimPT_Parex::Exploration::ToPtree().
Referenced by SimPT_Parex::ServerClientProtocol::SendStatus().