|
Open Model Railroad Network (OpenMRN)
|
HubPort that connects a raw device to a strongly typed Hub. More...
#include <HubDevice.hxx>
Classes | |
| class | ReadThread |
| Thread performing the read operations on the device. More... | |
Public Member Functions | |
| FdHubPort (HFlow *hub, int fd, Notifiable *done) | |
| Constructor. | |
| void | unregister_write_port () OVERRIDE |
| Removes the write flow from the hub's registration. | |
Public Member Functions inherited from FdHubPortBase | |
| FdHubPortBase (int fd, Notifiable *done) | |
| Constructor. | |
Public Member Functions inherited from FdHubPortInterface | |
| int | fd () |
Private Attributes | |
| HFlow * | hub_ |
| Parent hub to send the data to / read the data from. | |
| FdHubWriteFlow< typename HFlow::value_type > | writeFlow_ |
| StateFlow that is performing the actual writes. | |
| ReadThread | readThread_ |
| An OSThread child that is performing the reads. | |
Friends | |
| class | ReadThread |
Additional Inherited Members | |
Static Public Member Functions inherited from FdHubPortBase | |
| static void | fill_thread_name (char *buf, char mode, int fd) |
| Puts the desired thread name for the read or write thread. | |
Static Public Attributes inherited from FdHubPortBase | |
| static const int | kWriteThreadStackSize = 1000 |
| How many bytes of stack should we allocate to the write thread's stack. | |
| static const int | kReadThreadStackSize = 1000 |
| How many bytes of stack should we allocate to the read thread's stack. | |
Protected Member Functions inherited from FdHubPortBase | |
| const char * | fill_thread_name (char mode, int fd) |
| Puts the desired thread name for the read or write thread. | |
| void | report_error () |
| Call when an IO error is encountered. | |
Protected Member Functions inherited from FdHubPortInterface | |
| FdHubPortInterface (int fd) | |
Protected Attributes inherited from FdHubPortBase | |
| char | threadName_ [30] |
| Temporary buffer used for rendering thread names. | |
| Executor< 1 > | writeThread_ |
| This executor is running the writes. | |
| Service | writeService_ |
| Service for the write flow. | |
| BarrierNotifiable | barrier_ |
| This barrier will be notified when both read and write thread has exited. | |
| unsigned | hasError_: 1 |
| If this is 1, the fd has been closed. | |
| unsigned | writeExitEnqueued_: 1 |
| If this is 1, we have already enqueued the request to exit the write flow. | |
Protected Attributes inherited from FdHubPortInterface | |
| int | fd_ {-1} |
| The device file descriptor. | |
HubPort that connects a raw device to a strongly typed Hub.
The device is given by the fd to an opened device instance (or socket, pipe, etc). Starts two additional threads: one for reading, one for writing.
Reads and writes will be performed in the units defined by the type of the hub: for string-typed hubs in 64 bytes units; for hubs of specific structures (such as CAN frame, dcc Packets or dcc Feedback structures) in the units of the size of the structure.
Definition at line 287 of file HubDevice.hxx.
|
inline |
Constructor.
| hub | Parent hub where to register *this. |
| fd | file descriptor to read/write |
| done | will be notified when the termination of the port is completed. |
Definition at line 296 of file HubDevice.hxx.
Definition at line 305 of file HubDevice.hxx.
|
inlinevirtual |
Removes the write flow from the hub's registration.
Triggers the write flow to call barrier_ when all the pending queue entries are released.
Implements FdHubPortBase.
Definition at line 310 of file HubDevice.hxx.
|
friend |
Definition at line 371 of file HubDevice.hxx.
|
private |
Parent hub to send the data to / read the data from.
Definition at line 374 of file HubDevice.hxx.
|
private |
An OSThread child that is performing the reads.
Definition at line 378 of file HubDevice.hxx.
|
private |
StateFlow that is performing the actual writes.
Definition at line 376 of file HubDevice.hxx.