EnTT 3.13.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
entt::process< Derived, Delta > Class Template Reference

Base class for processes. More...

#include <process.hpp>

Public Types

using delta_type = Delta
 Type used to provide elapsed time.
 

Public Member Functions

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.
 

Protected Member Functions

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 Derived, typename Delta>
class entt::process< Derived, Delta >

Base class for processes.

This class stays true to the CRTP idiom. Derived classes must specify what's the intended type for elapsed times.
A process should expose publicly the following member functions whether required:

Derived classes can change the internal state of a process by invoking the succeed and fail protected member functions and even pause or unpause the process itself.

See also
scheduler
Template Parameters
DerivedActual type of process that extends the class template.
DeltaType to use to provide elapsed time.

Definition at line 71 of file process.hpp.

Member Typedef Documentation

◆ delta_type

template<typename Derived , typename Delta >
using entt::process< Derived, Delta >::delta_type = Delta

Type used to provide elapsed time.

Definition at line 166 of file process.hpp.

Constructor & Destructor Documentation

◆ ~process()

template<typename Derived , typename Delta >
virtual entt::process< Derived, Delta >::~process ( )
inlinevirtualnoexcept

Default destructor.

Definition at line 169 of file process.hpp.

Member Function Documentation

◆ abort()

template<typename Derived , typename Delta >
void entt::process< Derived, Delta >::abort ( const bool  immediate = false)
inline

Aborts a process if it's still alive.

The function is idempotent and it does nothing if the process isn't alive.

Parameters
immediateRequests an immediate operation.

Definition at line 181 of file process.hpp.

◆ alive()

template<typename Derived , typename Delta >
bool entt::process< Derived, Delta >::alive ( ) const
inlinenoexcept

Returns true if a process is either running or paused.

Returns
True if the process is still alive, false otherwise.

Definition at line 195 of file process.hpp.

◆ fail()

template<typename Derived , typename Delta >
void entt::process< Derived, Delta >::fail ( )
inlineprotectednoexcept

Terminates a process with errors if it's still alive.

The function is idempotent and it does nothing if the process isn't alive.

Definition at line 134 of file process.hpp.

◆ finished()

template<typename Derived , typename Delta >
bool entt::process< Derived, Delta >::finished ( ) const
inlinenoexcept

Returns true if a process is already terminated.

Returns
True if the process is terminated, false otherwise.

Definition at line 203 of file process.hpp.

◆ pause()

template<typename Derived , typename Delta >
void entt::process< Derived, Delta >::pause ( )
inlineprotectednoexcept

Stops a process if it's in a running state.

The function is idempotent and it does nothing if the process isn't running.

Definition at line 146 of file process.hpp.

◆ paused()

template<typename Derived , typename Delta >
bool entt::process< Derived, Delta >::paused ( ) const
inlinenoexcept

Returns true if a process is currently paused.

Returns
True if the process is paused, false otherwise.

Definition at line 211 of file process.hpp.

◆ rejected()

template<typename Derived , typename Delta >
bool entt::process< Derived, Delta >::rejected ( ) const
inlinenoexcept

Returns true if a process terminated with errors.

Returns
True if the process terminated with errors, false otherwise.

Definition at line 219 of file process.hpp.

◆ succeed()

template<typename Derived , typename Delta >
void entt::process< Derived, Delta >::succeed ( )
inlineprotectednoexcept

Terminates a process with success if it's still alive.

The function is idempotent and it does nothing if the process isn't alive.

Definition at line 122 of file process.hpp.

◆ tick()

template<typename Derived , typename Delta >
void entt::process< Derived, Delta >::tick ( const Delta  delta,
void *  data = nullptr 
)
inline

Updates a process and its internal state if required.

Parameters
deltaElapsed time.
dataOptional data.

Definition at line 228 of file process.hpp.

◆ unpause()

template<typename Derived , typename Delta >
void entt::process< Derived, Delta >::unpause ( )
inlineprotectednoexcept

Restarts a process if it's paused.

The function is idempotent and it does nothing if the process isn't paused.

Definition at line 158 of file process.hpp.


The documentation for this class was generated from the following files: