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

#include <convertdef.h>

Collaboration diagram for attstruc:

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.
 
qatt topo
 
qatt lvlh
 
qatt geoc
 
qatt selc
 
qatt icrf
 
extraatt extra
 

Member Function Documentation

json11::Json attstruc::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
837  {
838  return json11::Json::object {
839  { "utc" , utc },
840  { "topo" , topo },
841  { "lvlh" , lvlh },
842  { "geoc" , geoc },
843  { "selc" , selc },
844  { "icrf" , icrf },
845  { "extra" , extra }
846  };
847  }
std::map< std::string, Json > object
Definition: json11.hpp:88
qatt geoc
Definition: convertdef.h:828
qatt lvlh
Definition: convertdef.h:827
qatt selc
Definition: convertdef.h:829
qatt icrf
Definition: convertdef.h:830
qatt topo
Definition: convertdef.h:826
extraatt extra
Definition: convertdef.h:831
double utc
Definition: convertdef.h:825
void attstruc::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
855  {
856  string error;
857  json11::Json parsed = json11::Json::parse(js,error);
858  if(error.empty()) {
859  if(!parsed["utc"].is_null()) utc = parsed["utc"].number_value();
860  if(!parsed["topo"].is_null()) topo.from_json(parsed["utc"].dump());
861  if(!parsed["lvlh"].is_null()) lvlh.from_json(parsed["lvlh"].dump());
862  if(!parsed["geoc"].is_null()) geoc.from_json(parsed["geoc"].dump());
863  if(!parsed["selc"].is_null()) selc.from_json(parsed["selc"].dump());
864  if(!parsed["icrf"].is_null()) icrf.from_json(parsed["icrf"].dump());
865  if(!parsed["extra"].is_null()) extra.from_json(parsed["extra"].dump());
866  } else {
867  cerr<<"ERROR = "<<error<<endl;
868  }
869  return;
870  }
qatt geoc
Definition: convertdef.h:828
Definition: json11.hpp:79
qatt lvlh
Definition: convertdef.h:827
void dump(std::string &out) const
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
qatt selc
Definition: convertdef.h:829
void from_json(const string &js)
Set class contents from JSON string.
Definition: convertdef.h:507
qatt icrf
Definition: convertdef.h:830
qatt topo
Definition: convertdef.h:826
void from_json(const string &js)
Set class contents from JSON string.
Definition: convertdef.h:716
extraatt extra
Definition: convertdef.h:831
double utc
Definition: convertdef.h:825

Member Data Documentation

double attstruc::utc = 0.
qatt attstruc::topo
qatt attstruc::lvlh
qatt attstruc::geoc
qatt attstruc::selc
qatt attstruc::icrf
extraatt attstruc::extra

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