TuringSim
C++ framework to simulate abstract computing models
Classes | Functions
TuringSim::Utils::Debug Namespace Reference

The namespace for debug printers. More...

Classes

class  Debug
 A generic debug printer, defaulting to operator<< , when no specialization applies. More...
 
struct  Debug< CharT, Traits, bool >
 The debug printer for bool. More...
 
struct  Debug< CharT, Traits, std::array< T, N > >
 The debug printer for arrays. More...
 
struct  Debug< CharT, Traits, std::deque< T, Alloc > >
 The debug printer for deque. More...
 
struct  Debug< CharT, Traits, std::map< Key, Value, Comp, Alloc > >
 The debug printer for maps. More...
 
struct  Debug< CharT, Traits, std::monostate >
 The debug printer for monostate. More...
 
struct  Debug< CharT, Traits, std::optional< T > >
 The debug printer for options. More...
 
struct  Debug< CharT, Traits, std::pair< T1, T2 > >
 The debug printer for pairs. More...
 
struct  Debug< CharT, Traits, std::queue< T, C > >
 The debug printer for queue. More...
 
struct  Debug< CharT, Traits, std::set< T, Comp, Alloc > >
 The debug printer for sets. More...
 
struct  Debug< CharT, Traits, std::shared_ptr< T > >
 The debug printer for shared pointers. More...
 
struct  Debug< CharT, Traits, std::string >
 The debug printer for string. More...
 
struct  Debug< CharT, Traits, std::tuple< TT... > >
 The debug printer for tuples. More...
 
struct  Debug< CharT, Traits, std::vector< T, Alloc > >
 The debug printer for vectors. More...
 
struct  Debug< CharT, Traits, std::weak_ptr< T > >
 The debug printer for shared pointers. More...
 

Functions

template<typename T , typename CharT = char, typename Traits = std::char_traits<CharT>>
std::function< std::basic_ostream< CharT, Traits > &(std::basic_ostream< CharT, Traits > &)> debug (const T &s)
 Generic debug printing function. More...
 
template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, const std::function< std::basic_ostream< CharT, Traits > &(std::basic_ostream< CharT, Traits > &)> &f)
 Allows to use printers with stream operators. More...
 
template<typename T , typename CharT = char, typename Trait = std::char_traits<CharT>, typename Alloc = std::allocator<CharT>>
std::basic_string< CharT, Trait, Alloc > toString (const T &s)
 A generic stringifier. More...
 
template<typename T , typename CharT = char, typename Traits = std::char_traits<CharT>>
std::function< std::basic_ostream< CharT, Traits > &(std::basic_ostream< CharT, Traits > &)> spaceNumber (const T &k)
 return a debug printer that spaces number by group of 3. More...
 

Detailed Description

The namespace for debug printers.

Function Documentation

◆ debug()

template<typename T , typename CharT = char, typename Traits = std::char_traits<CharT>>
std::function<std::basic_ostream<CharT, Traits>&(std::basic_ostream<CharT, Traits>&)> TuringSim::Utils::Debug::debug ( const T &  s)

Generic debug printing function.

Template Parameters
Tprinted type.
CharTchar type.
Traitsstd::basic_ostream trait.
Parameters
[in]sthe thing to print.
Returns
a printer.

Definition at line 34 of file printer.h.

Here is the caller graph for this function:

◆ operator<<()

template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& TuringSim::Utils::Debug::operator<< ( std::basic_ostream< CharT, Traits > &  os,
const std::function< std::basic_ostream< CharT, Traits > &(std::basic_ostream< CharT, Traits > &)> &  f 
)

Allows to use printers with stream operators.

Template Parameters
CharTchar type.
Traitsstd::basic_ostream trait.
Parameters
[in,out]osoutput stream.
[in]fthe printer.
Returns
the updated stream.

Definition at line 34 of file printer.h.

◆ spaceNumber()

template<typename T , typename CharT = char, typename Traits = std::char_traits<CharT>>
std::function<std::basic_ostream<CharT, Traits>&(std::basic_ostream<CharT, Traits>&)> TuringSim::Utils::Debug::spaceNumber ( const T &  k)

return a debug printer that spaces number by group of 3.

Template Parameters
Ttype of the number to print.
CharTchar type.
Traitsstd::basic_ostream trait.
Parameters
[in]kthe number to print.
Returns
the debug printer.

Definition at line 425 of file printer.h.

◆ toString()

template<typename T , typename CharT = char, typename Trait = std::char_traits<CharT>, typename Alloc = std::allocator<CharT>>
std::basic_string<CharT, Trait, Alloc> TuringSim::Utils::Debug::toString ( const T &  s)

A generic stringifier.

Template Parameters
Tthe type of elements to serialize
CharTchar type.
Traitsstd::basic_ostream trait.
Allocan allocator.
Parameters
[in]sthe thing to stringify.
Returns

Definition at line 411 of file printer.h.

Here is the call graph for this function: