# saga::task Class Reference

Brief description starts here. More...

`#include <task.hpp>`

Inheritance diagram for saga::task:

[legend]

List of all members.

## Public Types
typedef task_base::state | state
| Brief description starts here.
## Public Member Functions
| task (saga::task_base::state t=saga::task_base::New)
| Brief description starts here.
| ~task ()
| Destroys the object.
void | run (void)
| Starts the asynchronous operation.
void | cancel (void)
| Cancels the asynchronous operation.
bool | wait (double timeout=-1.0)
| Waits for the task to finish.
state | get_state ()
| Gets the state of the task.
void | rethrow ()
| Re-throws any exception a failed task caught.
saga::object | get_object () const
| Gets the object from which this task was created.
template<typename Retval>
Retval & | get_result ()
| Gets the result of the asynchronous operation.
template<typename Retval>
Retval const & | get_result () const
void | get_result ()
| Synchronization for API functions with no return value only.
void | get_result () const
## Friends
bool | operator== (task const &lhs, task const &rhs)
| Brief description starts here.

## Detailed Description

Brief description starts here.

/*! Operations performed in highly heterogeneous distributed environments may take a long time to complete, and it is thus desirable to have the ability to perform operations in an asynchronous manner. The SAGA task model provides this ability to all other SAGA classes.

## Member Typedef Documentation

typedef task_base::state saga::task::state

Brief description starts here.

Reimplemented from saga::task_base.

## Constructor & Destructor Documentation

saga::task::task | ( | saga::task_base::state | t = `saga::task_base::New` | ) | `[explicit]`

Brief description starts here.

saga::task::~task | ( | void |  | ) |

Destroys the object.

## Member Function Documentation

void saga::task::run | ( | void |  | ) |

Starts the asynchronous operation.

Reimplemented in saga::job::job.

void saga::task::cancel | ( | void |  | ) |

Cancels the asynchronous operation.

Parameters:

  | timeout | Time for freeing resources.

bool saga::task::wait | ( | double | timeout = `-1.0` | ) |

Waits for the task to finish.

Parameters:

  | timeout | Second to wait

Returns:
  Indicating if the task is done running.

Reimplemented in saga::job::job.

task::state saga::task::get_state | ( | void |  | ) |

Gets the state of the task.

Returns:
  State of the task.

Reimplemented in saga::job::job.

Referenced by get_result(), and rethrow().

void saga::task::rethrow | ( |  | ) |

Re-throws any exception a failed task caught.

References saga::task_base::Failed, and get_state().

saga::object saga::task::get_object | ( |  | ) | const

Gets the object from which this task was created.

Returns:
  Object this task was created from.

template<typename Retval>

void saga::task::get_result | ( |  | ) | `[inline]`

Gets the result of the asynchronous operation.

Returns:
  Return value of async method.

References saga::task_base::Failed, and get_state().

Referenced by saga::cpr::checkpoint::add_file(), saga::stream::server::connect(), saga::cpr::job::cpr_list(), saga::name_space::directory::get_entry(), saga::cpr::checkpoint::get_file(), saga::cpr::directory::get_file_num(), saga::detail::permissions< saga::job::job >::get_group(), saga::name_space::directory::get_num_entries(), saga::detail::permissions< saga::job::job >::get_owner(), saga::cpr::directory::get_parent(), saga::name_space::directory::is_dir(), saga::name_space::directory::is_entry(), saga::name_space::directory::is_link(), saga::cpr::checkpoint::list_files(), saga::sd::discoverer::list_services(), saga::name_space::directory::make_dir(), saga::name_space::directory::move(), saga::name_space::directory::open(), saga::advert::directory::open(), saga::advert::directory::open_dir(), saga::cpr::checkpoint::open_file(), saga::job::service::run_job(), saga::cpr::checkpoint::stage_file(), saga::advert::entry::store_string(), and saga::cpr::directory::update_file().

template<typename Retval>

void saga::task::get_result | ( |  | ) | const`[inline]`

References saga::task_base::Failed, and get_state().

void saga::task::get_result | ( |  | ) |

Synchronization for API functions with no return value only.

void saga::task::get_result | ( |  | ) | const

## Friends And Related Function Documentation

bool operator== | ( | task const & | lhs,
|  | task const & | rhs |
| ) |  |  | `[friend]`

Brief description starts here.

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

- task.hpp
- task_get_result_impl.hpp
- advert/task_get_result.cpp
- cpr/task_get_result.cpp
- file/task_get_result.cpp
- isn/task_get_result.cpp
- job/task_get_result.cpp
- namespace/task_get_result.cpp
- replica/task_get_result.cpp
- rpc/task_get_result.cpp
- sd/task_get_result.cpp
- stream/task_get_result.cpp
- task.cpp