error reporting function */
| 29 | |
| 30 | /* error reporting function */ |
| 31 | void errorHandler(void* userPtr, const RTCError code, const char* str = nullptr) |
| 32 | { |
| 33 | if (code == RTC_ERROR_NONE) |
| 34 | return; |
| 35 | |
| 36 | std::string descr = str ? ": " + std::string(str) : ""; |
| 37 | switch (code) { |
| 38 | case RTC_ERROR_UNKNOWN : throw std::runtime_error("RTC_ERROR_UNKNOWN"+descr); |
| 39 | case RTC_ERROR_INVALID_ARGUMENT : throw std::runtime_error("RTC_ERROR_INVALID_ARGUMENT"+descr); break; |
| 40 | case RTC_ERROR_INVALID_OPERATION: throw std::runtime_error("RTC_ERROR_INVALID_OPERATION"+descr); break; |
| 41 | case RTC_ERROR_OUT_OF_MEMORY : throw std::runtime_error("RTC_ERROR_OUT_OF_MEMORY"+descr); break; |
| 42 | case RTC_ERROR_UNSUPPORTED_CPU : throw std::runtime_error("RTC_ERROR_UNSUPPORTED_CPU"+descr); break; |
| 43 | case RTC_ERROR_CANCELLED : throw std::runtime_error("RTC_ERROR_CANCELLED"+descr); break; |
| 44 | default : throw std::runtime_error("invalid error code"+descr); break; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | bool hasISA(const int isa) |
| 49 | { |