5 enum Bunit { BunitB = 0, BunitkB = 1, BunitMB = 2, BunitGB = 3, BunitTB = 4 };
6 enum Tunit { TunitMS, TunitS, TunitM, TunitH };
7 enum state { OK = 0, WARNING = 1, CRITICAL = 2 };
13 //TRUE means everything BELOW upper/outside [lower-upper] is fine
14 bool legal, perc, set;
16 threshold(bool l = true)
17 : set(false), legal(l) {}
19 threshold(const double v, const double c, bool l = true, bool p = false)
20 : lower(v), upper(c), legal(l), perc(p), set(true) {}
22 //return TRUE if the threshold is broken
23 bool rend(const double b)
28 return b > upper == legal;
30 return (b < lower || upper < b) != legal;
33 //returns a printable string of the threshold
34 std::wstring pString()
45 s.append(L"[").append(std::to_wstring(lower)).append(L"%").append(L"-")
46 .append(std::to_wstring(upper)).append(L"%").append(L"]");
48 s.append(L"[").append(std::to_wstring(lower)).append(L"-")
49 .append(std::to_wstring(upper)).append(L"]");
52 s = std::to_wstring(lower).append(L"%");
54 s = std::to_wstring(lower);
60 threshold parse(const std::wstring&);
61 Bunit parseBUnit(const wchar_t *);
62 std::wstring BunitStr(const Bunit&);
63 Tunit parseTUnit(const wchar_t *);
64 std::wstring TunitStr(const Tunit&);