SAGA Adaptor CPI v.1.0
|
Handles a large number of asynchronous operations. More...
#include <task_container.hpp>
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< task > | list_tasks (void) const |
Lists the tasks in the task_container. | |
std::vector< task_base::state > | get_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< task > | wait (wait_mode mode=All, float timeout=-1.0) |
Wait for one or more of the tasks to finish. |
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.
The wait mode enum specifies the condition on which a wait() operation on a saga::task container returns.
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.
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.
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.
task | Task to add to the task_container. |
Definition at line 40 of file task_container.cpp.
void saga::task_container::remove_task | ( | task | t | ) |
Removes a task from a task_container.
task | Cookie identifying the task to be removed. |
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.
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.
Definition at line 55 of file task_container.cpp.
void saga::task_container::cancel | ( | void | ) |
Cancels all the asynchronous operations in the container.
timeout | Time for freeing resources. |
Definition at line 60 of file task_container.cpp.
Wait for one or more of the tasks to finish.
mode | Wait for all or any task |
timeout | Seconds to wait |
Definition at line 65 of file task_container.cpp.