54 #include <sys/types.h> 62 #include "rnr/rnrconfig.h" 67 #define M_TAU (2.0 * M_PI) 71 const long MILLION = 1000000;
72 const long long BILLION = 1000000000;
110 return b?
"true":
"false";
127 return d / 360.0 *
M_TAU;
139 return r /
M_TAU * 360.0;
163 inline double fcap(
double a,
double min,
double max)
165 return a<min? min: a>max? max: a;
177 inline int cap(
int a,
int min,
int max)
179 return a<min? min: a>max? max: a;
189 return a<0? -1.0: 1.0;
218 bool operator<(
const struct timeval& lhs,
const struct timeval& rhs);
231 bool operator==(
const struct timeval& lhs,
const struct timeval& rhs);
244 bool operator>(
const struct timeval& lhs,
const struct timeval& rhs);
256 struct timeval operator+(const struct timeval& op1,
257 const struct timeval& op2);
269 struct timeval operator-(const struct timeval& op1,
270 const struct timeval& op2);
282 long dt_usec(
struct timeval& t1,
struct timeval& t0);
294 double dt(
struct timeval& t1,
struct timeval& t0);
312 bool operator<(
const struct timespec& lhs,
const struct timespec& rhs);
325 bool operator==(
const struct timespec& lhs,
const struct timespec& rhs);
338 bool operator>(
const struct timespec& lhs,
const struct timespec& rhs);
350 struct timespec operator+(const struct timespec& op1,
351 const struct timespec& op2);
363 struct timespec operator-(const struct timespec& op1,
364 const struct timespec& op2);
376 long long dt_nsec(
struct timespec& t1,
struct timespec& t0);
388 double dt(
struct timespec& t1,
struct timespec& t0);
416 std::vector<std::string> &
split(
const std::string &s,
418 std::vector<std::string> &elems);
428 std::vector<std::string>
split(
const std::string &s,
char delim);
433 #endif // _HEK_UTILS_H const char * boolstr(bool b)
Boolean to string.
bool operator>(const struct timeval &lhs, const struct timeval &rhs)
Compare operator to test if left hand side time is later than the right hand side time...
bool operator<(const struct timeval &lhs, const struct timeval &rhs)
Compare operator to test if left hand side time is earlier than the right hand side time...
double signof(double a)
Sign of a.
double dt(struct timeval &t1, struct timeval &t0)
Calculate delta time.
#define M_TAU
tau = 2 * pi
double fcap(double a, double min, double max)
Cap value within limits [min, max].
double radToDeg(double r)
Convert radians to degrees.
const char * getStrError(const int ecode)
Get the error string describing the <b><i>Hekateros</i></b> error code.
int cap(int a, int min, int max)
Cap value within limits [min, max].
bool operator==(const struct timeval &lhs, const struct timeval &rhs)
Compare operator to test if left hand side time equals the right hand side time.
int iabs(int a)
Integer absolute value.
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
Split string at the delimiter character.
Top-level package include file.
double degToRad(double d)
Convert degrees to radians.
uint_t strToVersion(const std::string &str)
Convert version dotted string to integer equivalent.
std::string getRealDeviceName(const std::string &strDevName)
Get real device name.
long long dt_nsec(struct timespec &t1, struct timespec &t0)
Calculate delta time in nanoseconds.
The <b><i>Hekateros</i></b> namespace encapsulates all <b><i>Hekateros</i></b> related constructs...
long dt_usec(struct timeval &t1, struct timeval &t0)
Calculate delta time in microseconds.