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

Method prepare

src/ml/dyn_lib_classifier.cpp:5–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3
4
5int DynLibClassifier::prepare ()
6{
7 if (dll_loader != NULL)
8 {
9 return (int)BrainFlowExitCodes::ANOTHER_CLASSIFIER_IS_PREPARED_ERROR;
10 }
11 if (get_dyn_lib_path ().empty ())
12 {
13 safe_logger (spdlog::level::err, "dyn lib path is not provided.");
14 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
15 }
16 dll_loader = new DLLLoader (get_dyn_lib_path ().c_str ());
17 if (!dll_loader->load_library ())
18 {
19 safe_logger (spdlog::level::err, "Failed to load library");
20 delete dll_loader;
21 dll_loader = NULL;
22 return (int)BrainFlowExitCodes::GENERAL_ERROR;
23 }
24 int (*func) (void *, struct BrainFlowModelParams *) =
25 (int (*) (void *, struct BrainFlowModelParams *))dll_loader->get_address ("prepare");
26 if (func == NULL)
27 {
28 safe_logger (spdlog::level::err, "failed to get function address for prepare");
29 delete dll_loader;
30 dll_loader = NULL;
31 return (int)BrainFlowExitCodes::GENERAL_ERROR;
32 }
33 return func ((void *)this, &params);
34}
35
36int DynLibClassifier::predict (double *data, int data_len, double *output, int *output_len)
37{

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.80
load_libraryMethod · 0.80
get_addressMethod · 0.45

Tested by

no test coverage detected