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

#include <jsondef.h>

Collaboration diagram for psenstruc:

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

float press = 0.f
 Current Pressure. More...
 

Member Function Documentation

json11::Json psenstruc::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
3114  {
3115  return json11::Json::object {
3116  { "press" , press }
3117  };
3118  }
std::map< std::string, Json > object
Definition: json11.hpp:88
float press
Current Pressure.
Definition: jsondef.h:3108
void psenstruc::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
3126  {
3127  string error;
3128  json11::Json parsed = json11::Json::parse(s,error);
3129  if(error.empty()) {
3130  if(!parsed["press"].is_null()) { press = parsed["press"].number_value(); }
3131  } else {
3132  cerr<<"ERROR: <"<<error<<">"<<endl;
3133  }
3134  return;
3135  }
Definition: json11.hpp:79
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
float press
Current Pressure.
Definition: jsondef.h:3108
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

float psenstruc::press = 0.f

Current Pressure.


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