Class Utils.
More...
#include <utils.h>
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.
◆ Utils()
◆ 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
-
| str | The comma-delimited string. |
- Returns
- std::vector<int> The output vector of doubles.
Definition at line 34 of file utils.cpp.
35{
36
37 std::vector<double> data_vec;
38
39
40 std::stringstream ss(str);
41
42
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}
◆ 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
-
| str | The comma-delimited string. |
- Returns
- std::vector<int> The output vector of integers.
Definition at line 9 of file utils.cpp.
10{
11
12 std::vector<int> data_vec;
13
14
15 std::stringstream ss(str);
16
17
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)); }
The documentation for this class was generated from the following files: