nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
diagnostics.hpp
Go to the documentation of this file.
1
3
// toolboxes/builtin/include/nk/builtin/programming/errors/diagnostics.hpp
4
#pragma once
5
6
#include <memory_resource>
7
#include <nk/value/span.hpp>
8
#include <nk/value/value.hpp>
9
10
namespace
nk {
11
class
Engine
;
12
}
13
14
namespace
nk::runtime {
15
18
19
void
registerDiagnosticsRuntime(Engine &engine);
20
21
// ── error() ───────────────────────────────────────────────────
22
36
[[noreturn]]
void
error
(
Span<const Value>
args);
37
46
void
warning
(
Engine
&engine,
Span<const Value>
args);
// lint: engine-io
47
49
struct
LastWarn
{
50
std::string
msg
;
51
std::string
id
;
52
};
53
61
LastWarn
lastwarnGet
();
62
71
void
lastwarnSet
(
const
std::string &msg,
const
std::string &
id
);
72
82
Value
mexception
(
Span<const Value>
args, std::pmr::memory_resource *mr =
nullptr
);
83
84
// ── rethrow(ME) / throw(ME) ──────────────────────────────────────────
85
93
[[noreturn]]
void
rethrowStruct
(
const
Value
&me);
94
108
void
assertCond
(
Span<const Value>
args);
109
110
112
}
// namespace nk::runtime
nk::Engine
Definition
engine.hpp:32
nk::Span
Definition
span.hpp:11
nk::Value
Core MATLAB-compatible multidimensional array and scalar value type.
Definition
value.hpp:61
nk::runtime::rethrowStruct
void rethrowStruct(const Value &me)
Rethrow from an MException struct (rethrow(me) / throw(me)).
nk::runtime::error
void error(Span< const Value > args)
Throw an Error (error(...)).
nk::runtime::lastwarnSet
void lastwarnSet(const std::string &msg, const std::string &id)
Overwrite the most-recent warning state.
nk::runtime::assertCond
void assertCond(Span< const Value > args)
Throw on a false condition (assert(...)).
nk::runtime::mexception
Value mexception(Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
Build an MException-like struct (me = MException(id, msg, args...)).
nk::runtime::warning
void warning(Engine &engine, Span< const Value > args)
Engine-stateful warning (warning(...)).
nk::runtime::lastwarnGet
LastWarn lastwarnGet()
Read most-recent warning state ([msg, id] = lastwarn()).
nk::runtime::LastWarn
Snapshot of the most-recent warning.
Definition
diagnostics.hpp:49
nk::runtime::LastWarn::id
std::string id
Last warning's identifier ("" if unset).
Definition
diagnostics.hpp:51
nk::runtime::LastWarn::msg
std::string msg
Last warning's formatted message.
Definition
diagnostics.hpp:50
src
runtime
include
nk
runtime
diagnostics.hpp
Generated by
1.17.0