OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
cbdc::ostream_serializer Class Referencefinal

Implementation of serializer for writing to a std::ostream. More...

#include <ostream_serializer.hpp>

Inheritance diagram for cbdc::ostream_serializer:
Collaboration diagram for cbdc::ostream_serializer:

Public Member Functions

 ostream_serializer (std::ostream &s)
 Constructor.
 
auto end_of_buffer () const -> bool final
 Indicates whether the serializer has reached the end of the stream.
 
void advance_cursor (size_t len) final
 Moves the stream forward without writing to the stream.
 
void reset () final
 Seeks the stream position to the beginning.
 
auto write (const void *data, size_t len) -> bool final
 Attempts to write the given number of bytes from the given memory location to the stream's current position.
 
auto read (void *data, size_t len) -> bool final
 Not implemented for ostream.
 
- Public Member Functions inherited from cbdc::stream_serializer
 stream_serializer (std::ios &s)
 Constructor.
 
 operator bool () const final
 Indicates whether the last serialization operation succeeded.
 
- Public Member Functions inherited from cbdc::serializer
virtual ~serializer ()=default
 
 serializer (const serializer &)=delete
 
auto operator= (const serializer &)=delete
 
 serializer (serializer &&)=delete
 
auto operator= (serializer &&)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from cbdc::serializer
 serializer ()=default
 

Detailed Description

Implementation of serializer for writing to a std::ostream.

Definition at line 15 of file ostream_serializer.hpp.

Constructor & Destructor Documentation

◆ ostream_serializer()

cbdc::ostream_serializer::ostream_serializer ( std::ostream & s)
explicit

Constructor.

Parameters
sostream to serialize into.

Definition at line 12 of file ostream_serializer.cpp.

Member Function Documentation

◆ advance_cursor()

void cbdc::ostream_serializer::advance_cursor ( size_t len)
finalvirtual

Moves the stream forward without writing to the stream.

Parameters
lennumber of bytes by which to move the stream forward.

Implements cbdc::serializer.

Definition at line 26 of file ostream_serializer.cpp.

◆ end_of_buffer()

auto cbdc::ostream_serializer::end_of_buffer ( ) const -> bool
nodiscardfinalvirtual

Indicates whether the serializer has reached the end of the stream.

Returns
true if the ostream has reached the end of the stream.

Implements cbdc::serializer.

Definition at line 16 of file ostream_serializer.cpp.

◆ read()

auto cbdc::ostream_serializer::read ( void * data,
size_t len ) -> bool
finalvirtual

Not implemented for ostream.

Returns
false.

Implements cbdc::serializer.

Definition at line 42 of file ostream_serializer.cpp.

◆ reset()

void cbdc::ostream_serializer::reset ( )
finalvirtual

Seeks the stream position to the beginning.

Implements cbdc::serializer.

Definition at line 30 of file ostream_serializer.cpp.

◆ write()

auto cbdc::ostream_serializer::write ( const void * data,
size_t len ) -> bool
finalvirtual

Attempts to write the given number of bytes from the given memory location to the stream's current position.

Parameters
datamemory location from which to write data into the stream.
lennumber of bytes to write into the stream.
Returns
true if the operation wrote the requested number of bytes from the data source into the stream.

Implements cbdc::serializer.

Definition at line 35 of file ostream_serializer.cpp.


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