Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
NetworkState Class Referenceabstract

"Abstract" interface for a binary network state. More...

#include <NetworkState.hxx>

Inheritance diagram for NetworkState:
openlcb::NetworkState

Public Types

enum  State { VALID = 0 , INVALID = 1 , UNKNOWN = 3 }
 

Public Member Functions

virtual ~NetworkState ()
 Destructor.
 
virtual void set_callback (std::function< void()> cb)=0
 Set the change notification callback.
 
virtual void toggle (Notifiable *done)=0
 Toggle the state.
 
virtual void set_state (bool state, Notifiable *done)=0
 Set the state.
 
virtual State get_state ()=0
 Get the current state.
 
virtual bool is_state_known ()=0
 Get an indication as to if the state is known.
 
virtual void initiate_query (BarrierNotifiable *done)=0
 Queries and acquires the current state of the bit.
 
virtual void reset ()=0
 Reset the network state to unknown.
 

Detailed Description

"Abstract" interface for a binary network state.

Definition at line 35 of file utils/NetworkState.hxx.

Member Enumeration Documentation

◆ State

Enumerator
VALID 

state is "valid"

INVALID 

state is "invalid"

UNKNOWN 

state is "unknown"

Definition at line 38 of file utils/NetworkState.hxx.

Constructor & Destructor Documentation

◆ ~NetworkState()

virtual NetworkState::~NetworkState ( )
inlinevirtual

Destructor.

Definition at line 46 of file utils/NetworkState.hxx.

Member Function Documentation

◆ get_state()

virtual State NetworkState::get_state ( )
pure virtual

Get the current state.

Returns
VALID, INVALID, or UNKNOWN

Implemented in openlcb::NetworkState.

◆ initiate_query()

virtual void NetworkState::initiate_query ( BarrierNotifiable done)
pure virtual

Queries and acquires the current state of the bit.

Parameters
doneis the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread.

Implemented in openlcb::NetworkState.

◆ is_state_known()

virtual bool NetworkState::is_state_known ( )
pure virtual

Get an indication as to if the state is known.

Returns
true if known, else false

Implemented in openlcb::NetworkState.

◆ reset()

virtual void NetworkState::reset ( )
pure virtual

Reset the network state to unknown.

Implemented in openlcb::NetworkState.

◆ set_callback()

virtual void NetworkState::set_callback ( std::function< void()>  cb)
pure virtual

Set the change notification callback.

Parameters
cbwill be involked every time the state is changed (both from local calls as well as from the network stack)

Implemented in openlcb::NetworkState.

◆ set_state()

virtual void NetworkState::set_state ( bool  state,
Notifiable done 
)
pure virtual

Set the state.

Parameters
statenew state value
doneis the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread.

Implemented in openlcb::NetworkState.

◆ toggle()

virtual void NetworkState::toggle ( Notifiable done)
pure virtual

Toggle the state.

Parameters
doneis the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread.

Implemented in openlcb::NetworkState.


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