CASM  1.1.0
A Clusters Approach to Statistical Mechanics
JsonParser

Detailed Description

JSON input/output.

Classes

class  CASM::jsonParser
 
struct  CASM::jsonConstructor< ReturnType >
 Helper struct for constructing objects that need additional data. More...
 
struct  CASM::jsonMake< ValueType >
 Helper struct for constructing objects that need additional data. More...
 
class  CASM::jsonParserIterator< IsConst >
 

Functions

std::ostream & CASM::operator<< (std::ostream &stream, const jsonParser &json)
 
std::istream & CASM::operator>> (std::istream &stream, jsonParser &json)
 
jsonParserCASM::to_json (bool value, jsonParser &json)
 To JSON for basic types. More...
 
jsonParserCASM::to_json (int value, jsonParser &json)
 
jsonParserCASM::to_json (unsigned int value, jsonParser &json)
 
jsonParserCASM::to_json (long int value, jsonParser &json)
 
jsonParserCASM::to_json (unsigned long int value, jsonParser &json)
 
jsonParserCASM::to_json (double value, jsonParser &json)
 
jsonParserCASM::to_json (const std::string &value, jsonParser &json)
 
jsonParserCASM::to_json (const char *value, jsonParser &json)
 
jsonParserCASM::to_json (const jsonParser &value, jsonParser &json)
 
template<typename T >
CASM::from_json (const jsonParser &json)
 From JSON for basic types. More...
 
template<typename T >
std::unique_ptr< T > CASM::make_from_json (const jsonParser &json)
 Make from JSON for basic types. More...
 
template<>
bool CASM::from_json< bool > (const jsonParser &json)
 
template<>
int CASM::from_json< int > (const jsonParser &json)
 
template<>
unsigned int CASM::from_json< unsigned int > (const jsonParser &json)
 
template<>
long int CASM::from_json< long int > (const jsonParser &json)
 
template<>
unsigned long int CASM::from_json< unsigned long int > (const jsonParser &json)
 
template<>
double CASM::from_json< double > (const jsonParser &json)
 
template<>
std::string CASM::from_json< std::string > (const jsonParser &json)
 
template<>
jsonParser CASM::from_json< jsonParser > (const jsonParser &json)
 
void CASM::from_json (bool &value, const jsonParser &json)
 From JSON for basic types. More...
 
void CASM::from_json (int &value, const jsonParser &json)
 
void CASM::from_json (unsigned int &value, const jsonParser &json)
 
void CASM::from_json (long int &value, const jsonParser &json)
 
void CASM::from_json (unsigned long int &value, const jsonParser &json)
 
void CASM::from_json (double &value, const jsonParser &json)
 
void CASM::from_json (std::string &value, const jsonParser &json)
 
void CASM::from_json (jsonParser &value, const jsonParser &json)
 
void CASM::from_json (std::istream &stream, const jsonParser &json)
 
void CASM::from_json (fs::path &value, const jsonParser &json)
 
void CASM::to_json (std::istream &stream, jsonParser &json)
 Create a jsonParser from a stream. More...
 
void CASM::to_json (fs::path file_path, jsonParser &json)
 Create a jsonParser by reading a file. More...
 
template<typename T >
jsonParserCASM::to_json (const std::complex< T > &value, jsonParser &json)
 To JSON for complex. More...
 
template<typename T >
void CASM::from_json (std::complex< T > &value, const jsonParser &json)
 From JSON for complex. More...
 
template<typename Key , typename T >
jsonParserCASM::to_json (const std::pair< Key, T > &value, jsonParser &json)
 To JSON for std::pair<std::string, T> More...
 
template<typename Key , typename T >
void CASM::from_json (std::pair< Key, T > &value, const jsonParser &json)
 From JSON for std::pair<std::string, T> More...
 
template<typename T , typename... Args>
void CASM::make_from_json (std::unique_ptr< T > &ptr, const jsonParser &json, Args &&... args)
 Make from JSON for basic types. More...
 
fs::path CASM::find_diff (const jsonParser &A, const jsonParser &B)
 Return the location at which jsonParser 'A' != 'B' as a fs::path. More...
 
fs::path CASM::find_diff (const jsonParser &A, const jsonParser &B, double tol)
 
template<typename T >
jsonParser CASM::json_pair (const std::string &key, const T &value)
 Create pair/value json object without intermediate temporary. More...
 
template<typename T , typename... Args>
jsonParserCASM::jsonParser::push_back (const T &value, Args &&... args)
 
template<typename T , typename... Args>
CASM::jsonParser::get (Args &&... args) const
 Get data from json, using one of several alternatives. More...
 
template<typename T , typename... Args>
void CASM::jsonParser::get (T &t, Args &&... args) const
 
template<typename T , typename... Args>
bool CASM::jsonParser::get_if (T &t, const std::string &key, Args &&... args) const
 
template<typename T , typename... Args>
CASM::jsonParser::get_if_else (const std::string &key, const T &default_value, Args &&... args) const
 
template<typename T , typename... Args>
bool CASM::jsonParser::get_else (T &t, const std::string &key, const T &default_value, Args &&... args) const
 
template<typename T , typename... Args>
std::unique_ptr< T > CASM::jsonParser::make (Args &&... args) const
 Get data from json. More...
 
template<typename T , typename... Args>
void CASM::jsonParser::make (std::unique_ptr< T > &ptr, Args &&... args) const
 Get data from json. More...
 
template<typename T , typename... Args>
bool CASM::jsonParser::make_if (std::unique_ptr< T > &ptr, const std::string &key, Args &&... args) const
 Get data from json if key exists. More...
 
template<typename T , typename... Args>
std::unique_ptr< T > CASM::jsonParser::make_optional (const std::string &key, Args &&... args) const
 Get data from json if key exists, else return empty ptr. More...
 
template<typename T , typename... Args>
std::unique_ptr< T > CASM::jsonParser::make_if_else (const std::string &key, std::unique_ptr< T > default_value, Args &&... args) const
 Get data from json if 'this' contains 'key', else return 'default_value'. More...
 
template<typename T , typename... Args>
bool CASM::jsonParser::make_else (std::unique_ptr< T > &ptr, const std::string &key, std::unique_ptr< T > default_value, Args &&... args) const
 Get data from json if key exists, else assign default_value. More...
 
template<typename T >
jsonParserCASM::jsonParser::put (const T &value)
 
template<typename Iterator >
jsonParserCASM::jsonParser::put_obj (Iterator begin, Iterator end)
 
template<typename T >
jsonParserCASM::jsonParser::put_array (size_type N, const T &t)
 Puts new JSON array, using the same value. More...
 
template<typename Iterator , typename... Args, typename CASM_TMP::enable_if_iterator< Iterator >::type * = nullptr>
jsonParserCASM::jsonParser::put_array (Iterator begin, Iterator end, Args &&... args)
 Puts new JSON array, from iterators. More...
 
template<typename T >
jsonParserCASM::jsonParser::operator= (const T &value)
 
template<typename K , typename V >
jsonParserCASM::to_json (const std::map< K, V > &map, jsonParser &json)
 Converts to a JSON object. More...
 
template<typename K , typename V >
void CASM::from_json (std::map< K, V > &map, const jsonParser &json)
 
template<typename T , typename... Args>
jsonParserCASM::to_json (const std::map< std::string, T > &map, jsonParser &json, Args &&... args)
 Converts to a JSON object. More...
 
template<typename T , typename... Args>
void CASM::from_json (std::map< std::string, T > &map, const jsonParser &json, Args &&... args)
 
template<typename T , typename... Args>
jsonParserCASM::to_json (const std::vector< T > &vec, jsonParser &json, Args &&... args)
 Converts to a JSON array. More...
 
template<typename T , typename... Args>
void CASM::from_json (std::vector< T > &vec, const jsonParser &json, Args &&... args)
 
template<typename T >
void CASM::from_json (std::vector< T > &vec, const jsonParser &json, const T &initial)
 
template<typename T , std::size_t N>
jsonParserCASM::to_json (const std::array< T, N > &arr, jsonParser &json)
 Converts to a JSON array. More...
 
template<typename T , std::size_t N>
void CASM::from_json (std::array< T, N > &arr, const jsonParser &json)
 
template<typename T , typename Compare >
jsonParserCASM::to_json (const std::set< T, Compare > &set, jsonParser &json)
 Converts to a JSON array. More...
 
template<typename T , typename Compare , typename... Args>
void CASM::from_json (std::set< T, Compare > &set, const jsonParser &json, Args &&... args)
 
template<typename T , typename Compare >
jsonParserCASM::to_json (const std::unordered_set< T, Compare > &set, jsonParser &json)
 Converts to a JSON array. More...
 
template<typename T , typename Compare , typename... Args>
void CASM::from_json (std::unordered_set< T, Compare > &set, const jsonParser &json, Args &&... args)
 
template<typename Derived >
CASM::jsonParserCASM::to_json (const Eigen::MatrixBase< Derived > &value, CASM::jsonParser &json)
 Write Eigen Matrix/Vector to JSON. More...
 
template<typename Derived >
CASM::jsonParserCASM::to_json (const Eigen::MatrixBase< Derived > &value, CASM::jsonParser &json, CASM::jsonParser::as_array)
 Write Eigen Matrix/Vector to JSON. More...
 
template<typename Derived >
CASM::jsonParserCASM::to_json (const Eigen::MatrixBase< Derived > &value, CASM::jsonParser &json, CASM::jsonParser::as_flattest)
 Write Eigen Matrix/Vector to JSON. More...
 
template<typename Derived >
CASM::jsonParserCASM::to_json_array (const Eigen::MatrixBase< Derived > &value, CASM::jsonParser &json)
 Write Eigen Matrix with 1 row or 1 column to JSON array. More...
 
template<typename Derived >
CASM::jsonParser CASM::to_json_array (const Eigen::MatrixBase< Derived > &value)
 Write Eigen Matrix with 1 row or 1 column to JSON array. More...
 
template<typename Derived >
void CASM::from_json (Eigen::MatrixBase< Derived > &value, const CASM::jsonParser &json)
 Read Eigen Matrix/Vector from JSON. More...
 

Function Documentation

◆ find_diff() [1/2]

fs::path CASM::find_diff ( const jsonParser A,
const jsonParser B 
)

Return the location at which jsonParser 'A' != 'B' as a fs::path.

Return the location at which jsonParser 'A' != 'B' as a boost::filesystem::path

Definition at line 475 of file jsonParser.cc.

◆ find_diff() [2/2]

fs::path CASM::find_diff ( const jsonParser A,
const jsonParser B,
double  tol 
)

Return the location at which jsonParser !A.almost_equal(B, tol) as a boost::filesystem::path

Return the location at which jsonParser !A.almost_equal(B, tol) as a fs::path

Definition at line 481 of file jsonParser.cc.

◆ from_json() [1/21]

void CASM::from_json ( bool &  value,
const jsonParser json 
)

From JSON for basic types.

Definition at line 120 of file jsonParser.cc.

◆ from_json() [2/21]

template<typename T >
T CASM::from_json ( const jsonParser json)

From JSON for basic types.

Default works if T::T() and 'void from_json(T&, const jsonParser&)' exist.

Definition at line 574 of file jsonParser.hh.

◆ from_json() [3/21]

void CASM::from_json ( double &  value,
const jsonParser json 
)

Definition at line 136 of file jsonParser.cc.

◆ from_json() [4/21]

template<typename Derived >
void CASM::from_json ( Eigen::MatrixBase< Derived > &  value,
const CASM::jsonParser json 
)

Read Eigen Matrix/Vector from JSON.

  • Reads 1d JSON array as column vector

Definition at line 331 of file json_io.hh.

◆ from_json() [5/21]

void CASM::from_json ( fs::path &  value,
const jsonParser json 
)

Definition at line 162 of file jsonParser.cc.

◆ from_json() [6/21]

void CASM::from_json ( int &  value,
const jsonParser json 
)

Definition at line 122 of file jsonParser.cc.

◆ from_json() [7/21]

void CASM::from_json ( jsonParser value,
const jsonParser json 
)

Definition at line 160 of file jsonParser.cc.

◆ from_json() [8/21]

void CASM::from_json ( long int &  value,
const jsonParser json 
)

Definition at line 128 of file jsonParser.cc.

◆ from_json() [9/21]

template<typename T , std::size_t N>
void CASM::from_json ( std::array< T, N > &  arr,
const jsonParser json 
)

Read map from JSON

Clears any previous contents

Definition at line 198 of file json_io.hh.

◆ from_json() [10/21]

template<typename T >
void CASM::from_json ( std::complex< T > &  value,
const jsonParser json 
)

From JSON for complex.

re-throw exceptions

Definition at line 523 of file jsonParser.hh.

◆ from_json() [11/21]

void CASM::from_json ( std::istream &  stream,
const jsonParser json 
)

◆ from_json() [12/21]

template<typename K , typename V >
void CASM::from_json ( std::map< K, V > &  map,
const jsonParser json 
)

Read map from JSON

Clears any previous contents

Definition at line 116 of file json_io.hh.

◆ from_json() [13/21]

template<typename T , typename... Args>
void CASM::from_json ( std::map< std::string, T > &  map,
const jsonParser json,
Args &&...  args 
)

Read map from JSON

Clears any previous contents

Definition at line 137 of file json_io.hh.

◆ from_json() [14/21]

template<typename Key , typename T >
void CASM::from_json ( std::pair< Key, T > &  value,
const jsonParser json 
)

From JSON for std::pair<std::string, T>

Definition at line 952 of file jsonParser.hh.

◆ from_json() [15/21]

template<typename T , typename Compare , typename... Args>
void CASM::from_json ( std::set< T, Compare > &  set,
const jsonParser json,
Args &&...  args 
)

Read std::set from JSON array

Clears any previous contents, constructs via jsonConstructor<T>

Definition at line 225 of file json_io.hh.

◆ from_json() [16/21]

void CASM::from_json ( std::string &  value,
const jsonParser json 
)

Definition at line 156 of file jsonParser.cc.

◆ from_json() [17/21]

template<typename T , typename Compare , typename... Args>
void CASM::from_json ( std::unordered_set< T, Compare > &  set,
const jsonParser json,
Args &&...  args 
)

Read std::set from JSON array

Clears any previous contents, constructs via jsonConstructor<T>

Definition at line 246 of file json_io.hh.

◆ from_json() [18/21]

template<typename T , typename... Args>
void CASM::from_json ( std::vector< T > &  vec,
const jsonParser json,
Args &&...  args 
)

Read std::vector<T> from JSON

Clears any previous contents

Definition at line 158 of file json_io.hh.

◆ from_json() [19/21]

template<typename T >
void CASM::from_json ( std::vector< T > &  vec,
const jsonParser json,
const T &  initial 
)

Read std::vector<T> from JSON

Clears any previous contents

vec.resize(json.size(), initial);
int i = 0;
for(auto it = json.begin(); it != json.end(); ++it, ++i) {
from_json(vec[i], *it);
}
void from_json(ClexDescription &desc, const jsonParser &json)

Definition at line 178 of file json_io.hh.

◆ from_json() [20/21]

void CASM::from_json ( unsigned int &  value,
const jsonParser json 
)

Definition at line 124 of file jsonParser.cc.

◆ from_json() [21/21]

void CASM::from_json ( unsigned long int &  value,
const jsonParser json 
)

Definition at line 132 of file jsonParser.cc.

◆ from_json< bool >()

template<>
bool CASM::from_json< bool > ( const jsonParser json)

Definition at line 79 of file jsonParser.cc.

◆ from_json< double >()

template<>
double CASM::from_json< double > ( const jsonParser json)

Definition at line 104 of file jsonParser.cc.

◆ from_json< int >()

template<>
int CASM::from_json< int > ( const jsonParser json)

Definition at line 84 of file jsonParser.cc.

◆ from_json< jsonParser >()

template<>
jsonParser CASM::from_json< jsonParser > ( const jsonParser json)

Definition at line 116 of file jsonParser.cc.

◆ from_json< long int >()

template<>
long int CASM::from_json< long int > ( const jsonParser json)

Definition at line 94 of file jsonParser.cc.

◆ from_json< std::string >()

template<>
std::string CASM::from_json< std::string > ( const jsonParser json)

Definition at line 111 of file jsonParser.cc.

◆ from_json< unsigned int >()

template<>
unsigned int CASM::from_json< unsigned int > ( const jsonParser json)

Definition at line 89 of file jsonParser.cc.

◆ from_json< unsigned long int >()

template<>
unsigned long int CASM::from_json< unsigned long int > ( const jsonParser json)

Definition at line 99 of file jsonParser.cc.

◆ get() [1/2]

template<typename T , typename... Args>
T CASM::jsonParser::get ( Args &&...  args) const

Get data from json, using one of several alternatives.

Get data from json, using one of several alternatives

Use for any type T for which the either of the following is specialized (they are called in the following order):

Definition at line 716 of file jsonParser.hh.

◆ get() [2/2]

template<typename T , typename... Args>
void CASM::jsonParser::get ( T &  t,
Args &&...  args 
) const

Get data from json, for any type T for which 'void from_json( T &value, const jsonParser &json, Args... args)' is defined Call using: T t; json.get(t);

Get data from json

This is equivalent to:

from_json(t, *this, std::forward<Args>(args)...);

Definition at line 728 of file jsonParser.hh.

◆ get_else()

template<typename T , typename... Args>
bool CASM::jsonParser::get_else ( T &  t,
const std::string &  key,
const T &  default_value,
Args &&...  args 
) const

Get data from json, if 'this' contains 'key', else set to 'default_value' Returns true if 'key' found, else false

Get data from json if key exists, else assign default_value

If 'key' exists, this is equivalent to:

find(key)->get(t, std::forward<Args>(args)...);
iterator find(const std::string &name)
Return iterator to JSON object value with 'name'.
Definition: jsonParser.cc:543

Definition at line 775 of file jsonParser.hh.

◆ get_if()

template<typename T , typename... Args>
bool CASM::jsonParser::get_if ( T &  t,
const std::string &  key,
Args &&...  args 
) const

Get data from json, if 'this' contains 'key' Returns true if 'key' found, else false

Get data from json if key exists

If 'key' exists, this is equivalent to:

find(key)->get(t, std::forward<Args>(args)...);

Definition at line 740 of file jsonParser.hh.

◆ get_if_else()

template<typename T , typename... Args>
T CASM::jsonParser::get_if_else ( const std::string &  key,
const T &  default_value,
Args &&...  args 
) const

Get data from json, if 'this' contains 'key', else return to 'default_value'

Get data from json if key exists, else return default_value

If 'key' exists, this is equivalent to:

find(key)->get<T>(std::forward<Args>(args)...);

Definition at line 757 of file jsonParser.hh.

◆ json_pair()

template<typename T >
jsonParser CASM::json_pair ( const std::string &  key,
const T &  value 
)

Create pair/value json object without intermediate temporary.

Definition at line 959 of file jsonParser.hh.

◆ make() [1/2]

template<typename T , typename... Args>
std::unique_ptr< T > CASM::jsonParser::make ( Args &&...  args) const

Get data from json.

Get data from json, using one of several alternatives

Use for any type T for which the either of the following is specialized (they are called in the following order):

Definition at line 806 of file jsonParser.hh.

◆ make() [2/2]

template<typename T , typename... Args>
void CASM::jsonParser::make ( std::unique_ptr< T > &  ptr,
Args &&...  args 
) const

Get data from json.

Get data from json

This is equivalent to:

make_from_json(ptr, *this, std::forward<Args>(args)...);

Definition at line 818 of file jsonParser.hh.

◆ make_else()

template<typename T , typename... Args>
bool CASM::jsonParser::make_else ( std::unique_ptr< T > &  ptr,
const std::string &  key,
std::unique_ptr< T >  default_value,
Args &&...  args 
) const

Get data from json if key exists, else assign default_value.

Get data from json if key exists, else assign default_value

If 'key' exists, this is equivalent to:

find(key)->make(ptr, std::forward<Args>(args)...);

Definition at line 883 of file jsonParser.hh.

◆ make_from_json() [1/2]

template<typename T >
std::unique_ptr< T > CASM::make_from_json ( const jsonParser json)

Make from JSON for basic types.

Default uses 'from_json<T>(const jsonParser&)' with copy constructor.

Definition at line 582 of file jsonParser.hh.

◆ make_from_json() [2/2]

template<typename T , typename... Args>
void CASM::make_from_json ( std::unique_ptr< T > &  ptr,
const jsonParser json,
Args &&...  args 
)

Make from JSON for basic types.

Definition at line 594 of file jsonParser.hh.

◆ make_if()

template<typename T , typename... Args>
bool CASM::jsonParser::make_if ( std::unique_ptr< T > &  ptr,
const std::string &  key,
Args &&...  args 
) const

Get data from json if key exists.

Get data from json if key exists

If 'key' exists, this is equivalent to:

find(key)->make(ptr, std::forward<Args>(args)...);

Definition at line 830 of file jsonParser.hh.

◆ make_if_else()

template<typename T , typename... Args>
std::unique_ptr< T > CASM::jsonParser::make_if_else ( const std::string &  key,
std::unique_ptr< T >  default_value,
Args &&...  args 
) const

Get data from json if 'this' contains 'key', else return 'default_value'.

Get data from json if 'this' contains 'key', else return 'default_value'

If 'key' exists, this is equivalent to:

find(key)->make(std::forward<Args>(args)...);

Definition at line 865 of file jsonParser.hh.

◆ make_optional()

template<typename T , typename... Args>
std::unique_ptr< T > CASM::jsonParser::make_optional ( const std::string &  key,
Args &&...  args 
) const

Get data from json if key exists, else return empty ptr.

Get data from json if key exists, else return empty ptr

If 'key' exists, this is equivalent to:

find(key)->make(std::forward<Args>(args)...);

Definition at line 848 of file jsonParser.hh.

◆ operator<<()

std::ostream & CASM::operator<< ( std::ostream &  stream,
const jsonParser json 
)

Definition at line 213 of file jsonParser.cc.

◆ operator=()

template<typename T >
jsonParser & CASM::jsonParser::operator= ( const T &  value)

Puts data of any type T for which 'jsonParser& to_json( const T &value, jsonParser &json)' is defined

Definition at line 939 of file jsonParser.hh.

◆ operator>>()

std::istream & CASM::operator>> ( std::istream &  stream,
jsonParser json 
)

Definition at line 177 of file jsonParser.cc.

◆ push_back()

template<typename T , typename... Args>
jsonParser & CASM::jsonParser::push_back ( const T &  value,
Args &&...  args 
)

Puts new valued element at end of array of any type T for which 'jsonParser& to_json( const T &value, jsonParser &json)' is defined

re-throw exceptions

Definition at line 684 of file jsonParser.hh.

◆ put()

template<typename T >
jsonParser & CASM::jsonParser::put ( const T &  value)

Puts data of any type T for which 'jsonParser& to_json( const T &value, jsonParser &json)' is defined (same as 'operator=')

Puts data of any type T for which 'jsonParser& to_json( const T &value, jsonParser &json)' is defined (same as operator=)

Definition at line 899 of file jsonParser.hh.

◆ put_array() [1/2]

template<typename Iterator , typename... Args, typename CASM_TMP::enable_if_iterator< Iterator >::type * >
jsonParser & CASM::jsonParser::put_array ( Iterator  begin,
Iterator  end,
Args &&...  args 
)

Puts new JSON array, from iterators.

Definition at line 927 of file jsonParser.hh.

◆ put_array() [2/2]

template<typename T >
jsonParser & CASM::jsonParser::put_array ( size_type  N,
const T &  t 
)

Puts new JSON array, using the same value.

Definition at line 916 of file jsonParser.hh.

◆ put_obj()

template<typename Iterator >
jsonParser & CASM::jsonParser::put_obj ( Iterator  begin,
Iterator  end 
)

Puts new JSON object, from iterators over a range of values of type std::pair<std::string, T>

Definition at line 906 of file jsonParser.hh.

◆ to_json() [1/22]

jsonParser & CASM::to_json ( bool  value,
jsonParser json 
)

To JSON for basic types.

Functions for converting basic types to/from json.

Definition at line 12 of file jsonParser.cc.

◆ to_json() [2/22]

jsonParser & CASM::to_json ( const char *  value,
jsonParser json 
)

Definition at line 55 of file jsonParser.cc.

◆ to_json() [3/22]

template<typename Derived >
CASM::jsonParser& CASM::to_json ( const Eigen::MatrixBase< Derived > &  value,
CASM::jsonParser json 
)

Write Eigen Matrix/Vector to JSON.

Definition at line 259 of file json_io.hh.

◆ to_json() [4/22]

template<typename Derived >
CASM::jsonParser& CASM::to_json ( const Eigen::MatrixBase< Derived > &  value,
CASM::jsonParser json,
CASM::jsonParser::as_array   
)

Write Eigen Matrix/Vector to JSON.

Definition at line 275 of file json_io.hh.

◆ to_json() [5/22]

template<typename Derived >
CASM::jsonParser& CASM::to_json ( const Eigen::MatrixBase< Derived > &  value,
CASM::jsonParser json,
CASM::jsonParser::as_flattest   
)

Write Eigen Matrix/Vector to JSON.

Definition at line 294 of file json_io.hh.

◆ to_json() [6/22]

jsonParser & CASM::to_json ( const jsonParser value,
jsonParser json 
)

Definition at line 60 of file jsonParser.cc.

◆ to_json() [7/22]

template<typename T , std::size_t N>
jsonParser& CASM::to_json ( const std::array< T, N > &  arr,
jsonParser json 
)

Converts to a JSON array.

Definition at line 190 of file json_io.hh.

◆ to_json() [8/22]

template<typename T >
jsonParser& CASM::to_json ( const std::complex< T > &  value,
jsonParser json 
)

To JSON for complex.

Definition at line 514 of file jsonParser.hh.

◆ to_json() [9/22]

template<typename K , typename V >
jsonParser& CASM::to_json ( const std::map< K, V > &  map,
jsonParser json 
)

Converts to a JSON object.

Definition at line 101 of file json_io.hh.

◆ to_json() [10/22]

template<typename T , typename... Args>
jsonParser& CASM::to_json ( const std::map< std::string, T > &  map,
jsonParser json,
Args &&...  args 
)

Converts to a JSON object.

Definition at line 128 of file json_io.hh.

◆ to_json() [11/22]

template<typename Key , typename T >
jsonParser & CASM::to_json ( const std::pair< Key, T > &  value,
jsonParser json 
)

To JSON for std::pair<std::string, T>

To JSON for std::pair<std::string, T> and other convertible types.

Definition at line 945 of file jsonParser.hh.

◆ to_json() [12/22]

template<typename T , typename Compare >
jsonParser& CASM::to_json ( const std::set< T, Compare > &  set,
jsonParser json 
)

Converts to a JSON array.

Definition at line 217 of file json_io.hh.

◆ to_json() [13/22]

jsonParser & CASM::to_json ( const std::string &  value,
jsonParser json 
)

Definition at line 50 of file jsonParser.cc.

◆ to_json() [14/22]

template<typename T , typename Compare >
jsonParser& CASM::to_json ( const std::unordered_set< T, Compare > &  set,
jsonParser json 
)

Converts to a JSON array.

Definition at line 237 of file json_io.hh.

◆ to_json() [15/22]

template<typename T , typename... Args>
jsonParser& CASM::to_json ( const std::vector< T > &  vec,
jsonParser json,
Args &&...  args 
)

Converts to a JSON array.

Definition at line 149 of file json_io.hh.

◆ to_json() [16/22]

jsonParser & CASM::to_json ( double  value,
jsonParser json 
)

Definition at line 37 of file jsonParser.cc.

◆ to_json() [17/22]

void CASM::to_json ( fs::path  file_path,
jsonParser json 
)

Create a jsonParser by reading a file.

Create a jsonParser by reading a file

This function reads the contents of the file at 'file_path' as if it were JSON. Use 'to_json(file_path.string(), json)' if you only want the path as a string

Definition at line 69 of file jsonParser.cc.

◆ to_json() [18/22]

jsonParser & CASM::to_json ( int  value,
jsonParser json 
)

Definition at line 17 of file jsonParser.cc.

◆ to_json() [19/22]

jsonParser & CASM::to_json ( long int  value,
jsonParser json 
)

Definition at line 27 of file jsonParser.cc.

◆ to_json() [20/22]

void CASM::to_json ( std::istream &  stream,
jsonParser json 
)
inline

Create a jsonParser from a stream.

Definition at line 501 of file jsonParser.hh.

◆ to_json() [21/22]

jsonParser & CASM::to_json ( unsigned int  value,
jsonParser json 
)

Definition at line 22 of file jsonParser.cc.

◆ to_json() [22/22]

jsonParser & CASM::to_json ( unsigned long int  value,
jsonParser json 
)

Definition at line 32 of file jsonParser.cc.

◆ to_json_array() [1/2]

template<typename Derived >
CASM::jsonParser CASM::to_json_array ( const Eigen::MatrixBase< Derived > &  value)

Write Eigen Matrix with 1 row or 1 column to JSON array.

Definition at line 321 of file json_io.hh.

◆ to_json_array() [2/2]

template<typename Derived >
CASM::jsonParser& CASM::to_json_array ( const Eigen::MatrixBase< Derived > &  value,
CASM::jsonParser json 
)

Write Eigen Matrix with 1 row or 1 column to JSON array.

Definition at line 313 of file json_io.hh.