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

#include <convertdef.h>

Collaboration diagram for locstruc:

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.
 Master time for location, in Modified Julian Day. More...
 
posstruc pos
 posstruc for this time. More...
 
attstruc att
 attstruc for this time. More...
 

Member Function Documentation

json11::Json locstruc::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
889  {
890  return json11::Json::object {
891  { "utc" , utc },
892  { "pos" , pos },
893  { "att" , att }
894  };
895  }
std::map< std::string, Json > object
Definition: json11.hpp:88
double utc
Master time for location, in Modified Julian Day.
Definition: convertdef.h:879
attstruc att
attstruc for this time.
Definition: convertdef.h:883
posstruc pos
posstruc for this time.
Definition: convertdef.h:881
void locstruc::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
903  {
904  string error;
905  json11::Json parsed = json11::Json::parse(js,error);
906  if(error.empty()) {
907  if(!parsed["utc"].is_null()) utc = parsed["utc"].number_value();
908  if(!parsed["pos"].is_null()) pos.from_json(parsed["pos"].dump());
909  if(!parsed["att"].is_null()) att.from_json(parsed["att"].dump());
910  } else {
911  cerr<<"ERROR = "<<error<<endl;
912  }
913  return;
914  }
Definition: json11.hpp:79
double utc
Master time for location, in Modified Julian Day.
Definition: convertdef.h:879
void dump(std::string &out) const
attstruc att
attstruc for this time.
Definition: convertdef.h:883
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
void from_json(const string &js)
Set class contents from JSON string.
Definition: convertdef.h:790
void from_json(const string &js)
Set class contents from JSON string.
Definition: convertdef.h:855
posstruc pos
posstruc for this time.
Definition: convertdef.h:881

Member Data Documentation

double locstruc::utc = 0.

Master time for location, in Modified Julian Day.

posstruc locstruc::pos

posstruc for this time.

attstruc locstruc::att

attstruc for this time.


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