53 #include <sys/types.h> 61 #include "rnr/rnrconfig.h" 66 #define M_TAU (2.0 * M_PI) 70 const long MILLION = 1000000;
71 const long long BILLION = 1000000000;
109 return b?
"true":
"false";
126 return d / 360.0 *
M_TAU;
138 return r /
M_TAU * 360.0;
162 inline double fcap(
double a,
double min,
double max)
164 return a<min? min: a>max? max: a;
176 inline int cap(
int a,
int min,
int max)
178 return a<min? min: a>max? max: a;
190 inline uint_t
cap(uint_t a, uint_t min, uint_t max)
192 return a<min? min: a>max? max: a;
202 return a<0? -1.0: 1.0;
236 bool operator<(
const struct timeval& lhs,
const struct timeval& rhs);
250 bool operator==(
const struct timeval& lhs,
const struct timeval& rhs);
265 bool operator>(
const struct timeval& lhs,
const struct timeval& rhs);
280 bool operator<=(
const struct timeval& lhs,
const struct timeval& rhs);
295 bool operator>=(
const struct timeval& lhs,
const struct timeval& rhs);
307 struct timeval operator+(const struct timeval& op1,
308 const struct timeval& op2);
320 struct timeval operator-(const struct timeval& op1,
321 const struct timeval& op2);
333 long dt_usec(
struct timeval& t1,
struct timeval& t0);
345 double dt(
struct timeval& t1,
struct timeval& t0);
366 bool operator<(
const struct timespec& lhs,
const struct timespec& rhs);
380 bool operator==(
const struct timespec& lhs,
const struct timespec& rhs);
395 bool operator>(
const struct timespec& lhs,
const struct timespec& rhs);
410 bool operator<=(
const struct timespec& lhs,
const struct timespec& rhs);
425 bool operator>=(
const struct timespec& lhs,
const struct timespec& rhs);
437 struct timespec operator+(const struct timespec& op1,
438 const struct timespec& op2);
450 struct timespec operator-(const struct timespec& op1,
451 const struct timespec& op2);
463 long long dt_nsec(
struct timespec& t1,
struct timespec& t0);
475 double dt(
struct timespec& t1,
struct timespec& t0);
503 std::vector<std::string> &
split(
const std::string &s,
505 std::vector<std::string> &elems);
515 std::vector<std::string>
split(
const std::string &s,
char delim);
546 Dim(
double width,
double height,
double length)
601 #endif // _LAE_UTILS_H bool operator>=(const struct timeval &lhs, const struct timeval &rhs)
Greater than or equal to compare operator.
double dt(struct timeval &t1, struct timeval &t0)
Calculate delta time.
Dim()
Default constructor.
double degToRad(double d)
Convert degrees to radians.
double signof(double a)
Sign of a.
uint_t strToVersion(const std::string &str)
Convert version dotted string to integer equivalent.
virtual ~Dim()
Destructor.
bool operator>(const struct timeval &lhs, const struct timeval &rhs)
Greater than compare operator.
double fcap(double a, double min, double max)
Cap value within limits [min, max].
double m_length
object length (meters)
Object width x height x length dimensions class.
Dim(double width, double height, double length)
Initialization constructor.
const char * getStrError(const int ecode)
Get the error string describing the <b><i>Laelaps</i></b> error code.
double radToDeg(double r)
Convert radians to degrees.
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
Split string at the delimiter character.
int iabs(int a)
Integer absolute value.
struct timespec timespec_t
typedef'ed timespec structure
bool operator<=(const struct timeval &lhs, const struct timeval &rhs)
Less than or equal to compare operator.
bool operator<(const struct timeval &lhs, const struct timeval &rhs)
Less than compare operator.
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Dim(const Dim &src)
Copy constructor.
Dim operator=(const Dim &rhs)
Assignment operator.
int cap(int a, int min, int max)
Cap value within limits [min, max].
double m_height
object height (meters)
long long dt_nsec(struct timespec &t1, struct timespec &t0)
Calculate delta time in nanoseconds.
bool operator==(const struct timeval &lhs, const struct timeval &rhs)
Equality compare operator.
struct timeval timeval_t
typedef'ed timeval structure
#define M_TAU
tau = 2 * pi
double m_width
object width (meters)
const char * boolstr(bool b)
Boolean to string.
std::string getRealDeviceName(const std::string &strDevName)
Get real device name.
Top-level package include file.
long dt_usec(struct timeval &t1, struct timeval &t0)
Calculate delta time in microseconds.