35 #ifndef REPORTINGUTILS_H
36 #define REPORTINGUTILS_H
53 size_t pos = prettyFunction.find(
"(");
54 if (pos == std::string::npos)
55 return prettyFunction;
56 prettyFunction.erase(pos);
57 pos = prettyFunction.rfind(
" ");
58 if (pos == std::string::npos)
59 return prettyFunction;
60 prettyFunction.erase(0, pos + 1);
61 return prettyFunction;
64 #define printErr std::cerr << "!!! " << __PRETTY_FUNCTION__ << " [" << __FILE__ << ":" << __LINE__ << "]: ERROR: " << std::flush
65 #define printWarn std::cerr << ">>> " << __PRETTY_FUNCTION__ << " [" << __FILE__ << ":" << __LINE__ << "]: "<<std::endl<<"Warning: " << std::flush
66 #define printInfo std::cout << ">>> " << getClassMethod__(__PRETTY_FUNCTION__) << "(): Info: " << std::flush
72 #ifndef SVN_VERSION // SVN_VERSION set by Makefile
73 #define SVN_VERSION "undefined"
83 printInfo <<
"subversion repository revision is unknown." << std::endl;
85 printInfo <<
"subversion repository revision is '" << ver <<
"'" << std::endl;
89 #ifndef CMAKE_SOURCE_DIR // CMAKE_SOURCE_DIR set by Makefile
90 #define CMAKE_SOURCE_DIR "undefined"
98 const std::string date = __DATE__;
99 const std::string
time = __TIME__;
100 const std::string ver = __VERSION__;
102 printInfo <<
"this executable was compiled in ";
104 std::cout <<
"'" << dir <<
"'";
106 std::cout <<
"unknown directory";
107 std::cout <<
" on " << date <<
" " << time <<
" by compiler " << ver << std::endl;
114 template<
typename T1,
typename T2>
118 const std::pair<T1, T2>& pair)
120 return out <<
"(" << pair.first <<
", " << pair.second <<
")";
128 const std::vector<T>& vec)
131 for (
unsigned int i = 0; i < (vec.size() - 1); ++i)
132 out <<
"[" << i <<
"] = " << vec[i] <<
", ";
133 return out <<
"[" << vec.size() - 1 <<
"] = " << vec[vec.size() - 1] <<
"}";
142 const unsigned int nmbTotal,
143 const bool absolute =
false,
144 const unsigned int fieldWidth = 3,
145 const unsigned int nmbSteps = 10,
146 std::ostream& out = std::cout)
148 const double step = nmbTotal / (double)nmbSteps;
149 if ((
int)(currentPos /
step) - (
int)((currentPos - 1) / step) != 0) {
151 out <<
" " << std::setw(fieldWidth) << currentPos <<
" of " << nmbTotal << std::endl;
153 out <<
" " << std::setw(fieldWidth) << (int)(currentPos / step) * nmbSteps <<
" %" << std::endl;
200 #endif // REPORTINGUTILS_H