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

Cartesian position with time. More...

#include <convertdef.h>

Collaboration diagram for cposstruc:

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.
 UTC as Modified Julian Day. More...
 
cartpos pos
 Cartesian structure with all elements of position. More...
 

Detailed Description

Cartesian position with time.

Cartesian position structure with an additional time element.

See also
cartpos

Member Function Documentation

json11::Json cposstruc::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
226  {
227  return json11::Json::object {
228  { "utc", utc },
229  { "pos", pos }
230  };
231  }
std::map< std::string, Json > object
Definition: json11.hpp:88
double utc
UTC as Modified Julian Day.
Definition: convertdef.h:218
cartpos pos
Cartesian structure with all elements of position.
Definition: convertdef.h:220
void cposstruc::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
239  {
240  string error;
241  json11::Json parsed = json11::Json::parse(js,error);
242  if(error.empty()) {
243  if(!parsed["utc"].is_null()) utc = parsed["utc"].number_value();
244  if(!parsed["pos"].is_null()) pos.from_json(parsed["pos"].dump());
245  } else {
246  cerr << "ERROR = "<<error<<endl;
247  }
248  return;
249  }
Definition: json11.hpp:79
void from_json(const string &js)
Set class contents from JSON string.
Definition: convertdef.h:192
void dump(std::string &out) const
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
double utc
UTC as Modified Julian Day.
Definition: convertdef.h:218
cartpos pos
Cartesian structure with all elements of position.
Definition: convertdef.h:220

Member Data Documentation

double cposstruc::utc = 0.

UTC as Modified Julian Day.

cartpos cposstruc::pos

Cartesian structure with all elements of position.


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