Kinematics Animation Multithread
utils.cpp
Go to the documentation of this file.
1#include "../include/utils.h"
2
9std::vector<int> Utils::analog_str_buf_to_int_vec(const std::string& str)
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}
27
34std::vector<double> Utils::analog_str_buf_to_double_vec(const std::string& str)
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}
static std::vector< double > analog_str_buf_to_double_vec(const std::string &str)
Convert comma-delimited string to double vector of analog values.
Definition: utils.cpp:34
static std::vector< int > analog_str_buf_to_int_vec(const std::string &str)
Convert comma-delimited string to int vector of analog values.
Definition: utils.cpp:9