Commit e3e081b0 authored by Martin Marinov's avatar Martin Marinov
Browse files

Added DoubleFormatSession to control the way float/doubles are output in the debug stream.

[git-p4: depot-paths = "//ReForm/ReForm/main/Base/": change = 11981]
parent adba32e6
......@@ -1067,7 +1067,7 @@ int Controller::module_level(const char* _mod)
return Stream::get_global().dfile()->module_level(_mod);
}
std::string Controller::double_format()
const char* Controller::double_format()
{
return Stream::get_global().dfile()->double_format();
}
......
......@@ -16,32 +16,50 @@
#ifdef DEB_ON
namespace Debug {
/*! A currently empty control interface class onto the DebFile class(es)
exploited by DebStream. */
class Controller
{
public:
static void set_module_level(const char * _mod, const int _lev);
static int module_level(const char * _mod);
static void set_module_level(const char* _mod, const int _lev);
static int module_level(const char* _mod);
//! Set printf style format string used for double (and float) numeric print
static void set_double_format(const char * _fmt);
static std::string double_format();
static void set_double_format(const char* _fmt);
static const char* double_format();
};
class DoubleFormatSession
{
public:
DoubleFormatSession(const char* _fmt)
: fmt_bck_(Controller::double_format())
{
Controller::set_double_format(_fmt);
}
Controller() {}
~Controller() {}
~DoubleFormatSession()
{
Controller::set_double_format(fmt_bck_.data());
}
private:
std::string fmt_bck_;
};
} // endnamespace
}// namespace Debug
#define DEB_set_module_level(MM, LL) { Controller::set_module_level(MM, LL); }
#define DEB_set_double_format(FF) { Controller::set_double_format(FF); }
//#define DEB_set_module_level(MM, LL) { Controller::set_module_level(MM, LL); }
//#define DEB_set_double_format(FF) { Controller::set_double_format(FF); }
#define DEB_double_format(FF) Debug::DoubleFormatSession double_format(FF);
#else
#define DEB_set_module_level(MM, LL) {}
#define DEB_set_double_format(FF) {}
//#define DEB_set_module_level(MM, LL) {}
//#define DEB_set_double_format(FF) {}
#define DEB_double_format(FF)
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment