| 3 | |
| 4 | |
| 5 | int 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, ¶ms); |
| 34 | } |
| 35 | |
| 36 | int DynLibClassifier::predict (double *data, int data_len, double *output, int *output_len) |
| 37 | { |
nothing calls this directly
no test coverage detected