SatCat5
satcat5::poll::Timekeeper Class Reference

Detailed Description

Global coordinator for multiple Timer objects.

Polling this object regularly is required for SatCat5 operation.

SatCat5 event-loop concepts.

This class also stores the pointer to the system TimeRef.

Definition at line 168 of file polling.h.

#include <polling.h>

Inheritance diagram for satcat5::poll::Timekeeper:
[legend]
Collaboration diagram for satcat5::poll::Timekeeper:
[legend]

Public Member Functions

satcat5::util::TimeRefget_clock () const
 Get the system time reference, if one is set. More...
 
bool clock_ready () const
 Has a system time reference been provided?
 
void set_clock (satcat5::util::TimeRef *timer)
 Immediately set the system time reference. More...
 
void suggest_clock (satcat5::util::TimeRef *timer)
 Compare the provided reference to the current TimeRef, and keep whichever is "better" by an internal heuristic. More...
 
bool pre_test_reset ()
 Reset timekeeper state at the start of each unit test. More...
 
void request_poll ()
 Call this method to request polling at a later time. More...
 
void request_cancel ()
 Call this method to cancel a previous request_poll().
 

Static Public Member Functions

static unsigned count_ondemand ()
 Count queued objects of this type (i.e., non-idle).
 

Protected Member Functions

void poll_demand () override
 Deferred event handler, called after request(). More...
 

Protected Attributes

satcat5::util::TimeVal m_tref
 

Private Attributes

satcat5::poll::OnDemandm_next
 
bool m_idle
 

Member Function Documentation

◆ get_clock()

satcat5::util::TimeRef * satcat5::poll::Timekeeper::get_clock ( ) const

Get the system time reference, if one is set.

Note: The SATCAT5_CLOCK macro is an alias for satcat5::poll::timekeeper.get_clock().

Definition at line 246 of file polling.cc.

◆ poll_demand()

void satcat5::poll::Timekeeper::poll_demand ( )
overrideprotectedvirtual

Deferred event handler, called after request().

Child class MUST override this method. (Call "request_poll" to enqueue a callback to this method.)

Implements satcat5::poll::OnDemand.

Definition at line 271 of file polling.cc.

◆ pre_test_reset()

bool satcat5::poll::Timekeeper::pre_test_reset ( )

Reset timekeeper state at the start of each unit test.

(Unit testing only, should not be called in production.)

Definition at line 264 of file polling.cc.

◆ request_poll()

void satcat5::poll::OnDemand::request_poll ( )
inherited

Call this method to request polling at a later time.

Safe to stack requests, but only one call to poll().

Definition at line 208 of file polling.cc.

◆ set_clock()

void satcat5::poll::Timekeeper::set_clock ( satcat5::util::TimeRef timer)

Immediately set the system time reference.

(Use this if you're sure which reference you want to use.)

Definition at line 250 of file polling.cc.

◆ suggest_clock()

void satcat5::poll::Timekeeper::suggest_clock ( satcat5::util::TimeRef timer)

Compare the provided reference to the current TimeRef, and keep whichever is "better" by an internal heuristic.

(Use this if there may be several possible references.)

Definition at line 257 of file polling.cc.


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