11 #ifndef OPENVDB_UTIL_FORMATS_HAS_BEEN_INCLUDED 12 #define OPENVDB_UTIL_FORMATS_HAS_BEEN_INCLUDED 17 #include <openvdb/version.h> 37 const std::string& head =
"",
38 const std::string& tail =
"\n",
39 bool exact =
false,
int width = 8,
int precision = 3);
52 const std::string& head =
"",
53 const std::string& tail =
"\n",
54 bool exact =
true,
int width = 8,
int precision = 3);
66 printTime(std::ostream& os,
double milliseconds,
67 const std::string& head =
"",
68 const std::string& tail =
"\n",
69 int width = 4,
int precision = 1,
int verbose = 0);
76 template<
typename IntT>
80 static char sep() {
return ','; }
84 std::ostream&
put(std::ostream& os)
const 87 std::ostringstream ostr;
89 std::string s = ostr.str();
91 size_t padding = (s.size() % 3) ? 3 - (s.size() % 3) : 0;
92 s = std::string(padding,
' ') + s;
96 for (
size_t i = 0, N = s.size(); i < N; ) {
99 if (i >= padding && i % 3 == 0 && i < s.size()) {
105 os << s.substr(padding, s.size());
113 template<
typename IntT>
114 std::ostream& operator<<(std::ostream& os, const FormattedInt<IntT>& n) {
return n.put(os); }
117 template<
typename IntT>
124 #endif // OPENVDB_UTIL_FORMATS_HAS_BEEN_INCLUDED
OPENVDB_API int printNumber(std::ostream &os, uint64_t number, const std::string &head="", const std::string &tail="\n", bool exact=true, int width=8, int precision=3)
Definition: Exceptions.h:13
OPENVDB_API int printBytes(std::ostream &os, uint64_t bytes, const std::string &head="", const std::string &tail="\n", bool exact=false, int width=8, int precision=3)
OPENVDB_API int printTime(std::ostream &os, double milliseconds, const std::string &head="", const std::string &tail="\n", int width=4, int precision=1, int verbose=0)
FormattedInt< IntT > formattedInt(IntT n)
Definition: Formats.h:118
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218