Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value Union Reference

a JSON value More...

Public Member Functions

 json_value ()=default
 default constructor (for null values) More...
 
 json_value (boolean_t v) noexcept
 constructor for booleans More...
 
 json_value (number_integer_t v) noexcept
 constructor for numbers (integer) More...
 
 json_value (number_unsigned_t v) noexcept
 constructor for numbers (unsigned) More...
 
 json_value (number_float_t v) noexcept
 constructor for numbers (floating-point) More...
 
 json_value (value_t t)
 constructor for empty values of a given type More...
 
 json_value (const string_t &value)
 constructor for strings More...
 
 json_value (string_t &&value)
 constructor for rvalue strings More...
 
 json_value (const object_t &value)
 constructor for objects More...
 
 json_value (object_t &&value)
 constructor for rvalue objects More...
 
 json_value (const array_t &value)
 constructor for arrays More...
 
 json_value (array_t &&value)
 constructor for rvalue arrays More...
 
void destroy (value_t t) noexcept
 

Public Attributes

object_tobject
 object (stored with pointer to save storage) More...
 
array_tarray
 array (stored with pointer to save storage) More...
 
string_tstring
 string (stored with pointer to save storage) More...
 
boolean_t boolean
 boolean More...
 
number_integer_t number_integer
 number (integer) More...
 
number_unsigned_t number_unsigned
 number (unsigned integer) More...
 
number_float_t number_float
 number (floating-point) More...
 

Detailed Description

template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType, class BooleanType, class NumberIntegerType, class NumberUnsignedType, class NumberFloatType, template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
union nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value

a JSON value

The actual storage for a JSON value of the basic_json class. This union combines the different storage types for the JSON value types defined in value_t.

JSON type value_t type used type
object object pointer to object_t
array array pointer to array_t
string string pointer to string_t
boolean boolean boolean_t
number number_integer number_integer_t
number number_unsigned number_unsigned_t
number number_float number_float_t
null null no value is stored
Note
Variable-length types (objects, arrays, and strings) are stored as pointers. The size of the union should not exceed 64 bits if the default value types are used.
Since
version 1.0.0

Definition at line 13126 of file json.hpp.

Constructor & Destructor Documentation

template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( )
default

default constructor (for null values)

template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( boolean_t  v)
inlinenoexcept

constructor for booleans

Definition at line 13146 of file json.hpp.

13146 : boolean(v) {}
boolean_t boolean
boolean
Definition: json.hpp:13135
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( number_integer_t  v)
inlinenoexcept

constructor for numbers (integer)

Definition at line 13148 of file json.hpp.

13148 : number_integer(v) {}
number_integer_t number_integer
number (integer)
Definition: json.hpp:13137
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( number_unsigned_t  v)
inlinenoexcept

constructor for numbers (unsigned)

Definition at line 13150 of file json.hpp.

13150 : number_unsigned(v) {}
number_unsigned_t number_unsigned
number (unsigned integer)
Definition: json.hpp:13139
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( number_float_t  v)
inlinenoexcept

constructor for numbers (floating-point)

Definition at line 13152 of file json.hpp.

13152 : number_float(v) {}
number_float_t number_float
number (floating-point)
Definition: json.hpp:13141
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( value_t  t)
inline

constructor for empty values of a given type

Definition at line 13154 of file json.hpp.

References nlohmann::detail::array, nlohmann::detail::boolean, nlohmann::detail::other_error::create(), JSON_THROW, JSON_UNLIKELY, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.

13155  {
13156  switch (t)
13157  {
13158  case value_t::object:
13159  {
13160  object = create<object_t>();
13161  break;
13162  }
13163 
13164  case value_t::array:
13165  {
13166  array = create<array_t>();
13167  break;
13168  }
13169 
13170  case value_t::string:
13171  {
13172  string = create<string_t>("");
13173  break;
13174  }
13175 
13176  case value_t::boolean:
13177  {
13178  boolean = boolean_t(false);
13179  break;
13180  }
13181 
13183  {
13185  break;
13186  }
13187 
13189  {
13191  break;
13192  }
13193 
13194  case value_t::number_float:
13195  {
13197  break;
13198  }
13199 
13200  case value_t::null:
13201  {
13202  object = nullptr; // silence warning, see #821
13203  break;
13204  }
13205 
13206  default:
13207  {
13208  object = nullptr; // silence warning, see #821
13209  if (JSON_UNLIKELY(t == value_t::null))
13210  {
13211  JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.4.0")); // LCOV_EXCL_LINE
13212  }
13213  break;
13214  }
13215  }
13216  }
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:13075
array_t * array
array (stored with pointer to save storage)
Definition: json.hpp:13131
array (ordered collection of values)
NumberUnsignedType number_unsigned_t
a type for a number (unsigned)
Definition: json.hpp:13007
static other_error create(int id_, const std::string &what_arg)
Definition: json.hpp:1107
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:12936
number value (signed integer)
number_unsigned_t number_unsigned
number (unsigned integer)
Definition: json.hpp:13139
number_float_t number_float
number (floating-point)
Definition: json.hpp:13141
#define JSON_UNLIKELY(x)
Definition: json.hpp:194
#define JSON_THROW(exception)
Definition: json.hpp:162
object (unordered set of name/value pairs)
BooleanType boolean_t
a type for a boolean
Definition: json.hpp:12864
number_integer_t number_integer
number (integer)
Definition: json.hpp:13137
number value (unsigned integer)
number value (floating-point)
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( const string_t value)
inline

constructor for strings

Definition at line 13219 of file json.hpp.

References Catch::Generators::value().

13220  {
13221  string = create<string_t>(value);
13222  }
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:15647
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( string_t &&  value)
inline

constructor for rvalue strings

Definition at line 13225 of file json.hpp.

References Catch::Generators::value().

13226  {
13227  string = create<string_t>(std::move(value));
13228  }
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:15647
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( const object_t value)
inline

constructor for objects

Definition at line 13231 of file json.hpp.

References Catch::Generators::value().

13232  {
13233  object = create<object_t>(value);
13234  }
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:15647
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( object_t &&  value)
inline

constructor for rvalue objects

Definition at line 13237 of file json.hpp.

References Catch::Generators::value().

13238  {
13239  object = create<object_t>(std::move(value));
13240  }
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:15647
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( const array_t value)
inline

constructor for arrays

Definition at line 13243 of file json.hpp.

References Catch::Generators::value().

13244  {
13245  array = create<array_t>(value);
13246  }
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:15647
array_t * array
array (stored with pointer to save storage)
Definition: json.hpp:13131
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value ( array_t &&  value)
inline

constructor for rvalue arrays

Definition at line 13249 of file json.hpp.

References Catch::Generators::value().

13250  {
13251  array = create<array_t>(std::move(value));
13252  }
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:15647
array_t * array
array (stored with pointer to save storage)
Definition: json.hpp:13131

Member Function Documentation

template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
void nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::destroy ( value_t  t)
inlinenoexcept

Definition at line 13254 of file json.hpp.

References nlohmann::detail::array, nlohmann::detail::object, and nlohmann::detail::string.

13255  {
13256  switch (t)
13257  {
13258  case value_t::object:
13259  {
13260  AllocatorType<object_t> alloc;
13261  std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
13262  std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);
13263  break;
13264  }
13265 
13266  case value_t::array:
13267  {
13268  AllocatorType<array_t> alloc;
13269  std::allocator_traits<decltype(alloc)>::destroy(alloc, array);
13270  std::allocator_traits<decltype(alloc)>::deallocate(alloc, array, 1);
13271  break;
13272  }
13273 
13274  case value_t::string:
13275  {
13276  AllocatorType<string_t> alloc;
13277  std::allocator_traits<decltype(alloc)>::destroy(alloc, string);
13278  std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);
13279  break;
13280  }
13281 
13282  default:
13283  {
13284  break;
13285  }
13286  }
13287  }
object_t * object
object (stored with pointer to save storage)
Definition: json.hpp:13129
array_t * array
array (stored with pointer to save storage)
Definition: json.hpp:13131
string_t * string
string (stored with pointer to save storage)
Definition: json.hpp:13133
array (ordered collection of values)
object (unordered set of name/value pairs)

Member Data Documentation

template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
array_t* nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::array
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
boolean_t nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::boolean
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
number_float_t nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::number_float
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
number_integer_t nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::number_integer
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
number_unsigned_t nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::number_unsigned
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
object_t* nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::object
template<template< typename, typename, typename... > class ObjectType, template< typename, typename... > class ArrayType, class StringType , class BooleanType , class NumberIntegerType , class NumberUnsignedType , class NumberFloatType , template< typename > class AllocatorType, template< typename, typename=void > class JSONSerializer>
string_t* nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::string

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