Mercurial > libanimone
comparison include/animone/strategies.h @ 31:668f4f31ddda
strategist: outward APIs are now in C
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 10 Feb 2025 00:07:21 -0500 |
| parents | 27b988a1048c |
| children |
comparison
equal
deleted
inserted
replaced
| 30:a76e55e098d1 | 31:668f4f31ddda |
|---|---|
| 1 #ifndef ANIMONE_ANIMONE_STRATEGIES_H_ | 1 #ifndef ANIMONE_ANIMONE_STRATEGIES_H_ |
| 2 #define ANIMONE_ANIMONE_STRATEGIES_H_ | 2 #define ANIMONE_ANIMONE_STRATEGIES_H_ |
| 3 | 3 |
| 4 #include "animone.h" | 4 #include "animone.h" |
| 5 | |
| 6 #ifdef __cplusplus | |
| 7 extern "C" { | |
| 8 #endif | |
| 9 | |
| 10 int animone_internal_ApplyStrategies(animone::Result *results, size_t results_size); | |
| 11 | |
| 12 #ifdef __cplusplus | |
| 13 } | |
| 14 | |
| 15 #include <cstdlib> | |
| 5 #include <vector> | 16 #include <vector> |
| 6 | 17 |
| 7 namespace animone::internal { | 18 namespace animone::internal { |
| 8 | 19 |
| 9 bool ApplyStrategies(std::vector<Result>& results); | 20 inline bool ApplyStrategies(std::vector<Result>& results) |
| 21 { | |
| 22 Result *results_c; | |
| 23 size_t results_size_c; | |
| 24 | |
| 25 int x = ::animone_internal_ApplyStrategies(results_c, results_size_c); | |
| 26 | |
| 27 results.assign(results_c, results_c + results_size_c); | |
| 28 | |
| 29 std::free(results_c); | |
| 30 | |
| 31 return x; | |
| 32 } | |
| 10 | 33 |
| 11 } | 34 } |
| 12 | 35 |
| 36 #endif // defined(__cplusplus) | |
| 37 | |
| 13 #endif // ANIMONE_ANIMONE_STRATEGIES_H_ | 38 #endif // ANIMONE_ANIMONE_STRATEGIES_H_ |
