A context is a node within a tree that represents deadlines and key/value pairs.
#include <context.hpp>
|
| Context () |
| Constructs a new context with no deadline, and no value associated.
|
|
Context | WithDeadline (DateTime const &deadline) const |
| Creates a context with a deadline. More...
|
|
template<class T > |
Context | WithValue (Key const &key, T &&value) const |
| Creates a context without a deadline, but with key and value associated with it. More...
|
|
DateTime | GetDeadline () const |
| Gets the deadline for this context or the branch of contexts this context belongs to. More...
|
|
template<class T > |
bool | TryGetValue (Key const &key, T &outputValue) const |
| Gets the value associated with a key parameter within this context or the branch of contexts this context belongs to. More...
|
|
void | Cancel () |
| Cancels the context.
|
|
bool | IsCancelled () const |
| Checks if the context is cancelled. More...
|
|
void | ThrowIfCancelled () const |
| Checks if the context is cancelled. More...
|
|
◆ GetDeadline()
- Returns
- The deadline associated with the context;
Azure::DateTime::max()
if no deadline is specified.
◆ IsCancelled()
bool Azure::Core::Context::IsCancelled |
( |
| ) |
const |
|
inline |
- Returns
true
if this context is cancelled; otherwise, false
.
◆ ThrowIfCancelled()
void Azure::Core::Context::ThrowIfCancelled |
( |
| ) |
const |
|
inline |
◆ TryGetValue()
template<class T >
bool Azure::Core::Context::TryGetValue |
( |
Key const & |
key, |
|
|
T & |
outputValue |
|
) |
| const |
|
inline |
- Template Parameters
-
T | The type of the value to be retrieved. |
- Parameters
-
key | A key associated with a context to find. |
outputValue | A reference to the value corresponding to the key to be set, if found within the context tree. |
- Returns
true
if key
is found, with outputValue
set to the value associated with the key found; otherwise, false
.
- Note
- The
outputValue
is left unmodified if the key
is not found.
◆ WithDeadline()
Context Azure::Core::Context::WithDeadline |
( |
DateTime const & |
deadline | ) |
const |
|
inline |
- Parameters
-
deadline | A point in time after which a context expires. |
- Returns
- A child context with deadline.
◆ WithValue()
template<class T >
Context Azure::Core::Context::WithValue |
( |
Key const & |
key, |
|
|
T && |
value |
|
) |
| const |
|
inline |
- Template Parameters
-
T | The type of the value to be stored with the key. |
- Parameters
-
key | A key to associate with this context. |
value | A value to associate with this context. |
- Returns
- A child context with no deadline and the
key
and value
associated with it.
The documentation for this class was generated from the following files: