![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
Load JSON file using jsmn utility. More...
#include <JsonCdl.hpp>
Classes | |
| struct | _cdl_info_t |
| Hold all info associated with a single CDL. More... | |
Public Member Functions | |
| JsonCdl () | |
| ~JsonCdl () | |
| int16 | registerCdl (const char *name, cdl_types_e cdl_type, uint8 cdl_size, void *data_ptr) |
| Register a CDL to be loaded. | |
| int16 | parseCdlFile (const char *file_data, uint32 file_len) |
| Parse a CDL file given at file_data. | |
Public Attributes | |
| uint32 | num_loaded_correct = 0 |
| uint32 | num_missing = 0 |
| uint32 | num_errors = 0 |
| uint32 | num_failed_registries = 0 |
Protected Member Functions | |
| int16 | _loadSingleCdl (const _cdl_info_t *cdl_info_ptr, const char *file_data, jsmntok_t *json_ptr, uint8 num_tok) |
| Load a single CDL from the json file. | |
Protected Attributes | |
| uint32 | _storage_index = 0 |
| _cdl_info_t | _cdls [NUM_CDLS] |
| Storage array for CDLs. | |
Load JSON file using jsmn utility.
The JsonCdl class is tasked with parsing CDLs stored in JSON format from json files stored in any location. It does not load the file, but takes a string of CDLs and 1) Loads them in 2) Counts missing CDLs 3) Counts CDLs that were loaded incorrectly
Templated parameters:
|
inline |
|
inline |
|
protected |
Load a single CDL from the json file.
| cdl_info_ptr | Pointer to cdl info struct |
| file_data | The file data loaded |
| tokens | Array of jsmn tokens to load |
| num_tokens | The number of tokens to utilize |
| int16 clockwerk::JsonCdl< NUM_CDLS, MAX_JSON_KEY_LEN, MAX_JSON_FIELD_LEN >::parseCdlFile | ( | const char * | file_data, |
| uint32 | file_len ) |
Parse a CDL file given at file_data.
| file_data | The file c string to parse. Must be valid c string |
| file_len | The length of the file |
| int16 clockwerk::JsonCdl< NUM_CDLS, MAX_JSON_KEY_LEN, MAX_JSON_FIELD_LEN >::registerCdl | ( | const char * | name, |
| cdl_types_e | cdl_type, | ||
| uint8 | cdl_size, | ||
| void * | data_ptr ) |
Register a CDL to be loaded.
| name | Name of the CDL. Must be a valid C string |
| cdl_type | The CDL type |
| size | The length of the CDL type, in number of values (NOT bytes) |
| data_ptr | Pointer to location at which CDL should be saved |
|
protected |
Storage array for CDLs.
|
protected |
| uint32 clockwerk::JsonCdl< NUM_CDLS, MAX_JSON_KEY_LEN, MAX_JSON_FIELD_LEN >::num_errors = 0 |
| uint32 clockwerk::JsonCdl< NUM_CDLS, MAX_JSON_KEY_LEN, MAX_JSON_FIELD_LEN >::num_failed_registries = 0 |
| uint32 clockwerk::JsonCdl< NUM_CDLS, MAX_JSON_KEY_LEN, MAX_JSON_FIELD_LEN >::num_loaded_correct = 0 |
| uint32 clockwerk::JsonCdl< NUM_CDLS, MAX_JSON_KEY_LEN, MAX_JSON_FIELD_LEN >::num_missing = 0 |