FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::BinaryStream Class Reference

Binary Stream class. More...

#include <binary_stream.hpp>

Inheritance diagram for FEAT::BinaryStream:

Public Member Functions

 BinaryStream ()
 default CTOR More...
 
void clear ()
 Clears the current stream. More...
 
std::vector< char > & container ()
 Returns a reference to the internal vector container. More...
 
const std::vector< char > & container () const
 Returns a reference to the internal vector container. More...
 
char * data ()
 Returns the data array of the stream. More...
 
const char * data () const
 Returns the data array of the stream. More...
 
void read_stream (std::istream &is)
 Reads the content of a binary input stream. More...
 
std::streamsize size () const
 Returns the current size of the stream. More...
 
void write_stream (std::ostream &os) const
 Writes the content to a binary output stream. More...
 

Private Attributes

BinaryBuffer _buffer
 

Detailed Description

Binary Stream class.

This class implements a dynamic binary memory input/output stream implementing the std::iostream interface.

Warning
This class is not yet fully matured and shall therefore be used with care!

This class can be used to write and read binary data into/from memory to test functions which usually use the std::[i|o]fstream classes for input and output from/into files.

This class is the binary counterpart of the text-based std::stringstream class.

Author
Peter Zajac

Definition at line 28 of file binary_stream.hpp.

Constructor & Destructor Documentation

◆ BinaryStream()

FEAT::BinaryStream::BinaryStream ( )
inline

default CTOR

Definition at line 192 of file binary_stream.hpp.

Member Function Documentation

◆ clear()

void FEAT::BinaryStream::clear ( )
inline

Clears the current stream.

Definition at line 209 of file binary_stream.hpp.

Referenced by read_stream().

◆ container() [1/2]

std::vector< char > & FEAT::BinaryStream::container ( )
inline

Returns a reference to the internal vector container.

Returns
A reference to the internal vector container.

Definition at line 236 of file binary_stream.hpp.

Referenced by FEAT::Dist::Comm::bcast_binarystream(), FEAT::DistFileIO::read_combined(), FEAT::Control::Domain::PartiDomainControlBase< DomainLevel_ >::serialize_partitioning(), and FEAT::DistFileIO::write_combined().

◆ container() [2/2]

const std::vector< char > & FEAT::BinaryStream::container ( ) const
inline

Returns a reference to the internal vector container.

Returns
A reference to the internal vector container.

Definition at line 245 of file binary_stream.hpp.

◆ data() [1/2]

char * FEAT::BinaryStream::data ( )
inline

Returns the data array of the stream.

Returns
The data array of the stream.

Definition at line 218 of file binary_stream.hpp.

Referenced by FEAT::Control::CheckpointControl::load(), FEAT::DistFileIO::write_ordered(), and write_stream().

◆ data() [2/2]

const char * FEAT::BinaryStream::data ( ) const
inline

Returns the data array of the stream.

Returns
The data array of the stream.

Definition at line 227 of file binary_stream.hpp.

◆ read_stream()

void FEAT::BinaryStream::read_stream ( std::istream &  is)
inline

Reads the content of a binary input stream.

This function copies the content of the input stream into this binary stream object. The previous content of this binary stream (if any) is discarded.

Parameters
[in]isThe input stream from which to read.

Definition at line 260 of file binary_stream.hpp.

References clear().

Referenced by FEAT::DistFileIO::_read_file().

◆ size()

std::streamsize FEAT::BinaryStream::size ( ) const
inline

Returns the current size of the stream.

Returns
The current size of the stream in bytes.

Definition at line 201 of file binary_stream.hpp.

Referenced by FEAT::DistFileIO::write_ordered(), and write_stream().

◆ write_stream()

void FEAT::BinaryStream::write_stream ( std::ostream &  os) const
inline

Writes the content to a binary output stream.

This function writes the content of this binary stream at the current position of the output stream object.

Parameters
[in]osThe output stream to which to write to.

Definition at line 292 of file binary_stream.hpp.

References data(), and size().

Referenced by FEAT::DistFileIO::_write_file().

Member Data Documentation

◆ _buffer

BinaryBuffer FEAT::BinaryStream::_buffer
private

Definition at line 188 of file binary_stream.hpp.


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