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

Heater Structure definition. More...

#include <jsondef.h>

Collaboration diagram for htrstruc:

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

bool state = true
 
float setvertex = 0.f
 Temperature set vertex. More...
 

Detailed Description

Heater Structure definition.

This structure holds the description of a heaters.

Member Function Documentation

json11::Json htrstruc::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
2715  {
2716  return json11::Json::object {
2717  { "state" , state },
2718  { "setvertex" , setvertex }
2719  };
2720  }
std::map< std::string, Json > object
Definition: json11.hpp:88
float setvertex
Temperature set vertex.
Definition: jsondef.h:2709
bool state
Definition: jsondef.h:2707
void htrstruc::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
2728  {
2729  string error;
2730  json11::Json parsed = json11::Json::parse(s,error);
2731  if(error.empty()) {
2732  if(!parsed["state"].is_null()) { state = parsed["state"].bool_value(); }
2733  if(!parsed["setvertex"].is_null()) { setvertex = parsed["setvertex"].number_value(); }
2734  } else {
2735  cerr<<"ERROR: <"<<error<<">"<<endl;
2736  }
2737  return;
2738  }
Definition: json11.hpp:79
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
float setvertex
Temperature set vertex.
Definition: jsondef.h:2709
bool bool_value() const
Definition: json11.cpp:282
bool state
Definition: jsondef.h:2707
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

bool htrstruc::state = true
float htrstruc::setvertex = 0.f

Temperature set vertex.


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