| 63 | OSVR_UTIL_MULTILINE_END |
| 64 | |
| 65 | OSVR_ReturnCode osvrClientGetDisplay(OSVR_ClientContext ctx, |
| 66 | OSVR_DisplayConfig *disp) { |
| 67 | OSVR_VALIDATE_OUTPUT_PTR(disp, "display config"); |
| 68 | if (ctx == nullptr) { |
| 69 | OSVR_DEV_VERBOSE("Passed a null client context!"); |
| 70 | *disp = nullptr; |
| 71 | return OSVR_RETURN_FAILURE; |
| 72 | } |
| 73 | std::shared_ptr<OSVR_DisplayConfigObject> config; |
| 74 | try { |
| 75 | config = std::make_shared<OSVR_DisplayConfigObject>(ctx); |
| 76 | } catch (std::exception &e) { |
| 77 | OSVR_DEV_VERBOSE( |
| 78 | "Error creating display config: constructor threw exception :" |
| 79 | << e.what()); |
| 80 | return OSVR_RETURN_FAILURE; |
| 81 | } |
| 82 | if (!config) { |
| 83 | OSVR_DEV_VERBOSE( |
| 84 | "Error creating display config - null config returned"); |
| 85 | return OSVR_RETURN_FAILURE; |
| 86 | } |
| 87 | if (!config->cfg) { |
| 88 | OSVR_DEV_VERBOSE("Error creating display config - null internal config " |
| 89 | "object returned"); |
| 90 | return OSVR_RETURN_FAILURE; |
| 91 | } |
| 92 | ctx->acquireObject(config); |
| 93 | *disp = config.get(); |
| 94 | return OSVR_RETURN_SUCCESS; |
| 95 | } |
| 96 | |
| 97 | #define OSVR_VALIDATE_DISPLAY_CONFIG \ |
| 98 | OSVR_UTIL_MULTILINE_BEGIN \ |
no test coverage detected