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

Spherical position structure. More...

#include <convertdef.h>

Collaboration diagram for spherpos:

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

Detailed Description

Spherical position structure.

Structure containing 3 spherical vectors representing position, velocity and acceleration.

See also
svector

Member Function Documentation

json11::Json spherpos::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
330  {
331  return json11::Json::object {
332  { "utc" , utc },
333  { "s", s },
334  { "v", v },
335  { "a", a },
336  { "pass", static_cast<int>(pass) }
337  };
338  }
svector s
Position vector.
Definition: convertdef.h:318
std::map< std::string, Json > object
Definition: json11.hpp:88
svector v
Velocity vector.
Definition: convertdef.h:320
double utc
Definition: convertdef.h:316
svector a
Acceleration vector.
Definition: convertdef.h:322
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:324
void spherpos::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
346  {
347  string error;
348  json11::Json parsed = json11::Json::parse(js,error);
349  if(error.empty()) {
350  if(!parsed["utc"].is_null()) utc = parsed["utc"].number_value();
351  if(!parsed["s"].is_null()) s.from_json(parsed["s"].dump());
352  if(!parsed["v"].is_null()) v.from_json(parsed["v"].dump());
353  if(!parsed["a"].is_null()) a.from_json(parsed["a"].dump());
354  if(!parsed["pass"].is_null()) pass = parsed["pass"].int_value();
355  } else {
356  cerr<<"ERROR = "<<error<<endl;
357  }
358  return;
359  }
svector s
Position vector.
Definition: convertdef.h:318
Definition: json11.hpp:79
void dump(std::string &out) const
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:201
svector v
Velocity vector.
Definition: convertdef.h:320
double utc
Definition: convertdef.h:316
svector a
Acceleration vector.
Definition: convertdef.h:322
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:324

Member Data Documentation

double spherpos::utc = 0.
svector spherpos::s

Position vector.

svector spherpos::v

Velocity vector.

svector spherpos::a

Acceleration vector.

uint32_t spherpos::pass = 0

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


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