12 #ifndef ROOT_StringConv
13 #define ROOT_StringConv
18 #include "RConfigure.h"
37 template <
typename value_type>
44 static const char *
const suffix[][2] =
53 unsigned int unit = si ? 1000 : 1024;
61 }
else if (bytes > 0) {
63 (
int) (
sizeof(suffix) /
sizeof(suffix[0]) - 1));
65 *coeff = bytes /
std::pow(unit, exp);
66 *units = suffix[
exp][!
si];
89 size_t size = str.size();
92 const double coeff = stod(str, &cur);
95 while (cur<size && isspace(str[cur])) ++cur;
102 double v = exp ? coeff *
std::pow(unit, exp / 3) : coeff;
110 if (cur==size)
return result();
112 switch (toupper(str[cur])) {
113 case 'B': exp = 0;
break;
114 case 'K': exp = 3;
break;
115 case 'M': exp = 6;
break;
116 case 'G': exp = 9;
break;
117 case 'T': exp = 12;
break;
118 case 'E': exp = 15;
break;
119 case 'Z': exp = 18;
break;
120 case 'Y': exp = 21;
break;
127 if (cur<size && toupper(str[cur]) ==
'I') {
132 if (cur==size)
return result();
135 switch (toupper(str[cur])) {
138 case '\t': ++cur;
break;
140 case '\0':
return result();
161 #endif // ROOT_StringConv
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Namespace for new ROOT classes and functions.
void ToHumanReadableSize(value_type bytes, Bool_t si, Double_t *coeff, const char **units)
Return the size expressed in 'human readeable' format.
EFromHumanReadableSize FromHumanReadableSize(std::string_view str, T &value)
Convert strings like the following into byte counts 5MB, 5 MB, 5M, 3.7GB, 123b, 456kB, 3.7GiB, 5MiB with some amount of forgiveness baked into the parsing.
double pow(double, double)
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
ClassImp(TSlaveInfo) Int_t TSlaveInfo const TSlaveInfo * si
Used to sort slaveinfos by ordinal.