5#ifndef LINE_REG_API_DISPATCH_DETAIL_H
6#define LINE_REG_API_DISPATCH_DETAIL_H
60 if (s.
digits <= 50)
return Op::template run<Real50>(a);
61 if (s.
digits <= 100)
return Op::template run<Real100>(a);
62 return Op::template run<Real200>(a);
64 throw InputError(
"unreachable arithmetic selection");
83 return Op::template
run<T>(a);
87 "this function evaluates transcendental terms (exp, log, sqrt or a "
88 "matrix exponential), which the exact rational field does not contain; "
89 "rerun with --arith double or --arith real:<digits>.");
105 if constexpr (std::is_same<T, double>::value) {
110 "this function is implemented in double precision only; rerun with "
125inline std::uint64_t
required_seed(
Args& a,
const std::string& fn,
const char* spelled =
"seed") {
127 throw InputError(fn +
": " + spelled +
" is required; the port draws from a seeded "
128 "generator and has no session RNG to fall back on");
129 return static_cast<std::uint64_t
>(a.
count(
"seed"));
139 Json out = Json::object();
153 if (with_nmax && a.
has(
"nmax")) o.
nmax =
static_cast<long>(a.
count(
"nmax"));
164#define LINE_API_GROUP(g) \
165 void register_api_##g(DispatchTable& t); \
166 void register_library_only_##g(LibraryOnlyTable& t);
Direct invocation of a single API function from named JSON arguments.
#define LINE_API_GROUP(g)
The one conversion policy between JSON and the templated API layer.
UnsupportedError(const std::string &what)
Named-argument reader over the parsed JSON object.
std::size_t count(const char *key)
A required nonnegative count.
bool has(const char *key) const
std::vector< T > vector(const char *key)
Required vector argument; absent is an error, not an empty vector.
const std::vector< void(*)(LibraryOnlyTable &)> & api_library_only_registrars()
void register_library_only_trace(LibraryOnlyTable &t)
std::uint64_t required_seed(Args &a, const std::string &fn, const char *spelled="seed")
The seed of a function whose port draws from a caller-owned generator.
void register_library_only_mam(LibraryOnlyTable &t)
void register_library_only_misc(LibraryOnlyTable &t)
void register_api_qsys(DispatchTable &t)
Json run_at(const ArithSpec &s, Args &a)
Run an operation at the selected arithmetic.
void register_api_mam(DispatchTable &t)
void register_library_only_pfqn_a(LibraryOnlyTable &t)
void register_library_only_mc(LibraryOnlyTable &t)
qsys::QsysResOptions read_qsys_res_options(Args &a, bool with_nmax=true)
The 'tPoints', 'percentiles' and 'nmax' options those functions share.
Json encode_vector(const std::vector< T > &v)
void register_api_mc(DispatchTable &t)
void register_api_trace(DispatchTable &t)
void register_library_only_pfqn_b(LibraryOnlyTable &t)
void register_library_only_qsys(LibraryOnlyTable &t)
Json encode_scalar(const T &v)
std::function< Json(const ArithSpec &, Args &)> Invoker
void register_api_misc(DispatchTable &t)
void register_api_pfqn_b(DispatchTable &t)
std::map< std::string, std::string > LibraryOnlyTable
name -> why the function has no named-JSON-argument form.
Json encode_qsys_res(const qsys::QsysResT< T > &r)
MATLAB's res struct of the exact queueing-system functions: one key per measure, in the reference's f...
std::map< std::string, Invoker > DispatchTable
const std::vector< void(*)(DispatchTable &)> & api_dispatch_registrars()
void register_api_pfqn_a(DispatchTable &t)
Conservation laws of a layered queueing network, enumerated from its structure.
The res struct the exact queueing-system functions return, and the numeric helpers those functions sh...
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
One measure of a res struct: a scalar or a row vector.
The name-value options shared by the exact functions: tPoints, percentiles and nmax (a negative nmax ...
std::vector< double > percentiles
std::vector< double > tPoints
MATLAB's res struct: named measures in insertion order, plus res.analyzer.
std::vector< QsysResFieldT< T > > fields
The arithmetic a call runs at: Real also carries the precision tier.
unsigned digits
significant decimal digits, Real only
Wrap an Op whose registry entry lists Double ONLY.
Wrap an Op whose registry entry lists Double and Real but NOT Exact.