BoosterSeat
0.1
A C++ library that includes common utilities that are used in other projects.
|
Namespaces | |
clck | |
filesystem | |
fs_int | |
Internal inline functions used only in this file. | |
geo | |
layout | |
math | |
string | |
template_tools | |
time | |
Classes | |
class | BoosterSeatException |
class | ConsecutiveValuesFilter |
A simple counting filter that allows for some noise. More... | |
class | IStopwatch |
class | ITimer |
Interface for a timer class. More... | |
class | Pressure |
class | Process |
A class to handle linux process calls. More... | |
struct | raii_char_str |
class | RollingAverage |
Moving average calculator. More... | |
class | SoftwareStopwatch |
A manually controlled stopwatch that does not use the system clock. More... | |
class | SoftwareTimer |
A software timer class for manual control. More... | |
class | Stopwatch |
A simple stopwatch class. Basic start (resume), stop (pause), and reset functionality. More... | |
class | Time |
The generic time class for BoosterSeat. Uses UTC time. More... | |
class | Timer |
A simple timer class for timing events. More... | |
Enumerations | |
enum class | ErrorNumber { UNSPECIFIED = 0 , FS_PATH_DOES_NOT_EXIST = 1 , FS_PATH_ALREADY_EXISTS = 2 , FS_PATH_NOT_REGULAR_FILE = 3 , FS_PATH_NOT_DIRECTORY = 4 , FS_FILE_NOT_VALID = 5 , FS_NO_WRITE_PERMISSIONS = 6 , FS_NO_READ_PERMISSIONS = 7 , FS_INVALID_SIZE_UNIT = 8 , TIME_INVALID_TIMEZONE = 9 , GEO_INVALID_LATITUDE = 10 , GEO_INVALID_LONGITUDE = 11 , TIME_INVALID_TIME = 12 , PROCESS_NOT_COMPLETE = 13 , PROCESS_TIMEOUT = 14 , NOT_YET_IMPLEMENTED } |
Functions | |
bool | containsPrefix (const std::string &str, const std::string &prefix) |
Checks if a string contains a prefix. More... | |
bool | containsSubstring (const std::string &str, const std::string &sub) |
Checks if a string contains a substring. More... | |
bool | containsSuffix (const std::string &str, const std::string &suffix) |
Checks if a string contains a suffix. More... | |
double | doubleToPrecisionTwo (double) |
Rounds a double to two decimal places. For example: 1.2345 -> 1.23. More... | |
uint32_t | getUnixTime () |
Get the current Unix time. More... | |
bool | isApproxEqual (double a, double b, double epsilon) |
Just a simple function to compare two doubles by a given epsilon. More... | |
bool | isApproxEqualPercent (const double a, const double b, const double percent) |
double | randomDouble (double min, double max) |
Generates a random double within the given range. More... | |
std::string | randomHexString (size_t length) |
Generates a random hex string of the given length. More... | |
std::string | rndTs (double d, int precision) |
void | sleep (int32_t milliseconds) |
Variables | |
constexpr double | D2R = PI / 180.0 |
Factor to convert degrees to radians. More... | |
constexpr double | HALF_PI = PI / 2.0 |
Half of pi. More... | |
constexpr double | K_GRAVITY = 9.80665 |
Standard gravity constant. More... | |
constexpr int | K_PIPE_READ = 0 |
constexpr int | K_PIPE_WRITE = 1 |
constexpr int | kPrecision = 6 |
constexpr double | PI = 3.14159265358979323846 |
The mathematical constant pi. More... | |
constexpr double | R2D = 180.0 / PI |
Factor to convert radians to degrees. More... | |
constexpr double | THREE_PI_HALVES = 3.0 * HALF_PI |
Three halves of pi. More... | |
constexpr double | TWO_PI = 2.0 * PI |
Two times pi. More... | |
|
strong |
Enumerator | |
---|---|
UNSPECIFIED | Default value, just for backwards compatibility. Should not be used in new code. |
FS_PATH_DOES_NOT_EXIST | Path does not exist when it should. Includes path in message. |
FS_PATH_ALREADY_EXISTS | Path already exists when it should not. Includes path in message. |
FS_PATH_NOT_REGULAR_FILE | Path is not a regular file. Includes path in message. |
FS_PATH_NOT_DIRECTORY | Path is not a directory. Includes path in message. |
FS_FILE_NOT_VALID | File is not valid. Includes if/ofstream error code in message. Format: "Stream errno:<errorno> | <path>" |
FS_NO_WRITE_PERMISSIONS | Throw if write permissions are required but do not exist. |
FS_NO_READ_PERMISSIONS | Throw if read permissions are required but do not exist. |
FS_INVALID_SIZE_UNIT | Thrown if an invalid size unit is used. |
TIME_INVALID_TIMEZONE | Thrown if an invalid time zone is used. |
GEO_INVALID_LATITUDE | Latitude is out of range/invalid. |
GEO_INVALID_LONGITUDE | Longitude is out of range/invalid. |
TIME_INVALID_TIME | Invalid time. |
PROCESS_NOT_COMPLETE | Part of bst::Process, thrown if the process is not yet complete yet a method is called that requires the process to be complete. Call waitToComplete first. |
PROCESS_TIMEOUT | Part of bst::Process, thrown if the process times out. |
NOT_YET_IMPLEMENTED | Throws if a feature is not yet implemented. |
uint32_t bst::getUnixTime | ( | ) |
Get the current Unix time.
References bst::clck::now().
double bst::doubleToPrecisionTwo | ( | double | d | ) |
Rounds a double to two decimal places. For example: 1.2345 -> 1.23.
double | The double to round. |
|
inline |
Just a simple function to compare two doubles by a given epsilon.
a | - The first double. |
b | - The second double. |
epsilon | - The maximum difference between the two doubles. |
Referenced by isApproxEqualPercent().
|
inline |
a | |
b | |
percent | - value between 0.0 and 1.0 |
References isApproxEqual().
Referenced by validateSize().
|
inline |
std::string bst::randomHexString | ( | size_t | length | ) |
double bst::randomDouble | ( | double | min, |
double | max | ||
) |
Generates a random double within the given range.
min | - The minimum value of the range. |
max | - The maximum value of the range. |
Referenced by TEST().
|
inline |
Referenced by main(), TEST(), and bst::Process::waitToComplete().
|
inline |
Checks if a string contains a substring.
str | - The string to check |
sub | - The substring to check for |
|
inline |
Checks if a string contains a prefix.
str | - The string to check |
prefix | - The prefix to check for |
|
inline |
Checks if a string contains a suffix.
str | - The string to check |
suffix | - The suffix to check for |
|
inlineconstexpr |
|
inlineconstexpr |
Referenced by bst::Process::child(), and bst::Process::run().
|
inlineconstexpr |
Referenced by bst::Process::child(), and bst::Process::run().
|
inlineconstexpr |
The mathematical constant pi.
|
inlineconstexpr |
Half of pi.
|
inlineconstexpr |
Three halves of pi.
|
inlineconstexpr |
Two times pi.
|
inlineconstexpr |
Factor to convert degrees to radians.
|
inlineconstexpr |
Factor to convert radians to degrees.
|
inlineconstexpr |
Standard gravity constant.