![]() |
Stan
2.5.0
probability, sampling & optimization
|
A json_data_handler is an implementation of a json_handler that restricts the allowed JSON text a set of Stan variable declarations in JSON format.
More...
#include <json_data_handler.hpp>
Public Member Functions | |
| json_data_handler (vars_map_r &vars_r, vars_map_i &vars_i) | |
| Construct a json_data_handler object. More... | |
| void | start_text () |
| Handle the the start of the text. More... | |
| void | end_text () |
| Handle the the end of the text. More... | |
| void | start_array () |
| Handle the start of an array. More... | |
| void | end_array () |
| Handle the end of an array. More... | |
| void | start_object () |
| Handle the start of an object. More... | |
| void | end_object () |
| Handle the end of an object. More... | |
| void | null () |
| Handle the null literal value. More... | |
| void | boolean (bool p) |
| Handle the boolean literal value of the specified polarity. More... | |
| void | string (const std::string &s) |
| Handle the specified string value. More... | |
| void | key (const std::string &key) |
| Handle the specified object key. More... | |
| void | number_double (double x) |
| Handle a the specified double-precision floating point value. More... | |
| void | number_long (long n) |
| Handle a the specified long integer value. More... | |
| void | number_unsigned_long (unsigned long n) |
| Handle a the specified unsigned long integer value. More... | |
| void | save_current_key_value_pair () |
| void | incr_dim_size () |
| template<typename T > | |
| void | to_column_major (std::vector< T > &cm_vals, const std::vector< T > &rm_vals, const std::vector< size_t > &dims) |
| void | set_last_dim () |
| size_t | convert_offset_rtl_2_ltr (size_t rtl_offset, const std::vector< size_t > &dims) |
Public Member Functions inherited from stan::json::json_handler | |
| json_handler () | |
| ~json_handler () | |
A json_data_handler is an implementation of a json_handler that restricts the allowed JSON text a set of Stan variable declarations in JSON format.
Each Stan variable consists of a JSON key : value pair. The key is a string and the value is either a single numeric scalar value or a JSON array of numeric values.
The json_data_handler checks that the top-level JSON object contains a set of name-value pairs where the values can be either numeric scalar objects or or numeric arrays of any dimensionality. Arrays must be rectangular. Empty arrays are not allowed, nor are arrays of empty arrays. The strings "inf" and "-inf" are mapped to positive and negative infinity, respectively.
Definition at line 54 of file json_data_handler.hpp.
|
inline |
Construct a json_data_handler object.
Warning: This method does not close the input stream.
| vars_r | - name-value map for real-valued variables |
| vars_i | - name-value map for int-valued variables |
Definition at line 102 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the boolean literal value of the specified polarity.
| p | polarity of boolean |
Reimplemented from stan::json::json_handler.
Definition at line 177 of file json_data_handler.hpp.
|
inline |
Definition at line 306 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the end of an array.
Reimplemented from stan::json::json_handler.
Definition at line 139 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the end of an object.
Reimplemented from stan::json::json_handler.
Definition at line 166 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the the end of the text.
Reimplemented from stan::json::json_handler.
Definition at line 115 of file json_data_handler.hpp.
|
inline |
Definition at line 279 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the specified object key.
| s | String object key to handle. |
Reimplemented from stan::json::json_handler.
Definition at line 203 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the null literal value.
Reimplemented from stan::json::json_handler.
Definition at line 171 of file json_data_handler.hpp.
|
inlinevirtual |
Handle a the specified double-precision floating point value.
| x | Value to handle. |
Reimplemented from stan::json::json_handler.
Definition at line 209 of file json_data_handler.hpp.
|
inlinevirtual |
Handle a the specified long integer value.
| n | Value to handle. |
Reimplemented from stan::json::json_handler.
Definition at line 221 of file json_data_handler.hpp.
|
inlinevirtual |
Handle a the specified unsigned long integer value.
| n | Value to handle. |
Reimplemented from stan::json::json_handler.
Definition at line 231 of file json_data_handler.hpp.
|
inline |
Definition at line 241 of file json_data_handler.hpp.
|
inline |
Definition at line 296 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the start of an array.
Reimplemented from stan::json::json_handler.
Definition at line 119 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the start of an object.
Reimplemented from stan::json::json_handler.
Definition at line 158 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the the start of the text.
Reimplemented from stan::json::json_handler.
Definition at line 109 of file json_data_handler.hpp.
|
inlinevirtual |
Handle the specified string value.
| s | String value to handle. |
Reimplemented from stan::json::json_handler.
Definition at line 183 of file json_data_handler.hpp.
|
inline |
Definition at line 289 of file json_data_handler.hpp.