pdcomm::Secs1Event
Class
Owned, immutable snapshot of one SECS-I endpoint event.
class Secs1EventSecs1Endpoint::nextEvent() returns events in the order they were queued. info() tells the kind: a received message (PDCOMM_SECS1_EVENT_INBOUND), block-level delivery of a submitted message (PDCOMM_SECS1_EVENT_OUTBOUND_COMPLETE), a submission that was not delivered (PDCOMM_SECS1_EVENT_OUTBOUND_FAILED) or a terminal fault (PDCOMM_SECS1_EVENT_FAULT). body() copies the body of a received message.
Unlike the endpoint, an event is not bound to the endpoint's thread, and it stays valid after the endpoint is destroyed.
Notes
- Move-only RAII wrapper over
PdcommSecs1Event. info() and body() may run concurrently on any thread; destruction must not race with them. body() can also throwstd::bad_alloc.
Members
Secs1Event
Constructor
Creates an empty event that owns no native handle.
Secs1Event() noexcept = defaultSecs1Event
Constructor
Takes ownership of the native handle owned by other.
Secs1Event(Secs1Event &&other) noexceptParameters
| Name | Description |
|---|---|
other | Source wrapper; it becomes empty. |
Secs1Event
Constructor
Copying is disabled; the wrapper exclusively owns its native handle.
Secs1Event(const Secs1Event &) = deletebody
Method
Copies the body of a received message.
std::vector<uint8_t> body() constThe bytes are the reassembled message body exactly as received; the endpoint does not parse it as SECS-II. The copy is empty for a message without a body and for every event kind other than PDCOMM_SECS1_EVENT_INBOUND.
Returns
An independent copy of the body.
Notes
- Throws
pdcomm::Error:PDCOMM_INVALID_ARGUMENTwhen the event is empty.
info
Method
Describes the event with pdcomm_secs1_event_info().
PdcommSecs1EventInfo info() constFields that do not apply to the event kind are zero. A received message carries the block header fields (device ID, direction from the R-bit, stream, function, W-bit and system bytes) and the body length. Outbound events, and a fault that aborted a submission, carry the submission token. A fault carries fault_kind, fault_detail and discarded_partial.
Returns
The description, with struct_size set by the library.
Notes
- Throws
pdcomm::Error:PDCOMM_INVALID_ARGUMENTwhen the event is empty.
operator bool
Method
Reports whether the wrapper owns a native event.
explicit operator bool() const noexceptSecs1Endpoint::nextEvent() returns an empty event when its queue is empty.
Returns
true when an event is owned.
operator=
Method
Releases the current handle, then takes ownership of the handle owned by other.
Secs1Event &operator=(Secs1Event &&other) noexceptParameters
| Name | Description |
|---|---|
other | Source wrapper; it becomes empty. |
Returns
This wrapper.
operator=
Method
Copy assignment is disabled; the wrapper exclusively owns its native handle.
Secs1Event &operator=(const Secs1Event &) = delete~Secs1Event
Method
Releases the native event with pdcomm_secs1_event_destroy().
~Secs1Event()Any thread may release an event. An empty event releases nothing.