SAGA C++ API 1.6
saga::task_container Class Reference

Handles a large number of asynchronous operations. More...

#include <task_container.hpp>

Inheritance diagram for saga::task_container:

List of all members.

Public Types

enum  wait_mode {
  All = 1,
  Any = 2
}
 The wait mode enum specifies the condition on which a wait() operation on a saga::task container returns. More...

Public Member Functions

 task_container (void)
 Creates a task_container.
 ~task_container (void)
 Destroys a task_container.
void run ()
 Start all asynchronous operations in the container.
void add_task (task t)
 Adds a task to a task_container.
void remove_task (task t)
 Removes a task from a task_container.
std::vector< tasklist_tasks (void) const
 Lists the tasks in the task_container.
std::vector< task_base::stateget_states (void) const
 Gets the states of all tasks in the task_container.
void cancel (void)
 Cancels all the asynchronous operations in the container.
std::vector< taskwait (wait_mode mode=All, float timeout=-1.0)
 Wait for one or more of the tasks to finish.

Detailed Description

Handles a large number of asynchronous operations.

Managing a large number of tasks can be tedious. The task_container class is designed to help in these situations, and to effectively handle a large number of asynchronous operations.

Definition at line 34 of file task_container.hpp.


Member Enumeration Documentation

The wait mode enum specifies the condition on which a wait() operation on a saga::task container returns.

Enumerator:
All 

wait() returns if all tasks in the container reached a final state

Any 

wait() returns if one or more tasks in the container reached a final state.

Definition at line 52 of file task_container.hpp.


Constructor & Destructor Documentation

saga::task_container::task_container ( void  )

Creates a task_container.

Definition at line 18 of file task_container.cpp.

saga::task_container::~task_container ( void  )

Destroys a task_container.

Definition at line 23 of file task_container.cpp.


Member Function Documentation

void saga::task_container::run ( void  )

Start all asynchronous operations in the container.

Definition at line 70 of file task_container.cpp.

void saga::task_container::add_task ( task  t)

Adds a task to a task_container.

Parameters:
taskTask to add to the task_container.
Returns:
Cookie identifying the added task.

Definition at line 40 of file task_container.cpp.

void saga::task_container::remove_task ( task  t)

Removes a task from a task_container.

Parameters:
taskCookie identifying the task to be removed.
Returns:
The removed task.

Definition at line 45 of file task_container.cpp.

std::vector< task > saga::task_container::list_tasks ( void  ) const

Lists the tasks in the task_container.

Returns:
Array of cookies for all tasks in task_container.

Definition at line 50 of file task_container.cpp.

std::vector< task_base::state > saga::task_container::get_states ( void  ) const

Gets the states of all tasks in the task_container.

Returns:
Array of states for tasks in task_container.

Definition at line 55 of file task_container.cpp.

void saga::task_container::cancel ( void  )

Cancels all the asynchronous operations in the container.

Parameters:
timeoutTime for freeing resources.

Definition at line 60 of file task_container.cpp.

std::vector< task > saga::task_container::wait ( wait_mode  mode = All,
float  timeout = -1.0 
)

Wait for one or more of the tasks to finish.

Parameters:
modeWait for all or any task
timeoutSeconds to wait
Returns:
Finished task

Definition at line 65 of file task_container.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines