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

Target structure. More...

#include <jsondef.h>

Collaboration diagram for targetstruc:

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

double utc = 0.
 
char name [40+1] = ""
 
uint16_t type = 0
 
float azfrom = 0.f
 
float elfrom = 0.f
 
float azto = 0.f
 
float elto = 0.f
 
double range = 0.
 
double close = 0.
 
float min = 0.f
 
locstruc loc
 

Detailed Description

Target structure.

Contains entries unique to each Target

Member Function Documentation

json11::Json targetstruc::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
1308  {
1309  return json11::Json::object {
1310  { "utc" , utc },
1311  { "name" , name },
1312  { "type" , type },
1313  { "azfrom" , azfrom },
1314  { "elfrom" , elfrom },
1315  { "azto" , azto },
1316  { "elto" , elto },
1317  { "range" , range },
1318  { "close" , close },
1319  { "min" , min },
1320  { "loc" , loc }
1321  };
1322  }
std::map< std::string, Json > object
Definition: json11.hpp:88
char name[40+1]
Definition: jsondef.h:1293
float azfrom
Definition: jsondef.h:1295
uint16_t type
Definition: jsondef.h:1294
float elto
Definition: jsondef.h:1298
double utc
Definition: jsondef.h:1292
float min
Definition: jsondef.h:1301
double range
Definition: jsondef.h:1299
double close
Definition: jsondef.h:1300
locstruc loc
Definition: jsondef.h:1302
float azto
Definition: jsondef.h:1297
float elfrom
Definition: jsondef.h:1296
void targetstruc::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
1330  {
1331  string error;
1332  json11::Json p = json11::Json::parse(s,error);
1333  if(error.empty()) {
1334  if(!p["utc"].is_null()) { utc = p["utc"].number_value(); }
1335  if(!p["name"].is_null()) { strcpy(name, p["name"].string_value().c_str()); }
1336  if(!p["type"].is_null()) { type = p["type"].int_value(); }
1337  if(!p["azfrom"].is_null()) { azfrom = p["azfrom"].number_value(); }
1338  if(!p["elfrom"].is_null()) { elfrom = p["elfrom"].number_value(); }
1339  if(!p["azto"].is_null()) { azto = p["azto"].number_value(); }
1340  if(!p["elto"].is_null()) { elto = p["elto"].number_value(); }
1341  if(!p["range"].is_null()) { range = p["range"].number_value(); }
1342  if(!p["close"].is_null()) { close = p["close"].number_value(); }
1343  if(!p["min"].is_null()) { min = p["min"].number_value(); }
1344  if(!p["loc"].is_null()) { loc.from_json(p["loc"].dump()); }
1345  } else {
1346  cerr<<"ERROR: <"<<error<<">"<<endl;
1347  }
1348  return;
1349  }
Definition: json11.hpp:79
char name[40+1]
Definition: jsondef.h:1293
float azfrom
Definition: jsondef.h:1295
uint16_t type
Definition: jsondef.h:1294
float elto
Definition: jsondef.h:1298
void from_json(const string &js)
Set class contents from JSON string.
Definition: convertdef.h:903
double utc
Definition: jsondef.h:1292
static double * p
Definition: gauss_jackson_test.cpp:42
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
float min
Definition: jsondef.h:1301
double range
Definition: jsondef.h:1299
double close
Definition: jsondef.h:1300
locstruc loc
Definition: jsondef.h:1302
float azto
Definition: jsondef.h:1297
float elfrom
Definition: jsondef.h:1296
int int_value() const
Definition: json11.cpp:281
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

double targetstruc::utc = 0.
char targetstruc::name[40+1] = ""
uint16_t targetstruc::type = 0
float targetstruc::azfrom = 0.f
float targetstruc::elfrom = 0.f
float targetstruc::azto = 0.f
float targetstruc::elto = 0.f
double targetstruc::range = 0.
double targetstruc::close = 0.
float targetstruc::min = 0.f
locstruc targetstruc::loc

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