![]() |
Spicy
|
#include <sink.h>
Public Member Functions | |
Sink (const Sink &)=delete | |
Sink (Sink &&)=default | |
Sink & | operator= (const Sink &)=delete |
Sink & | operator= (Sink &&)=default |
template<typename T > | |
void | connect (spicy::rt::UnitRef< T > unit) |
template<typename T > | |
void | connect_filter (spicy::rt::UnitRef< T > unit) |
void | close () |
void | connect_mime_type (const MIMEType &mt) |
void | connect_mime_type (const std::string &mt) |
void | connect_mime_type (const hilti::rt::Bytes &mt) |
void | gap (uint64_t seq, uint64_t len) |
uint64_t | sequence_number () const |
void | set_auto_trim (bool enable) |
void | set_initial_sequence_number (uint64_t seq) |
void | set_policy (sink::ReassemblerPolicy policy) |
uint64_t | size () const |
void | skip (uint64_t seq) |
void | trim (uint64_t seq) |
void | write (hilti::rt::Bytes data, std::optional< uint64_t > seq={}, std::optional< uint64_t > len={}) |
Public Attributes | |
filter::State< sink::detail::sink_name > | _filter |
Runtime implementation for Spicy's sink
type.
Note: When adding/changing methods that generated code acceeses, adapt the Spicy-side spicy_rt::Sink
as well.
|
inline |
Disconnects all units connected to the sink. They will then no longer receive any data written into the sink.
|
inline |
Connects a unit instance to the sink. The unit will then receive any data written into the sink.
unit | unit to connect to the sink. |
|
inline |
Connects a filter unit to the sink. Any input will then pass through the filter before being forwarded tp parsing. Must not be called when data has been processed already. Multiple filters can be connected and will be chained.
filter | filter unit to connect to the sink. |
<tt>SinkError</tt> | if the type cannot be parsed |
void Sink::connect_mime_type | ( | const MIMEType & | mt | ) |
Connects new instances of all units to the sink that support a given MIME type. The units will then all receive any data written into the think.
mt | MIME type to connect units for |
|
inline |
Connects new instances of all units to the sink that support a given MIME type. The units will then all receive any data written into the think.
mt | MIME type to connect units for |
<tt>mime::InvalidType</tt> | if the type cannot be parsed |
|
inline |
Connets instances of all units to the sink that support a given MIME type. The units will then all receive any data written into the think.
mt | MIME type to connect units for |
<tt>mime::InvalidType</tt> | if the type cannot be parsed |
void Sink::gap | ( | uint64_t | seq, |
uint64_t | len | ||
) |
Reports a gap in the input stream.
seq | absolute sequence number of the gap |
len | length of the gap |
|
inline |
Returns the current position in the sequence space.
|
inline |
Enable/disable automatic trimming.
enable | true to enable trimming, false to disable |
|
inline |
Sets the initial sequence number.
seq | absolute sequence number to associate with 1st byte of input. |
|
inline |
Sets the sink's reassembler policy.
|
inline |
Returns the number of bytes written into the sink so far.
void Sink::skip | ( | uint64_t | seq | ) |
Skips ahead in the input stream.
seq | absolute sequence number to skip ahead to |
void Sink::trim | ( | uint64_t | seq | ) |
Trims buffered input.
seq | absolute sequence number to trim up to. |
void Sink::write | ( | hilti::rt::Bytes | data, |
std::optional< uint64_t > | seq = {} , |
||
std::optional< uint64_t > | len = {} |
||
) |
Writes data to the sink, forwarding it to all connected units.
data | data to write |
seq | absolute sequence number; defaults to end of current input |
len | length in sequence space; defaults to length of data |
filter::State<sink::detail::sink_name> spicy::rt::Sink::_filter |
Tracks connected filters. This is internal, but needs to be public because some free-standing functions are accessing it.