/* * ValuePrinter.hpp * * Created on: Aug 3, 2012 * Author: heber */ #ifndef VALUEPRINTER_HPP_ #define VALUEPRINTER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "CodePatterns/toString.hpp" /** ValuePrinter prints the value for one row in a table of values each associated to a * specific boost::fusion-style key \a MapKey. * * This is made such that we may use boost::mpl::for_each to quickly create * the value line if specialized printName()s and a boost::fusion::vector * containing all these keys is present */ template struct ValuePrinter { ValuePrinter(const MapType &_instance, const size_t level) : instance(_instance), value(toString(level)) {} template void operator()(MapKey &) { //typedef typename boost::fusion::result_of::value_at_key::type MapValue; std::stringstream valuestream; valuestream << std::setprecision(numprecision) << boost::fusion::at_key(instance); value += std::string("\t") + valuestream.str(); } const std::string &get() const { return value; } private: const MapType &instance; std::string value; }; #endif /* VALUEPRINTER_HPP_ */