OSSIA
Open Scenario System for Interactive Application
json_reader_detail.hpp
1 #pragma once
2 #include <ossia/detail/json.hpp>
4 #include <ossia/network/exceptions.hpp>
5 
6 namespace ossia::oscquery
7 {
8 inline void json_assert(bool val)
9 {
10  if(!val)
11  throw ossia::bad_request_error{"Bad request"};
12 }
13 
14 namespace detail
15 {
16 
17 struct json_parser_impl
18 {
19  static bool ReadValue(const rapidjson::Value& val, int32_t& res);
20  static bool ReadValue(const rapidjson::Value& val, float& res);
21  static bool ReadValue(const rapidjson::Value& val, double& res);
22  static bool ReadValue(const rapidjson::Value& val, std::string& res);
23  static bool ReadValue(const rapidjson::Value& val, bool& res);
24  static bool ReadValue(const rapidjson::Value& val, ossia::repetition_filter& res);
25  static bool ReadValue(const rapidjson::Value& val, ossia::bounding_mode& res);
26  static bool ReadValue(const rapidjson::Value& val, ossia::access_mode& am);
27  static bool ReadValue(
28  const ossia::net::node_base&, const rapidjson::Value& val, ossia::domain& res);
29  static bool ReadValue(const rapidjson::Value& val, ossia::unit_t& res);
30  static bool ReadValue(const rapidjson::Value& val, ossia::net::tags& res);
31  static bool ReadValue(const rapidjson::Value& val, ossia::net::instance_bounds& res);
32 
33  static ossia::value ReadValue(const rapidjson::Value& val);
34 
35  static void readObject(ossia::net::node_base& node, const rapidjson::Value& obj);
36 
37  static void readParameter(net::node_base& node, const rapidjson::Value& obj);
38 
39  static void reloadObject(ossia::net::node_base& node, const rapidjson::Value& obj);
40 };
41 }
42 
43 using val_t = rapidjson::Value;
44 }
The node_base class.
Definition: network/base/node.hpp:48
The value class.
Definition: value.hpp:173
repetition_filter
If enabled, sending twice the same value will only send it once by network.
Definition: parameter_properties.hpp:70
bounding_mode
Address behaviors at crossing domain boundaries.
Definition: parameter_properties.hpp:56
access_mode
Address behaviors at crossing domain boundaries time.
Definition: parameter_properties.hpp:46
std::vector< std::string > tags
Tags applied to a node: {"model", "interesting", ...}.
Definition: node_attributes.hpp:71
Used when a bad network request is done on a local server.
Definition: network/exceptions.hpp:72
domain A domain of values
Definition: domain_base.hpp:23
How many instances a node can have.
Definition: node_attributes.hpp:36
Definition: dataspace.hpp:24