Go to the documentation of this file.
9 #ifndef EAGINE_SERIALIZE_OSTREAM_SINK_HPP
10 #define EAGINE_SERIALIZE_OSTREAM_SINK_HPP
30 return std::numeric_limits<span_size_t>::max();
36 write_to_stream(current(), blk);
40 if(!current().good()) {
53 EAGINE_MAYBE_UNUSED(th);
54 std::stringstream top{std::move(_subs.top())};
56 current() << top.rdbuf();
61 EAGINE_MAYBE_UNUSED(th);
70 auto current() noexcept -> std::ostream& {
78 std::stack<std::stringstream> _subs;
83 #endif // EAGINE_SERIALIZE_OSTREAM_SINK_HPP
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
auto begin_work() -> transaction_handle final
Begins a write transaction on this data sink.
Definition: ostream_sink.hpp:46
@ data_sink_error
Internal error in the serialization data sink.
void rollback(transaction_handle th) final
Rolls-back writes done as a part of transaction identified by argument.
Definition: ostream_sink.hpp:59
Common code is placed in this namespace.
Definition: eagine.hpp:21
Class for manipulating and testing a group of enumeration-based bits.
Definition: bitfield.hpp:19
Abstract base class for serialization data sinks.
Definition: data_sink.hpp:24
std::uintptr_t transaction_handle
Alias for type indentifying sink transaction that can be rolled back.
Definition: data_sink.hpp:60
auto finalize() -> serialization_errors final
Does additional finalization, like compression after serialization operation.
Definition: ostream_sink.hpp:65
virtual auto write(memory::const_block data) -> result=0
Writes a block of data into this sink.
Non-owning view of a contiguous range of memory with ValueType elements.
Definition: flatten_fwd.hpp:16
auto write(memory::const_block blk) -> serialization_errors final
Writes a block of data into this sink.
Definition: ostream_sink.hpp:35
Serialization data sink backed by an output stream.
Definition: ostream_sink.hpp:23
void commit(transaction_handle th) final
Commits writes done as a part of transaction identified by argument.
Definition: ostream_sink.hpp:51
ostream_data_sink(std::ostream &out) noexcept
Constructor setting the target stream.
Definition: ostream_sink.hpp:26
@ too_much_data
Too much data to fit into serialization data sink.
auto remaining_size() -> span_size_t final
Returns the remaining available size for data in this sink.
Definition: ostream_sink.hpp:29