Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::DistributedBit Class Reference

Implementation of the BitEventInterface that has accessors to the desired and actual state, but does not perform callback on change. More...

#include <EventHandlerTemplates.hxx>

Inheritance diagram for openlcb::DistributedBit:
openlcb::BitEventInterface

Public Member Functions

 DistributedBit (Node *node, uint64_t event_on, uint64_t event_off)
 
 ~DistributedBit ()
 Destructor.
 
Nodenode () override
 Get a refference to the owning Node.
 
EventState get_current_state () override
 Get the current state.
 
EventState get_requested_state () override
 Get the requested state.
 
void set_state (bool new_value) override
 Set the current state.
 
void set_requested_state (bool new_value)
 Set the requested state.
 
void toggle_state ()
 Invert the requested state from the current state.
 
- Public Member Functions inherited from openlcb::BitEventInterface
 BitEventInterface (uint64_t event_on, uint64_t event_off)
 
uint64_t event_on ()
 returns the event ID for representing the state transition OFF->ON.
 
uint64_t event_off ()
 returns the event ID for representing the state transition ON->OFF.
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (DistributedBit)
 

Private Attributes

Nodenode_
 node that this interface is bound to
 
EventState state_
 Event state.
 
EventState requested_
 Event state reauested.
 

Detailed Description

Implementation of the BitEventInterface that has accessors to the desired and actual state, but does not perform callback on change.

Definition at line 231 of file EventHandlerTemplates.hxx.

Constructor & Destructor Documentation

◆ DistributedBit()

openlcb::DistributedBit::DistributedBit ( Node node,
uint64_t  event_on,
uint64_t  event_off 
)
inline

Definition at line 234 of file EventHandlerTemplates.hxx.

◆ ~DistributedBit()

openlcb::DistributedBit::~DistributedBit ( )
inline

Destructor.

Definition at line 243 of file EventHandlerTemplates.hxx.

Member Function Documentation

◆ get_current_state()

EventState openlcb::DistributedBit::get_current_state ( )
inlineoverridevirtual

Get the current state.

Returns
current state

Implements openlcb::BitEventInterface.

Definition at line 256 of file EventHandlerTemplates.hxx.

◆ get_requested_state()

EventState openlcb::DistributedBit::get_requested_state ( )
inlineoverridevirtual

Get the requested state.

Returns
requested state

Reimplemented from openlcb::BitEventInterface.

Definition at line 263 of file EventHandlerTemplates.hxx.

◆ node()

Node * openlcb::DistributedBit::node ( )
inlineoverridevirtual

Get a refference to the owning Node.

Returns
Node reference

Implements openlcb::BitEventInterface.

Definition at line 249 of file EventHandlerTemplates.hxx.

◆ set_requested_state()

void openlcb::DistributedBit::set_requested_state ( bool  new_value)
inline

Set the requested state.

Parameters
newrequested value

Definition at line 277 of file EventHandlerTemplates.hxx.

◆ set_state()

void openlcb::DistributedBit::set_state ( bool  new_value)
inlineoverridevirtual

Set the current state.

Parameters
newstate value

Implements openlcb::BitEventInterface.

Definition at line 270 of file EventHandlerTemplates.hxx.

◆ toggle_state()

void openlcb::DistributedBit::toggle_state ( )
inline

Invert the requested state from the current state.

Definition at line 283 of file EventHandlerTemplates.hxx.

Member Data Documentation

◆ node_

Node* openlcb::DistributedBit::node_
private

node that this interface is bound to

Definition at line 291 of file EventHandlerTemplates.hxx.

◆ requested_

EventState openlcb::DistributedBit::requested_
private

Event state reauested.

Definition at line 297 of file EventHandlerTemplates.hxx.

◆ state_

EventState openlcb::DistributedBit::state_
private

Event state.

Definition at line 294 of file EventHandlerTemplates.hxx.


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