VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::Schedule::Status Class Reference

RAII handle returned by exec_task() for a void-callback task. More...

#include <schedule.h>

Inheritance diagram for vlink::Schedule::Status:
Collaboration diagram for vlink::Schedule::Status:

Classes

struct  StatusImpl

Public Member Functions

 Status ()
 Constructs an invalid Status (not yet associated with a task).
 ~Status ()
 Destructor.
 Status (const Status &)=delete
Statusoperator= (const Status &)=delete
 Status (Status &&status) noexcept
 Move constructor.
Statusoperator= (Status &&status) noexcept
 Move assignment.
void set_valid (bool valid)
 Sets whether the status is valid (task was successfully posted).
bool is_valid () const
 Returns true if the associated task was posted successfully.
Statuson_schedule_timeout (Callback &&callback)
 Registers a callback fired when the task does not start within schedule_timeout_ms.
Statuson_execution_timeout (Callback &&callback)
 Registers a callback fired when the task runs longer than execution_timeout_ms.
Statuson_catch (CatchCallback &&callback)
 Registers a callback fired when the task throws an exception.

Protected Attributes

friend Schedule
std::shared_ptr< StatusImplimpl_

Detailed Description

RAII handle returned by exec_task() for a void-callback task.

Holds a shared reference to the internal task state. Destruction does not cancel the task. Callback registration methods return *this to allow chaining.

Constructor & Destructor Documentation

◆ Status() [1/3]

vlink::Schedule::Status::Status ( )

Constructs an invalid Status (not yet associated with a task).

Here is the caller graph for this function:

◆ ~Status()

vlink::Schedule::Status::~Status ( )

Destructor.

◆ Status() [2/3]

vlink::Schedule::Status::Status ( const Status & )
delete
Here is the call graph for this function:

◆ Status() [3/3]

vlink::Schedule::Status::Status ( Status && status)
noexcept

Move constructor.

Parameters
statusSource status to move from.
Here is the call graph for this function:

Member Function Documentation

◆ is_valid()

bool vlink::Schedule::Status::is_valid ( ) const
nodiscard

Returns true if the associated task was posted successfully.

Returns
true if valid.

◆ on_catch()

Status & vlink::Schedule::Status::on_catch ( CatchCallback && callback)

Registers a callback fired when the task throws an exception.

The exception is caught inside the wrapper and passed to this callback. The task is considered failed after an exception.

Parameters
callbackCallback invoked with the caught exception.
Returns
Reference to *this for chaining.
Here is the call graph for this function:

◆ on_execution_timeout()

Status & vlink::Schedule::Status::on_execution_timeout ( Callback && callback)

Registers a callback fired when the task runs longer than execution_timeout_ms.

Parameters
callbackCallback invoked from the loop thread on execution timeout.
Returns
Reference to *this for chaining.
Here is the call graph for this function:

◆ on_schedule_timeout()

Status & vlink::Schedule::Status::on_schedule_timeout ( Callback && callback)

Registers a callback fired when the task does not start within schedule_timeout_ms.

Parameters
callbackCallback invoked from the loop thread on schedule timeout.
Returns
Reference to *this for chaining.
Here is the call graph for this function:

◆ operator=() [1/2]

Status & vlink::Schedule::Status::operator= ( const Status & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

Status & vlink::Schedule::Status::operator= ( Status && status)
noexcept

Move assignment.

Parameters
statusSource status to move from.
Returns
Reference to *this.
Here is the call graph for this function:

◆ set_valid()

void vlink::Schedule::Status::set_valid ( bool valid)

Sets whether the status is valid (task was successfully posted).

Parameters
validtrue if the associated task was posted successfully.

Member Data Documentation

◆ impl_

std::shared_ptr<StatusImpl> vlink::Schedule::Status::impl_
protected

◆ Schedule

friend vlink::Schedule::Status::Schedule
protected

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