Helpers.hh File Reference
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/special_functions/round.hpp>
#include <algorithm>
#include <cmath>
#include <limits>
#include <string>
#include <iostream>
#include <vector>

Go to the source code of this file.

Namespaces

 gazebo
 Forward declarations for the common classes.
 
 gazebo::math
 Math namespace.
 

Macros

#define GZ_DBL_INF   std::numeric_limits<double>::infinity()
 Double positive infinite value. More...
 
#define GZ_DBL_MAX   std::numeric_limits<double>::max()
 Double maximum value. More...
 
#define GZ_DBL_MIN   std::numeric_limits<double>::min()
 Double min value. More...
 
#define GZ_FLT_MAX   std::numeric_limits<float>::max()
 Float maximum value. More...
 
#define GZ_FLT_MIN   std::numeric_limits<float>::min()
 Float minimum value. More...
 
#define GZ_INT32_MAX   std::numeric_limits<int32_t>::max()
 32bit integer maximum value More...
 
#define GZ_INT32_MIN   std::numeric_limits<int32_t>::min()
 32bit integer minimum value More...
 
#define GZ_UINT32_MAX   std::numeric_limits<uint32_t>::max()
 32bit unsigned integer maximum value More...
 
#define GZ_UINT32_MIN   std::numeric_limits<uint32_t>::min()
 32bit unsigned integer minimum value More...
 

Functions

template<typename T >
clamp (T _v, T _min, T _max)
 Simple clamping function. More...
 
template<typename T >
bool equal (const T &_a, const T &_b, const T &_epsilon=1e-6)
 check if two values are equal, within a tolerance More...
 
float fixnan (float _v)
 Fix a nan value. More...
 
double fixnan (double _v)
 Fix a nan value. More...
 
bool isnan (float _v)
 check if a float is NaN More...
 
bool isnan (double _v)
 check if a double is NaN More...
 
bool isPowerOfTwo (unsigned int _x)
 is this a power of 2? More...
 
template<typename T >
max (const std::vector< T > &_values)
 get the maximum value of vector of values More...
 
template<typename T >
mean (const std::vector< T > &_values)
 get mean of vector of values More...
 
template<typename T >
min (const std::vector< T > &_values)
 get the minimum value of vector of values More...
 
double parseFloat (const std::string &_input)
 parse string into float More...
 
int parseInt (const std::string &_input)
 parse string into an integer More...
 
template<typename T >
precision (const T &_a, const unsigned int &_precision)
 get value at a specified precision More...
 
unsigned int roundUpPowerOfTwo (unsigned int _x)
 Get the smallest power of two that is greater or equal to a given value. More...
 
template<typename T >
variance (const std::vector< T > &_values)
 get variance of vector of values More...
 

Variables

static const double NAN_D = std::numeric_limits<double>::quiet_NaN()
 Returns the representation of a quiet not a number (NAN) More...
 
static const int NAN_I = std::numeric_limits<int>::quiet_NaN()
 Returns the representation of a quiet not a number (NAN) More...
 

Macro Definition Documentation

§ GZ_DBL_INF

#define GZ_DBL_INF   std::numeric_limits<double>::infinity()

Double positive infinite value.

§ GZ_DBL_MAX

#define GZ_DBL_MAX   std::numeric_limits<double>::max()

Double maximum value.

§ GZ_DBL_MIN

#define GZ_DBL_MIN   std::numeric_limits<double>::min()

Double min value.

§ GZ_FLT_MAX

#define GZ_FLT_MAX   std::numeric_limits<float>::max()

Float maximum value.

§ GZ_FLT_MIN

#define GZ_FLT_MIN   std::numeric_limits<float>::min()

Float minimum value.

§ GZ_INT32_MAX

#define GZ_INT32_MAX   std::numeric_limits<int32_t>::max()

32bit integer maximum value

§ GZ_INT32_MIN

#define GZ_INT32_MIN   std::numeric_limits<int32_t>::min()

32bit integer minimum value

§ GZ_UINT32_MAX

#define GZ_UINT32_MAX   std::numeric_limits<uint32_t>::max()

32bit unsigned integer maximum value

§ GZ_UINT32_MIN

#define GZ_UINT32_MIN   std::numeric_limits<uint32_t>::min()

32bit unsigned integer minimum value