13#ifdef ASRT_NODISCARD_ENABLED
14#define ASRT_NODISCARD [[nodiscard]]
19#include "../asrtl/allocator.h"
20#include "../asrtl/asrt_assert.h"
21#include "../asrtl/chann.h"
22#include "../asrtl/source.h"
31using source = asrt_source;
32using chann_id = asrt_chann_id;
33using status = asrt_status;
37template <
typename T >
38using uptr = std::unique_ptr< T >;
39template <
typename T >
40using opt = std::optional< T >;
42inline asrt_span cnv( std::span< uint8_t > buff )
46 .e = buff.data() + buff.size(),
50inline std::span< uint8_t > cnv(
asrt_span buff )
52 return { buff.
b, buff.
e };
55ASRT_NODISCARD
inline enum asrt_status dispatch(
struct asrt_node& head, std::span< uint8_t > buff )
57 return asrt_chann_dispatch(
58 &head,
asrt_span{ .
b = buff.data(), .e = buff.data() + buff.size() } );
61ASRT_NODISCARD
inline enum asrt_status
tick(
struct asrt_node& head, uint32_t now )
63 return asrt_chann_tick( &head, now );
76ASRT_NODISCARD
inline status recv(
asrt_node& n, std::span< uint8_t > buff )
78 return asrt_chann_recv( &n, cnv( buff ) );
83 return asrt_chann_recv( &n, buff );
86template <
typename T >
89 T& operator*() {
return *_p; }
90 T* operator->() {
return _p; }
92 operator T&() {
return *_p; }
93 operator T*() {
return _p; }
102 ASRT_ASSERT( t !=
nullptr );
117 explicit operator bool() const noexcept {
return _cur !=
nullptr; }
121 void finish(
enum asrt_status s )
noexcept { asrt_send_req_list_done( _list, s ); }
139 return send_req_ref{ &list };
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: callback.hpp:17
void tick(ref< asrt_cntr_assm > assm, uint32_t now)
Advance all assembly modules by one tick.
Definition: cntr_assm.hpp:32
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: allocator.h:28
A node in a doubly-linked channel chain.
Definition: chann.h:122
Intrusive FIFO of outgoing send requests.
Definition: chann.h:76
An outgoing message request placed in a module's send queue.
Definition: chann.h:64
Scatter-gather buffer: a primary byte range [b, e) followed by rest_count additional spans.
Definition: span.h:37
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: span.h:23
uint8_t * b
Pointer to the first byte.
Definition: span.h:24
uint8_t * e
One-past-the-end pointer.
Definition: span.h:25