Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::LocalIf Class Reference
Inheritance diagram for openlcb::LocalIf:
openlcb::If Service

Public Member Functions

 LocalIf (int local_nodes_count, NodeID gateway_node_id)
 
void add_owned_flow (Executable *e) override
 Transfers ownership of a module to the interface.
 
void delete_local_node (Node *node) override
 Removes a local node from this interface.
 
bool matching_node (NodeHandle expected, NodeHandle actual) override
 
NodeID get_default_node_id () override
 
- Public Member Functions inherited from openlcb::If
 If (ExecutorBase *executor, int local_nodes_count)
 Constructs an NMRAnet interface.
 
virtual ~If ()
 Destructor.
 
MessageHandlerglobal_message_write_flow ()
 
MessageHandleraddressed_message_write_flow ()
 
MessageDispatchFlowdispatcher ()
 
void add_local_node (Node *node)
 Registers a new local node on this interface.
 
Nodelookup_local_node (NodeID id)
 Looks up a node ID in the local nodes' registry.
 
virtual Nodelookup_local_node_handle (NodeHandle handle)
 Looks up a node ID in the local nodes' registry.
 
Nodefirst_local_node ()
 
Nodenext_local_node (NodeID previous)
 Iterator helper on the local nodes map.
 
virtual void canonicalize_handle (NodeHandle *h)
 Canonicalizes the node handle: fills in id and/or alias from the maps the interface holds internally.
 
void set_tx_hook (std::function< void()> hook)
 Sets a transmit hook.
 
StreamTransportstream_transport ()
 
void set_stream_transport (StreamTransport *s)
 Adds the necessary object for this interface to support stream transport.
 
- Public Member Functions inherited from Service
 Service (ExecutorBase *e)
 Constructor.
 
 ~Service ()
 Destructor.
 
ExecutorBaseexecutor ()
 

Private Attributes

std::vector< std::unique_ptr< Destructable > > ownedFlows_
 
NodeID gatewayNodeID_
 

Additional Inherited Members

- Public Types inherited from openlcb::If
typedef DispatchFlow< Buffer< GenMessage >, 4 > MessageDispatchFlow
 Type of the dispatcher of incoming NMRAnet messages.
 
- Protected Member Functions inherited from openlcb::If
void remove_local_node_from_map (Node *node)
 
- Protected Attributes inherited from openlcb::If
MessageHandlerglobalWriteFlow_
 Allocator containing the global write flows.
 
MessageHandleraddressedWriteFlow_
 Allocator containing the addressed write flows.
 

Detailed Description

Definition at line 319 of file async_if_test_helper.hxx.

Constructor & Destructor Documentation

◆ LocalIf()

openlcb::LocalIf::LocalIf ( int  local_nodes_count,
NodeID  gateway_node_id 
)
inline

Definition at line 322 of file async_if_test_helper.hxx.

Member Function Documentation

◆ add_owned_flow()

void openlcb::LocalIf::add_owned_flow ( Executable e)
inlineoverridevirtual

Transfers ownership of a module to the interface.

It will be brought down in the destructor. The destruction order is guaranteed such that all supporting structures are still available when the flow is destryed, but incoming messages can not come in anymore.

Todo:
(balazs.racz) revise whether this needs to be virtual.

Implements openlcb::If.

Definition at line 328 of file async_if_test_helper.hxx.

◆ delete_local_node()

void openlcb::LocalIf::delete_local_node ( Node node)
inlineoverridevirtual

Removes a local node from this interface.

This function must be called from the interface's executor.

Parameters
nodeis the node to delete. The node will not be freed, just removed from the data structures.

Implements openlcb::If.

Definition at line 333 of file async_if_test_helper.hxx.

◆ get_default_node_id()

NodeID openlcb::LocalIf::get_default_node_id ( )
inlineoverridevirtual
Returns
the node ID of the default node on this interface. For TCP interfaces this is the gateway node ID, for CAN interfaces this is the node ID used for alias allocation on the CAN-bus.

Implements openlcb::If.

Definition at line 350 of file async_if_test_helper.hxx.

◆ matching_node()

bool openlcb::LocalIf::matching_node ( NodeHandle  expected,
NodeHandle  actual 
)
inlineoverridevirtual
Returns
true if the two node handles match as far as we can tell without doing any network traffic.

Implements openlcb::If.

Definition at line 338 of file async_if_test_helper.hxx.

Member Data Documentation

◆ gatewayNodeID_

NodeID openlcb::LocalIf::gatewayNodeID_
private

Definition at line 357 of file async_if_test_helper.hxx.

◆ ownedFlows_

std::vector<std::unique_ptr<Destructable> > openlcb::LocalIf::ownedFlows_
private

Definition at line 356 of file async_if_test_helper.hxx.


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