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

Collection of control flows necessary for implementing the Traction Protocol. More...

#include <TractionTrain.hxx>

Inheritance diagram for openlcb::TrainService:
Service Atomic

Classes

struct  Impl
 Implementation structure for TrainService. More...
 

Public Member Functions

 TrainService (If *iface, NodeRegistry *train_node_registry=new DefaultNodeRegistry)
 Constructor.
 
Ififace ()
 
void register_train (TrainNode *node)
 Registers a new train with the train service.
 
void unregister_train (TrainNode *node)
 Removes a train node from the local interface.
 
bool is_known_train_node (Node *node)
 Checks if the a given node is a train node operated by this Traction Service.
 
- Public Member Functions inherited from Service
 Service (ExecutorBase *e)
 Constructor.
 
 ~Service ()
 Destructor.
 
ExecutorBaseexecutor ()
 

Private Attributes

Implimpl_
 Implementation flows.
 
Ififace_
 OpenLCB interface.
 
std::unique_ptr< NodeRegistrynodes_
 List of train nodes managed by this Service.
 

Additional Inherited Members

- Private Member Functions inherited from Atomic
void lock ()
 
void unlock ()
 

Detailed Description

Collection of control flows necessary for implementing the Traction Protocol.

usage: instantiate for the given interface. Pass the pointer to the train nodes upon their construction.

Definition at line 357 of file TractionTrain.hxx.

Constructor & Destructor Documentation

◆ TrainService()

openlcb::TrainService::TrainService ( If iface,
NodeRegistry train_node_registry = new DefaultNodeRegistry 
)

Constructor.

Parameters
ifacethe OpenLCB interface to which the train nodes are bound.
train_node_registryimplementation of the NodeRegistry. Ownership is transferred.

Definition at line 664 of file TractionTrain.cxx.

◆ ~TrainService()

openlcb::TrainService::~TrainService ( )

Definition at line 672 of file TractionTrain.cxx.

Member Function Documentation

◆ iface()

If * openlcb::TrainService::iface ( )
inline

Definition at line 368 of file TractionTrain.hxx.

◆ is_known_train_node()

bool openlcb::TrainService::is_known_train_node ( Node node)
inline

Checks if the a given node is a train node operated by this Traction Service.

Parameters
nodea virtual node
Returns
true if this is a known train node.

Definition at line 385 of file TractionTrain.hxx.

◆ register_train()

void openlcb::TrainService::register_train ( TrainNode node)

Registers a new train with the train service.

Will initiate a node initialization flow for the train.

Definition at line 677 of file TractionTrain.cxx.

◆ unregister_train()

void openlcb::TrainService::unregister_train ( TrainNode node)

Removes a train node from the local interface.

Parameters
nodetrain to remove from registry.

Definition at line 687 of file TractionTrain.cxx.

Member Data Documentation

◆ iface_

If* openlcb::TrainService::iface_
private

OpenLCB interface.

Definition at line 395 of file TractionTrain.hxx.

◆ impl_

Impl* openlcb::TrainService::impl_
private

Implementation flows.

Definition at line 393 of file TractionTrain.hxx.

◆ nodes_

std::unique_ptr<NodeRegistry> openlcb::TrainService::nodes_
private

List of train nodes managed by this Service.

Definition at line 397 of file TractionTrain.hxx.


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