|
Open Model Railroad Network (OpenMRN)
|
Use this class to read from an fd using select() in a state flow. More...
#include <StateFlow.hxx>
Public Member Functions | |
| StateFlowSelectHelper (StateFlowBase *parent) | |
Public Member Functions inherited from Selectable | |
| Selectable (Executable *parent) | |
| Constructor. | |
| void | reset (SelectType type, int fd, unsigned priority) |
| Re-initialize a Selectable preparing to add it to select(). | |
| bool | is_empty () |
| unsigned | priority () |
| SelectType | type () |
| Executable * | parent () |
| int | fd () |
| void | set_wakeup (Executable *e) |
| Can be used to override the executable to wake up. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Public Attributes | ||
| union { | ||
| const uint8_t * wbuf_ | ||
| uint8_t * rbuf_ | ||
| }; | ||
| Callback | nextState_ | |
| State to transition to after the read is complete. | ||
| unsigned | readFully_: 1 | |
| 1 if we need to read until all remaining_ is consumed. | ||
| unsigned | readNonblocking_: 1 | |
| 1 if we need a non-blocking read, in other words, try once | ||
| unsigned | readWithTimeout_: 1 | |
| 1 if there is also a timer involved; in this case *this must be a StateFlowTimedSelectHelper. | ||
| unsigned | hasError_: 1 | |
| 1 if there was an error reading of writing. | ||
| unsigned | remaining_: 28 | |
| Number of bytes still outstanding to read. | ||
Additional Inherited Members | |
Public Types inherited from Selectable | |
| enum | SelectType { READ = 1 , WRITE = 2 , EXCEPT = 3 } |
| Which operation this file should be selected upon. More... | |
| enum | Limits { MAX_FD = (1 << 14) - 1 , MAX_PRIO = (1 << 16) - 1 } |
| Helper declarations for the certain fields' maximums. More... | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Use this class to read from an fd using select() in a state flow.
Usage:
class FooFlow : public StateFlow(may use any variant) { Action do_read() { return read_repeated(&readHelper_, fd_, buf_, 32, STATE(read_done)); } ... private: StateFlowSelectHelper readHelper_; int fd_; char buf_[32]; }
Definition at line 860 of file StateFlow.hxx.
|
inline |
| parent | is the owning stateflow. |
Definition at line 863 of file StateFlow.hxx.
| unsigned StateFlowBase::StateFlowSelectHelper::hasError_ |
1 if there was an error reading of writing.
Definition at line 886 of file StateFlow.hxx.
| Callback StateFlowBase::StateFlowSelectHelper::nextState_ |
State to transition to after the read is complete.
Definition at line 876 of file StateFlow.hxx.
| uint8_t* StateFlowBase::StateFlowSelectHelper::rbuf_ |
Definition at line 872 of file StateFlow.hxx.
| unsigned StateFlowBase::StateFlowSelectHelper::readFully_ |
1 if we need to read until all remaining_ is consumed.
0 if we want to return as soon as we have read something.
Definition at line 879 of file StateFlow.hxx.
| unsigned StateFlowBase::StateFlowSelectHelper::readNonblocking_ |
1 if we need a non-blocking read, in other words, try once
Definition at line 881 of file StateFlow.hxx.
| unsigned StateFlowBase::StateFlowSelectHelper::readWithTimeout_ |
1 if there is also a timer involved; in this case *this must be a StateFlowTimedSelectHelper.
Definition at line 884 of file StateFlow.hxx.
| unsigned StateFlowBase::StateFlowSelectHelper::remaining_ |
Number of bytes still outstanding to read.
Definition at line 888 of file StateFlow.hxx.
| const uint8_t* StateFlowBase::StateFlowSelectHelper::wbuf_ |
Definition at line 871 of file StateFlow.hxx.