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

Rotor Structure definition. More...

#include <jsondef.h>

Collaboration diagram for rotstruc:

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 angle = 0.f
 Angular position. More...
 

Detailed Description

Rotor Structure definition.

This structure holds the description of a rotors.

Member Function Documentation

json11::Json rotstruc::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
2908  {
2909  return json11::Json::object {
2910  { "angle" , angle }
2911  };
2912  }
std::map< std::string, Json > object
Definition: json11.hpp:88
float angle
Angular position.
Definition: jsondef.h:2902
void rotstruc::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
2920  {
2921  string error;
2922  json11::Json parsed = json11::Json::parse(s,error);
2923  if(error.empty()) {
2924  if(!parsed["angle"].is_null()) { angle = parsed["angle"].number_value(); }
2925  } else {
2926  cerr<<"ERROR: <"<<error<<">"<<endl;
2927  }
2928  return;
2929  }
Definition: json11.hpp:79
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
float angle
Angular position.
Definition: jsondef.h:2902
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

float rotstruc::angle = 0.f

Angular position.


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