1
1
#include < fstream>
2
2
#include < set>
3
- #include < sstream>
4
3
#include < string.h>
5
4
#include < string>
6
5
#include < vector>
10
9
#include " brainflow_boards.h"
11
10
#include " brainflow_constants.h"
12
11
13
- inline std::string int_to_string ( int val);
14
- inline int get_single_value (
12
+
13
+ static int get_single_value (
15
14
int board_id, const char *param_name, int *value, bool use_logger = true );
16
- inline int get_string_value (
15
+ static int get_string_value (
17
16
int board_id, const char *param_name, char *string, int *len, bool use_logger = true );
18
- inline int get_array_value (
17
+ static int get_array_value (
19
18
int board_id, const char *param_name, int *output_array, int *len, bool use_logger = true );
20
19
21
20
22
21
int get_board_descr (int board_id, char *board_descr, int *len)
23
22
{
24
23
try
25
24
{
26
- std::string res = brainflow_boards_json[" boards" ][int_to_string (board_id)].dump ();
25
+ std::string res = brainflow_boards_json[" boards" ][std::to_string (board_id)].dump ();
27
26
strcpy (board_descr, res.c_str ());
28
27
*len = (int )strlen (res.c_str ());
29
28
return (int )BrainFlowExitCodes::STATUS_OK;
@@ -166,18 +165,11 @@ int get_exg_channels (int board_id, int *exg_channels, int *len)
166
165
return (int )BrainFlowExitCodes::STATUS_OK;
167
166
}
168
167
169
- inline std::string int_to_string (int val)
170
- {
171
- std::ostringstream ss;
172
- ss << val;
173
- return ss.str ();
174
- }
175
-
176
- inline int get_single_value (int board_id, const char *param_name, int *value, bool use_logger)
168
+ static int get_single_value (int board_id, const char *param_name, int *value, bool use_logger)
177
169
{
178
170
try
179
171
{
180
- int val = (int )brainflow_boards_json[" boards" ][int_to_string (board_id)][param_name];
172
+ int val = (int )brainflow_boards_json[" boards" ][std::to_string (board_id)][param_name];
181
173
*value = val;
182
174
return (int )BrainFlowExitCodes::STATUS_OK;
183
175
}
@@ -191,13 +183,13 @@ inline int get_single_value (int board_id, const char *param_name, int *value, b
191
183
}
192
184
}
193
185
194
- inline int get_array_value (
186
+ static int get_array_value (
195
187
int board_id, const char *param_name, int *output_array, int *len, bool use_logger)
196
188
{
197
189
try
198
190
{
199
191
std::vector<int > values =
200
- brainflow_boards_json[" boards" ][int_to_string (board_id)][param_name];
192
+ brainflow_boards_json[" boards" ][std::to_string (board_id)][param_name];
201
193
if (!values.empty ())
202
194
{
203
195
memcpy (output_array, &values[0 ], sizeof (int ) * values.size ());
@@ -215,12 +207,12 @@ inline int get_array_value (
215
207
}
216
208
}
217
209
218
- inline int get_string_value (
210
+ static int get_string_value (
219
211
int board_id, const char *param_name, char *string, int *len, bool use_logger)
220
212
{
221
213
try
222
214
{
223
- std::string val = brainflow_boards_json[" boards" ][int_to_string (board_id)][param_name];
215
+ std::string val = brainflow_boards_json[" boards" ][std::to_string (board_id)][param_name];
224
216
strcpy (string, val.c_str ());
225
217
*len = (int )strlen (val.c_str ());
226
218
return (int )BrainFlowExitCodes::STATUS_OK;
0 commit comments