$darkmode
cloe::utility::Contact< D > Class Template Referenceabstract

#include <hmi_contact.hpp>

Inheritance diagram for cloe::utility::Contact< D >:

Public Member Functions

 Contact (bool active)
 
void update (D time, bool down)
 
bool has_contact () const
 

Protected Member Functions

virtual void contact_down (D time)=0
 
virtual void contact_up (D time)=0
 

Protected Attributes

bool active_ {false}
 

Detailed Description

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

A contact allows electricity to pass through it when it has contact with a source and a drain.

This phenomenon is modelled with this superclass, of which Switch and PushButton are the primary subtypes.

The function of switches occasionally changes based on the passage of time. What unit is used for time and what effect that has is parameterized via templating.

Member Function Documentation

◆ contact_down()

template<typename D = Duration>
virtual void cloe::utility::Contact< D >::contact_down ( time)
protectedpure virtual

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.

Here is the caller graph for this function:

◆ contact_up()

template<typename D = Duration>
virtual void cloe::utility::Contact< D >::contact_up ( time)
protectedpure virtual

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.

Here is the caller graph for this function:

◆ update()

template<typename D = Duration>
void cloe::utility::Contact< D >::update ( time,
bool  down 
)
inline

Update the state of a contact.

If the contact is not active, it only triggers when true is sent. This is not virtual for performance reasons.

Here is the call graph for this function:

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