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

#include <convertdef.h>

Collaboration diagram for aattstruc:

Public Member Functions

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

Public Attributes

double utc = 0.
 
avector s
 
avector v
 
avector a
 

Member Function Documentation

json11::Json aattstruc::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
376  {
377  return json11::Json::object {
378  { "utc" , utc },
379  { "s" , s },
380  { "v" , v },
381  { "a" , a }
382  };
383  }
std::map< std::string, Json > object
Definition: json11.hpp:88
avector a
Definition: convertdef.h:370
avector v
Definition: convertdef.h:369
avector s
Definition: convertdef.h:368
double utc
Definition: convertdef.h:367
void aattstruc::from_json ( const string &  js)
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
390  {
391  string error;
392  json11::Json parsed = json11::Json::parse(js,error);
393  if(error.empty()) {
394  if(!parsed["utc"].is_null()) utc = parsed["utc"].number_value();
395  if(!parsed["s"].is_null()) s.from_json(parsed["s"].dump());
396  if(!parsed["v"].is_null()) v.from_json(parsed["v"].dump());
397  if(!parsed["a"].is_null()) a.from_json(parsed["a"].dump());
398  } else {
399  cerr<<"ERROR = "<<error<<endl;
400  }
401  return;
402  }
Definition: json11.hpp:79
avector a
Definition: convertdef.h:370
avector v
Definition: convertdef.h:369
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:311
void dump(std::string &out) const
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
avector s
Definition: convertdef.h:368
double utc
Definition: convertdef.h:367

Member Data Documentation

double aattstruc::utc = 0.
avector aattstruc::s
avector aattstruc::v
avector aattstruc::a

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