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

3 element spherical vector More...

#include <vector.h>

Collaboration diagram for svector:

Public Member Functions

 svector ()
 
 svector (double tphi, double tlambda, double tr)
 
json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &s)
 Set class contents from JSON string. More...
 

Public Attributes

double phi = 0.
 N/S in radians. More...
 
double lambda = 0.
 E/W in radians. More...
 
double r = 0.
 Radius in meters. More...
 

Detailed Description

3 element spherical vector

3 double precision numbers representing a vector in a spherical space. Lambda increases east.

Constructor & Destructor Documentation

svector::svector ( )
inline
176 {}
svector::svector ( double  tphi,
double  tlambda,
double  tr 
)
inline
177  {
178  phi = tphi;
179  lambda = tlambda;
180  r = tr;
181  }
double lambda
E/W in radians.
Definition: vector.h:172
double phi
N/S in radians.
Definition: vector.h:170
double r
Radius in meters.
Definition: vector.h:174

Member Function Documentation

json11::Json svector::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
187  {
188  return json11::Json::object {
189  { "phi" , phi },
190  { "lambda" , lambda },
191  { "r" , r }
192  };
193  }
std::map< std::string, Json > object
Definition: json11.hpp:88
double lambda
E/W in radians.
Definition: vector.h:172
double phi
N/S in radians.
Definition: vector.h:170
double r
Radius in meters.
Definition: vector.h:174
void svector::from_json ( const string &  s)
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
201  {
202  string error;
203  json11::Json parsed = json11::Json::parse(s,error);
204  if(error.empty()) {
205  if(!parsed["phi"].is_null()) phi = parsed["phi"].number_value();
206  if(!parsed["lambda"].is_null()) lambda = parsed["lambda"].number_value();
207  if(!parsed["r"].is_null()) r = parsed["r"].number_value();
208  } else {
209  cerr<<"ERROR: <"<<error<<">"<<endl;
210  }
211  return;
212  }
Definition: json11.hpp:79
double lambda
E/W in radians.
Definition: vector.h:172
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
double phi
N/S in radians.
Definition: vector.h:170
double r
Radius in meters.
Definition: vector.h:174

Member Data Documentation

double svector::phi = 0.

N/S in radians.

double svector::lambda = 0.

E/W in radians.

double svector::r = 0.

Radius in meters.


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