Skip to content

Class eva::Heartbeat

ClassList > eva > Heartbeat

Base class for components that need periodic updates. More...

  • #include <evaHeartbeat.h>

Inherits the following classes: eva::Tickable

Public Functions

Type Name
Heartbeat (unsigned long periodMs)
Constructor with fixed period.
unsigned long getPeriod () const
Get the heartbeat period.
virtual void tick () override
Update method - call this regularly from main loop. Checks if period has elapsed and calls onHeartbeat() if needed.
virtual ~Heartbeat () = default
Virtual destructor.

Public Functions inherited from eva::Tickable

See eva::Tickable

Type Name
Tickable ()
Tickable (const Tickable &) = delete
Tickable (Tickable &&) = delete
Tickable & operator= (const Tickable &) = delete
Tickable & operator= (Tickable &&) = delete
virtual ~Tickable ()

Public Static Functions inherited from eva::Tickable

See eva::Tickable

Type Name
void tac ()
Triggers tick on this and all linked tickables.

Protected Functions

Type Name
virtual void onHeartbeat () = 0
Virtual method to be overridden by derived classes. Called at each heartbeat interval.

Detailed Description

Provides a simple heartbeat mechanism with fixed period. Derived classes must implement onHeartbeat() which will be called at regular intervals.

The period is set at construction and cannot be changed (immutable).

Public Functions Documentation

function Heartbeat

Constructor with fixed period.

eva::Heartbeat::Heartbeat (
    unsigned long periodMs
) 

Parameters:


function getPeriod

Get the heartbeat period.

unsigned long eva::Heartbeat::getPeriod () const

Returns:

Period in milliseconds (immutable).


function tick

Update method - call this regularly from main loop. Checks if period has elapsed and calls onHeartbeat() if needed.

virtual void eva::Heartbeat::tick () override

Implements eva::Tickable::tick


function ~Heartbeat

Virtual destructor.

virtual eva::Heartbeat::~Heartbeat () = default

Protected Functions Documentation

function onHeartbeat

Virtual method to be overridden by derived classes. Called at each heartbeat interval.

virtual void eva::Heartbeat::onHeartbeat () = 0


The documentation for this class was generated from the following file src/evaHeartbeat.h