Kinematics Animation Multithread
Classes | Public Member Functions | Static Public Member Functions | List of all members
Utils Class Reference

Class Utils. More...

#include <utils.h>

Classes

struct  Range
 Range stucture (templated) More...
 

Public Member Functions

 Utils ()
 Constructor. More...
 

Static Public Member Functions

static double deg2rad (double deg)
 Convert degrees to rad. More...
 
static std::vector< int > analog_str_buf_to_int_vec (const std::string &str)
 Convert comma-delimited string to int vector of analog values. More...
 
static std::vector< double > analog_str_buf_to_double_vec (const std::string &str)
 Convert comma-delimited string to double vector of analog values. More...
 

Detailed Description

Class Utils.

This class includes some generic function that are used in various places inside the project.

Definition at line 14 of file utils.h.

Constructor & Destructor Documentation

◆ Utils()

Utils::Utils ( )

Constructor.

Member Function Documentation

◆ analog_str_buf_to_double_vec()

std::vector< double > Utils::analog_str_buf_to_double_vec ( const std::string &  str)
static

Convert comma-delimited string to double vector of analog values.

Return a vector of doubles from a comma-delimited string.

Parameters
strThe comma-delimited string.
Returns
std::vector<int> The output vector of doubles.

Definition at line 34 of file utils.cpp.

35{
36 // Initialize data vector
37 std::vector<double> data_vec;
38
39 // Initialize string stream
40 std::stringstream ss(str);
41
42 // Get data and convert to analog
43 while (ss.good())
44 {
45 std::string substr;
46 std::getline(ss, substr, ',');
47 data_vec.push_back(std::stod(substr));
48 }
49
50 return data_vec;
51}
Here is the caller graph for this function:

◆ analog_str_buf_to_int_vec()

std::vector< int > Utils::analog_str_buf_to_int_vec ( const std::string &  str)
static

Convert comma-delimited string to int vector of analog values.

Return a vector of integers from a comma-delimited string. (could have been templated if you can template stoi and stod).

Parameters
strThe comma-delimited string.
Returns
std::vector<int> The output vector of integers.

Definition at line 9 of file utils.cpp.

10{
11 // Initialize data vector
12 std::vector<int> data_vec;
13
14 // Initialize string stream
15 std::stringstream ss(str);
16
17 // Get data and convert to analog
18 while (ss.good())
19 {
20 std::string substr;
21 std::getline(ss, substr, ',');
22 data_vec.push_back(std::stoi(substr));
23 }
24
25 return data_vec;
26}

◆ deg2rad()

static double Utils::deg2rad ( double  deg)
inlinestatic

Convert degrees to rad.

Definition at line 28 of file utils.h.

28{ return (deg * (M_PI / 180.0)); }
Here is the caller graph for this function:

The documentation for this class was generated from the following files: