VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::Schedule Struct Referencefinal

Non-constructible utility struct providing task scheduling primitives. More...

#include <schedule.h>

Collaboration diagram for vlink::Schedule:

Classes

struct  Config
 Scheduling parameters for a task posted via MessageLoop::exec_task(). More...
class  Status
 RAII handle returned by exec_task() for a void-callback task. More...
class  RetStatus
 RAII handle returned by exec_task() for a bool-returning callback task. More...

Public Types

using Callback = std::function<void()>
 Callback type for void tasks and lifecycle hooks (schedule/execution timeout, else).
using RetCallback = std::function<bool()>
 Callback type for tasks that return a boolean result.
using CatchCallback = std::function<void(std::exception&)>
 Callback type invoked when an exception is caught inside the task.

Public Member Functions

 Schedule ()=delete
 Schedule (const Schedule &)=delete
Scheduleoperator= (const Schedule &)=delete
 Schedule (Schedule &&)=delete
Scheduleoperator= (Schedule &&)=delete

Static Public Member Functions

static Status process (const Config &config, Callback &&callback, Callback &wrapper_callback)
 Wraps a void callback in a Config envelope and produces a wrapper task.
static RetStatus process_with_ret (const Config &config, RetCallback &&callback, Callback &wrapper_callback)
 Wraps a bool-returning callback in a Config envelope and produces a wrapper task.

Detailed Description

Non-constructible utility struct providing task scheduling primitives.

Contains Config, Status, RetStatus, process() and process_with_ret(). Users interact with this struct primarily via MessageLoop::exec_task().

Member Typedef Documentation

◆ Callback

using vlink::Schedule::Callback = std::function<void()>

Callback type for void tasks and lifecycle hooks (schedule/execution timeout, else).

◆ CatchCallback

using vlink::Schedule::CatchCallback = std::function<void(std::exception&)>

Callback type invoked when an exception is caught inside the task.

◆ RetCallback

using vlink::Schedule::RetCallback = std::function<bool()>

Callback type for tasks that return a boolean result.

Constructor & Destructor Documentation

◆ Schedule() [1/3]

vlink::Schedule::Schedule ( )
delete
Here is the caller graph for this function:

◆ Schedule() [2/3]

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

◆ Schedule() [3/3]

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

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ process()

Status vlink::Schedule::process ( const Config & config,
Callback && callback,
Callback & wrapper_callback )
staticnodiscard

Wraps a void callback in a Config envelope and produces a wrapper task.

Called internally by MessageLoop::exec_task(). Creates the Status and populates wrapper_callback with the task wrapper ready to be posted to the queue.

Parameters
configScheduling configuration.
callbackVoid callable to execute.
wrapper_callbackOutput: the wrapped task to be posted.
Returns
Status handle for chaining callbacks.
Here is the caller graph for this function:

◆ process_with_ret()

RetStatus vlink::Schedule::process_with_ret ( const Config & config,
RetCallback && callback,
Callback & wrapper_callback )
staticnodiscard

Wraps a bool-returning callback in a Config envelope and produces a wrapper task.

Called internally by MessageLoop::exec_task(). Creates the RetStatus and populates wrapper_callback with the task wrapper ready to be posted to the queue.

Parameters
configScheduling configuration.
callbackBool-returning callable to execute.
wrapper_callbackOutput: the wrapped task to be posted.
Returns
RetStatus handle for chaining callbacks.
Here is the caller graph for this function:

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