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

Cartesian full position structure. More...

#include <convertdef.h>

Collaboration diagram for cartpos:

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 of Position. More...
 
rvector s
 Location. More...
 
rvector v
 Velocity. More...
 
rvector a
 Acceleration. More...
 
uint32_t pass = 0.
 pass indicator: allows synchronization with other attitude and position values. More...
 

Detailed Description

Cartesian full position structure.

Cartesian position structure with three vectors specifying position, velocity and acceleration.

Member Function Documentation

json11::Json cartpos::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
176  {
177  return json11::Json::object {
178  { "utc" , utc },
179  { "s", s },
180  { "v", v },
181  { "a", a },
182  { "pass", static_cast<int>(pass) }
183  };
184  }
std::map< std::string, Json > object
Definition: json11.hpp:88
rvector a
Acceleration.
Definition: convertdef.h:167
double utc
UTC of Position.
Definition: convertdef.h:161
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:170
rvector s
Location.
Definition: convertdef.h:163
rvector v
Velocity.
Definition: convertdef.h:165
void cartpos::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
192  {
193  string error;
194  json11::Json parsed = json11::Json::parse(js,error);
195  if(error.empty()) {
196  if(!parsed["utc"].is_null()) utc = parsed["utc"].number_value();
197  if(!parsed["s"].is_null()) s.from_json(parsed["s"].dump());
198  if(!parsed["v"].is_null()) v.from_json(parsed["v"].dump());
199  if(!parsed["a"].is_null()) a.from_json(parsed["a"].dump());
200  if(!parsed["pass"].is_null()) pass = parsed["pass"].int_value();
201  } else {
202  cerr<<"ERROR = "<<error<<endl;
203  }
204  return;
205  }
Definition: json11.hpp:79
rvector a
Acceleration.
Definition: convertdef.h:167
double utc
UTC of Position.
Definition: convertdef.h:161
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:170
void dump(std::string &out) const
rvector s
Location.
Definition: convertdef.h:163
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:80
rvector v
Velocity.
Definition: convertdef.h:165

Member Data Documentation

double cartpos::utc = 0.

UTC of Position.

rvector cartpos::s

Location.

rvector cartpos::v

Velocity.

rvector cartpos::a

Acceleration.

uint32_t cartpos::pass = 0.

pass indicator: allows synchronization with other attitude and position values.


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