9 #define TRG_SHORT_NAMES
15 #include "trg/trg/Utilities.h"
26 TRGUtilities::dateString(
void)
33 strftime(ts1,
sizeof(ts1),
"%Y/%m/%d %H:%M %Z", tl);
38 TRGUtilities::dateStringF(
void)
45 strftime(ts0,
sizeof(ts0),
"%Y%m%d_%H%M", tl);
50 TRGUtilities::itostring(
int i)
56 return std::to_string(i);
60 TRGUtilities::dtostring(
double d,
unsigned int precision)
63 s << std::setprecision(precision) << d;
68 TRGUtilities::carstring(
const std::string& s)
76 for (i = 0; i < len; i++) {
77 if (!isspace(s[i]))
break;
79 for (; i < len; i++) {
88 TRGUtilities::cdrstring(
const std::string& s)
96 for (i = 0; i < len; i++) {
97 if (!isspace(s[i]))
break;
99 for (; i < len; i++) {
100 if (isspace(s[i]))
break;
102 for (; i < len; i++) {
103 if (!isspace(s[i]))
break;
109 TRGUtilities::bitDisplay(
unsigned val)
111 bitDisplay(val, 31, 0);
115 TRGUtilities::bitDisplay(
unsigned val,
unsigned f,
unsigned l)
118 for (i = 0; i < f - l; i++) {
119 if ((i % 8) == 0) cout <<
" ";
120 cout << (val >> (f - i)) % 2;
125 TRGUtilities::streamDisplay(
unsigned val,
unsigned f,
unsigned l)
128 for (
unsigned i = f; i < l + 1; i++) {
129 if ((i % 8) == 0) s +=
" ";
130 s += itostring((val >> i) % 2);
136 TRGUtilities::streamDisplay(
unsigned val)
138 return streamDisplay(val, 0, 63);
Abstract base class for different kinds of events.