Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
nlohmann::detail::input_adapter Class Reference

#include <json.hpp>

Public Member Functions

 input_adapter (std::istream &i)
 input adapter for input stream More...
 
 input_adapter (std::istream &&i)
 input adapter for input stream More...
 
 input_adapter (const std::wstring &ws)
 
 input_adapter (const std::u16string &ws)
 
 input_adapter (const std::u32string &ws)
 
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
 input_adapter (CharT b, std::size_t l)
 input adapter for buffer More...
 
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
 input_adapter (CharT b)
 input adapter for string literal More...
 
template<class IteratorType , typename std::enable_if< std::is_same< typename std::iterator_traits< IteratorType >::iterator_category, std::random_access_iterator_tag >::value, int >::type = 0>
 input_adapter (IteratorType first, IteratorType last)
 input adapter for iterator range with contiguous storage More...
 
template<class T , std::size_t N>
 input_adapter (T(&array)[N])
 input adapter for array More...
 
template<class ContiguousContainer , typename std::enable_if< not std::is_pointer< ContiguousContainer >::value andstd::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(std::begin(std::declval< ContiguousContainer const >()))>::iterator_category >::value, int >::type = 0>
 input_adapter (const ContiguousContainer &c)
 input adapter for contiguous container More...
 
 operator input_adapter_t ()
 

Private Attributes

input_adapter_t ia = nullptr
 the actual adapter More...
 

Detailed Description

Definition at line 2335 of file json.hpp.

Constructor & Destructor Documentation

nlohmann::detail::input_adapter::input_adapter ( std::istream &  i)
inline

input adapter for input stream

Definition at line 2341 of file json.hpp.

2342  : ia(std::make_shared<input_stream_adapter>(i)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438
nlohmann::detail::input_adapter::input_adapter ( std::istream &&  i)
inline

input adapter for input stream

Definition at line 2345 of file json.hpp.

2346  : ia(std::make_shared<input_stream_adapter>(i)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438
nlohmann::detail::input_adapter::input_adapter ( const std::wstring &  ws)
inline

Definition at line 2348 of file json.hpp.

2349  : ia(std::make_shared<wide_string_input_adapter<std::wstring>>(ws)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438
nlohmann::detail::input_adapter::input_adapter ( const std::u16string &  ws)
inline

Definition at line 2351 of file json.hpp.

2352  : ia(std::make_shared<wide_string_input_adapter<std::u16string>>(ws)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438
nlohmann::detail::input_adapter::input_adapter ( const std::u32string &  ws)
inline

Definition at line 2354 of file json.hpp.

References Catch::Generators::value().

2355  : ia(std::make_shared<wide_string_input_adapter<std::u32string>>(ws)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( CharT  b,
std::size_t  l 
)
inline

input adapter for buffer

Definition at line 2364 of file json.hpp.

References Catch::Generators::value().

2365  : ia(std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(b), l)) {}
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438
template<typename CharT , typename std::enable_if< std::is_pointer< CharT >::value andstd::is_integral< typename std::remove_pointer< CharT >::type >::value andsizeof(typename std::remove_pointer< CharT >::type)==1, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( CharT  b)
inline

input adapter for string literal

Definition at line 2376 of file json.hpp.

References Catch::Generators::value().

2377  : input_adapter(reinterpret_cast<const char*>(b),
2378  std::strlen(reinterpret_cast<const char*>(b))) {}
input_adapter(std::istream &i)
input adapter for input stream
Definition: json.hpp:2341
template<class IteratorType , typename std::enable_if< std::is_same< typename std::iterator_traits< IteratorType >::iterator_category, std::random_access_iterator_tag >::value, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( IteratorType  first,
IteratorType  last 
)
inline

input adapter for iterator range with contiguous storage

Definition at line 2385 of file json.hpp.

References JSON_LIKELY.

2386  {
2387 #ifndef NDEBUG
2388  // assertion to check that the iterator range is indeed contiguous,
2389  // see http://stackoverflow.com/a/35008842/266378 for more discussion
2390  const auto is_contiguous = std::accumulate(
2391  first, last, std::pair<bool, int>(true, 0),
2392  [&first](std::pair<bool, int> res, decltype(*first) val)
2393  {
2394  res.first &= (val == *(std::next(std::addressof(*first), res.second++)));
2395  return res;
2396  }).first;
2397  assert(is_contiguous);
2398 #endif
2399 
2400  // assertion to check that each element is 1 byte long
2401  static_assert(
2402  sizeof(typename std::iterator_traits<IteratorType>::value_type) == 1,
2403  "each element in the iterator range must have the size of 1 byte");
2404 
2405  const auto len = static_cast<size_t>(std::distance(first, last));
2406  if (JSON_LIKELY(len > 0))
2407  {
2408  // there is at least one element: use the address of first
2409  ia = std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(&(*first)), len);
2410  }
2411  else
2412  {
2413  // the address of first cannot be used: use nullptr
2414  ia = std::make_shared<input_buffer_adapter>(nullptr, len);
2415  }
2416  }
#define JSON_LIKELY(x)
Definition: json.hpp:193
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438
template<class T , std::size_t N>
nlohmann::detail::input_adapter::input_adapter ( T(&)  array[N])
inline

input adapter for array

Definition at line 2420 of file json.hpp.

References Catch::Generators::value().

array (ordered collection of values)
not_this_one end(...)
not_this_one begin(...)
input_adapter(std::istream &i)
input adapter for input stream
Definition: json.hpp:2341
template<class ContiguousContainer , typename std::enable_if< not std::is_pointer< ContiguousContainer >::value andstd::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(std::begin(std::declval< ContiguousContainer const >()))>::iterator_category >::value, int >::type = 0>
nlohmann::detail::input_adapter::input_adapter ( const ContiguousContainer &  c)
inline

input adapter for contiguous container

Definition at line 2428 of file json.hpp.

not_this_one end(...)
not_this_one begin(...)
input_adapter(std::istream &i)
input adapter for input stream
Definition: json.hpp:2341

Member Function Documentation

nlohmann::detail::input_adapter::operator input_adapter_t ( )
inline

Definition at line 2431 of file json.hpp.

2432  {
2433  return ia;
2434  }
input_adapter_t ia
the actual adapter
Definition: json.hpp:2438

Member Data Documentation

input_adapter_t nlohmann::detail::input_adapter::ia = nullptr
private

the actual adapter

Definition at line 2438 of file json.hpp.


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