libwreport  3.29
Public Member Functions | Data Fields
wreport::buffers::BufrOutput Struct Reference

Binary buffer with bit-level append operations. More...

#include <bufr.h>

Public Member Functions

 BufrOutput (std::string &out)
 Wrap a string into a BufrOutput. More...
 
void add_bits (uint32_t val, int n)
 Append n bits from 'val'. More...
 
void raw_append (const char *str, int len)
 Append a string len bits long to the output buffer as it is, ignoring partially encoded bits.
 
void append_short (unsigned short val)
 Append a 16 bits integer.
 
void append_byte (unsigned char val)
 Append an 8 bits integer.
 
void append_missing (unsigned len_bits)
 Append a missing value len_bits long.
 
void append_string (const Var &var, unsigned len_bits)
 Append a string variable.
 
void append_string (const char *val, unsigned len_bits)
 Append a string len_bits bits long.
 
void append_binary (const unsigned char *val, unsigned len_bits)
 Append a binary value len_bits bits long.
 
void append_var (Varinfo info, const Var &var)
 Append var encoded according to info.
 
void append_missing (Varinfo info)
 Append a missing value according to info.
 
void flush ()
 Write all bits left to the buffer, padding the last partial byte with zeros if needed to make it even.
 

Data Fields

std::string & out
 Output buffer to which we append encoded data.
 
uint8_t pbyte
 Byte to which we are appending bits to encode.
 
int pbyte_len
 Number of bits already encoded in pbyte.
 

Detailed Description

Binary buffer with bit-level append operations.

Constructor & Destructor Documentation

◆ BufrOutput()

wreport::buffers::BufrOutput::BufrOutput ( std::string &  out)

Wrap a string into a BufrOutput.

Parameters
outString to append data to

Member Function Documentation

◆ add_bits()

void wreport::buffers::BufrOutput::add_bits ( uint32_t  val,
int  n 
)

Append n bits from 'val'.

n must be <= 32.

Referenced by append_byte(), append_missing(), and append_short().


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