Goby3  3.1.5a
2024.05.23
binary.h File Reference
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <bitset>
#include <boost/dynamic_bitset.hpp>

Go to the source code of this file.

Namespaces

 goby
 The global namespace for the Goby project.
 
 goby::util
 

Functions

Binary encoding
void goby::util::hex_decode (const std::string &in, std::string *out)
 Decodes a (little-endian) hexadecimal string to a byte string. Index 0 and 1 (first byte) of in are written to index 0 (first byte) of out More...
 
std::string goby::util::hex_decode (const std::string &in)
 
void goby::util::hex_encode (const std::string &in, std::string *out, bool upper_case=false)
 Encodes a (little-endian) hexadecimal string from a byte string. Index 0 of in is written to index 0 and 1 (first byte) of out More...
 
std::string goby::util::hex_encode (const std::string &in)
 
template<typename T >
bool goby::util::hex_string2number (const std::string &s, T &t)
 attempts to convert a hex string into a numerical representation (of type T) More...
 
template<typename T >
bool goby::util::number2hex_string (std::string &s, const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string More...
 
template<typename T >
std::string goby::util::number2hex_string (const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string assuming success More...
 
Binary encoding
void goby::util::hex_decode (const std::string &in, std::string *out)
 Decodes a (little-endian) hexadecimal string to a byte string. Index 0 and 1 (first byte) of in are written to index 0 (first byte) of out More...
 
std::string goby::util::hex_decode (const std::string &in)
 
void goby::util::hex_encode (const std::string &in, std::string *out, bool upper_case=false)
 Encodes a (little-endian) hexadecimal string from a byte string. Index 0 of in is written to index 0 and 1 (first byte) of out More...
 
std::string goby::util::hex_encode (const std::string &in)
 
template<typename T >
bool goby::util::hex_string2number (const std::string &s, T &t)
 attempts to convert a hex string into a numerical representation (of type T) More...
 
template<typename T >
bool goby::util::number2hex_string (std::string &s, const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string More...
 
template<typename T >
std::string goby::util::number2hex_string (const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string assuming success More...