CASM  1.1.0
A Clusters Approach to Statistical Mechanics
PermutationIO.cc
Go to the documentation of this file.
2 
3 #include <vector>
4 
8 
9 namespace CASM {
10 
11 std::ostream &operator<<(std::ostream &out, const Permutation &perm) {
12  out << perm.perm_array();
13  return out;
14 }
15 
16 //**************************************************************
17 
18 jsonParser &to_json(const Permutation &perm, jsonParser &json) {
19  return CASM::to_json(perm.perm_array(), json);
20 }
21 
22 void from_json(Permutation &perm, const jsonParser &json) {
23  try {
24  std::vector<Index> permutation_vector;
25  from_json(permutation_vector, json);
26  perm = Permutation(permutation_vector);
27  } catch (...) {
29  throw;
30  }
31 }
32 } // namespace CASM
const std::vector< Index > & perm_array() const
Definition: Permutation.hh:62
Main CASM namespace.
Definition: APICommand.hh:8
std::ostream & operator<<(std::ostream &_stream, const FormattedPrintable &_formatted)
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
void from_json(ClexDescription &desc, const jsonParser &json)