|
EnTT 3.16.0
|
Base class for processes. More...
#include <process.hpp>


Public Types | |
| using | allocator_type = Allocator |
| Allocator type. | |
| using | delta_type = Delta |
| Type used to provide elapsed time. | |
| using | handle_type = std::shared_ptr<basic_process> |
| Handle type. | |
Public Member Functions | |
| basic_process () | |
| Default constructor. | |
| basic_process (const allocator_type &allocator) | |
| Constructs a scheduler with a given allocator. | |
| basic_process (const basic_process &)=delete | |
| Default copy constructor, deleted on purpose. | |
| basic_process (basic_process &&)=delete | |
| Default move constructor, deleted on purpose. | |
| virtual | ~basic_process ()=default |
| Default destructor. | |
| basic_process & | operator= (const basic_process &)=delete |
| Default copy assignment operator, deleted on purpose. | |
| basic_process & | operator= (basic_process &&)=delete |
| Default move assignment operator, deleted on purpose. | |
| constexpr allocator_type | get_allocator () const noexcept |
| Returns the associated allocator. | |
| void | abort () |
| Aborts a process if it's still alive, otherwise does nothing. | |
| void | succeed () noexcept |
| Terminates a process with success if it's still alive, otherwise does nothing. | |
| void | fail () noexcept |
| Terminates a process with errors if it's still alive, otherwise does nothing. | |
| void | pause () noexcept |
| Stops a process if it's running, otherwise does nothing. | |
| void | unpause () noexcept |
| Restarts a process if it's paused, otherwise does nothing. | |
| 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. | |
| template<typename Type, typename... Args> | |
| basic_process & | then (Args &&...args) |
| Assigns a child process to run in case of success. | |
| template<typename Func> | |
| basic_process & | then (Func func) |
| Assigns a child process to run in case of success. | |
| handle_type | peek () |
| Returns the child process without releasing ownership, if any. | |
| void | tick (const Delta delta, void *data=nullptr) |
| Updates a process and its internal state, if required. | |
Base class for processes.
Derived classes must specify what's the intended type for elapsed times.
A process can implement the following member functions whether required:
It's invoked once per tick until a process is explicitly aborted or it terminates either with or without errors. Even though it's not mandatory to declare this member function, as a rule of thumb each process should at least define it to work properly. The void * parameter is an opaque pointer to user data (if any) forwarded directly to the process during an update.
It's invoked in case of success, immediately after an update and during the same tick.
It's invoked in case of errors, immediately after an update and during the same tick.
It's invoked only if a process is explicitly aborted. There is no guarantee that it executes in the same tick, this depends solely on whether the process is aborted immediately or not.
Derived classes can change the internal state of a process by invoking the succeed and fail member functions and even pause or unpause the process itself.
| Delta | Type to use to provide elapsed time. |
| Allocator | Type of allocator used to manage memory and elements. |
Definition at line 72 of file process.hpp.
| using entt::basic_process< Delta, Allocator >::allocator_type = Allocator |
Allocator type.
Definition at line 94 of file process.hpp.
| using entt::basic_process< Delta, Allocator >::delta_type = Delta |
Type used to provide elapsed time.
Definition at line 96 of file process.hpp.
| using entt::basic_process< Delta, Allocator >::handle_type = std::shared_ptr<basic_process> |
Handle type.
Definition at line 98 of file process.hpp.
|
inline |
Default constructor.
Definition at line 101 of file process.hpp.
|
inlineexplicit |
Constructs a scheduler with a given allocator.
| allocator | The allocator to use. |
Definition at line 108 of file process.hpp.
|
inline |
Aborts a process if it's still alive, otherwise does nothing.
Definition at line 142 of file process.hpp.
|
inlinenodiscardnoexcept |
Returns true if a process is either running or paused.
Definition at line 186 of file process.hpp.
|
inlinenoexcept |
Terminates a process with errors if it's still alive, otherwise does nothing.
Definition at line 162 of file process.hpp.
|
inlinenodiscardnoexcept |
Returns true if a process is already terminated.
Definition at line 194 of file process.hpp.
|
inlinenodiscardconstexprnoexcept |
Returns the associated allocator.
Definition at line 137 of file process.hpp.
|
delete |
Default move assignment operator, deleted on purpose.
|
delete |
Default copy assignment operator, deleted on purpose.
|
inlinenoexcept |
Stops a process if it's running, otherwise does nothing.
Definition at line 169 of file process.hpp.
|
inlinenodiscardnoexcept |
Returns true if a process is currently paused.
Definition at line 202 of file process.hpp.
|
inline |
Returns the child process without releasing ownership, if any.
Definition at line 244 of file process.hpp.
|
inlinenodiscardnoexcept |
Returns true if a process terminated with errors.
Definition at line 210 of file process.hpp.
|
inlinenoexcept |
Terminates a process with success if it's still alive, otherwise does nothing.
Definition at line 152 of file process.hpp.
|
inline |
Assigns a child process to run in case of success.
| Type | Type of child process to create. |
| Args | Types of arguments to use to initialize the child process. |
| args | Parameters to use to initialize the child process. |
Definition at line 222 of file process.hpp.
|
inline |
Assigns a child process to run in case of success.
| Func | Type of child process to create. |
| func | Either a lambda or a functor to use as a child process. |
Definition at line 234 of file process.hpp.
|
inline |
Updates a process and its internal state, if required.
| delta | Elapsed time. |
| data | Optional data. |
Definition at line 253 of file process.hpp.
|
inlinenoexcept |
Restarts a process if it's paused, otherwise does nothing.
Definition at line 176 of file process.hpp.