saga::task_container Class Reference

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

#include <task_container.hpp>

Inheritance diagram for saga::task_container:

Inheritance graph
[legend]

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.


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.


Constructor & Destructor Documentation

saga::task_container::task_container ( void   ) 

Creates a task_container.

saga::task_container::~task_container ( void   ) 

Destroys a task_container.


Member Function Documentation

void saga::task_container::run ( void   ) 

Start all asynchronous operations in the container.

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

Adds a task to a task_container.

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

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

Removes a task from a task_container.

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

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.

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.

void saga::task_container::cancel ( void   ) 

Cancels all the asynchronous operations in the container.

Parameters:
timeout Time for freeing resources.

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:
mode Wait for all or any task
timeout Seconds to wait
Returns:
Finished task


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

Generated on Mon Aug 24 09:04:05 2009 for SAGA C++ API by  doxygen 1.5.6