COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
jsonlib.h
Go to the documentation of this file.
1 /********************************************************************
2 * Copyright (C) 2015 by Interstel Technologies, Inc.
3 * and Hawaii Space Flight Laboratory.
4 *
5 * This file is part of the COSMOS/core that is the central
6 * module for COSMOS. For more information on COSMOS go to
7 * <http://cosmos-project.com>
8 *
9 * The COSMOS/core software is licenced under the
10 * GNU Lesser General Public License (LGPL) version 3 licence.
11 *
12 * You should have received a copy of the
13 * GNU Lesser General Public License
14 * If not, go to <http://www.gnu.org/licenses/>
15 *
16 * COSMOS/core is free software: you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of
19 * the License, or (at your option) any later version.
20 *
21 * COSMOS/core is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * Refer to the "licences" folder for further information on the
27 * condititons and terms to use this software.
28 ********************************************************************/
29 
30 #ifndef _JSONLIB_H
31 #define _JSONLIB_H 1
32 
37 
109 //#pragma GCC diagnostic ignored "-Wwrite-strings"
110 
111 #include "support/configCosmos.h"
112 
113 #include "support/jsondef.h"
114 #include "support/datalib.h"
115 #include "support/stringlib.h"
116 #include <limits>
117 using std::numeric_limits;
118 
122 
124 int32_t json_create_node(cosmosstruc *cinfo, string &node_name, uint16_t node_type=NODE_TYPE_COMPUTER);
125 int32_t json_create_cpu(string &node_name);
126 int32_t json_clone(cosmosstruc *cinfo);
127 int32_t json_clone(cosmosstruc *cinfo1, cosmosstruc *cinfo2);
128 int32_t json_repoint(cosmosstruc *cinfo);
129 void json_destroy(cosmosstruc *cinfo);
130 int32_t json_pushdevspec(uint16_t cidx, cosmosstruc *cinfo);
131 
132 int32_t json_createpiece(cosmosstruc *cinfo, string name, DeviceType ctype, double emi=1.0, double abs=1.0, double hcap=0.9, double hcon=205., double density=2710.);
133 int32_t json_addpiece(cosmosstruc *cinfo, string name, DeviceType ctype, double emi=1.0, double abs=1.0, double hcap=0.9, double hcon=205., double density=2710.);
134 int32_t json_findpiece(cosmosstruc *cinfo, string name);
135 int32_t json_findcomp(cosmosstruc *cinfo, string name);
136 int32_t json_finddev(cosmosstruc *cinfo, string name);
137 int32_t json_createport(cosmosstruc *cinfo, string name, PORT_TYPE type);
138 //uint16_t json_addequation(const char *text, cosmosstruc *cinfo, uint16_t unit);
139 int32_t json_addentry(string name, string value, cosmosstruc *cinfo);
140 int32_t json_addentry(jsonentry entry, cosmosstruc *cinfo);
141 int32_t json_addentry(string name, uint16_t d1, uint16_t d2, ptrdiff_t offset, uint16_t type, uint16_t group, cosmosstruc *cinfo, uint16_t unit=0);
142 int32_t json_addentry(string name, uint16_t d1, uint16_t d2, uint8_t *ptr, uint16_t type, cosmosstruc *cinfo, uint16_t unit=0);
143 int32_t json_toggleentry(string name, uint16_t d1, uint16_t d2, cosmosstruc *cinfo, bool state);
144 bool json_checkentry(string name, uint16_t d1, uint16_t d2, cosmosstruc *cinfo);
145 int32_t json_mapentries(cosmosstruc *cinfo);
146 int32_t json_mapbaseentries(cosmosstruc *cinfo);
147 int32_t json_mappieceentry(uint16_t pidx, cosmosstruc *cinfo);
148 int32_t json_togglepieceentry(uint16_t pidx, cosmosstruc *cinfo, bool state);
149 int32_t json_mapcompentry(uint16_t cidx, cosmosstruc *cinfo);
150 int32_t json_togglecompentry(uint16_t cidx, cosmosstruc *cinfo, bool state);
151 uint16_t json_mapdeviceentry(const devicestruc &device, cosmosstruc *cinfo);
152 int32_t json_toggledeviceentry(uint16_t didx, DeviceType type, cosmosstruc *cinfo, bool state);
153 uint16_t json_mapportentry(uint16_t portidx, cosmosstruc *cinfo);
154 int32_t json_toggleportentry(uint16_t portidx, cosmosstruc *cinfo, bool state);
155 int32_t json_mapvertexentry(uint16_t vidx, cosmosstruc *cinfo);
156 int32_t json_mapfaceentry(uint16_t fidx, cosmosstruc *cinfo);
157 size_t json_count_hash(uint16_t hash, cosmosstruc *cinfo);
158 size_t json_count_total(cosmosstruc *cinfo);
159 
160 uint8_t *json_ptr_of_offset(ptrdiff_t offset, uint16_t group, cosmosstruc *cinfo);
161 uint8_t *json_ptr_of_entry(const jsonentry &entry, cosmosstruc *cinfo);
162 jsonentry *json_entry_of(uint8_t *ptr, cosmosstruc *cinfo);
163 jsonentry *json_entry_of(string token, cosmosstruc *cinfo);
166 int32_t json_table_of_list(vector<jsonentry*> &entry, string tokens, cosmosstruc *cinfo);
167 uint16_t json_type_of_name(string token, cosmosstruc *cinfo);
168 
169 int32_t json_append(string &jstring, const char *tstring);
170 
171 int32_t json_out_value(string &jstring, string name, uint8_t *data, uint16_t type, cosmosstruc *cinfo);
172 int32_t json_out_handle(string &jstring, jsonhandle handle,cosmosstruc *cinfo);
173 int32_t json_out_entry(string &jstring, const jsonentry &entry, cosmosstruc *cinfo);
174 int32_t json_out(string &jstring, string token,cosmosstruc *cinfo);
175 int32_t json_out_list(string &jstring, string tokens, cosmosstruc *cinfo);
176 int32_t json_out_1d(string &jstring, const char *token, uint16_t col, cosmosstruc *cinfo);
177 int32_t json_out_2d(string &jstring,const char *token, uint16_t row, uint16_t col,cosmosstruc *cinfo);
178 int32_t json_out_name(string &jstring, string name);
179 int32_t json_out_character(string &jstring,char character);
180 int32_t json_out_type(string &jstring, uint8_t *data, uint16_t type, cosmosstruc *cinfo);
181 int32_t json_out_bool(string &jstring,bool value);
182 int32_t json_out_int8(string &jstring,int8_t value);
183 int32_t json_out_int16(string &jstring,int16_t value);
184 int32_t json_out_int32(string &jstring,int32_t value);
185 int32_t json_out_uint8(string &jstring,uint8_t value);
186 int32_t json_out_uint16(string &jstring,uint16_t value);
187 int32_t json_out_uint32(string &jstring,uint32_t value);
188 int32_t json_out_float(string &jstring,float value);
189 int32_t json_out_double(string &jstring,double value);
190 int32_t json_out_string(string &jstring, string ostring, uint16_t len);
191 int32_t json_out_vector(string &jstring,Vector value);
192 int32_t json_out_svector(string &jstring,svector value);
193 int32_t json_out_avector(string &jstring,avector value);
194 int32_t json_out_gvector(string &jstring,gvector value);
195 int32_t json_out_cvector(string &jstring,cvector value);
196 int32_t json_out_rvector(string &jstring,rvector value);
197 int32_t json_out_tvector(string &jstring,rvector value);
198 int32_t json_out_quaternion(string &jstring,quaternion value);
199 int32_t json_out_cartpos(string &jstring,cartpos value);
200 int32_t json_out_geoidpos(string &jstring,geoidpos value);
201 int32_t json_out_spherpos(string &jstring,spherpos value);
202 int32_t json_out_dcmatt(string &jstring, dcmatt value);
203 int32_t json_out_qatt(string &jstring,qatt value);
204 int32_t json_out_dcm(string &jstring,rmatrix value);
205 int32_t json_out_rmatrix(string &jstring,rmatrix value);
206 int32_t json_out_beatstruc(string &jstring,beatstruc value);
207 int32_t json_out_node(string &jstring, string value);
208 int32_t json_out_utcstart(string &jstring, double value);
209 int32_t json_out_ecipos(string &jstring,cartpos value);
210 int32_t json_out_posstruc(string &jstring,posstruc value);
211 int32_t json_out_attstruc(string &jstring,attstruc value);
212 int32_t json_out_locstruc(string &jstring,locstruc value);
213 int32_t json_out_commandevent(string &jstring, eventstruc event);
214 
215 uint8_t *json_ptrto(string token, cosmosstruc *cinfo);
216 uint8_t *json_ptrto_1d(const char *token, uint16_t index1, cosmosstruc *cinfo);
217 uint8_t *json_ptrto_2d(const char *token, uint16_t index1, uint16_t index2, cosmosstruc *cinfo);
218 
219 double json_equation(const char *&ptr, cosmosstruc *cinfo);
220 double json_equation(jsonequation *ptr, cosmosstruc *cinfo); // TODO: overload with json_equation
221 double json_equation(jsonhandle *handle, cosmosstruc *cinfo); // TODO: overload with json_equation
222 
223 int32_t json_get_int(jsonhandle &handle, cosmosstruc *cinfo);
224 int32_t json_get_int(string token, cosmosstruc *cinfo);
225 int32_t json_get_int(string token, uint16_t index1, cosmosstruc *cinfo);
226 int32_t json_get_int(string token, uint16_t index1, uint16_t index2, cosmosstruc *cinfo);
227 int32_t json_get_int(const jsonentry &entry, cosmosstruc *cinfo);
228 
229 uint32_t json_get_uint(jsonhandle &handle, cosmosstruc *cinfo);
230 uint32_t json_get_uint(string token, cosmosstruc *cinfo);
231 uint32_t json_get_uint(string token, uint16_t index1, cosmosstruc *cinfo);
232 uint32_t json_get_uint(string token, uint16_t index1, uint16_t index2, cosmosstruc *cinfo);
233 uint32_t json_get_uint(const jsonentry &entry, cosmosstruc *cinfo);
234 
236 double json_get_double(string token, cosmosstruc *cinfo);
237 double json_get_double(string token, uint16_t index1, cosmosstruc *cinfo);
238 double json_get_double(string token, uint16_t index1, uint16_t index2, cosmosstruc *cinfo);
239 double json_get_double(const jsonentry &entry, cosmosstruc *cinfo);
240 
241 rvector json_get_rvector(const jsonentry &entry, cosmosstruc *cinfo);
243 
244 string json_get_string(string token, cosmosstruc *cinfo);
245 string json_get_string(const jsonentry &entry, cosmosstruc *cinfo);
246 
247 posstruc json_get_posstruc(const jsonentry &entry, cosmosstruc *cinfo);
248 
249 int32_t json_set_number(double val, const jsonentry &entry, cosmosstruc *cinfo);
250 int32_t json_set_string(string val, const jsonentry &entry, cosmosstruc *cinfo);
251 
252 int32_t json_scan(char *istring);
253 
254 int32_t json_tokenize(string jstring, cosmosstruc *cinfo, vector <jsontoken> &tokens);
255 int32_t json_tokenize_namedmember(const char *&pointer, cosmosstruc *cinfo, jsontoken &token);
256 int32_t json_parse(string json, cosmosstruc *cinfo);
257 int32_t json_parse_namedmember(const char *&ptr, cosmosstruc *cinfo);
258 int32_t json_parse_value(const char* &ptr, uint16_t type, ptrdiff_t offset, uint16_t group, cosmosstruc *cinfo);
259 int32_t json_parse_value(const char* &ptr, const jsonentry &entry, cosmosstruc *cinfo);
260 int32_t json_parse_value(const char *&ptr, uint16_t type, uint8_t *data, cosmosstruc *cinfo);
261 int32_t json_parse_equation(const char* &ptr, string &equation);
262 int32_t json_parse_operand(const char* &ptr, jsonoperand *operand, cosmosstruc *cinfo);
263 int32_t json_extract_string(const char* &ptr, string &ostring);
264 int32_t json_extract_name(const char* &ptr, string &ostring);
265 
266 string json_extract_namedmember(string json, string token);
267 int32_t json_extract_value(const char *&ptr, string &value);
268 string json_convert_string(string object);
269 int32_t json_convert_int32(string object);
270 uint32_t json_convert_uint32(string object);
271 int16_t json_convert_int16(string object);
272 uint16_t json_convert_uint16(string object);
273 float json_convert_float(string object);
274 double json_convert_double(string object);
275 
276 int32_t json_parse_number(const char* &ptr, double *value);
277 int32_t json_skip_character(const char* &ptr, const char character);
278 int32_t json_skip_to_next_member(const char* &ptr);
279 int32_t json_skip_white(const char* &ptr);
280 int32_t json_clear_cosmosstruc(int32_t type, cosmosstruc *cinfo);
281 int32_t json_setup_node(jsonnode json, cosmosstruc *cinfo, bool create_flag = false);
282 int32_t json_setup_node(string &node, cosmosstruc *cinfo);
283 int32_t json_load_node(string node, jsonnode &json);
284 int32_t json_dump_node(cosmosstruc *cinfo);
285 int32_t json_recenter_node(cosmosstruc *cinfo);
286 
287 const char *json_of_wildcard(string &jstring, string wildcard, cosmosstruc *cinfo);
288 const char *json_of_list(string &jstring, string tokens, cosmosstruc *cinfo);
289 const char *json_of_table(string &jstring,vector<jsonentry*> entries,cosmosstruc *cinfo);
290 const char *json_of_node(string &jstring, cosmosstruc *cinfo);
291 const char *json_of_agent(string &jstring, cosmosstruc *cinfo);
292 const char *json_of_target(string &jstring, cosmosstruc *cinfo, uint16_t num);
293 const char *json_of_time(string &jstring, cosmosstruc *cinfo);
294 const char *json_of_beat(string &jstring, cosmosstruc *cinfo);
295 const char *json_of_beacon(string &jstring, cosmosstruc *cinfo);
296 const char *json_of_groundcontact(cosmosstruc *cinfo);
297 const char *json_of_soh(string &jstring, cosmosstruc *cinfo);
298 string json_list_of_soh(cosmosstruc *cinfo);
299 string json_list_of_fullsoh(cosmosstruc *cinfo);
300 string json_list_of_all(cosmosstruc *cinfo);
301 const char *json_of_utc(string &jstring, cosmosstruc *cinfo);
302 const char *json_of_state_eci(string &jstring, cosmosstruc *cinfo);
303 const char *json_of_state_geoc(string &jstring, cosmosstruc *cinfo);
304 const char *json_of_imu(string &jstring,uint16_t num, cosmosstruc *cinfo);
305 const char *json_of_rw(string &jstring,uint16_t index, cosmosstruc *cinfo);
306 const char *json_of_mtr(string &jstring,uint16_t index, cosmosstruc *cinfo);
307 const char *json_of_ephemeris(string &jstring, cosmosstruc *cinfo);
308 const char *json_of_groundstation(string &jstring, cosmosstruc *cinfo);
309 const char *json_of_event(string &jstring, cosmosstruc *cinfo);
310 const char *json_of_log(string &jstring, cosmosstruc *cinfo);
311 //char* json_of_command(string &jstring, string node, string name, string user, string type, double utc);
312 const char *json_node(string &jstring, cosmosstruc *cinfo);
313 const char *json_vertices(string &jstring, cosmosstruc *cinfo);
314 const char *json_faces(string &jstring, cosmosstruc *cinfo);
315 const char *json_pieces(string &jstring, cosmosstruc *cinfo);
316 const char *json_devices_general(string &jstring, cosmosstruc *cinfo);
317 const char *json_devices_specific(string &jstring, cosmosstruc *cinfo);
318 const char *json_ports(string &jstring, cosmosstruc *cinfo);
319 
320 void json_test(cosmosstruc *cinfo);
321 
322 uint16_t json_hash(string hstring);
323 //uint16_t json_hash2(const char *string);
324 //json_name *json_get_name_list();
325 uint32_t json_get_name_list_count(cosmosstruc *cinfo);
326 int32_t json_name_map(string name, cosmosstruc *cinfo, jsonhandle &handle);
327 int32_t json_equation_map(string equation, cosmosstruc *cinfo, jsonhandle *handle);
328 
329 bool json_static(char* json_extended_name);
330 bool json_dynamic(char* json_extended_name);
331 
332 int32_t node_init(string name, cosmosstruc *cinfo);
333 int32_t node_calc(cosmosstruc *cinfo);
334 void create_databases(cosmosstruc *cinfo);
335 //void load_databases(char *name, uint16_t type, cosmosstruc *cinfo);
336 size_t load_dictionary(vector<eventstruc> &dict, cosmosstruc *cinfo, const char *file);
337 int32_t load_target(cosmosstruc *cinfo);
338 int32_t update_target(cosmosstruc *cinfo);
340 size_t calc_events(vector<eventstruc> &dictionary, cosmosstruc *cinfo, vector<eventstruc> &events);
341 uint16_t device_type_index(string name);
342 string device_type_name(uint32_t type);
343 string port_type_name(uint32_t type);
344 
346 
347 std::ostream& operator<<(std::ostream& out, const beatstruc& b);
348 
349 
350 
351 
352 #endif
int32_t json_out_type(string &jstring, uint8_t *data, uint16_t type, cosmosstruc *cinfo)
Output JSON Value.
Definition: jsonlib.cpp:1393
int32_t json_out_1d(string &jstring, const char *token, uint16_t index, cosmosstruc *cinfo)
Perform JSON output for a single element of a 1D named JSON item.
Definition: jsonlib.cpp:2855
int32_t json_mapbaseentries(cosmosstruc *cinfo)
Add base entries to JMAP.
Definition: jsonlib.cpp:7368
const char * json_of_groundstation(string &jstring, cosmosstruc *cinfo)
int32_t load_target(cosmosstruc *cinfo)
Load Track list.
Definition: jsonlib.cpp:11208
string json_list_of_fullsoh(cosmosstruc *cinfo)
Definition: jsonlib.cpp:9529
int32_t json_out_bool(string &jstring, bool value)
Boolean to JSON.
Definition: jsonlib.cpp:1594
string json_list_of_soh(cosmosstruc *cinfo)
Definition: jsonlib.cpp:9252
const char * json_of_groundcontact(cosmosstruc *cinfo)
int32_t json_out_cvector(string &jstring, cvector value)
cvector to JSON
Definition: jsonlib.cpp:2086
size_t calc_events(vector< eventstruc > &dictionary, cosmosstruc *cinfo, vector< eventstruc > &events)
Calculate current Events.
Definition: jsonlib.cpp:11356
int32_t json_finddev(cosmosstruc *cinfo, string name)
Definition: jsonlib.cpp:755
int32_t json_out_attstruc(string &jstring, attstruc value)
attstruc to JSON
Definition: jsonlib.cpp:2446
Device structure.
Definition: jsondef.h:3692
int32_t json_recenter_node(cosmosstruc *cinfo)
Definition: jsonlib.cpp:6545
int32_t json_toggleportentry(uint16_t portidx, cosmosstruc *cinfo, bool state)
Toggle port entry.
Definition: jsonlib.cpp:8673
int32_t json_out_commandevent(string &jstring, eventstruc value)
Command event to JSON.
Definition: jsonlib.cpp:2554
Definition: jsondef.h:923
int32_t json_parse_operand(const char *&ptr, jsonoperand *operand, cosmosstruc *cinfo)
Parse the next JSON equation operand out of a JSON stream.
Definition: jsonlib.cpp:5120
uint16_t json_mapdeviceentry(const devicestruc &device, cosmosstruc *cinfo)
Add device entry.
Definition: jsonlib.cpp:7777
uint32_t json_convert_uint32(string object)
Quaternion Attitude.
Definition: convertdef.h:475
int32_t json_set_string(string val, const jsonentry &entry, cosmosstruc *cinfo)
Definition: jsonlib.cpp:5401
int32_t json_load_node(string node, jsonnode &json)
Map Name Space to global data structure components and pieces.
Definition: jsonlib.cpp:6326
float json_convert_float(string object)
Target structure.
Definition: jsondef.h:1290
PORT_TYPE
Definition: jsondef.h:644
3 element generic row vector
Definition: vector.h:53
int32_t json_setup_node(jsonnode json, cosmosstruc *cinfo, bool create_flag)
Setup JSON Namespace using Node description JSON.
Definition: jsonlib.cpp:6869
rvector json_get_rvector(const jsonentry &entry, cosmosstruc *cinfo)
Return rvector from entry.
Definition: jsonlib.cpp:3788
int32_t json_create_node(cosmosstruc *cinfo, string &node_name, uint16_t node_type)
Definition: jsonlib.cpp:517
size_t json_count_hash(uint16_t hash, cosmosstruc *cinfo)
Number of items in current JSON map with a specific hash.
Definition: jsonlib.cpp:1286
int32_t json_parse(string jstring, cosmosstruc *cinfo)
Parse JSON using Name Space.
Definition: jsonlib.cpp:4799
static antstruc target
Definition: agent_antenna.cpp:160
int32_t json_tokenize(string jstring, cosmosstruc *cinfo, vector< jsontoken > &tokens)
Tokenize using JSON Name Space.
Definition: jsonlib.cpp:4600
Direction Cosine Matrix Attitude.
Definition: convertdef.h:423
int32_t json_out_int32(string &jstring, int32_t value)
Signed 32 bit integer to JSON.
Definition: jsonlib.cpp:1652
const char * json_of_table(string &jstring, vector< jsonentry * > table, cosmosstruc *cinfo)
Create JSON stream from entries.
Definition: jsonlib.cpp:8733
Geodetic position structure.
Definition: convertdef.h:259
int32_t json_out_string(string &jstring, string ostring, uint16_t len)
String to JSON.
Definition: jsonlib.cpp:1764
Cartesian full position structure.
Definition: convertdef.h:158
int32_t json_out_gvector(string &jstring, gvector value)
gvector to JSON
Definition: jsonlib.cpp:1854
int32_t json_out_geoidpos(string &jstring, geoidpos value)
geoidpos to JSON
Definition: jsonlib.cpp:2175
int32_t json_out_quaternion(string &jstring, quaternion value)
quaternion to JSON
Definition: jsonlib.cpp:2054
int32_t update_target(cosmosstruc *cinfo)
Update Track list.
Definition: jsonlib.cpp:11262
uint32_t json_get_uint(jsonhandle &handle, cosmosstruc *cinfo)
Return unsigned integer from handle.
Definition: jsonlib.cpp:3524
int32_t json_out_entry(string &jstring, const jsonentry &entry, cosmosstruc *cinfo)
Perform JSON output for a single JSON entry.
Definition: jsonlib.cpp:1327
int32_t json_out_tvector(string &jstring, rvector value)
Quaternion, scalar last, using x, y, z.
Definition: vector.h:402
uint16_t json_mapportentry(uint16_t portidx, cosmosstruc *cinfo)
Add port entry.
Definition: jsonlib.cpp:8652
int32_t json_append(string &jstring, const char *tstring)
Extend JSON stream.
Definition: jsonlib.cpp:1546
int32_t json_parse_equation(const char *&ptr, string &equation)
Parse the next JSON equation out of a JSON stream.
Definition: jsonlib.cpp:5045
const char * json_of_beat(string &jstring, cosmosstruc *cinfo)
Create JSON Heart Beat string.
Definition: jsonlib.cpp:9039
int32_t json_out_value(string &jstring, string name, uint8_t *data, uint16_t type, cosmosstruc *cinfo)
Output JSON Pair.
Definition: jsonlib.cpp:1361
int32_t json_out(string &jstring, string token, cosmosstruc *cinfo)
Perform JSON output for a single named JSON item.
Definition: jsonlib.cpp:2905
int32_t json_out_uint32(string &jstring, uint32_t value)
Unsigned 32 bit integer to JSON.
Definition: jsonlib.cpp:1703
int32_t json_clear_cosmosstruc(int32_t type, cosmosstruc *cinfo)
Clear global data structure.
Definition: jsonlib.cpp:6268
void create_databases(cosmosstruc *cinfo)
Dump tab delimited database files.
Definition: jsonlib.cpp:11006
bool json_checkentry(string name, uint16_t d1, uint16_t d2, cosmosstruc *cinfo)
Check the enable state of an entry in the JSON Namespace map.
Definition: jsonlib.cpp:1258
const char * json_of_state_eci(string &jstring, cosmosstruc *cinfo)
Definition: jsonlib.cpp:9930
string json_get_string(string token, cosmosstruc *cinfo)
Return string from name.
Definition: jsonlib.cpp:4045
int32_t json_out_ecipos(string &jstring, cartpos value)
ECI position to JSON.
Definition: jsonlib.cpp:2324
uint32_t json_get_name_list_count(cosmosstruc *cinfo)
Definition: jsonlib.cpp:10810
uint8_t * json_ptrto(string token, cosmosstruc *cinfo)
Return the data pointer that matches a JSON name.
Definition: jsonlib.cpp:3283
string json_extract_namedmember(string json, string token)
Extract JSON value matching name.
Definition: jsonlib.cpp:4417
const char * json_of_utc(string &jstring, cosmosstruc *cinfo)
Definition: jsonlib.cpp:9211
int32_t json_out_int16(string &jstring, int16_t value)
Signed 16 bit integer to JSON.
Definition: jsonlib.cpp:1635
int32_t json_extract_value(const char *&ptr, string &value)
Extract next JSON value.
Definition: jsonlib.cpp:4477
int32_t json_out_uint16(string &jstring, uint16_t value)
Unsigned 16 bit integer to JSON.
Definition: jsonlib.cpp:1686
int32_t json_out_double(string &jstring, double value)
Perform JSON output for a single nonindexed double.
Definition: jsonlib.cpp:1741
cosmosstruc * json_init()
Initialize JSON pointer map.
Definition: jsonlib.cpp:454
jsonequation * json_equation_of(jsonhandle handle, cosmosstruc *cinfo)
Info on Namespace equation.
Definition: jsonlib.cpp:3224
int32_t json_out_name(string &jstring, string name)
Object name to JSON.
Definition: jsonlib.cpp:1577
void json_test(cosmosstruc *cinfo)
Definition: jsonlib.cpp:10552
bool json_static(char *json_extended_name)
const char * json_of_mtr(string &jstring, uint16_t index, cosmosstruc *cinfo)
Definition: jsonlib.cpp:9896
const char * json_of_state_geoc(string &jstring, cosmosstruc *cinfo)
Definition: jsonlib.cpp:9941
int32_t json_convert_int32(string object)
int32_t json_out_rvector(string &jstring, rvector value)
rvector to JSON
Definition: jsonlib.cpp:2018
uint16_t device_type_index(string name)
Definition: jsonlib.cpp:11386
int32_t json_out_spherpos(string &jstring, spherpos value)
spherpos to JSON
Definition: jsonlib.cpp:2224
static vector< eventstruc > events
Definition: propagator_simple.cpp:64
int32_t json_table_of_list(vector< jsonentry * > &table, string tokens, cosmosstruc *cinfo)
Output a vector of JSON entries.
Definition: jsonlib.cpp:3086
long b
Definition: jpegint.h:371
int32_t json_dump_node(cosmosstruc *cinfo)
Save Node entries to disk.
Definition: jsonlib.cpp:7233
Definition: convertdef.h:733
Data Management header file.
string node_name
Definition: agent_001.cpp:46
const char * json_ports(string &jstring, cosmosstruc *cinfo)
Dump Port description.
Definition: jsonlib.cpp:10536
double json_equation(const char *&ptr, cosmosstruc *cinfo)
Return the results of a JSON equation.
Definition: jsonlib.cpp:4294
int32_t node_init(string node, cosmosstruc *cinfo)
Initialize Node configuration.
Definition: jsonlib.cpp:10832
const char * json_node(string &jstring, cosmosstruc *cinfo)
Dump Node description.
Definition: jsonlib.cpp:9960
int32_t json_scan(char *istring)
JSON equation operand.
Definition: jsondef.h:846
uint8_t * json_ptr_of_offset(ptrdiff_t offset, uint16_t group, cosmosstruc *cinfo)
Address from offset.
Definition: jsonlib.cpp:3029
int32_t json_mapfaceentry(uint16_t fidx, cosmosstruc *cinfo)
Add face entry.
Definition: jsonlib.cpp:7605
jsonentry * json_entry_of(uint8_t *ptr, cosmosstruc *cinfo)
Info on Namespace address.
Definition: jsonlib.cpp:3124
int32_t json_skip_white(const char *&ptr)
Skip white space in JSON string.
Definition: jsonlib.cpp:5336
const char * json_devices_specific(string &jstring, cosmosstruc *cinfo)
Dump Specific Device description.
Definition: jsonlib.cpp:10158
3 element attitude vector.
Definition: vector.h:277
int32_t json_parse_number(const char *&ptr, double *number)
Parse the next number out of a JSON stream.
Definition: jsonlib.cpp:5269
int32_t json_equation_map(string equation, cosmosstruc *cinfo, jsonhandle *handle)
Get hash and index in JSON Equation map.
Definition: jsonlib.cpp:10609
3 element spherical vector
Definition: vector.h:167
JSON map offset entry.
Definition: jsondef.h:4164
3x3 element generic matrix
Definition: matrix.h:41
double json_get_double(jsonhandle &handle, cosmosstruc *cinfo)
Return double from handle.
Definition: jsonlib.cpp:3679
int32_t json_skip_to_next_member(const char *&ptr)
Skip to next COSMOS name in JSON string.
Definition: jsonlib.cpp:5354
posstruc json_get_posstruc(const jsonentry &entry, cosmosstruc *cinfo)
Return posstruc from entry.
Definition: jsonlib.cpp:4132
int32_t json_out_cartpos(string &jstring, cartpos value)
cartpos to JSON
Definition: jsonlib.cpp:2126
uint8_t * json_ptrto_2d(const char *token, uint16_t index1, uint16_t index2, cosmosstruc *cinfo)
int32_t json_out_int8(string &jstring, int8_t value)
Signed 8 bit integer to JSON.
Definition: jsonlib.cpp:1618
int32_t json_extract_string(const char *&ptr, string &ostring)
Parse the next JSON string out of a JSON stream.
Definition: jsonlib.cpp:5186
const char * json_pieces(string &jstring, cosmosstruc *cinfo)
Dump Piece description.
Definition: jsonlib.cpp:10055
int32_t json_toggledeviceentry(uint16_t didx, DeviceType type, cosmosstruc *cinfo, bool state)
Toggle device entry.
Definition: jsonlib.cpp:8234
int32_t json_out_node(string &jstring, string value)
Node name to JSON.
Definition: jsonlib.cpp:2274
int32_t json_tokenize_namedmember(const char *&ptr, cosmosstruc *cinfo, jsontoken &token)
Tokenize next JSON Named Pair.
Definition: jsonlib.cpp:4653
int32_t json_name_map(string name, cosmosstruc *cinfo, jsonhandle &handle)
Get hash and index in JSON Namespace map.
Definition: jsonlib.cpp:10581
Headers and definitions common to all COSMOS.
int32_t json_out_locstruc(string &jstring, locstruc value)
locstruc to JSON
Definition: jsonlib.cpp:2511
string name
Definition: cubesat2obj.cpp:6
bool json_dynamic(char *json_extended_name)
int32_t json_findcomp(cosmosstruc *cinfo, string name)
Definition: jsonlib.cpp:772
int32_t json_out_qatt(string &jstring, qatt value)
qatt to JSON
Definition: jsonlib.cpp:2677
size_t load_dictionary(vector< eventstruc > &dict, cosmosstruc *cinfo, const char *file)
Load Event Dictionary.
Definition: jsonlib.cpp:11313
const char * json_of_node(string &jstring, cosmosstruc *cinfo)
Create JSON Node string.
Definition: jsonlib.cpp:8826
int32_t json_mapcompentry(uint16_t cidx, cosmosstruc *cinfo)
Add component entry.
Definition: jsonlib.cpp:7708
Full COSMOS Event structure.
Definition: jsondef.h:1093
int32_t json_out_rmatrix(string &jstring, rmatrix value)
rmatrix to JSON
Definition: jsonlib.cpp:2760
const char * json_of_beacon(string &jstring, cosmosstruc *cinfo)
Create JSON Beacon string.
Definition: jsonlib.cpp:9059
int32_t json_out_vector(string &jstring, Vector value)
::Vector to JSON
Definition: jsonlib.cpp:1974
const char * json_of_imu(string &jstring, uint16_t num, cosmosstruc *cinfo)
Create JSON IMU string.
Definition: jsonlib.cpp:9154
int32_t json_out_uint8(string &jstring, uint8_t value)
Unsigned 8 bit integer to JSON.
Definition: jsonlib.cpp:1669
double json_convert_double(string object)
Convert JSON to double.
Definition: jsonlib.cpp:4574
int32_t json_toggleentry(string name, uint16_t d1, uint16_t d2, cosmosstruc *cinfo, bool state)
Toggle the enable state of an entry in the JSON Namespace map.
Definition: jsonlib.cpp:1224
int32_t json_out_dcm(string &jstring, rmatrix value)
rmatrix to JSON
Definition: jsonlib.cpp:2725
const char * json_of_event(string &jstring, cosmosstruc *cinfo)
Create JSON for an event.
Definition: jsonlib.cpp:9854
int32_t json_out_list(string &jstring, string tokens, cosmosstruc *cinfo)
Output a list of named JSON items.
Definition: jsonlib.cpp:2936
int32_t json_parse_namedmember(const char *&ptr, cosmosstruc *cinfo)
Parse next JSON Named Pair.
Definition: jsonlib.cpp:4847
gige_handle * handle
Definition: kpc9612p_recv.cpp:33
Spherical position structure.
Definition: convertdef.h:314
uint8_t * json_ptr_of_entry(const jsonentry &entry, cosmosstruc *cinfo)
Address from entry.
Definition: jsonlib.cpp:3004
JSON equation entry.
Definition: jsondef.h:865
void json_destroy(cosmosstruc *cinfo)
Remove JSON pointer map.
Definition: jsonlib.cpp:491
uint16_t json_convert_uint16(string object)
string port_type_name(uint32_t type)
JSON token.
Definition: jsondef.h:833
const char * json_of_soh(string &jstring, cosmosstruc *cinfo)
Definition: jsonlib.cpp:9828
const char * json_of_agent(string &jstring, cosmosstruc *cinfo)
Create JSON Agent string.
Definition: jsonlib.cpp:8923
const char * json_of_log(string &jstring, cosmosstruc *cinfo)
int32_t node_calc(cosmosstruc *cinfo)
Calculate Satellite configuration values.
Definition: jsonlib.cpp:10859
int32_t json_parse_value(const char *&ptr, const jsonentry &entry, cosmosstruc *cinfo)
Definition: jsonlib.cpp:5480
int32_t json_out_character(string &jstring, char character)
Single character to JSON.
Definition: jsonlib.cpp:1558
int32_t json_out_svector(string &jstring, svector value)
svector to JSON
Definition: jsonlib.cpp:1894
JSON handle.
Definition: jsondef.h:791
int32_t json_repoint(cosmosstruc *cinfo)
const char * json_of_ephemeris(string &jstring, cosmosstruc *cinfo)
Definition: jsonlib.cpp:9197
const char * json_faces(string &jstring, cosmosstruc *cinfo)
Dump Face description.
Definition: jsonlib.cpp:10016
DeviceType
Definition: jsondef.h:490
struct ip_mreq group
Definition: mcastclient.c:39
const char * json_of_list(string &jstring, string list, cosmosstruc *cinfo)
Create JSON stream from list.
Definition: jsonlib.cpp:8714
Definition: jsondef.h:724
int32_t json_togglepieceentry(uint16_t pidx, cosmosstruc *cinfo, bool state)
Toggle piece entry.
Definition: jsonlib.cpp:7674
int32_t json_mapentries(cosmosstruc *cinfo)
Definition: jsonlib.cpp:7324
int32_t json_out_beatstruc(string &jstring, beatstruc value)
beatstruc to JSON
Definition: jsonlib.cpp:2796
string json_convert_string(string object)
Convert JSON to string.
Definition: jsonlib.cpp:4557
string json_list_of_all(cosmosstruc *cinfo)
Get list of all Namespace names.
Definition: jsonlib.cpp:9225
static string source
Definition: ax25_recv.cpp:42
quaternion json_get_quaternion(const jsonentry &entry, cosmosstruc *cinfo)
Return quaternion from entry.
Definition: jsonlib.cpp:3884
const char * json_of_time(string &jstring, cosmosstruc *cinfo)
Create JSON Time string.
Definition: jsonlib.cpp:9012
int32_t json_out_float(string &jstring, float value)
Single precision floating vertex32_t to JSON.
Definition: jsonlib.cpp:1720
const char * json_of_wildcard(string &jstring, string wildcard, cosmosstruc *cinfo)
Create JSON stream from wildcard.
Definition: jsonlib.cpp:8692
stringlib include file A library providing functions for handling various types of string...
const char * json_of_rw(string &jstring, uint16_t index, cosmosstruc *cinfo)
Definition: jsonlib.cpp:9911
int32_t json_addpiece(cosmosstruc *cinfo, string name, DeviceType ctype, double emi, double abs, double hcap, double hcon, double density)
Add new piece.
Definition: jsonlib.cpp:808
int32_t json_createpiece(cosmosstruc *cinfo, string name, DeviceType ctype, double emi, double abs, double hcap, double hcon, double density)
Create new piece.
Definition: jsonlib.cpp:722
int32_t json_out_handle(string &jstring, jsonhandle handle, cosmosstruc *cinfo)
Perform JSON output for a JSON item by handle.
Definition: jsonlib.cpp:1313
int32_t json_get_int(jsonhandle &handle, cosmosstruc *cinfo)
Return integer from handle.
Definition: jsonlib.cpp:3360
int32_t json_skip_character(const char *&ptr, const char character)
Skip over a specific character in a JSON stream.
Definition: jsonlib.cpp:4972
string device_type_name(uint32_t type)
Definition: jsonlib.cpp:11399
int32_t json_addentry(string name, string value, cosmosstruc *cinfo)
int32_t json_out_utcstart(string &jstring, double value)
UTC Start to JSON.
Definition: jsonlib.cpp:2299
int32_t json_togglecompentry(uint16_t cidx, cosmosstruc *cinfo, bool state)
Toggle component entry.
Definition: jsonlib.cpp:7744
int32_t json_mapvertexentry(uint16_t vidx, cosmosstruc *cinfo)
Add vertex entry.
Definition: jsonlib.cpp:7580
Definition: cosmos-defs.h:99
int32_t json_out_2d(string &jstring, const char *token, uint16_t row, uint16_t col, cosmosstruc *cinfo)
Perform JSON output for a single element of a 2D named JSON item.
Definition: jsonlib.cpp:2881
const char * json_of_target(string &jstring, cosmosstruc *cinfo, uint16_t num)
Create JSON Track string.
Definition: jsonlib.cpp:8755
static string node
Definition: agent_monitor.cpp:126
Vector Class.
Definition: vector.h:672
std::ostream & operator<<(std::ostream &out, const beatstruc &b)
Definition: jsonlib.cpp:11422
Definition: jsondef.h:4199
int32_t json_out_dcmatt(string &jstring, dcmatt value)
Definition: jsonlib.cpp:2636
Definition: convertdef.h:823
3 element geodetic vector
Definition: vector.h:222
const char * json_vertices(string &jstring, cosmosstruc *cinfo)
Dump Vertex description.
Definition: jsonlib.cpp:9989
uint8_t * json_ptrto_1d(const char *token, uint16_t index1, cosmosstruc *cinfo)
size_t json_count_total(cosmosstruc *cinfo)
Number of items in the current JSON map.
Definition: jsonlib.cpp:1297
int32_t json_findpiece(cosmosstruc *cinfo, string name)
Definition: jsonlib.cpp:785
int32_t json_pushdevspec(uint16_t cidx, cosmosstruc *cinfo)
Definition: jsonlib.cpp:6671
uint16_t json_type_of_name(string token, cosmosstruc *cinfo)
Type of namespace name.
Definition: jsonlib.cpp:3261
Definition: convertdef.h:876
int16_t json_convert_int16(string object)
const char * json_devices_general(string &jstring, cosmosstruc *cinfo)
Dump General Device description.
Definition: jsonlib.cpp:10112
int32_t json_extract_name(const char *&ptr, string &ostring)
Parse the next variable name out of a JSON stream.
Definition: jsonlib.cpp:5003
static string device
Definition: ax25_recv.cpp:39
uint16_t json_hash(string hstring)
Calculate JSON HASH.
Definition: jsonlib.cpp:504
int32_t json_out_posstruc(string &jstring, posstruc value)
posstruc to JSON
Definition: jsonlib.cpp:2349
3 element cartesian vector
Definition: vector.h:107
int32_t json_clone(cosmosstruc *cinfo)
int32_t json_out_avector(string &jstring, avector value)
avector to JSON
Definition: jsonlib.cpp:1934
int32_t json_mappieceentry(uint16_t pidx, cosmosstruc *cinfo)
Add piece entry.
Definition: jsonlib.cpp:7635
int32_t json_createport(cosmosstruc *cinfo, string name, PORT_TYPE type)
Definition: jsonlib.cpp:1086
int32_t json_create_cpu(string &node_name)
Definition: jsonlib.cpp:545
int32_t json_set_number(double val, const jsonentry &entry, cosmosstruc *cinfo)
Definition: jsonlib.cpp:5442