rsvs3D  0.0.0
Codes for the c++ implementation of the 3D RSVS
rsvsjson.cpp
1 #include "rsvsjson.hpp"
2 
3 #include "warning.hpp"
4 void rsvsjson::flatupdate(rsvsjson::json &jfin, rsvsjson::json &jnew, bool isFlatFin, bool isFlatNew)
5 {
6  /*
7  Allows recursing update into sub fields
8  */
9  if (!isFlatNew)
10  {
11  jnew = jnew.flatten();
12  }
13  if (!isFlatFin)
14  {
15  jfin = jfin.flatten();
16  }
17 
18  // Insert values read into the parameter structure
19  jfin.update(jnew);
20 
21  try
22  {
23  jnew = jnew.unflatten();
24  }
25  catch (std::exception const &ex)
26  {
27  std::cerr << jnew.dump(2) << std::endl;
28  std::cerr << ex.what() << std::endl;
29  RSVS3D_ERROR("Could not unflatten jnew");
30  }
31  try
32  {
33  jfin = jfin.unflatten();
34  }
35  catch (std::exception const &ex)
36  {
37  std::cerr << jfin.dump(2) << std::endl;
38  std::cerr << ex.what() << std::endl;
39  RSVS3D_ERROR("Could not unflatten jfin");
40  }
41 }
Interface between the RSVS project and the JSON for Modern C++ library.
Provides the error and warning system used by the RSVS3D project.
#define RSVS3D_ERROR(M)
Throw generic rsvs errors.
Definition: warning.hpp:113