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

#include <jsondef.h>

Collaboration diagram for motrstruc:

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 max = 0.f
 Maximum speed in revolutions per second. More...
 
float rat = 0.f
 
float spd = 0.f
 

Member Function Documentation

json11::Json motrstruc::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
2753  {
2754  return json11::Json::object {
2755  { "max" , max },
2756  { "rat" , rat },
2757  { "spd" , spd }
2758  };
2759  }
std::map< std::string, Json > object
Definition: json11.hpp:88
float max
Maximum speed in revolutions per second.
Definition: jsondef.h:2744
float spd
Definition: jsondef.h:2747
float rat
Definition: jsondef.h:2746
void motrstruc::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
2767  {
2768  string error;
2769  json11::Json parsed = json11::Json::parse(s,error);
2770  if(error.empty()) {
2771  if(!parsed["max"].is_null()) { max = parsed["max"].number_value(); }
2772  if(!parsed["rat"].is_null()) { rat = parsed["rat"].number_value(); }
2773  if(!parsed["spd"].is_null()) { spd = parsed["spd"].number_value(); }
2774  } else {
2775  cerr<<"ERROR: <"<<error<<">"<<endl;
2776  }
2777  return;
2778  }
Definition: json11.hpp:79
float max
Maximum speed in revolutions per second.
Definition: jsondef.h:2744
float spd
Definition: jsondef.h:2747
float rat
Definition: jsondef.h:2746
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

float motrstruc::max = 0.f

Maximum speed in revolutions per second.

float motrstruc::rat = 0.f
float motrstruc::spd = 0.f

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