TaskInheritedVariable is a per-coroutine variable of arbitrary type.
More...
#include <userver/engine/task/inherited_variable.hpp>
|
const T * | GetOptional () const noexcept |
| Get the variable instance for the current task.
|
|
const T & | Get () const |
| Get the variable instance for the current task.
|
|
template<typename... Args> |
void | Emplace (Args &&... args) |
| Sets or replaces the T variable instance.
|
|
void | Set (T &&value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
void | Set (const T &value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
void | Erase () |
| Hide the variable so that it is no longer accessible from the current or new child tasks.
|
|
template<typename T>
class engine::TaskInheritedVariable< T >
TaskInheritedVariable is a per-coroutine variable of arbitrary type.
These are like engine::TaskLocalVariable, but the variable instances are inherited by child tasks created via utils::Async.
The order of destruction of task-inherited variables is unspecified.
Definition at line 24 of file inherited_variable.hpp.
◆ Emplace()
template<typename T >
template<typename... Args>
◆ Erase()
Hide the variable so that it is no longer accessible from the current or new child tasks.
- Note
- The variable might not actually be destroyed immediately.
Definition at line 57 of file inherited_variable.hpp.
◆ Get()
Get the variable instance for the current task.
- Exceptions
-
std::runtime_error | if variable was not set. |
Definition at line 37 of file inherited_variable.hpp.
◆ GetOptional()
Get the variable instance for the current task.
- Returns
- the variable or
nullptr
if variable was not set.
Definition at line 31 of file inherited_variable.hpp.
◆ Set() [1/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 52 of file inherited_variable.hpp.
◆ Set() [2/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 49 of file inherited_variable.hpp.
The documentation for this class was generated from the following file: