roo_control
API Documentation for roo_control
Loading...
Searching...
No Matches
roo_control::Selector< State > Class Template Referenceabstract

An abstraction of a multi-state device. More...

#include <selector.h>

Inheritance diagram for roo_control::Selector< State >:
[legend]

Public Member Functions

virtual ~Selector ()=default
 
virtual bool getState (State &result) const =0
 Retrieves the current state, or returns false when it cannot be read.
 

Detailed Description

template<typename State>
class roo_control::Selector< State >

An abstraction of a multi-state device.

This can represent a GPIO pushbutton, port extender, or software selector.

This abstraction serves two main purposes: 1) it makes it easy to swap the implementation of a selector, without changing the code that uses it. For example, you can start by connecting a simple connector to a GPIO port, but eventually upgrade to a port extender. You will not need to update the calling code (just the setup logic). 2) it allows building higher-level abstractions that are implementation-independent. For example, the DebouncingSelector (and its materialization, DebouncingBinarySelector) can be used to add debouncing on top of any switch implementation.

Definition at line 23 of file selector.h.

Constructor & Destructor Documentation

◆ ~Selector()

template<typename State >
virtual roo_control::Selector< State >::~Selector ( )
virtualdefault

Member Function Documentation

◆ getState()

template<typename State >
virtual bool roo_control::Selector< State >::getState ( State &  result) const
pure virtual

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