All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Functions
BinaryDumpUtils.h File Reference

Functions to dump the content of binary data chunks to console. More...

#include <ostream>
#include <iomanip>
#include <utility>
#include <type_traits>
#include <cstddef>

Go to the source code of this file.

Classes

struct  icarus::ns::util::details::BitObjHolder< Tag, T, Bits >
 An object wrapping some data (copy), with a tag type. More...
 
struct  icarus::ns::util::details::BinObjTag
 Tag object for BinObj. More...
 
struct  icarus::ns::util::details::BinObj< T, Bits >
 Holder for data to be presented in binary format (base 2). More...
 
struct  icarus::ns::util::details::HexObjTag
 
struct  icarus::ns::util::details::HexObj< T, Bits >
 Holder for data to be presented in hexadecimal format (base 16). More...
 
struct  icarus::ns::util::details::HexDumper< Atom >
 Wrapper to have data printed as hexadecimal dump. More...
 
struct  icarus::ns::util::details::ZeroPadder< T, Fill >
 A wrapper padding the dump of its data with zeroes (or C). More...
 
struct  icarus::ns::util::details::Blanks< N, C >
 An object representing N characters of value C. More...
 
class  icarus::ns::util::FormatFlagsGuard< IOS >
 Saves some status of the specified stream object, and restores it. More...
 
class  icarus::ns::util::FormatFlagsGuard< IOS >
 Saves some status of the specified stream object, and restores it. More...
 

Namespaces

 icarus::ns::util::details
 
 icarus::ns::util
 

Functions

template<typename T >
constexpr T icarus::ns::util::details::fourMSBmask ()
 Returns a bit mask of type T with the four most significant bits set. More...
 
template<typename T >
void icarus::ns::util::details::printHex (std::ostream &out, T value)
 Prints a zero-padded integral value into out. More...
 
template<unsigned int N, char C = ' '>
std::ostream & icarus::ns::util::details::operator<< (std::ostream &out, Blanks< N, C >)
 Dumps N characters of value C to out stream. More...
 
template<typename T , unsigned int Bits>
std::ostream & icarus::ns::util::details::operator<< (std::ostream &out, BinObj< T, Bits > const &data)
 Dumps data bit by bit into out stream. More...
 
template<typename T >
std::ostream & icarus::ns::util::details::operator<< (std::ostream &out, HexObj< T > const &data)
 Dumps data nibble by nibble into out stream. More...
 
template<typename Atom >
std::ostream & icarus::ns::util::details::operator<< (std::ostream &out, HexDumper< Atom > const &data)
 Dumps data in a hexadecimal table. More...
 
template<typename T >
std::ostream & icarus::ns::util::details::operator<< (std::ostream &out, ZeroPadder< T > const &data)
 Dumps a value padding with 0 via ZeroPadder wrapper. More...
 
Format adapters

These functions should be used in stream insertion statements like:

std::cout << icarus::ns::util::bin(0xAA) << std::endl;
template<typename T >
constexpr details::BinObj< T > icarus::ns::util::bin (T value)
 Returns a wrapper to print the specified data in binary format. More...
 
template<std::size_t Bits, typename T >
constexpr details::BinObj< T,
Bits > 
icarus::ns::util::bin (T value)
 Returns a wrapper to print the specified data in binary format. More...
 
template<typename Atom >
details::HexDumper< Atom > icarus::ns::util::hexdump (Atom const *data, std::size_t size, unsigned int columns=16U)
 Returns a wrapper to print the specified data in hex dump format. More...
 
template<typename T >
details::ZeroPadder< T > icarus::ns::util::zeropad (T data, unsigned int field, char pad= '0')
 Returns a wrapper to print the specified data with a field width. More...
 

Detailed Description

Functions to dump the content of binary data chunks to console.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.slac..nosp@m.stan.nosp@m.ford..nosp@m.edu)
Date
December 22, 2020

Definition in file BinaryDumpUtils.h.