|
Open Model Railroad Network (OpenMRN)
|
OpenLCB implementation of a binary network state. More...
#include <NetworkState.hxx>
Public Member Functions | |
| NetworkState (Node *node, WriteHelper *write_helper, uint64_t event_on, uint64_t event_off) | |
| Constructor. | |
Public Member Functions inherited from NetworkState | |
| virtual | ~NetworkState () |
| Destructor. | |
Private Member Functions | |
| void | set_callback (std::function< void()> cb) override |
| Set the change notification callback. | |
| void | toggle (Notifiable *done) override |
| Toggle the state. | |
| void | set_state (bool state, Notifiable *done) override |
| Set the state. | |
| State | get_state () override |
| Get the current state. | |
| bool | is_state_known () override |
| Get an indication as to if the state is known. | |
| void | initiate_query (BarrierNotifiable *done) override |
| Queries and acquires the current state of the bit. | |
| void | reset () override |
| Reset the network state to unknown. | |
Private Attributes | |
| WriteHelper * | writeHelper_ |
| helper for generating events | |
| CallbackNetworkInitializedBit | bit_ |
| bit (dual event) container | |
| BitEventPC | bitPC_ |
| bit event producer/consumer | |
Additional Inherited Members | |
Public Types inherited from NetworkState | |
| enum | State { VALID = 0 , INVALID = 1 , UNKNOWN = 3 } |
OpenLCB implementation of a binary network state.
Definition at line 36 of file openlcb/NetworkState.hxx.
|
inline |
Constructor.
| node | the virtual node who exposes this bit. |
| write_helper | helper for generating events |
| event_on | event ID to set the state to true |
| event_off | event ID to set the state to false |
Definition at line 44 of file openlcb/NetworkState.hxx.
|
inlineoverrideprivatevirtual |
Get the current state.
Implements NetworkState.
Definition at line 82 of file openlcb/NetworkState.hxx.
|
inlineoverrideprivatevirtual |
Queries and acquires the current state of the bit.
| done | is the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread. |
Implements NetworkState.
Definition at line 105 of file openlcb/NetworkState.hxx.
|
inlineoverrideprivatevirtual |
Get an indication as to if the state is known.
Implements NetworkState.
Definition at line 97 of file openlcb/NetworkState.hxx.
|
inlineoverrideprivatevirtual |
Reset the network state to unknown.
Implements NetworkState.
Definition at line 111 of file openlcb/NetworkState.hxx.
|
inlineoverrideprivatevirtual |
Set the change notification callback.
| cb | will be involked every time the state is changed (both from local calls as well as from the network stack) |
Implements NetworkState.
Definition at line 56 of file openlcb/NetworkState.hxx.
|
inlineoverrideprivatevirtual |
Set the state.
| state | new state value |
| done | is the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread. |
Implements NetworkState.
Definition at line 74 of file openlcb/NetworkState.hxx.
|
inlineoverrideprivatevirtual |
Toggle the state.
| done | is the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread. |
Implements NetworkState.
Definition at line 64 of file openlcb/NetworkState.hxx.
|
private |
bit (dual event) container
Definition at line 120 of file openlcb/NetworkState.hxx.
|
private |
bit event producer/consumer
Definition at line 123 of file openlcb/NetworkState.hxx.
|
private |
helper for generating events
Definition at line 117 of file openlcb/NetworkState.hxx.