#include <gpr/ml/RgminObjective.h>
|
| bool | failed () const noexcept |
| rgmin_status_t | capture (const char *callback) noexcept |
| void | report () const noexcept |
template<std::invocable Callback>
requires std::same_as<std::invoke_result_t<Callback>, rgmin_status_t> |
| rgmin_status_t | invoke (const char *name, Callback &&callback) noexcept |
Captures the first callback exception without unwinding through the C ABI. A failed context rejects every subsequent callback in the same fit.
Definition at line 41 of file RgminObjective.h.
◆ capture()
| rgmin_status_t funcmin::RgminCallbackFailure::capture |
( |
const char * | callback | ) |
|
|
noexcept |
Definition at line 15 of file RgminObjective.cpp.
17{
18 if (!error_) {
19 error_ = std::current_exception();
20 callback_ = callback;
21 }
22 return RGMIN_INTERNAL_ERROR;
23}
◆ failed()
| bool funcmin::RgminCallbackFailure::failed |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ invoke()
template<std::invocable Callback>
requires std::same_as<std::invoke_result_t<Callback>, rgmin_status_t>
| rgmin_status_t funcmin::RgminCallbackFailure::invoke |
( |
const char * | name, |
|
|
Callback && | callback ) |
|
inlinenoexcept |
Definition at line 52 of file RgminObjective.h.
53 {
54 if (
failed())
return RGMIN_INTERNAL_ERROR;
55 try {
56 return std::invoke(std::forward<Callback>(callback));
57 } catch (...) {
59 }
60 }
rgmin_status_t capture(const char *callback) noexcept
bool failed() const noexcept
◆ report()
| void funcmin::RgminCallbackFailure::report |
( |
| ) |
const |
|
noexcept |
Definition at line 25 of file RgminObjective.cpp.
26{
27 if (!error_) return;
28 try {
29 std::rethrow_exception(error_);
30 } catch (const std::exception& error) {
31 std::fprintf(stderr, "rgmin %s callback failed: %s\n", callback_,
32 error.what());
33 } catch (...) {
34 std::fprintf(stderr,
35 "rgmin %s callback failed: non-standard exception\n",
36 callback_);
37 }
38}
The documentation for this class was generated from the following files: