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

3x3 element cartesian matrix More...

#include <matrix.h>

Collaboration diagram for cmatrix:

Public Member Functions

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

cvector r1
 Row 1. More...
 
cvector r2
 Row 2. More...
 
cvector r3
 Row 3. More...
 

Detailed Description

3x3 element cartesian matrix

3 cvector elements representing 3 rows of a matrix in a right handed cartesian system

Member Function Documentation

json11::Json cmatrix::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
109  {
110  return json11::Json::object {
111  { "r1" , r1 },
112  { "r2" , r2 },
113  { "r3" , r3 }
114  };
115  }
std::map< std::string, Json > object
Definition: json11.hpp:88
cvector r1
Row 1.
Definition: matrix.h:99
cvector r3
Row 3.
Definition: matrix.h:103
cvector r2
Row 2.
Definition: matrix.h:101
void cmatrix::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
123  {
124  string error;
125  json11::Json parsed = json11::Json::parse(s,error);
126  if(error.empty()) {
127  if(!parsed["r1"].is_null()) r1.from_json(parsed["r1"].dump());
128  if(!parsed["r2"].is_null()) r2.from_json(parsed["r2"].dump());
129  if(!parsed["r3"].is_null()) r3.from_json(parsed["r3"].dump());
130  } else {
131  cerr<<"ERROR: <"<<error<<">"<<endl;
132  }
133  return;
134  }
Definition: json11.hpp:79
cvector r1
Row 1.
Definition: matrix.h:99
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:150
cvector r3
Row 3.
Definition: matrix.h:103
cvector r2
Row 2.
Definition: matrix.h:101

Member Data Documentation

cvector cmatrix::r1

Row 1.

cvector cmatrix::r2

Row 2.

cvector cmatrix::r3

Row 3.


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