VPTissue Reference Manual
SimPT_Parex::ExplorationProgress Class Reference

Class describing the progress state of an exploration. More...

#include <ExplorationProgress.h>

Inheritance diagram for SimPT_Parex::ExplorationProgress:
Inheritance graph
Collaboration diagram for SimPT_Parex::ExplorationProgress:
Collaboration graph

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 ExplorationGetExploration () const
 Returns the exploration of this object.
 
const std::list< unsigned int > & GetRunningTasks () const
 Returns the running tasks.
 
const ExplorationTaskGetTask (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...
 
SimTaskNextTask ()
 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...
 

Detailed Description

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


  1. NextTask
  2. GiveBack (didn't sent the exploration) & HandleResult (SimResult::ResultType::Failure)
  3. HandleResult (SimResult::ResultType::Stopped)
  4. CancelWaitingTask
  5. ResendCancelledTask
  6. HandleResult (SimResult::ResultType::Success)
  7. HandleResult (SimResult::ResultType::Failure)

Definition at line 58 of file ExplorationProgress.h.

Constructor & Destructor Documentation

SimPT_Parex::ExplorationProgress::ExplorationProgress ( const Exploration exploration)

Constructor.

Parameters
explorationThe 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.

Exceptions
ptree_bad_dataWhen the ptree doesn't have the correct data.
ptree_bad_pathWhen the ptree doesn't have the correct format.

Member Function Documentation

void SimPT_Parex::ExplorationProgress::CancelWaitingTask ( unsigned int  id)

Cancels a waiting task.

Parameters
idThe 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.

Parameters
idThe id of which to get the task.
Returns
The state and information of that 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.

Parameters
stateThe state of which to get the number of tasks.
Returns
The number of tasks with that state.

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).

Parameters
taskThe 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.

Here is the call graph for this function:

void SimPT_Parex::ExplorationProgress::HandleResult ( const SimResult result)
slot

Handles the result of a simulation task.

Parameters
resultThe 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().

Here is the call graph for this function:

bool SimPT_Parex::ExplorationProgress::IsFinished ( ) const

Return true if the exploration has finished.

Returns
Whether 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.

Returns
The next task or nullptr if there's no next task available. The ownership is transferred to the caller.

Definition at line 140 of file ExplorationProgress.cpp.

References SimPT_Parex::Exploration::CreateTask(), and SimPT_Parex::Running.

Here is the call graph for this function:

void SimPT_Parex::ExplorationProgress::ResendCancelledTask ( unsigned int  id)

Resends a cancelled task.

Parameters
idThe 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().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: