EnTT 3.13.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 >:
Inheritance graph
[legend]
Collaboration diagram for entt::process_adaptor< Func, Delta >:
Collaboration graph
[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 >
virtual ~process () noexcept
 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 = Delta
 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);
void succeed() noexcept
Terminates a process with success if it's still alive.
Definition process.hpp:122
void fail() noexcept
Terminates a process with errors if it's still alive.
Definition process.hpp:134

Where:

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
FuncActual type of process.
DeltaType to use to provide elapsed time.

Definition at line 306 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
ArgsTypes of arguments to use to initialize the actual process.
Parameters
argsParameters to use to initialize the actual process.

Definition at line 313 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
deltaElapsed time.
dataOptional data.

Definition at line 321 of file process.hpp.


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