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

Full COSMOS Event structure. More...

#include <jsondef.h>

Collaboration diagram for eventstruc:

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.
 Time event is to start. More...
 
double utcexec = 0.
 Time event was executed. More...
 
char node [40+1] = ""
 Node for event. More...
 
char name [40+1] = ""
 Name of event. More...
 
char user [40+1] = ""
 User of event. More...
 
uint32_t flag = 0
 Event flags. More...
 
uint32_t type = 0
 Event type. More...
 
double value = 0.
 Value of condition. More...
 
double dtime = 0.
 Event initial time consumed. More...
 
double ctime = 0.
 Event continuous time consumed. More...
 
float denergy = 0.f
 Event initial energy consumed. More...
 
float cenergy = 0.f
 Event continuous energy consumed. More...
 
float dmass = 0.f
 Event initial mass consumed. More...
 
float cmass = 0.f
 Event continuous mass consumed. More...
 
float dbytes = 0.f
 Event initial bytes consumed. More...
 
float cbytes = 0.f
 Event continuous bytes consumed. More...
 
jsonhandle handle
 Handle of condition that caused event, NULL if timed event. More...
 
char data [(COSMOS_MAX_DATA)] = ""
 Event specific data. More...
 
char condition [(COSMOS_MAX_DATA)] = ""
 Condition that caused event, NULL if timed event. More...
 

Detailed Description

Full COSMOS Event structure.

This is the struct that holds each Event, along with associated resources and conditions.

Member Function Documentation

json11::Json eventstruc::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
1139  {
1140  return json11::Json::object {
1141  { "utc" , utc },
1142  { "utcexec" , utcexec },
1143  { "node" , node },
1144  { "name" , name },
1145  { "user" , user },
1146  { "flag" , static_cast<int>(flag) },
1147  { "type" , static_cast<int>(type) },
1148  { "value" , value },
1149  { "dtime" , dtime },
1150  { "ctime" , ctime },
1151  { "denergy" , denergy },
1152  { "cenergy" , cenergy },
1153  { "dmass" , dmass },
1154  { "cmass" , cmass },
1155  { "dbytes" , dbytes },
1156  { "cbytes" , cbytes },
1157  { "handle" , handle },
1158  { "data" , data },
1159  { "condition" , condition }
1160  };
1161  }
float cbytes
Event continuous bytes consumed.
Definition: jsondef.h:1127
std::map< std::string, Json > object
Definition: json11.hpp:88
float cmass
Event continuous mass consumed.
Definition: jsondef.h:1123
float dmass
Event initial mass consumed.
Definition: jsondef.h:1121
double utcexec
Time event was executed.
Definition: jsondef.h:1098
float denergy
Event initial energy consumed.
Definition: jsondef.h:1117
jsonhandle handle
Handle of condition that caused event, NULL if timed event.
Definition: jsondef.h:1129
char condition[(COSMOS_MAX_DATA)]
Condition that caused event, NULL if timed event.
Definition: jsondef.h:1133
double dtime
Event initial time consumed.
Definition: jsondef.h:1113
double utc
Time event is to start.
Definition: jsondef.h:1096
double ctime
Event continuous time consumed.
Definition: jsondef.h:1115
char node[40+1]
Node for event.
Definition: jsondef.h:1100
char data[(COSMOS_MAX_DATA)]
Event specific data.
Definition: jsondef.h:1131
uint32_t type
Event type.
Definition: jsondef.h:1109
double value
Value of condition.
Definition: jsondef.h:1111
uint32_t flag
Event flags.
Definition: jsondef.h:1107
float dbytes
Event initial bytes consumed.
Definition: jsondef.h:1125
char name[40+1]
Name of event.
Definition: jsondef.h:1103
float cenergy
Event continuous energy consumed.
Definition: jsondef.h:1119
char user[40+1]
User of event.
Definition: jsondef.h:1105
void eventstruc::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
1169  {
1170  string error;
1171  json11::Json p = json11::Json::parse(s,error);
1172  if(error.empty()) {
1173  if(!p["utc"].is_null()) { utc = p["utc"].number_value(); }
1174  if(!p["utcexec"].is_null()) { utcexec = p["utcexec"].number_value(); }
1175  if(!p["node"].is_null()) { strcpy(node, p["node"].string_value().c_str()); }
1176  if(!p["name"].is_null()) { strcpy(name, p["name"].string_value().c_str()); }
1177  if(!p["user"].is_null()) { strcpy(user, p["user"].string_value().c_str()); }
1178  if(!p["flag"].is_null()) { flag = p["flag"].int_value(); }
1179  if(!p["type"].is_null()) { type = p["type"].int_value(); }
1180  if(!p["value"].is_null()) { value = p["value"].number_value(); }
1181  if(!p["dtime"].is_null()) { dtime = p["dtime"].number_value(); }
1182  if(!p["ctime"].is_null()) { ctime = p["ctime"].number_value(); }
1183  if(!p["denergy"].is_null()) { denergy = p["denergy"].number_value(); }
1184  if(!p["cenergy"].is_null()) { cenergy = p["cenergy"].number_value(); }
1185  if(!p["dmass"].is_null()) { dmass = p["dmass"].number_value(); }
1186  if(!p["cmass"].is_null()) { cmass = p["cmass"].number_value(); }
1187  if(!p["dbytes"].is_null()) { dbytes = p["dbytes"].number_value(); }
1188  if(!p["cbytes"].is_null()) { cbytes = p["cbytes"].number_value(); }
1189  if(!p["handle"].is_null()) { handle.from_json(p["handle"].dump()); }
1190  if(!p["data"].is_null()) { strcpy(data, p["data"].string_value().c_str()); }
1191  if(!p["condition"].is_null()) { strcpy(condition, p["condition"].string_value().c_str()); }
1192  } else {
1193  cerr<<"ERROR: <"<<error<<">"<<endl;
1194  }
1195  return;
1196  }
float cbytes
Event continuous bytes consumed.
Definition: jsondef.h:1127
Definition: json11.hpp:79
float cmass
Event continuous mass consumed.
Definition: jsondef.h:1123
float dmass
Event initial mass consumed.
Definition: jsondef.h:1121
double utcexec
Time event was executed.
Definition: jsondef.h:1098
float denergy
Event initial energy consumed.
Definition: jsondef.h:1117
jsonhandle handle
Handle of condition that caused event, NULL if timed event.
Definition: jsondef.h:1129
static double * p
Definition: gauss_jackson_test.cpp:42
char condition[(COSMOS_MAX_DATA)]
Condition that caused event, NULL if timed event.
Definition: jsondef.h:1133
double dtime
Event initial time consumed.
Definition: jsondef.h:1113
double utc
Time event is to start.
Definition: jsondef.h:1096
double ctime
Event continuous time consumed.
Definition: jsondef.h:1115
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
char node[40+1]
Node for event.
Definition: jsondef.h:1100
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:815
char data[(COSMOS_MAX_DATA)]
Event specific data.
Definition: jsondef.h:1131
uint32_t type
Event type.
Definition: jsondef.h:1109
double value
Value of condition.
Definition: jsondef.h:1111
uint32_t flag
Event flags.
Definition: jsondef.h:1107
float dbytes
Event initial bytes consumed.
Definition: jsondef.h:1125
char name[40+1]
Name of event.
Definition: jsondef.h:1103
float cenergy
Event continuous energy consumed.
Definition: jsondef.h:1119
int int_value() const
Definition: json11.cpp:281
double number_value() const
Definition: json11.cpp:280
char user[40+1]
User of event.
Definition: jsondef.h:1105

Member Data Documentation

double eventstruc::utc = 0.

Time event is to start.

double eventstruc::utcexec = 0.

Time event was executed.

char eventstruc::node[40+1] = ""

Node for event.

char eventstruc::name[40+1] = ""

Name of event.

char eventstruc::user[40+1] = ""

User of event.

uint32_t eventstruc::flag = 0

Event flags.

uint32_t eventstruc::type = 0

Event type.

double eventstruc::value = 0.

Value of condition.

double eventstruc::dtime = 0.

Event initial time consumed.

double eventstruc::ctime = 0.

Event continuous time consumed.

float eventstruc::denergy = 0.f

Event initial energy consumed.

float eventstruc::cenergy = 0.f

Event continuous energy consumed.

float eventstruc::dmass = 0.f

Event initial mass consumed.

float eventstruc::cmass = 0.f

Event continuous mass consumed.

float eventstruc::dbytes = 0.f

Event initial bytes consumed.

float eventstruc::cbytes = 0.f

Event continuous bytes consumed.

jsonhandle eventstruc::handle

Handle of condition that caused event, NULL if timed event.

char eventstruc::data[(COSMOS_MAX_DATA)] = ""

Event specific data.

char eventstruc::condition[(COSMOS_MAX_DATA)] = ""

Condition that caused event, NULL if timed event.


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