Clementine
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 <entt.hpp>

Public Types

using delta_type = Delta
 Type used to provide elapsed time.
 

Public Member Functions

virtual ~process ()
 Default destructor.
 
void abort (const bool immediately=false)
 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...
 
void tick (const Delta delta, void *data=nullptr)
 Updates a process and its internal state if required. More...
 

Protected Member Functions

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...
 

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.

Member Function Documentation

◆ abort()

template<typename Derived, typename Delta>
void entt::process< Derived, Delta >::abort ( const bool  immediately = 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
immediatelyRequests an immediate operation.

◆ alive()

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

Returns true if a process is either running or paused.

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

◆ dead()

template<typename Derived, typename Delta>
bool entt::process< Derived, Delta >::dead ( ) const
inline

Returns true if a process is already terminated.

Returns
True if the process is terminated, false otherwise.

◆ fail()

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

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

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

◆ pause()

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

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

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

◆ paused()

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

Returns true if a process is currently paused.

Returns
True if the process is paused, false otherwise.

◆ rejected()

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

Returns true if a process terminated with errors.

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

◆ succeed()

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

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

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

◆ 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.

◆ unpause()

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

Restarts a process if it's paused.

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


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