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

Trivial implementation of a virtual Node. More...

#include <DefaultNode.hxx>

Inheritance diagram for openlcb::DefaultNode:
openlcb::Node

Public Member Functions

 DefaultNode (If *iface, NodeID node_id, bool init=true)
 Constructor.
 
virtual ~DefaultNode ()
 Destructor.
 
NodeID node_id () OVERRIDE
 
Ififace () OVERRIDE
 
bool is_initialized () OVERRIDE
 
void set_initialized () OVERRIDE
 Callback from the node initialization flow when the node finished initialization.
 
void clear_initialized () OVERRIDE
 Callback from the simple stack when the node has to return to uninitialized state.
 
- Public Member Functions inherited from openlcb::Node
void initialize ()
 Callback from the simple stack to start the initialization process.
 

Private Attributes

NodeID nodeId_: 48
 48-bit node identifier of this node.
 
unsigned isInitialized_: 1
 1 if the node has reached initialized state.
 
Ififace_
 Interface this node is bound to.
 

Detailed Description

Trivial implementation of a virtual Node.

Stores all dynamic information in class member variables.

Definition at line 45 of file DefaultNode.hxx.

Constructor & Destructor Documentation

◆ DefaultNode()

openlcb::DefaultNode::DefaultNode ( If iface,
NodeID  node_id,
bool  init = true 
)

Constructor.

Parameters
ifacenetwork interface to be bound to
node_id48-bit OpenLCB ID of the node
inittrue to start the initialization flow upon construction

Definition at line 42 of file DefaultNode.cxx.

◆ ~DefaultNode()

openlcb::DefaultNode::~DefaultNode ( )
virtual

Destructor.

Definition at line 52 of file DefaultNode.cxx.

Member Function Documentation

◆ clear_initialized()

void openlcb::DefaultNode::clear_initialized ( )
inlinevirtual

Callback from the simple stack when the node has to return to uninitialized state.

Implements openlcb::Node.

Definition at line 77 of file DefaultNode.hxx.

◆ iface()

If * openlcb::DefaultNode::iface ( )
inlinevirtual

Implements openlcb::Node.

Definition at line 61 of file DefaultNode.hxx.

◆ is_initialized()

bool openlcb::DefaultNode::is_initialized ( )
inlinevirtual
Returns
true if the node is in the initialized state.

Nodes not in initialized state may not send traffic to the bus.

Implements openlcb::Node.

Definition at line 65 of file DefaultNode.hxx.

◆ node_id()

NodeID openlcb::DefaultNode::node_id ( )
inlinevirtual

Implements openlcb::Node.

Definition at line 57 of file DefaultNode.hxx.

◆ set_initialized()

void openlcb::DefaultNode::set_initialized ( )
inlinevirtual

Callback from the node initialization flow when the node finished initialization.

Nodes are not required to implement if they are not using NodeInitializationFlow.

Reimplemented from openlcb::Node.

Definition at line 71 of file DefaultNode.hxx.

Member Data Documentation

◆ iface_

If* openlcb::DefaultNode::iface_
private

Interface this node is bound to.

Definition at line 88 of file DefaultNode.hxx.

◆ isInitialized_

unsigned openlcb::DefaultNode::isInitialized_
private

1 if the node has reached initialized state.

Definition at line 86 of file DefaultNode.hxx.

◆ nodeId_

NodeID openlcb::DefaultNode::nodeId_
private

48-bit node identifier of this node.

Definition at line 84 of file DefaultNode.hxx.


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