$darkmode
cloe::utility::Switch< D > Class Template Reference

#include <hmi_contact.hpp>

Inheritance diagram for cloe::utility::Switch< D >:
[legend]
Collaboration diagram for cloe::utility::Switch< D >:
[legend]

Public Member Functions

 Switch (std::function< void()> set_fn, std::function< void()> unset_fn, bool active)
 
- Public Member Functions inherited from cloe::utility::Contact< D >
 Contact (bool active)
 
void update (D time, bool down)
 
bool has_contact () const
 

Protected Member Functions

void contact_down (D) override
 
void contact_up (D) override
 

Additional Inherited Members

- Protected Attributes inherited from cloe::utility::Contact< D >
bool active_ {false}
 

Detailed Description

template<typename D = Duration>
class cloe::utility::Switch< D >

Switch simulates a switch contact.

Pressing the switch immediately triggers the set function, and unpressing the switch immediately triggers the unset function.

*---------------—* set/push unset/release

In contrast to a PushButton, a switch can start its life in either the ON or the OFF position.

Member Function Documentation

◆ contact_down()

template<typename D = Duration>
void cloe::utility::Switch< D >::contact_down ( time)
inlineoverrideprotectedvirtual

Apply the contact.

This corresponds to pushing down on a key or button, or moving a switch to the ON position, and should set active_ to true.

Implements cloe::utility::Contact< D >.

◆ contact_up()

template<typename D = Duration>
void cloe::utility::Switch< D >::contact_up ( time)
inlineoverrideprotectedvirtual

Release the contact.

This corresponds to releasing a previous push on a key or button, or moving a switch to the OFF position, and should set active_ to false.

Implements cloe::utility::Contact< D >.


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