|
Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
|
#include <json.hpp>
Public Member Functions | |
| serializer (output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict) | |
| serializer (const serializer &)=delete | |
| serializer & | operator= (const serializer &)=delete |
| serializer (serializer &&)=delete | |
| serializer & | operator= (serializer &&)=delete |
| ~serializer ()=default | |
| void | dump (const BasicJsonType &val, const bool pretty_print, const bool ensure_ascii, const unsigned int indent_step, const unsigned int current_indent=0) |
| internal implementation of the serialization function More... | |
Private Types | |
| using | string_t = typename BasicJsonType::string_t |
| using | number_float_t = typename BasicJsonType::number_float_t |
| using | number_integer_t = typename BasicJsonType::number_integer_t |
| using | number_unsigned_t = typename BasicJsonType::number_unsigned_t |
Private Member Functions | |
| void | dump_escaped (const string_t &s, const bool ensure_ascii) |
| dump escaped string More... | |
| template<typename NumberType , detail::enable_if_t< std::is_same< NumberType, number_unsigned_t >::value orstd::is_same< NumberType, number_integer_t >::value, int > = 0> | |
| void | dump_integer (NumberType x) |
| dump an integer More... | |
| void | dump_float (number_float_t x) |
| dump a floating-point number More... | |
| void | dump_float (number_float_t x, std::true_type) |
| void | dump_float (number_float_t x, std::false_type) |
Static Private Member Functions | |
| static uint8_t | decode (uint8_t &state, uint32_t &codep, const uint8_t byte) noexcept |
| check whether a string is UTF-8 encoded More... | |
Private Attributes | |
| output_adapter_t< char > | o = nullptr |
| the output of the serializer More... | |
| std::array< char, 64 > | number_buffer {{}} |
| a (hopefully) large enough character buffer More... | |
| const std::lconv * | loc = nullptr |
| the locale More... | |
| const char | thousands_sep = '\0' |
| the locale's thousand separator character More... | |
| const char | decimal_point = '\0' |
| the locale's decimal point character More... | |
| std::array< char, 512 > | string_buffer {{}} |
| string buffer More... | |
| const char | indent_char |
| the indentation character More... | |
| string_t | indent_string |
| the indentation string More... | |
| const error_handler_t | error_handler |
| error_handler how to react on decoding errors More... | |
Static Private Attributes | |
| static constexpr uint8_t | UTF8_ACCEPT = 0 |
| static constexpr uint8_t | UTF8_REJECT = 1 |
|
private |
|
private |
|
private |
|
private |
|
inline |
| [in] | s | output stream to serialize to |
| [in] | ichar | indentation character to use |
| [in] | error_handler_ | how to react on decoding errors |
Definition at line 10818 of file json.hpp.
|
delete |
|
delete |
|
default |
|
inlinestaticprivatenoexcept |
check whether a string is UTF-8 encoded
The function checks each byte of a string whether it is UTF-8 encoded. The result of the check is stored in the state parameter. The function must be called initially with state 0 (accept). State 1 means the string must be rejected, because the current byte is not allowed. If the string is completely processed, but the state is non-zero, the string ended prematurely; that is, the last byte indicated more bytes should have followed.
| [in,out] | state | the state of the decoding |
| [in,out] | codep | codepoint (valid only if resulting state is UTF8_ACCEPT) |
| [in] | byte | next byte to decode |
Definition at line 11445 of file json.hpp.
|
inline |
internal implementation of the serialization function
This function is called by the public member function dump and organizes the serialization internally. The indentation level is propagated as additional parameter. In case of arrays and objects, the function is called recursively.
escape_string()operator<<"%g" format| [in] | val | value to serialize |
| [in] | pretty_print | whether the output shall be pretty-printed |
| [in] | indent_step | the indent level |
| [in] | current_indent | the current indent level (only used internally) |
Definition at line 10853 of file json.hpp.
References nlohmann::detail::array, nlohmann::detail::boolean, nlohmann::detail::discarded, JSON_UNLIKELY, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
inlineprivate |
dump escaped string
Escape a string by replacing certain special characters by a sequence of an escape character (backslash) and another character and other control characters by a sequence of "\u" followed by a four-digit hex representation. The escaped string is written to output stream o.
| [in] | s | the string to escape |
| [in] | ensure_ascii | whether to escape non-ASCII characters with sequences |
Linear in the length of string s.
Definition at line 11060 of file json.hpp.
References nlohmann::detail::type_error::create(), nlohmann::detail::ignore, JSON_LIKELY, JSON_THROW, nlohmann::detail::replace, nlohmann::detail::strict, nlohmann::detail::string, nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type(), and Catch::Generators::value().
|
inlineprivate |
dump a floating-point number
Dump a given floating-point number to output stream o. Works internally with number_buffer.
| [in] | x | floating-point number to dump |
Definition at line 11346 of file json.hpp.
|
inlineprivate |
Definition at line 11367 of file json.hpp.
References Catch::begin, Catch::end, nlohmann::detail::to_chars(), and x.
|
inlineprivate |
Definition at line 11375 of file json.hpp.
References cl_cmbl_bm::c, Catch::end, and x.
|
inlineprivate |
dump an integer
Dump a given integer to output stream o. Works internally with number_buffer.
| [in] | x | integer number (signed or unsigned) to dump |
| NumberType | either number_integer_t or number_unsigned_t |
Definition at line 11305 of file json.hpp.
|
delete |
|
delete |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |