COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
Cosmos::wavefront::vertex Struct Reference

#include <objlib.h>

Collaboration diagram for Cosmos::wavefront::vertex:

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

size_t v =0
 
size_t vt =0
 
size_t vn =0
 

Member Function Documentation

json11::Json Cosmos::wavefront::vertex::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
28  {
29  return json11::Json::object {
30  { "v" , static_cast<double>(v) },
31  { "vt" , static_cast<double>(vt) },
32  { "vn" , static_cast<double>(vn) }
33  };
34  }
std::map< std::string, Json > object
Definition: json11.hpp:88
size_t vn
Definition: objlib.h:22
size_t v
Definition: objlib.h:20
size_t vt
Definition: objlib.h:21
void Cosmos::wavefront::vertex::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
42  {
43  string error;
45  if(error.empty()) {
46  if(!p["v"].is_null()) v = static_cast<size_t>(p["v"].number_value());
47  if(!p["vt"].is_null()) vt = static_cast<size_t>(p["vt"].number_value());
48  if(!p["vn"].is_null()) vn = static_cast<size_t>(p["vn"].number_value());
49  } else {
50  cerr<<"ERROR: <"<<error<<">"<<endl;
51  }
52  return;
53  }
Definition: json11.hpp:79
size_t vn
Definition: objlib.h:22
size_t v
Definition: objlib.h:20
static double * p
Definition: gauss_jackson_test.cpp:42
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
size_t vt
Definition: objlib.h:21

Member Data Documentation

size_t Cosmos::wavefront::vertex::v =0
size_t Cosmos::wavefront::vertex::vt =0
size_t Cosmos::wavefront::vertex::vn =0

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