From f3be68a55245bd8c4d635779818daaabb00d936b Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Fri, 13 Apr 2012 15:21:11 +0100 Subject: [PATCH] add a way to print bool vars --- packages/CLPBN/clpbn/bp/Util.cpp | 11 +++++++++++ packages/CLPBN/clpbn/bp/Util.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/packages/CLPBN/clpbn/bp/Util.cpp b/packages/CLPBN/clpbn/bp/Util.cpp index 20f33a6c7..f9890fce6 100644 --- a/packages/CLPBN/clpbn/bp/Util.cpp +++ b/packages/CLPBN/clpbn/bp/Util.cpp @@ -37,6 +37,17 @@ unsigned Statistics::primaryNetCount_; namespace Util { + +template <> std::string +toString (const bool& b) +{ + std::stringstream ss; + ss << std::boolalpha << b; + return ss.str(); +} + + + void toLog (Params& v) { diff --git a/packages/CLPBN/clpbn/bp/Util.h b/packages/CLPBN/clpbn/bp/Util.h index 0b4d4173c..58e838d63 100644 --- a/packages/CLPBN/clpbn/bp/Util.h +++ b/packages/CLPBN/clpbn/bp/Util.h @@ -36,6 +36,8 @@ template bool contains ( template std::string toString (const T&); +template <> std::string toString (const bool&); + void toLog (Params&); void fromLog (Params&); @@ -312,6 +314,7 @@ void pow (Params&, double); }; + struct NetInfo { NetInfo (unsigned size, bool loopy, unsigned nIters, double time)