MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / parse_args

Function parse_args

cpp_package/examples/ml/src/eeg_metrics_ci.cpp:88–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88bool parse_args (int argc, char *argv[], struct BrainFlowInputParams *params, int *board_id,
89 struct BrainFlowModelParams *model_params)
90{
91 bool board_id_found = false;
92 bool classifier_found = false;
93 bool metric_found = false;
94 for (int i = 1; i < argc; i++)
95 {
96 if (std::string (argv[i]) == std::string ("--board-id"))
97 {
98 if (i + 1 < argc)
99 {
100 i++;
101 board_id_found = true;
102 *board_id = std::stoi (std::string (argv[i]));
103 }
104 else
105 {
106 std::cerr << "missed argument" << std::endl;
107 return false;
108 }
109 }
110 if (std::string (argv[i]) == std::string ("--classifier"))
111 {
112 if (i + 1 < argc)
113 {
114 i++;
115 classifier_found = true;
116 model_params->classifier = std::stoi (std::string (argv[i]));
117 }
118 else
119 {
120 std::cerr << "missed argument" << std::endl;
121 return false;
122 }
123 }
124 if (std::string (argv[i]) == std::string ("--metric"))
125 {
126 if (i + 1 < argc)
127 {
128 i++;
129 metric_found = true;
130 model_params->metric = std::stoi (std::string (argv[i]));
131 }
132 else
133 {
134 std::cerr << "missed argument" << std::endl;
135 return false;
136 }
137 }
138 if (std::string (argv[i]) == std::string ("--model-file"))
139 {
140 if (i + 1 < argc)
141 {
142 i++;
143 model_params->file = std::string (argv[i]);
144 }
145 else

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected