![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Named-argument reader over the parsed JSON object. More...
#include <line/reg/api_json.h>
Public Member Functions | |
| Args (const Json &j, std::string function) | |
| bool | has (const char *key) const |
| const Json & | get (const char *key) |
| Required argument; throws when absent. | |
| const Json * | opt (const char *key) |
| Optional argument; returns nullptr when absent. | |
| template<class T> | |
| Matrix< T > | matrix (const char *key) |
| template<class T> | |
| Matrix< T > | matrix_or_empty (const char *key) |
| template<class T> | |
| std::vector< T > | vector_or_empty (const char *key) |
| template<class T> | |
| std::vector< T > | vector (const char *key) |
| Required vector argument; absent is an error, not an empty vector. | |
| template<class T> | |
| std::vector< Matrix< T > > | matrices (const char *key) |
| Required list of matrices, e.g. | |
| template<class T> | |
| std::vector< Matrix< T > > | matrices_or_empty (const char *key) |
| template<class T> | |
| T | number (const char *key) |
| Required numeric argument, at the arithmetic of the call. | |
| std::size_t | count (const char *key) |
| A required nonnegative count. | |
| std::size_t | count (const char *key, std::size_t fallback) |
| unsigned | uinteger (const char *key) |
| The same as count(), for the arguments the port declares unsigned. | |
| unsigned | uinteger (const char *key, unsigned fallback) |
| int | required_integer (const char *key) |
| bool | boolean (const char *key, bool fallback) |
| A flag. | |
| std::string | text (const char *key, const std::string &fallback) |
| A string-valued option, e.g. | |
| std::vector< int > | ints (const char *key) |
| std::vector< int > | ints_or_empty (const char *key) |
| int | integer (const char *key, int fallback) |
| template<class T> | |
| T | scalar (const char *key, const T &fallback) |
| void | unsupported (const char *key, const std::string &why) |
| Refuse an argument the JSON boundary cannot carry, naming it, rather than proceeding as if it had not been given. | |
| void | done () const |
Named-argument reader over the parsed JSON object.
Every read marks the key; done() then refuses any key the function did not ask for, naming it and listing what the function does accept. Silently ignoring an unknown key is how a caller ends up with the default value of the argument they thought they were setting.
Definition at line 391 of file api_json.h.
|
inline |
Definition at line 393 of file api_json.h.
|
inline |
A flag.
Accepts a JSON boolean or the integers 0 and 1, nothing else.
Definition at line 505 of file api_json.h.
References line::InputError::InputError(), line::reg::int_vector_from_json(), and opt().
|
inline |
A required nonnegative count.
Refuses a negative value naming the argument rather than wrapping it around into a huge unsigned.
Definition at line 475 of file api_json.h.
References line::InputError::InputError(), and required_integer().
Referenced by count(), uinteger(), and uinteger().
|
inline |
Definition at line 483 of file api_json.h.
|
inline |
Definition at line 561 of file api_json.h.
References line::InputError::InputError().
|
inline |
Required argument; throws when absent.
Definition at line 403 of file api_json.h.
References line::InputError::InputError().
Referenced by ints(), matrices(), matrix(), number(), required_integer(), and vector().
|
inline |
Definition at line 400 of file api_json.h.
Referenced by count(), and matrices_or_empty().
|
inline |
Definition at line 534 of file api_json.h.
References line::InputError::InputError(), line::reg::int_vector_from_json(), and opt().
|
inline |
Definition at line 525 of file api_json.h.
References get(), and line::reg::int_vector_from_json().
|
inline |
Definition at line 529 of file api_json.h.
References line::reg::int_vector_from_json(), and opt().
|
inline |
Required list of matrices, e.g.
the per-class D1c of an MMAP. A single matrix is NOT silently promoted to a one-element list: the two shapes mean different models and the caller must say which one it meant.
Definition at line 446 of file api_json.h.
References get(), line::InputError::InputError(), and line::reg::matrix_from_json().
Referenced by matrices_or_empty().
|
inline |
Definition at line 459 of file api_json.h.
References has(), and matrices().
|
inline |
Definition at line 418 of file api_json.h.
References get(), and line::reg::matrix_from_json().
|
inline |
Definition at line 423 of file api_json.h.
References line::Matrix< T >::Matrix(), line::reg::matrix_from_json(), and opt().
|
inline |
Required numeric argument, at the arithmetic of the call.
Definition at line 467 of file api_json.h.
References get(), and line::reg::number_from_json().
|
inline |
Optional argument; returns nullptr when absent.
Definition at line 411 of file api_json.h.
Referenced by boolean(), integer(), ints_or_empty(), matrix_or_empty(), scalar(), text(), and vector_or_empty().
|
inline |
Definition at line 498 of file api_json.h.
References get(), line::InputError::InputError(), and line::reg::int_vector_from_json().
Referenced by count().
|
inline |
Definition at line 544 of file api_json.h.
References line::reg::number_from_json(), and opt().
|
inline |
A string-valued option, e.g.
a method or convention name.
Definition at line 516 of file api_json.h.
References line::InputError::InputError(), and opt().
|
inline |
The same as count(), for the arguments the port declares unsigned.
Definition at line 492 of file api_json.h.
References count().
|
inline |
Definition at line 494 of file api_json.h.
References count().
|
inline |
Refuse an argument the JSON boundary cannot carry, naming it, rather than proceeding as if it had not been given.
Definition at line 553 of file api_json.h.
References line::UnsupportedError::UnsupportedError().
|
inline |
Required vector argument; absent is an error, not an empty vector.
Definition at line 436 of file api_json.h.
References get(), and line::reg::vector_from_json().
|
inline |
Definition at line 429 of file api_json.h.
References opt(), and line::reg::vector_from_json().