|
Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
|
serialization to CBOR and MessagePack values More...
#include <json.hpp>
Public Member Functions | |
| binary_writer (output_adapter_t< CharType > adapter) | |
| create a binary writer More... | |
| void | write_bson (const BasicJsonType &j) |
| void | write_cbor (const BasicJsonType &j) |
| void | write_msgpack (const BasicJsonType &j) |
| void | write_ubjson (const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true) |
Static Public Member Functions | |
| template<typename C = CharType, enable_if_t< std::is_signed< C >::value and std::is_signed< char >::value > * = nullptr> | |
| static constexpr CharType | to_char_type (std::uint8_t x) noexcept |
| template<typename C = CharType, enable_if_t< std::is_signed< C >::value and std::is_unsigned< char >::value > * = nullptr> | |
| static CharType | to_char_type (std::uint8_t x) noexcept |
| template<typename C = CharType, enable_if_t< std::is_unsigned< C >::value > * = nullptr> | |
| static constexpr CharType | to_char_type (std::uint8_t x) noexcept |
| template<typename InputCharType , typename C = CharType, enable_if_t< std::is_signed< C >::value andstd::is_signed< char >::value andstd::is_same< char, typename std::remove_cv< InputCharType >::type >::value > * = nullptr> | |
| static constexpr CharType | to_char_type (InputCharType x) noexcept |
Private Types | |
| using | string_t = typename BasicJsonType::string_t |
Private Member Functions | |
| void | write_bson_entry_header (const string_t &name, const std::uint8_t element_type) |
| Writes the given element_type and name to the output adapter. More... | |
| void | write_bson_boolean (const string_t &name, const bool value) |
| Writes a BSON element with key name and boolean value value. More... | |
| void | write_bson_double (const string_t &name, const double value) |
| Writes a BSON element with key name and double value value. More... | |
| void | write_bson_string (const string_t &name, const string_t &value) |
| Writes a BSON element with key name and string value value. More... | |
| void | write_bson_null (const string_t &name) |
| Writes a BSON element with key name and null value. More... | |
| void | write_bson_integer (const string_t &name, const std::int64_t value) |
| Writes a BSON element with key name and integer value. More... | |
| void | write_bson_unsigned (const string_t &name, const std::uint64_t value) |
| Writes a BSON element with key name and unsigned value. More... | |
| void | write_bson_object_entry (const string_t &name, const typename BasicJsonType::object_t &value) |
| Writes a BSON element with key name and object value. More... | |
| void | write_bson_array (const string_t &name, const typename BasicJsonType::array_t &value) |
| Writes a BSON element with key name and array value. More... | |
| void | write_bson_element (const string_t &name, const BasicJsonType &j) |
| Serializes the JSON value j to BSON and associates it with the key name. More... | |
| void | write_bson_object (const typename BasicJsonType::object_t &value) |
| template<typename NumberType , typename std::enable_if< std::is_floating_point< NumberType >::value, int >::type = 0> | |
| void | write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix) |
| template<typename NumberType , typename std::enable_if< std::is_unsigned< NumberType >::value, int >::type = 0> | |
| void | write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix) |
| template<typename NumberType , typename std::enable_if< std::is_signed< NumberType >::value andnot std::is_floating_point< NumberType >::value, int >::type = 0> | |
| void | write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix) |
| CharType | ubjson_prefix (const BasicJsonType &j) const noexcept |
| determine the type prefix of container values More... | |
| template<typename NumberType , bool OutputIsLittleEndian = false> | |
| void | write_number (const NumberType n) |
Static Private Member Functions | |
| static std::size_t | calc_bson_entry_header_size (const string_t &name) |
| static std::size_t | calc_bson_string_size (const string_t &value) |
| static std::size_t | calc_bson_integer_size (const std::int64_t value) |
| static constexpr std::size_t | calc_bson_unsigned_size (const std::uint64_t value) noexcept |
| static std::size_t | calc_bson_array_size (const typename BasicJsonType::array_t &value) |
| static std::size_t | calc_bson_element_size (const string_t &name, const BasicJsonType &j) |
| Calculates the size necessary to serialize the JSON value j with its name. More... | |
| static std::size_t | calc_bson_object_size (const typename BasicJsonType::object_t &value) |
| Calculates the size of the BSON serialization of the given JSON-object j. More... | |
| static constexpr CharType | get_cbor_float_prefix (float) |
| static constexpr CharType | get_cbor_float_prefix (double) |
| static constexpr CharType | get_msgpack_float_prefix (float) |
| static constexpr CharType | get_msgpack_float_prefix (double) |
| static constexpr CharType | get_ubjson_float_prefix (float) |
| static constexpr CharType | get_ubjson_float_prefix (double) |
Private Attributes | |
| const bool | is_little_endian = binary_reader<BasicJsonType>::little_endianess() |
| whether we can assume little endianess More... | |
| output_adapter_t< CharType > | oa = nullptr |
| the output More... | |
serialization to CBOR and MessagePack values
|
private |
|
inlineexplicit |
create a binary writer
| [in] | adapter | output adapter to write to |
Definition at line 8354 of file json.hpp.
|
inlinestaticprivate |
Definition at line 9185 of file json.hpp.
|
inlinestaticprivate |
Calculates the size necessary to serialize the JSON value j with its name.
Definition at line 9221 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::boolean, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
inlinestaticprivate |
Definition at line 9033 of file json.hpp.
References nlohmann::detail::out_of_range::create(), JSON_THROW, and JSON_UNLIKELY.
|
inlinestaticprivate |
Definition at line 9110 of file json.hpp.
References max(), and anonymous_namespace{chameleon.cpp}::min().
|
inlinestaticprivate |
Calculates the size of the BSON serialization of the given JSON-object j.
| [in] | j | JSON value to serialize |
Definition at line 9309 of file json.hpp.
|
inlinestaticprivate |
|
inlinestaticprivatenoexcept |
Definition at line 9143 of file json.hpp.
References max(), and Catch::Generators::value().
|
inlinestaticprivate |
Definition at line 9340 of file json.hpp.
|
inlinestaticprivate |
Definition at line 9345 of file json.hpp.
|
inlinestaticprivate |
Definition at line 9354 of file json.hpp.
|
inlinestaticprivate |
Definition at line 9359 of file json.hpp.
References Catch::Generators::value().
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlinestaticnoexcept |
Definition at line 9617 of file json.hpp.
References Catch::Generators::value(), and x.
Referenced by nlohmann::detail::serializer< BasicJsonType >::dump_escaped().
|
inlinestaticnoexcept |
Definition at line 9624 of file json.hpp.
References Catch::Generators::value(), and x.
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inlineprivatenoexcept |
determine the type prefix of container values
Definition at line 9497 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::boolean, max(), anonymous_namespace{chameleon.cpp}::min(), nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
inline |
| [in] | j | JSON value to serialize |
Definition at line 8363 of file json.hpp.
References nlohmann::detail::type_error::create(), JSON_THROW, nlohmann::detail::object, and nlohmann::detail::string.
|
inlineprivate |
Writes a BSON element with key name and array value.
Definition at line 9201 of file json.hpp.
|
inlineprivate |
Writes a BSON element with key name and boolean value value.
Definition at line 9060 of file json.hpp.
|
inlineprivate |
Writes a BSON element with key name and double value value.
Definition at line 9070 of file json.hpp.
References Catch::Generators::value().
|
inlineprivate |
Serializes the JSON value j to BSON and associates it with the key name.
| name | The name to associate with the JSON entity j within the current BSON document |
Definition at line 9266 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::boolean, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
inlineprivate |
Writes the given element_type and name to the output adapter.
Definition at line 9048 of file json.hpp.
|
inlineprivate |
Writes a BSON element with key name and integer value.
Definition at line 9125 of file json.hpp.
References max(), anonymous_namespace{chameleon.cpp}::min(), and Catch::Generators::value().
|
inlineprivate |
Writes a BSON element with key name and null value.
Definition at line 9102 of file json.hpp.
|
inlineprivate |
| [in] | j | JSON value to serialize |
Definition at line 9324 of file json.hpp.
|
inlineprivate |
Writes a BSON element with key name and object value.
Definition at line 9175 of file json.hpp.
|
inlineprivate |
Writes a BSON element with key name and string value value.
Definition at line 9088 of file json.hpp.
|
inlineprivate |
Writes a BSON element with key name and unsigned value.
Definition at line 9153 of file json.hpp.
References nlohmann::detail::out_of_range::create(), JSON_THROW, max(), and Catch::Generators::value().
|
inline |
| [in] | j | JSON value to serialize |
Definition at line 8383 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::boolean, max(), nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
inline |
| [in] | j | JSON value to serialize |
Definition at line 8627 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::boolean, max(), anonymous_namespace{chameleon.cpp}::min(), nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
inlineprivate |
Definition at line 9594 of file json.hpp.
References Catch::Generators::value().
|
inlineprivate |
Definition at line 9371 of file json.hpp.
References Catch::Generators::value().
|
inlineprivate |
Definition at line 9384 of file json.hpp.
References nlohmann::detail::out_of_range::create(), JSON_THROW, max(), and Catch::Generators::value().
|
inlineprivate |
Definition at line 9437 of file json.hpp.
References nlohmann::detail::out_of_range::create(), JSON_THROW, max(), and anonymous_namespace{chameleon.cpp}::min().
|
inline |
| [in] | j | JSON value to serialize |
| [in] | use_count | whether to use '#' prefixes (optimized format) |
| [in] | use_type | whether to use '$' prefixes (optimized format) |
| [in] | add_prefix | whether prefixes need to be used for this value |
Definition at line 8869 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::boolean, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
private |
|
private |