SatCat5
satcat5::poll::OnDemand Class Referenceabstract

Detailed Description

An "OnDemand" object is polled only on request.

SatCat5 event-loop concepts.

A call to service() polls all pending OnDemand requests. This is the most common type of polling object. To receive OnDemand callbacks, derive a child class and override "poll_demand()".

Definition at line 131 of file polling.h.

#include <polling.h>

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

Public Member Functions

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

virtual void poll_demand ()=0
 Deferred event handler, called after request(). More...
 
constexpr OnDemand ()
 Register this pollable object. More...
 

Private Attributes

satcat5::poll::OnDemandm_next
 
bool m_idle
 

Constructor & Destructor Documentation

◆ OnDemand()

constexpr satcat5::poll::OnDemand::OnDemand ( )
inlineconstexprprotected

Register this pollable object.

(Only children should create or destroy the base class.)

Definition at line 151 of file polling.h.

Member Function Documentation

◆ poll_demand()

virtual void satcat5::poll::OnDemand::poll_demand ( )
protectedpure virtual

Deferred event handler, called after request().

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

Implemented in satcat5::ptp::Dispatch, satcat5::poll::Timekeeper, satcat5::io::MultiBuffer, satcat5::gui::Canvas, satcat5::test::CountOnDemand, satcat5::io::Readable, and satcat5::cfg::MultiSerial.

◆ request_poll()

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

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.


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