- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Interfaces::ExecutionInterface Class Reference

Inheritance diagram for Mers::Interfaces::ExecutionInterface:

[legend]
Collaboration diagram for Mers::Interfaces::ExecutionInterface:

[legend]
List of all members.

## Public Member Functions
| ExecutionInterface (TaskFactory *pTaskFactory)
virtual | ~ExecutionInterface ()
virtual bool | start (TaskIdentifier taskID)
virtual bool | stop ()
virtual bool | stop (TaskIdentifier taskID)
virtual int | step (bool block=true)
virtual bool | isDone ()
virtual bool | isDone (TaskIdentifier taskID)
virtual std::set< TaskIdentifier > | getRecentlyFailedTasks ()
virtual std::set< TaskIdentifier > | getRecentlyCompletedTasks ()
virtual Mers::Utils::Lang::String | getActiveTasksString ()
Mers::Utils::Lang::String | getTasksString ()
## Protected Attributes
std::set< TaskIdentifier > | currentTasks
| set of currently executing tasks
std::set< TaskIdentifier > | completedTasks
| set of completed tasks
std::set< TaskIdentifier > | recentlyFailedTasks
std::set< TaskIdentifier > | recentlyCompletedTasks
std::set< TaskIdentifier > | tasksToStart
std::set< TaskIdentifier > | tasksToStop

## Detailed Description

Definition at line 31 of file ExecutionInterface.h.

## Constructor & Destructor Documentation

ExecutionInterface::ExecutionInterface | ( | TaskFactory * | pTaskFactory | ) |

Creates a new execution interface.

Definition at line 41 of file ExecutionInterface.cpp.

References completedTasks, currentTasks, Mers::Interfaces::ExecutionInterfaceBase::mFailedTasks, recentlyCompletedTasks, recentlyFailedTasks, tasksToStart, and tasksToStop.

ExecutionInterface::~ExecutionInterface | ( |  | ) | `[virtual]`

Destroys this object.

Definition at line 56 of file ExecutionInterface.cpp.

## Member Function Documentation

bool ExecutionInterface::start | ( | TaskIdentifier | taskID | ) | `[virtual]`

Sets the task to be started when "step" is ran. The task will continue until it has either completed or is told to stop. The execution status of tasks can generally be queried, so the termination of the task can be determined. This routine should generally do as little work as possible.

Parameters:

  | task | The name of the task that should be started.

Returns:
  True if the task was found and set to start or if the task is already running, otherwise false. False may be returned for many reasons, including the inability of finding the task, the inability of starting the task (due to limitations in the conditions on the task, the number of times it can be run, the total number of tasks that can be run, etc), etc.

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 62 of file ExecutionInterface.cpp.

References completedTasks, currentTasks, Mers::Interfaces::ExecutionInterfaceBase::getTask(), Mers::Utils::Lang::Mutex::LockMutex(), tasksToStart, and Mers::Utils::Lang::Mutex::UnlockMutex().

Here is the call graph for this function:

bool ExecutionInterface::stop | ( |  | ) | `[virtual]`

Sets all tasks to be stop when "step" is ran. Every command that was started will be stopped, if possible.

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 87 of file ExecutionInterface.cpp.

References currentTasks, Mers::Utils::Lang::Mutex::LockMutex(), tasksToStop, and Mers::Utils::Lang::Mutex::UnlockMutex().

Here is the call graph for this function:

bool ExecutionInterface::stop | ( | TaskIdentifier | taskID | ) | `[virtual]`

If the task is currently active, it will set the task to be stopped when "step" is ran. Has no effect if the task was already stopped or already complete.

Parameters:

  | task | The task that should be stopped. A task will be stopped if it is still running and the task can be stopped.

Returns:
  true If the task was successfully stopped or was already stopped, false otherwise.

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 102 of file ExecutionInterface.cpp.

References completedTasks, currentTasks, Mers::Interfaces::ExecutionInterfaceBase::getTask(), Mers::Utils::Lang::Mutex::LockMutex(), tasksToStop, and Mers::Utils::Lang::Mutex::UnlockMutex().

Here is the call graph for this function:

int ExecutionInterface::step | ( | bool | block = `true` | ) | `[virtual]`

Takes a single processing step, i.e. starts and stops appropriate tasks and attempt to make progress for the started activites. If block is false, then this executive will only progress if it is ready to progress. If block is true, then this executive will wait until progress can be made before returning. Generally, block should be false for reactive systems, and should be true when running this task-step process on a separate thread.

Parameters:

  | block | If true, this procedure will always progress before returning. If false, this procedure will not block but will return an error if blocking is required to make progress.

Returns:
  the following values:
  * -1: no progress could be made w/o blocking
  * 0: successfully progressed
  * 1: execution failure
  * 2: exception (designers intent)

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 127 of file ExecutionInterface.cpp.

References completedTasks, currentTasks, Mers::Interfaces::ExecutionInterfaceBase::getTask(), Mers::Utils::Lang::Mutex::LockMutex(), Mers::Interfaces::ExecutionInterfaceBase::mFailedTasks, recentlyCompletedTasks, recentlyFailedTasks, tasksToStart, tasksToStop, and Mers::Utils::Lang::Mutex::UnlockMutex().

Here is the call graph for this function:

bool ExecutionInterface::isDone | ( |  | ) | `[virtual]`

Returns true if all procedures have completed.

Returns:
  true if all procedures have completed.

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 229 of file ExecutionInterface.cpp.

References completedTasks, and Mers::Interfaces::ExecutionInterfaceBase::mTasks.

bool ExecutionInterface::isDone | ( | TaskIdentifier | taskID | ) | `[virtual]`

Returns true if a specific task has completed.

Parameters:

  | task | The task whos status is desired

Returns:
  True if a specific procedure is done, false otherwise.

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 237 of file ExecutionInterface.cpp.

References completedTasks, and Mers::Interfaces::ExecutionInterfaceBase::getTask().

Here is the call graph for this function:

set< ExecutionInterface::TaskIdentifier > ExecutionInterface::getRecentlyFailedTasks | ( |  | ) | `[virtual]`

Returns the set of tasks that were determined to have failed by the last call to step. Typically called when step retuns with status 1 indicating that there was an execution failure

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 277 of file ExecutionInterface.cpp.

References recentlyFailedTasks.

set< ExecutionInterface::TaskIdentifier > ExecutionInterface::getRecentlyCompletedTasks | ( |  | ) | `[virtual]`

Returns the set of tasks that were determined to have completed by the last call to step.

Implements Mers::Interfaces::ExecutionInterfaceBase.

Definition at line 285 of file ExecutionInterface.cpp.

References recentlyCompletedTasks.

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

- /Users/fpy/titan-1-5-MBARI/Mers/Interfaces/ExecutionInterface.h
- /Users/fpy/titan-1-5-MBARI/Mers/Interfaces/ExecutionInterface.cpp