COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
equationstruc Struct Reference

Equation structure. More...

#include <jsondef.h>

Collaboration diagram for equationstruc:

Public Member Functions

json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &s)
 Set class contents from JSON string. More...
 

Public Attributes

string name
 
string value
 

Detailed Description

Equation structure.

Contains the name of an equation and the Equation string it vertexs to.

Member Function Documentation

json11::Json equationstruc::to_json ( ) const
inline

Convert class contents to JSON object.

Returns a json11 JSON object of the class

Returns
A json11 JSON object containing every member variable within the class
1260  {
1261  return json11::Json::object {
1262  { "name" , name },
1263  { "value", value }
1264  };
1265  }
std::map< std::string, Json > object
Definition: json11.hpp:88
string name
Definition: jsondef.h:1252
string value
Definition: jsondef.h:1254
void equationstruc::from_json ( const string &  s)
inline

Set class contents from JSON string.

Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()

Parameters
sJSON-formatted string to set class contents to
Returns
n/a
1273  {
1274  string error;
1275  json11::Json parsed = json11::Json::parse(s,error);
1276  if(error.empty()) {
1277  if(!parsed["name"].is_null()) { name = parsed["name"].string_value(); }
1278  if(!parsed["value"].is_null()) { value = parsed["value"].string_value(); }
1279  } else {
1280  cerr<<"ERROR: <"<<error<<">"<<endl;
1281  }
1282  return;
1283  }
Definition: json11.hpp:79
string name
Definition: jsondef.h:1252
string value
Definition: jsondef.h:1254
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
const std::string & string_value() const
Definition: json11.cpp:283

Member Data Documentation

string equationstruc::name
string equationstruc::value

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