EnTT: entt::process_adaptor< Func, Delta > Struct Template Reference

EnTT 3.15.0

Loading...
Searching...
No Matches
Public Member Functions | List of all members
entt::process_adaptor< Func, Delta > Struct Template Reference

Adaptor for lambdas and functors to turn them into processes. More...

`#include <process.hpp>`

Inheritance diagram for entt::process_adaptor< Func, Delta >:
[legend]
Collaboration diagram for entt::process_adaptor< Func, Delta >:
[legend]

## Public Member Functions
template<typename... Args>
| process_adaptor (Args &&...args)
| Constructs a process adaptor from a lambda or a functor.
void | update (const Delta delta, void *data)
| Updates a process and its internal state if required.
Public Member Functions inherited from entt::process< process_adaptor< Func, Delta >, Delta >
constexpr | process ()=default
| Default constructor.
| process (const process &)=default
| Default copy constructor.
| process (process &&) noexcept=default
| Default move constructor.
process & | operator= (const process &)=default
| Default copy assignment operator.
process & | operator= (process &&) noexcept=default
| Default move assignment operator.
virtual | ~process ()
| Default destructor.
void | abort (const bool immediate=false)
| Aborts a process if it's still alive.
bool | alive () const noexcept
| Returns true if a process is either running or paused.
bool | finished () const noexcept
| Returns true if a process is already terminated.
bool | paused () const noexcept
| Returns true if a process is currently paused.
bool | rejected () const noexcept
| Returns true if a process terminated with errors.
void | tick (const Delta delta, void *data=nullptr)
| Updates a process and its internal state if required.

## Additional Inherited Members
Public Types inherited from entt::process< process_adaptor< Func, Delta >, Delta >
using | delta_type
| Type used to provide elapsed time.
Protected Member Functions inherited from entt::process< process_adaptor< Func, Delta >, Delta >
void | succeed () noexcept
| Terminates a process with success if it's still alive.
void | fail () noexcept
| Terminates a process with errors if it's still alive.
void | pause () noexcept
| Stops a process if it's in a running state.
void | unpause () noexcept
| Restarts a process if it's paused.

## Detailed Description

template<typename Func, typename Delta>
struct entt::process_adaptor< Func, Delta >

Adaptor for lambdas and functors to turn them into processes.

Lambdas and functors can't be used directly with a scheduler for they are not properly defined processes with managed life cycles.
This class helps in filling the gap and turning lambdas and functors into full featured processes usable by a scheduler.

The signature of the function call operator should be equivalent to the following:

void(Delta delta, void *data, auto succeed, auto fail);
entt::process< process_adaptor< Func, Delta >, Delta >::succeed
void succeed() noexcept
Definition process.hpp:123
entt::process< process_adaptor< Func, Delta >, Delta >::fail
void fail() noexcept
Definition process.hpp:135

Where:

- `delta` is the elapsed time.
- `data` is an opaque pointer to user data if any, `nullptr` otherwise.
- `succeed` is a function to call when a process terminates with success.
- `fail` is a function to call when a process terminates with errors.

The signature of the function call operator of both `succeed` and `fail` is equivalent to the following:

void();

Usually users shouldn't worry about creating adaptors. A scheduler will create them internally each and avery time a lambda or a functor is used as a process.

See also
  process
  scheduler

Template Parameters

  Func | Actual type of process.
  Delta | Type to use to provide elapsed time.

Definition at line 328 of file process.hpp.

## Constructor & Destructor Documentation

## ◆ process_adaptor()

template<typename Func, typename Delta>
template<typename... Args>

entt::process_adaptor< Func, Delta >::process_adaptor | ( | Args &&... | args | ) |
| inline

Constructs a process adaptor from a lambda or a functor.

Template Parameters

  Args | Types of arguments to use to initialize the actual process.

Parameters

  args | Parameters to use to initialize the actual process.

Definition at line 335 of file process.hpp.

## Member Function Documentation

## ◆ update()

template<typename Func, typename Delta>

void entt::process_adaptor< Func, Delta >::update | ( | const Delta | delta,
|  | void * | data )
| inline

Updates a process and its internal state if required.

Parameters

  delta | Elapsed time.
  data | Optional data.

Definition at line 343 of file process.hpp.

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

- src/entt/process/process.hpp