Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
LocalTrackIf.hxx
Go to the documentation of this file.
1
36#ifndef _DCC_LOCALTRACKIF_HXX_
37#define _DCC_LOCALTRACKIF_HXX_
38
39#include "executor/Executor.hxx"
41#include "dcc/Packet.hxx"
42
43namespace dcc
44{
45
51class LocalTrackIf : public StateFlow<Buffer<dcc::Packet>, QList<1>>
52{
53public:
63 LocalTrackIf(Service *service, int pool_size);
64
66 {
67 return &pool_;
68 }
69
72 void set_fd(int fd)
73 {
74 fd_ = fd;
75 }
76
77protected:
79
82 {
83 return release_and_exit();
84 }
85
87 int fd_;
90};
91
97{
98public:
105 LocalTrackIfSelect(Service *service, int pool_size)
106 : LocalTrackIf(service, pool_size)
107 {
108 }
109
110protected:
112
114 StateFlowSelectHelper helper_{this};
115};
116
117} // namespace dcc
118
119#endif // _DCC_LOCALTRACKIF_HXX_
Pool of fixed number of items which can be allocated up on request.
Definition Buffer.hxx:573
Collection of related state machines that pend on incoming messages.
State flow with a given typed input queue.
Base::Action Action
Allows using Action without having StateFlowBase:: prefix in front of it.
StateFlow that accepts dcc::Packet structures and sends them to a local device driver for producing t...
LocalTrackIfSelect(Service *service, int pool_size)
Constructs a TrackInterface from an fd to the mainline.
StateFlowSelectHelper helper_
Helper class for select() ing the target device.
Action entry() OVERRIDE
Entry into the StateFlow activity.
StateFlow that accepts dcc::Packet structures and sends them to a local device driver for producing t...
FixedPool * pool() OVERRIDE
FixedPool pool_
Packet pool from which to allocate packets.
Action entry() OVERRIDE
Entry into the StateFlow activity.
int fd_
Filedes of the device to which we are writing the generated packets.
void set_fd(int fd)
You must call this function before sending any packets.
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
Definition macros.h:180