Go to the source code of this file.
Functions | |
int | count_json_array_elements (JsonNode *node) |
Counts the number of element in the Json array. More... | |
int | count_json_elements (JsonNode *node) |
Counts the number of element in the json node. More... | |
int | mbs_json_double (JsonNode *node, double *val_ptr, char *key, int read_write, int allow_missing) |
Link between double value and the specific key of a Json node or the current node. More... | |
int | mbs_json_get_double (JsonNode *node, double *val_ptr) |
Get the node value content a double. More... | |
int | mbs_json_set_double (JsonNode *node, double value) |
Set a double into a node. More... | |
int | mbs_json_string (JsonNode *node, char **str_ptr, const char *key, int mission, int allow_missing) |
Link between string value and the specific key of a Json node. More... | |
int | mbs_json_get_string (JsonNode *node, char **str_ptr) |
Get the node value content a double. More... | |
int | mbs_json_set_string (JsonNode *node, const char *string) |
Set a double into a node. More... | |
int | mbs_json_array (JsonNode *node, double **tab_ptr, int *size, const char *key, int mission, int allow_missing) |
Link an array (1D) value and the specific key of a Json node or the current node. More... | |
JsonNode * | mbs_json_add_array (JsonNode *root_node, double *array, int size, const char *key, int *err) |
Add or replace the array in the specified children of the root node. More... | |
int | mbs_json_tab (JsonNode *node, double ***tab_ptr, int size_1, int size_2, const char *key, int mission) |
Link between array (2D) value and the specific key of a Json node or the current node. More... | |
int | mbs_json_bool (JsonNode *node, int *val_ptr, char *key, int mission, int allow_missing) |
Link between bool value (int) and the specific key of a Json node or the current node. More... | |
int | mbs_json_get_bool (JsonNode *node, int *val_ptr) |
Get the node value content a bool as int. More... | |
int | mbs_json_set_bool (JsonNode *node, int value) |
Set a bool (int) into a node. More... | |
int | mbs_json_int (JsonNode *node, int *val_ptr, char *key, int read_write, int allow_missing) |
Link between integer value and the specific key of a Json node or the current node. More... | |
int | mbs_json_get_int (JsonNode *node, int *val_ptr) |
Get the node value content an integer. More... | |
int | mbs_json_set_int (JsonNode *node, int value) |
Set an integer into a node. More... | |
JsonNode * | mbs_json_save_mbs (MbsData *mbs_data, char *filename, int flag_q, int flag_qd, int flag_qdd, int flag_mass, int *err) |
Save the speficied status of the mbs in a json configuration node and file. More... | |
JsonNode * | load_and_create_json (const char *mbs_json_filename, int *err) |
int count_json_array_elements | ( | JsonNode * | node | ) |
Counts the number of element in the Json array.
[in] | node | The array node, if this is not a JSON_ARRAY then MBS_INFO_FAILURE is returned. |
int count_json_elements | ( | JsonNode * | node | ) |
Counts the number of element in the json node.
[in] | node | The Json node |
JsonNode* load_and_create_json | ( | const char * | mbs_json_filename, |
int * | err | ||
) |
JsonNode* mbs_json_add_array | ( | JsonNode * | root_node, |
double * | array, | ||
int | size, | ||
const char * | key, | ||
int * | err | ||
) |
Add or replace the array in the specified children of the root node.
[in,out] | root_node | The json node in which the array must be saved. NULL can be provided, in this case the array node has no parent |
[in] | array | The array of double to be saved. |
[in] | size | The number of element in the array. |
[in] | key | The name of the json array to be created. If a json node already exist with this key on the root node, it is freed then replaced by the array. If root_node is NULL, key is disregarded. |
[in,out] | err | Status code among MBS_INFO_SUCCESS and MBS_INFO_FAILURE. NULL can be provided, error will not be registered. |
int mbs_json_array | ( | JsonNode * | node, |
double ** | tab_ptr, | ||
int * | size, | ||
const char * | key, | ||
int | mission, | ||
int | allow_missing | ||
) |
Link an array (1D) value and the specific key of a Json node or the current node.
[in,out] | node | The Json node containing the targeted value. |
[in,out] | tab_ptr | The memory adress of the pointer to the array (to be read or set). if the pointer (tab_ptr[0]) is NULL and mission is READER a new array is allocated. |
[in,out] | size | The size of the array pointer by tab_ptr (if tab_ptr[0] is not NULL). |
[in] | key | The key of the json node to be used (to be read or set), if NULL the node is the array. |
[in] | mission | The mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER. |
[in] | allow_missing | Flag to disable failure (and message) if the key is missing, |
int mbs_json_bool | ( | JsonNode * | node, |
int * | val_ptr, | ||
char * | key, | ||
int | mission, | ||
int | allow_missing | ||
) |
Link between bool value (int) and the specific key of a Json node or the current node.
node | The Json node containing the targeted value. |
val_ptr | The memory containing the bool as integer (to be read or set) |
key | The key of the json node to be used (to be read or set). If null the node is used as target. |
mission | The mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER. |
allow_missing | Flag to disable failure (and message) if the key is missing. The return code is MBS_INFO_WARNING. |
int mbs_json_double | ( | JsonNode * | node, |
double * | val_ptr, | ||
char * | key, | ||
int | read_write, | ||
int | allow_missing | ||
) |
Link between double value and the specific key of a Json node or the current node.
node | The Json node containing the targeted value. |
val_ptr | The memory containing the double (to be read or set) |
key | The key of the json node to be used (to be read or set). If null the node is used as target. |
read_write | The mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER. |
allow_missing | Flag to disable failure (and message) if the key is missing. The return code is MBS_INFO_WARNING. |
int mbs_json_get_bool | ( | JsonNode * | node, |
int * | val_ptr | ||
) |
Get the node value content a bool as int.
The function convert the content of the node to double according to the node type. If the node is a JSON_STRING the following value are accepted:
node | The node to whose value must be read. |
val_ptr | The memory where to set the number. |
int mbs_json_get_double | ( | JsonNode * | node, |
double * | val_ptr | ||
) |
Get the node value content a double.
The function convert the content of the node to double according to the node type.
[in] | node | The node to whose value must be read. |
[out] | val_ptr | The memory where to set the number. |
int mbs_json_get_int | ( | JsonNode * | node, |
int * | val_ptr | ||
) |
Get the node value content an integer.
The function convert the content of the node to integer according to the node type.
[in] | node | The node to whose value must be read. |
[out] | val_ptr | The memory where to set the number. |
int mbs_json_get_string | ( | JsonNode * | node, |
char ** | str_ptr | ||
) |
Get the node value content a double.
The function convert the content of the node to double according to the node type.
If the string pointer is not pointing to NULL, memory is freed before allocating.
node | The node to whose value must be read. |
str_ptr | The memory adress of the pointer to the string (to be read or set). |
int mbs_json_int | ( | JsonNode * | node, |
int * | val_ptr, | ||
char * | key, | ||
int | read_write, | ||
int | allow_missing | ||
) |
Link between integer value and the specific key of a Json node or the current node.
node | The Json node containing the targeted value. |
val_ptr | The memory containing the integer (to be read or set) |
key | The key of the json node to be used (to be read or set). If null the node is used as target. |
read_write | The mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER. |
allow_missing | Flag to disable failure (and message) if the key is missing. The return code is MBS_INFO_WARNING. |
JsonNode* mbs_json_save_mbs | ( | MbsData * | mbs_data, |
char * | filename, | ||
int | flag_q, | ||
int | flag_qd, | ||
int | flag_qdd, | ||
int | flag_mass, | ||
int * | err | ||
) |
Save the speficied status of the mbs in a json configuration node and file.
Empty configuration files are not saved to disk, but are returned.
If unable to write the configuration to disk, the json configuration node is returned, but an error is set.
[in] | mbs_data | The multibody sytem to be saved |
[in] | filename | The name of the configuration file to be created. It contains path and extension. NULL can be provided, no file are created. |
[in] | flag_q | Flag to save joint coordinates. |
[in] | flag_qd | Flag to save joint velocities. |
[in] | flag_qdd | Flag to save joint accelerations. |
[in] | flag_mass | Flag to save bodies mass. |
[in,out] | err | err Status code among MBS_INFO_SUCCESS, MBS_INFO_FAILURE and MBS_INFO_WARNING. NULL can be provided, error will not be registered. |
int mbs_json_set_bool | ( | JsonNode * | node, |
int | value | ||
) |
Set a bool (int) into a node.
The function only accept JSON_BOOL, JSON_NUMBER and JSON_STRING nodes. The function convert the node to a JSON_BOOL.
node | The node to whose value must be set. |
value | The value to be set. |
int mbs_json_set_double | ( | JsonNode * | node, |
double | value | ||
) |
Set a double into a node.
The function only accept JSON_NUMBER and JSON_STRING nodes. In case of JSON_STRING an attempt is done to convert the node to JSON_NUMBER.
node | The node to whose value must be set. |
valule | The value to be set. |
int mbs_json_set_int | ( | JsonNode * | node, |
int | value | ||
) |
Set an integer into a node.
The function only accept JSON_NUMBER and JSON_STRING nodes. In case of JSON_STRING an attempt is done to convert the node to JSON_NUMBER.
node | The node to whose value must be set. |
valule | The value to be set. |
int mbs_json_set_string | ( | JsonNode * | node, |
const char * | string | ||
) |
Set a double into a node.
The function only accept JSON_NUMBER and JSON_STRING nodes. In case of JSON_STRING an attempt is done to convert the node to JSON_NUMBER.
node | The node to whose value must be set. |
string | The pointer to the string to be read. |
int mbs_json_string | ( | JsonNode * | node, |
char ** | str_ptr, | ||
const char * | key, | ||
int | mission, | ||
int | allow_missing | ||
) |
Link between string value and the specific key of a Json node.
node | The Json node containing the targeted value. |
str_ptr | The memory adress of the pointer to the string (to be read or set). For MBS_INFO_READER mission, if the pointer pointed by this variable is not NULL the memory is reallocated. |
key | The key of the json node to be used (to be read or set). |
mission | The mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER. |
allow_missing | Flag to disable failure (and message) if the key is missing. The return code is MBS_INFO_WARNING. |
int mbs_json_tab | ( | JsonNode * | node, |
double *** | tab_ptr, | ||
int | size_1, | ||
int | size_2, | ||
const char * | key, | ||
int | mission | ||
) |
Link between array (2D) value and the specific key of a Json node or the current node.
node | The Json node containing the targeted value. |
tab_ptr | The memory adress of the pointer to pointer to the array (to be read or set). if the pointer (tab_ptr[0]) is NULL and mission is READER a new array is allocated will be allocated but memory is NOT contigous. |
size_1 | The size along first axis of the array pointer by tab_ptr (if tab_ptr[0] is not NULL). |
size_2 | The size along second axis of the array pointer by tab_ptr (if tab_ptr[0] is not NULL). |
key | The key of the json node to be used (to be read or set), if NULL the node is the array. |
mission | The mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER. |