Helpers.hh
Go to the documentation of this file.
static const size_t IGN_NINE_SIZE_T
size_t type with a value of 9
Definition: Helpers.hh:254
std::chrono::steady_clock::time_point stringToTimePoint(const std::string &_timeString)
Convert a string to a std::chrono::steady_clock::time_point.
Definition: Helpers.hh:1073
std::tuple< PairInput, PairInput > Unpair(const PairOutput _key)
The reverse of the Pair function. Accepts a key, produced from the Pair function, and returns a tuple...
STL class.
T empty(T... args)
static const size_t IGN_SIX_SIZE_T
size_t type with a value of 6
Definition: Helpers.hh:245
static const int NAN_I
Returns the representation of a quiet not a number (NAN)
Definition: Helpers.hh:365
static const int32_t LOW_I32
32bit unsigned integer lowest value. This is equivalent to IGN_INT32_MIN, and is defined here for com...
Definition: Helpers.hh:333
static const float INF_F
float positive infinite value
Definition: Helpers.hh:281
static const double LOW_D
Double low value, equivalent to -MAX_D.
Definition: Helpers.hh:263
std::chrono::steady_clock::duration stringToDuration(const std::string &_timeString)
Convert a string to a std::chrono::steady_clock::duration.
Definition: Helpers.hh:1031
T find_first_not_of(T... args)
std::chrono::steady_clock::duration secNsecToDuration(const uint64_t &_sec, const uint64_t &_nanosec)
Convert seconds and nanoseconds to std::chrono::steady_clock::duration.
Definition: Helpers.hh:774
static const uint64_t MIN_UI64
64bit unsigned integer minimum value
Definition: Helpers.hh:342
static const uint32_t MIN_UI32
32bit unsigned integer minimum value
Definition: Helpers.hh:316
std::chrono::duration< uint64_t, std::ratio< 86400 > > days
This will exist in C++-20.
Definition: Helpers.hh:796
T precision(const T &_a, const unsigned int &_precision)
get value at a specified precision
Definition: Helpers.hh:590
static const size_t IGN_EIGHT_SIZE_T
size_t type with a value of 8
Definition: Helpers.hh:251
T mean(const std::vector< T > &_values)
get mean of vector of values
Definition: Helpers.hh:503
static const int32_t INF_I32
32-bit unsigned integer positive infinite value
Definition: Helpers.hh:336
T swap(T... args)
static const float NAN_F
Returns the representation of a quiet not a number (NAN)
Definition: Helpers.hh:284
static const int16_t MAX_I16
16bit unsigned integer maximum value
Definition: Helpers.hh:300
static const uint16_t MAX_UI16
16bit unsigned integer maximum value
Definition: Helpers.hh:287
T stod(T... args)
static const uint64_t MAX_UI64
64bit unsigned integer maximum value
Definition: Helpers.hh:339
static const uint64_t LOW_UI64
64bit unsigned integer lowest value. This is equivalent to IGN_UINT64_MIN, and is defined here for co...
Definition: Helpers.hh:346
unsigned int roundUpPowerOfTwo(unsigned int _x)
Get the smallest power of two that is greater or equal to a given value.
Definition: Helpers.hh:635
static const uint32_t MAX_UI32
32bit unsigned integer maximum value
Definition: Helpers.hh:313
T max(const std::vector< T > &_values)
get the maximum value of vector of values
Definition: Helpers.hh:529
T duration_cast(T... args)
static const int64_t MAX_I64
64bit unsigned integer maximum value
Definition: Helpers.hh:352
bool equal(const T &_a, const T &_b, const T &_epsilon=T(1e-6))
check if two values are equal, within a tolerance
Definition: Helpers.hh:556
std::string durationToString(const std::chrono::steady_clock::duration &_duration)
Convert a std::chrono::steady_clock::duration to a string.
Definition: Helpers.hh:847
static const double MIN_D
Double min value. This value will be similar to 2.22507e-308.
Definition: Helpers.hh:260
static const size_t IGN_ONE_SIZE_T
size_t type with a value of 1
Definition: Helpers.hh:230
T setw(T... args)
bool greaterOrNearEqual(const T &_a, const T &_b, const T &_epsilon=1e-6)
inequality test, within a tolerance
Definition: Helpers.hh:579
STL class.
T variance(const std::vector< T > &_values)
get variance of vector of values
Definition: Helpers.hh:515
T min(T... args)
static const size_t IGN_FOUR_SIZE_T
size_t type with a value of 4
Definition: Helpers.hh:239
std::pair< int64_t, int64_t > durationToSecNsec(const std::chrono::steady_clock::duration &_dur)
Convert a std::chrono::steady_clock::duration to a seconds and nanoseconds pair.
Definition: Helpers.hh:786
static const std::regex time_regex("^([0-9]+ ){0,1}" "(?:([1-9]:|[0-1][0-9]:|2[0-3]:){0,1}" "([0-9]:|[0-5][0-9]:)){0,1}" "(?:([0-9]|[0-5][0-9]){0,1}" "(\[0-9]{1,3}){0,1})$")
std::tuple< Durations... > breakDownDurations(DurationIn d)
break down durations NOTE: the template arguments must be properly ordered according to magnitude and...
Definition: Helpers.hh:806
static const uint32_t INF_UI32
32-bit unsigned integer positive infinite value
Definition: Helpers.hh:323
static const size_t IGN_FIVE_SIZE_T
size_t type with a value of 5
Definition: Helpers.hh:242
static const uint64_t INF_UI64
64-bit unsigned integer positive infinite value
Definition: Helpers.hh:349
T lowest(T... args)
static const float LOW_F
Float low value, equivalent to -MAX_F.
Definition: Helpers.hh:278
#define IGN_FP_VOLATILE
Define IGN_FP_VOLATILE for FP equality comparisons Use volatile parameters when checking floating poi...
Definition: Helpers.hh:196
STL class.
std::pair< int64_t, int64_t > timePointToSecNsec(const std::chrono::steady_clock::time_point &_time)
Convert a std::chrono::steady_clock::time_point to a seconds and nanoseconds pair.
Definition: Helpers.hh:738
T erase(T... args)
T setfill(T... args)
bool isPowerOfTwo(unsigned int _x)
Is this a power of 2?
Definition: Helpers.hh:625
static const uint16_t INF_UI16
16-bit unsigned integer positive infinite value
Definition: Helpers.hh:297
std::chrono::steady_clock::time_point secNsecToTimePoint(const uint64_t &_sec, const uint64_t &_nanosec)
Convert seconds and nanoseconds to std::chrono::steady_clock::time_point.
Definition: Helpers.hh:757
static const size_t IGN_ZERO_SIZE_T
size_t type with a value of 0
Definition: Helpers.hh:227
static const uint16_t MIN_UI16
16bit unsigned integer minimum value
Definition: Helpers.hh:290
static const uint16_t LOW_UI16
16bit unsigned integer lowest value. This is equivalent to IGN_UINT16_MIN, and is defined here for co...
Definition: Helpers.hh:294
static const int16_t MIN_I16
16bit unsigned integer minimum value
Definition: Helpers.hh:303
T infinity(T... args)
static const int32_t MIN_I32
32bit unsigned integer minimum value
Definition: Helpers.hh:329
T max(T... args)
static const int64_t MIN_I64
64bit unsigned integer minimum value
Definition: Helpers.hh:355
bool splitTimeBasedOnTimeRegex(const std::string &_timeString, uint64_t &numberDays, uint64_t &numberHours, uint64_t &numberMinutes, uint64_t &numberSeconds, uint64_t &numberMilliseconds)
Split a std::chrono::steady_clock::duration to a string.
Definition: Helpers.hh:948
T count(T... args)
T fixed(T... args)
PairOutput Pair(const PairInput _a, const PairInput _b)
A pairing function that maps two values to a unique third value. This is an implement of Szudzik's fu...
static const float MAX_F
Float maximum value. This value will be similar to 3.40282e+38.
Definition: Helpers.hh:272
T size(T... args)
STL class.
bool isEven(const int _v)
Check if parameter is even.
Definition: Helpers.hh:446
T pow(T... args)
static const double NAN_D
Returns the representation of a quiet not a number (NAN)
Definition: Helpers.hh:269
static const int16_t LOW_I16
16bit unsigned integer lowest value. This is equivalent to IGN_INT16_MIN, and is defined here for com...
Definition: Helpers.hh:307
static const int64_t LOW_I64
64bit unsigned integer lowest value. This is equivalent to IGN_INT64_MIN, and is defined here for com...
Definition: Helpers.hh:359
static const double MAX_D
Double maximum value. This value will be similar to 1.79769e+308.
Definition: Helpers.hh:257
static const size_t IGN_TWO_SIZE_T
size_t type with a value of 2
Definition: Helpers.hh:233
static const int64_t INF_I64
64-bit unsigned integer positive infinite value
Definition: Helpers.hh:362
bool isTimeString(const std::string &_timeString)
Check if the given string represents a time. An example time string is "0 00:00:00.000", which has the format "DAYS HOURS:MINUTES:SECONDS.MILLISECONDS".
Definition: Helpers.hh:900
T regex_search(T... args)
static const float MIN_F
Float minimum value. This value will be similar to 1.17549e-38.
Definition: Helpers.hh:275
T isnan(T... args)
double parseFloat(const std::string &_input)
parse string into float
Definition: Helpers.hh:708
constexpr T IGN_MASSMATRIX3_DEFAULT_TOLERANCE
The default tolerance value used by MassMatrix3::IsValid(), MassMatrix3::IsPositive(), and MassMatrix3::ValidMoments()
Definition: Helpers.hh:40
static const int16_t INF_I16
16-bit unsigned integer positive infinite value
Definition: Helpers.hh:310
T quiet_NaN(T... args)
static const double INF_D
Double positive infinite value.
Definition: Helpers.hh:266
void sort2(T &_a, T &_b)
Sort two numbers, such that _a <= _b.
Definition: Helpers.hh:600
static const uint32_t LOW_UI32
32bit unsigned integer lowest value. This is equivalent to IGN_UINT32_MIN, and is defined here for co...
Definition: Helpers.hh:320
static const size_t IGN_THREE_SIZE_T
size_t type with a value of 3
Definition: Helpers.hh:236
static const size_t IGN_SEVEN_SIZE_T
size_t type with a value of 7
Definition: Helpers.hh:248
T isinf(T... args)
Definition: Angle.hh:42
T setprecision(T... args)
std::string timePointToString(const std::chrono::steady_clock::time_point &_point)
Convert a std::chrono::steady_clock::time_point to a string.
Definition: Helpers.hh:820
T stoi(T... args)
T round(T... args)
int parseInt(const std::string &_input)
parse string into an integer
Definition: Helpers.hh:679
bool lessOrNearEqual(const T &_a, const T &_b, const T &_epsilon=1e-6)
inequality test, within a tolerance
Definition: Helpers.hh:568
T min(const std::vector< T > &_values)
get the minimum value of vector of values
Definition: Helpers.hh:542
T clamp(T _v, T _min, T _max)
Simple clamping function.
Definition: Helpers.hh:406
int roundUpMultiple(int _num, int _multiple)
Round a number up to the nearest multiple. For example, if the input number is 12 and the multiple is...
Definition: Helpers.hh:661
void sort3(T &_a, T &_b, T &_c)
Sort three numbers, such that _a <= _b <= _c.
Definition: Helpers.hh:612
static const int32_t MAX_I32
32bit unsigned integer maximum value
Definition: Helpers.hh:326