Pixie
Loading...
Searching...
No Matches
pixie::VectorOutputSink Class Reference

Explicit owning sink for binary data collected in memory. More...

#include <serialization.h>

Public Member Functions

bool empty () const noexcept
 Return whether no output bytes have been written.
 
std::size_t size_bytes () const noexcept
 Return the number of output bytes written.
 
std::span< const std::byte > bytes () const noexcept
 Return a view of all output bytes.
 
void reserve_bytes (std::size_t size_bytes)
 Reserve memory for at least size_bytes output bytes.
 
void write (std::span< const std::byte > bytes)
 Append bytes to the output.
 
void write_at (std::size_t position, std::span< const std::byte > bytes)
 Replace output bytes beginning at position.
 
void finish () noexcept
 Complete this in-memory output.
 
std::vector< std::byte > take ()
 Transfer the bytes and reset this sink to an empty state.
 

Detailed Description

Explicit owning sink for binary data collected in memory.

This sink intentionally grows with the complete output. Prefer a fixed span or file sink when bounded additional memory is required.

Member Function Documentation

◆ write_at()

void pixie::VectorOutputSink::write_at ( std::size_t position,
std::span< const std::byte > bytes )
inline

Replace output bytes beginning at position.

Exceptions
std::out_of_rangeif the range is outside the existing output.

The documentation for this class was generated from the following file: