libmoost
moost::utils Namespace Reference

Namespaces

namespace  scope_exit

Classes

class  benchmark
class  fixed_interval_timer
 A fixed interval timer. More...
class  histogram
class  relops
 Sub-class this to implement relops in your class. More...
class  singleton_default
class  stopwatch
class  scoped_stopwatch
class  YesNo

Functions

void assert_absolute_path (const boost::filesystem::path &path, const std::string &what="", bool accept_empty_path=true)
template<typename unsigned_intT >
unsigned_intT next_power_of_two (unsigned_intT num)
template<typename unsigned_intT >
bool is_power_of_two (unsigned_intT num)
template<typename unsigned_intT >
signed char msb_set (unsigned_intT num)
std::string demangle_name (char const *name)
std::string short_function_name (char const *name)
template<class T >
std::string stringify (const T &val, size_t truncate=0)
template<class T >
void streamstringify (std::ostream &os, const T &val, size_t=0)
template<class T1 , class T2 >
void streamstringify (std::ostream &os, const std::pair< T1, T2 > &val, size_t truncate=0)
template<class T >
void streamstringify (std::ostream &os, const std::set< T > &val, size_t truncate=0)
template<class T >
void streamstringify (std::ostream &os, const std::vector< T > &val, size_t truncate=0)
template<class T1 , class T2 >
void streamstringify (std::ostream &os, const std::map< T1, T2 > &val, size_t truncate=0)

Function Documentation

void moost::utils::assert_absolute_path ( const boost::filesystem::path &  path,
const std::string &  what = "",
bool  accept_empty_path = true 
)

Definition at line 39 of file assert.hpp.

Here is the caller graph for this function:

std::string moost::utils::demangle_name ( char const *  name) [inline]

Definition at line 57 of file demangler.hpp.

template<typename unsigned_intT >
bool moost::utils::is_power_of_two ( unsigned_intT  num)

Definition at line 82 of file bits.hpp.

Here is the caller graph for this function:

template<typename unsigned_intT >
signed char moost::utils::msb_set ( unsigned_intT  num)

Definition at line 91 of file bits.hpp.

Here is the caller graph for this function:

template<typename unsigned_intT >
unsigned_intT moost::utils::next_power_of_two ( unsigned_intT  num)

Definition at line 41 of file bits.hpp.

Here is the caller graph for this function:

std::string moost::utils::short_function_name ( char const *  name) [inline]

Definition at line 98 of file demangler.hpp.

template<class T >
void moost::utils::streamstringify ( std::ostream &  os,
const T &  val,
size_t  = 0 
)

Definition at line 81 of file stringify.hpp.

Here is the caller graph for this function:

template<class T1 , class T2 >
void moost::utils::streamstringify ( std::ostream &  os,
const std::pair< T1, T2 > &  val,
size_t  truncate = 0 
)

Definition at line 87 of file stringify.hpp.

Here is the call graph for this function:

template<class T >
void moost::utils::streamstringify ( std::ostream &  os,
const std::set< T > &  val,
size_t  truncate = 0 
)

Definition at line 97 of file stringify.hpp.

Here is the call graph for this function:

template<class T >
void moost::utils::streamstringify ( std::ostream &  os,
const std::vector< T > &  val,
size_t  truncate = 0 
)

Definition at line 116 of file stringify.hpp.

Here is the call graph for this function:

template<class T1 , class T2 >
void moost::utils::streamstringify ( std::ostream &  os,
const std::map< T1, T2 > &  val,
size_t  truncate = 0 
)

Definition at line 135 of file stringify.hpp.

Here is the call graph for this function:

template<class T >
std::string moost::utils::stringify ( const T &  val,
size_t  truncate 
)

Turn complex data structures into plain strings.

Usage is pretty simple: just call stringify with an arbitrarily nested data structure argument and it will turn its contents into a string representation. It's a bit like Perl's Data::Dumper for C++.

You can add support for your own types by overloading the template.

Definition at line 73 of file stringify.hpp.

Here is the call graph for this function:

Here is the caller graph for this function: