OGLplus  (0.59.0) a C++ wrapper for rendering APIs

Serialization data sink backed by a pre-allocated memory block. More...

#include <eagine/serialize/block_sink.hpp>

Public Member Functions

constexpr block_data_sink () noexcept=default
 Default constructor. More...
 
 block_data_sink (memory::block dst) noexcept
 Constructor setting the backing block.
 
void reset (memory::block dst)
 Resets the backing block. More...
 
auto done () const noexcept -> memory::block
 Returns the part of the backing block already written to. More...
 
auto free () const noexcept -> memory::block
 Returns the free part of the backing block. More...
 
auto remaining_size () -> span_size_t final
 Returns the size of the free part of the backing block. More...
 
auto write (memory::const_block blk) -> serialization_errors final
 Writes a block of data into this sink.
 
auto replace_with (memory::const_block blk) -> serialization_errors
 Replaces the content of the backing block with the content of the argument. More...
 
auto begin_work () -> transaction_handle final
 Begins a write transaction on this data sink. More...
 
void commit (transaction_handle th) final
 Commits writes done as a part of transaction identified by argument. More...
 
void rollback (transaction_handle th) final
 Rolls-back writes done as a part of transaction identified by argument. More...
 
auto finalize () -> serialization_errors override
 Does additional finalization, like compression after serialization operation.
 
virtual auto write (memory::const_block data) -> result=0
 Writes a block of data into this sink.
 
auto write (char chr) -> result
 Writes a single string character into this sink.
 
auto write (string_view str) -> result
 Writes a string view into this sink.
 
- Public Member Functions inherited from eagine::serializer_data_sink
auto write (char chr) -> result
 Writes a single string character into this sink.
 
auto write (string_view str) -> result
 Writes a string view into this sink.
 
auto write_some (memory::const_split_block data) -> serialization_result< memory::const_split_block >
 Writes as much as possible from a split data block.
 

Additional Inherited Members

- Public Types inherited from eagine::serializer_data_sink
using result = serialization_errors
 Alias for the operation result type.
 
using transaction_handle = std::uintptr_t
 Alias for type indentifying sink transaction that can be rolled back.
 
- Protected Member Functions inherited from eagine::abstract< serializer_data_sink >
constexpr abstract () noexcept=default
 Default constructible by derived.
 
constexpr abstract (abstract &&) noexcept=default
 Move constructible by derived.
 
constexpr abstract (const abstract &) noexcept=default
 Copy constructible by derived.
 
auto operator= (abstract &&) noexcept -> abstract &=default
 Move assignable by derived.
 
auto operator= (const abstract &) noexcept -> abstract &=default
 Copy assignable by derived.
 

Detailed Description

Serialization data sink backed by a pre-allocated memory block.

See also
block_data_source
packed_block_data_sink

Constructor & Destructor Documentation

◆ block_data_sink()

constexpr eagine::block_data_sink::block_data_sink ( )
constexprdefaultnoexcept

Default constructor.

Postcondition
free().empty()

Member Function Documentation

◆ begin_work()

auto eagine::block_data_sink::begin_work ( ) -> transaction_handle
inlinefinalvirtual

Begins a write transaction on this data sink.

See also
commit
rollback

Implements eagine::serializer_data_sink.

◆ commit()

void eagine::block_data_sink::commit ( transaction_handle  )
inlinefinalvirtual

Commits writes done as a part of transaction identified by argument.

See also
begin_work
rollback

Implements eagine::serializer_data_sink.

◆ done()

auto eagine::block_data_sink::done ( ) const -> memory::block
inlinenoexcept

◆ free()

auto eagine::block_data_sink::free ( ) const -> memory::block
inlinenoexcept

Returns the free part of the backing block.

See also
done
remaining_size

Referenced by remaining_size(), and write().

◆ remaining_size()

auto eagine::block_data_sink::remaining_size ( ) -> span_size_t
inlinefinalvirtual

Returns the size of the free part of the backing block.

See also
free
done

Implements eagine::serializer_data_sink.

◆ replace_with()

auto eagine::block_data_sink::replace_with ( memory::const_block  blk) -> serialization_errors
inline

Replaces the content of the backing block with the content of the argument.

See also
reset

Referenced by eagine::packed_block_data_sink::finalize().

◆ reset()

void eagine::block_data_sink::reset ( memory::block  dst)
inline

Resets the backing block.

See also
replace_with

◆ rollback()

void eagine::block_data_sink::rollback ( transaction_handle  )
inlinefinalvirtual

Rolls-back writes done as a part of transaction identified by argument.

See also
begin_work
commit

Implements eagine::serializer_data_sink.


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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).