Goby3 3.2.3
2025.05.13
Loading...
Searching...
No Matches
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

namespace  goby
 The global namespace for the Goby project.
 
namespace  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
 
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
 
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)
 
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
 
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