Stan  2.10.0
probability, sampling & optimization
Public Member Functions | List of all members
stan::json::json_data_handler Class Reference

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>

Inheritance diagram for stan::json::json_data_handler:
stan::json::json_handler

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 ()
 

Detailed Description

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 53 of file json_data_handler.hpp.

Constructor & Destructor Documentation

stan::json::json_data_handler::json_data_handler ( vars_map_r &  vars_r,
vars_map_i &  vars_i 
)
inline

Construct a json_data_handler object.

Warning: This method does not close the input stream.

Parameters
vars_r- name-value map for real-valued variables
vars_i- name-value map for int-valued variables

Definition at line 101 of file json_data_handler.hpp.

Member Function Documentation

void stan::json::json_data_handler::boolean ( bool  p)
inlinevirtual

Handle the boolean literal value of the specified polarity.

Parameters
ppolarity of boolean

Reimplemented from stan::json::json_handler.

Definition at line 179 of file json_data_handler.hpp.

size_t stan::json::json_data_handler::convert_offset_rtl_2_ltr ( size_t  rtl_offset,
const std::vector< size_t > &  dims 
)
inline

Definition at line 315 of file json_data_handler.hpp.

void stan::json::json_data_handler::end_array ( )
inlinevirtual

Handle the end of an array.

Reimplemented from stan::json::json_handler.

Definition at line 139 of file json_data_handler.hpp.

void stan::json::json_data_handler::end_object ( )
inlinevirtual

Handle the end of an object.

Reimplemented from stan::json::json_handler.

Definition at line 168 of file json_data_handler.hpp.

void stan::json::json_data_handler::end_text ( )
inlinevirtual

Handle the the end of the text.

Reimplemented from stan::json::json_handler.

Definition at line 114 of file json_data_handler.hpp.

void stan::json::json_data_handler::incr_dim_size ( )
inline

Definition at line 286 of file json_data_handler.hpp.

void stan::json::json_data_handler::key ( const std::string &  s)
inlinevirtual

Handle the specified object key.

Parameters
sString object key to handle.

Reimplemented from stan::json::json_handler.

Definition at line 208 of file json_data_handler.hpp.

void stan::json::json_data_handler::null ( )
inlinevirtual

Handle the null literal value.

Reimplemented from stan::json::json_handler.

Definition at line 173 of file json_data_handler.hpp.

void stan::json::json_data_handler::number_double ( double  x)
inlinevirtual

Handle a the specified double-precision floating point value.

Parameters
xValue to handle.

Reimplemented from stan::json::json_handler.

Definition at line 214 of file json_data_handler.hpp.

void stan::json::json_data_handler::number_long ( long  n)
inlinevirtual

Handle a the specified long integer value.

Parameters
nValue to handle.

Reimplemented from stan::json::json_handler.

Definition at line 227 of file json_data_handler.hpp.

void stan::json::json_data_handler::number_unsigned_long ( unsigned long  n)
inlinevirtual

Handle a the specified unsigned long integer value.

Parameters
nValue to handle.

Reimplemented from stan::json::json_handler.

Definition at line 238 of file json_data_handler.hpp.

void stan::json::json_data_handler::save_current_key_value_pair ( )
inline

Definition at line 248 of file json_data_handler.hpp.

void stan::json::json_data_handler::set_last_dim ( )
inline

Definition at line 305 of file json_data_handler.hpp.

void stan::json::json_data_handler::start_array ( )
inlinevirtual

Handle the start of an array.

Reimplemented from stan::json::json_handler.

Definition at line 118 of file json_data_handler.hpp.

void stan::json::json_data_handler::start_object ( )
inlinevirtual

Handle the start of an object.

Reimplemented from stan::json::json_handler.

Definition at line 159 of file json_data_handler.hpp.

void stan::json::json_data_handler::start_text ( )
inlinevirtual

Handle the the start of the text.

Reimplemented from stan::json::json_handler.

Definition at line 108 of file json_data_handler.hpp.

void stan::json::json_data_handler::string ( const std::string &  s)
inlinevirtual

Handle the specified string value.

Parameters
sString value to handle.

Reimplemented from stan::json::json_handler.

Definition at line 186 of file json_data_handler.hpp.

template<typename T >
void stan::json::json_data_handler::to_column_major ( std::vector< T > &  cm_vals,
const std::vector< T > &  rm_vals,
const std::vector< size_t > &  dims 
)
inline

Definition at line 296 of file json_data_handler.hpp.


The documentation for this class was generated from the following file:

     [ Stan Home Page ] © 2011–2016, Stan Development Team.