Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -1067,7 +1067,7 @@ int Controller::module_level(const char* _mod) ...@@ -1067,7 +1067,7 @@ int Controller::module_level(const char* _mod)
return Stream::get_global().dfile()->module_level(_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(); return Stream::get_global().dfile()->double_format();
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#ifdef DEB_ON #ifdef DEB_ON
namespace Debug { namespace Debug {
/*! A currently empty control interface class onto the DebFile class(es) /*! A currently empty control interface class onto the DebFile class(es)
exploited by DebStream. */ exploited by DebStream. */
class Controller class Controller
...@@ -26,22 +27,39 @@ public: ...@@ -26,22 +27,39 @@ public:
//! Set printf style format string used for double (and float) numeric print //! Set printf style format string used for double (and float) numeric print
static void set_double_format(const char* _fmt); static void set_double_format(const char* _fmt);
static std::string double_format(); static const char* double_format();
};
class DoubleFormatSession
{
public:
DoubleFormatSession(const char* _fmt)
: fmt_bck_(Controller::double_format())
{
Controller::set_double_format(_fmt);
}
Controller() {} ~DoubleFormatSession()
~Controller() {} {
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_module_level(MM, LL) { Controller::set_module_level(MM, LL); }
#define DEB_set_double_format(FF) { Controller::set_double_format(FF); } //#define DEB_set_double_format(FF) { Controller::set_double_format(FF); }
#define DEB_double_format(FF) Debug::DoubleFormatSession double_format(FF);
#else #else
#define DEB_set_module_level(MM, LL) {} //#define DEB_set_module_level(MM, LL) {}
#define DEB_set_double_format(FF) {} //#define DEB_set_double_format(FF) {}
#define DEB_double_format(FF)
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment