MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::bin_io Namespace Reference

Enumerations

enum  BinaryOrASCII : bool { ASCII = false , BINARY = true }
 Enum to specify if values should be read in binary or ASCII format. More...
 

Functions

void WriteBase64 (std::ostream &out, const void *bytes, size_t nbytes)
 Given a buffer bytes of length nbytes, encode the data in base-64 format, and write the encoded data to the output stream out.
 
void DecodeBase64 (const char *src, size_t len, std::vector< char > &buf)
 Decode len base-64 encoded characters in the buffer src, and store the resulting decoded data in buf. buf will be resized as needed.
 
size_t NumBase64Chars (size_t nbytes)
 Return the number of characters needed to encode nbytes in base-64.
 
template<typename T >
void write (std::ostream &os, T value)
 Write 'value' to stream.
 
template<typename T >
read (std::istream &is)
 Read a value from the stream and return it.
 
template<typename T >
read (const char *buf)
 Read a value of type T from a binary buffer and return it.
 
template<typename T >
void AppendBytes (std::vector< char > &vec, const T &val)
 Append the binary representation of val to the byte buffer vec.
 
template<typename T >
ReadBinaryOrASCII (std::istream &input, BinaryOrASCII binary)
 Read and return a value of type T from the input stream, in either binary or ASCII format, depending on the value of binary.
 
template<typename T >
void Skip (std::istream &input, int num, BinaryOrASCII binary)
 Skip num values of type T from the input stream, in either binary or ASCII format, depending on the value of binary.
 

Enumeration Type Documentation

◆ BinaryOrASCII

Enum to specify if values should be read in binary or ASCII format.

Enumerator
ASCII 
BINARY 

Definition at line 29 of file binaryio.hpp.

Function Documentation

◆ AppendBytes()

template<typename T >
void mfem::bin_io::AppendBytes ( std::vector< char > & vec,
const T & val )

Append the binary representation of val to the byte buffer vec.

Definition at line 62 of file binaryio.hpp.

◆ DecodeBase64()

void mfem::bin_io::DecodeBase64 ( const char * src,
size_t len,
std::vector< char > & buf )

Decode len base-64 encoded characters in the buffer src, and store the resulting decoded data in buf. buf will be resized as needed.

Definition at line 74 of file binaryio.cpp.

◆ NumBase64Chars()

size_t mfem::bin_io::NumBase64Chars ( size_t nbytes)

Return the number of characters needed to encode nbytes in base-64.

This is equal to 4*nbytes/3, rounded up to the nearest multiple of 4.

Definition at line 103 of file binaryio.cpp.

◆ read() [1/2]

template<typename T >
T mfem::bin_io::read ( const char * buf)
inline

Read a value of type T from a binary buffer and return it.

Definition at line 53 of file binaryio.hpp.

◆ read() [2/2]

template<typename T >
T mfem::bin_io::read ( std::istream & is)
inline

Read a value from the stream and return it.

Definition at line 44 of file binaryio.hpp.

◆ ReadBinaryOrASCII()

template<typename T >
T mfem::bin_io::ReadBinaryOrASCII ( std::istream & input,
BinaryOrASCII binary )

Read and return a value of type T from the input stream, in either binary or ASCII format, depending on the value of binary.

Definition at line 86 of file binaryio.hpp.

◆ Skip()

template<typename T >
void mfem::bin_io::Skip ( std::istream & input,
int num,
BinaryOrASCII binary )

Skip num values of type T from the input stream, in either binary or ASCII format, depending on the value of binary.

Definition at line 103 of file binaryio.hpp.

◆ write()

template<typename T >
void mfem::bin_io::write ( std::ostream & os,
T value )
inline

Write 'value' to stream.

Definition at line 37 of file binaryio.hpp.

◆ WriteBase64()

void mfem::bin_io::WriteBase64 ( std::ostream & out,
const void * bytes,
size_t nbytes )

Given a buffer bytes of length nbytes, encode the data in base-64 format, and write the encoded data to the output stream out.

Definition at line 25 of file binaryio.cpp.