|
OpenLexocad
27.0
|
Adaptor for lambdas and functors to turn them into processes. More...
#include <entt.hpp>
Public Member Functions | |
| template<typename... Args> | |
| process_adaptor (Args &&... args) | |
| Constructs a process adaptor from a lambda or a functor. More... | |
| void | update (const Delta delta, void *data) |
| Updates a process and its internal state if required. More... | |
Public Member Functions inherited from entt::process< process_adaptor< Func, Delta >, Delta > | |
| void | tick (const Delta delta, void *data=nullptr) |
| Updates a process and its internal state if required. More... | |
| virtual | ~process () ENTT_NOEXCEPT |
| Default destructor. More... | |
| void | abort (const bool immediately=false) ENTT_NOEXCEPT |
| Aborts a process if it's still alive. More... | |
| bool | alive () const ENTT_NOEXCEPT |
| Returns true if a process is either running or paused. More... | |
| bool | dead () const ENTT_NOEXCEPT |
| Returns true if a process is already terminated. More... | |
| bool | paused () const ENTT_NOEXCEPT |
| Returns true if a process is currently paused. More... | |
| bool | rejected () const ENTT_NOEXCEPT |
| Returns true if a process terminated with errors. More... | |
Additional Inherited Members | |
Public Types inherited from entt::process< process_adaptor< Func, Delta >, Delta > | |
| using | delta_type = Delta |
| Type used to provide elapsed time. More... | |
Protected Member Functions inherited from entt::process< process_adaptor< Func, Delta >, Delta > | |
| void | succeed () ENTT_NOEXCEPT |
| Terminates a process with success if it's still alive. More... | |
| void | fail () ENTT_NOEXCEPT |
| Terminates a process with errors if it's still alive. More... | |
| void | pause () ENTT_NOEXCEPT |
| Stops a process if it's in a running state. More... | |
| void | unpause () ENTT_NOEXCEPT |
| Restarts a process if it's paused. More... | |
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:
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:
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.
| Func | Actual type of process. |
| Delta | Type to use to provide elapsed time. |
|
inline |
Constructs a process adaptor from a lambda or a functor.
| Args | Types of arguments to use to initialize the actual process. |
| args | Parameters to use to initialize the actual process. |
|
inline |
Updates a process and its internal state if required.
| delta | Elapsed time. |
| data | Optional data. |