#include "mbs_binder_public.h"
#include "mbs_load_struct.h"
#include "mbs_path.h"
#include "mbs_saver.h"
#include "mbs_xml_binder_private.h"
#include "mbs_define.h"
#include "mbs_errors_names.h"
#include "mbs_binder_private.h"
#include <errno.h>
#include <float.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include "mbs_message.h"
Macros | |
#define | MSG_ERR ">> XML>> " |
#define | MSG_PRE " >> " |
Functions | |
int | get_int_xlm_node (xmlNodePtr in_node) |
GET functions ///////////////////////. More... | |
int | get_int_xlm_attr (xmlAttrPtr in_node) |
double | get_double_xlm_node (xmlNodePtr in_node) |
int | get_string_xml_node (xmlNodePtr in_node, char **dest) |
int | get_string_xml_attr (xmlAttrPtr in_node, char **dest) |
int | get_string_xml_node_2 (char **string_ptr, xmlNodePtr in_node) |
int | set_double_xlm_node (xmlNodePtr in_node, double value) |
SET functions ///////////////////////. More... | |
int | set_char_xlm_node (xmlNodePtr in_node, const char *text) |
int | compare_char_xml_node (xmlNodePtr in_node, const char *text) |
COMPARE functions ///////////////////. More... | |
xmlNodePtr | new_double_xlm_node (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content, double value) |
Creation functions //////////////////. More... | |
xmlNodePtr | new_char_xlm_node (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content, const char *text) |
xmlNodePtr | mbs_xmlNewDocNode_xyz (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content, double value) |
xmlNodePtr | mbs_xmlNewDocNode_attr_rgb (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content, char *R, char *G, char *B) |
int | cmp_string_xml_attr (xmlAttrPtr in_node, const char *string) |
other functions ///////////////////// More... | |
xmlNodePtr | find_xmlNodePtr (xmlNodePtr node, char *name) |
xmlNodePtr | mbs_info_find_children_xml (xmlNodePtr node, const char *name) |
Return the children whose name matches. More... | |
xmlNodePtr | get_basebody_node (xmlDocPtr doc) |
Look for the base node in the document. More... | |
xmlNodePtr | get_bodytree_node (xmlDocPtr doc) |
Look for the bodytree node in the document. More... | |
xmlNodePtr | get_body_node (xmlNodePtr bodytree, const char *body_name) |
Look for the specified body node in the tree. More... | |
xmlNodePtr | get_basebody_3Dshapes (xmlDocPtr doc, int create) |
Look for the node containing the 3D shape (x3D) of the base node. More... | |
xmlNodePtr | get_point_node (xmlNodePtr body_node, const char *point_name, int allow_new, double coords_2d[2]) |
Look for the specified point node in the body or base node. More... | |
xmlNodePtr | get_body_3Dshapes (xmlDocPtr doc, const char *body_name) |
Look for the node containing the 3D shape (x3D) of the specified body. More... | |
xmlNodePtr | create_shape (xmlNodePtr parent_node, const char *shape_name, char *shape_nature) |
xmlNodePtr | get_inline_shape (xmlNodePtr shape3D_node, const char *shape_name, int allow_creation) |
Look for the specified inline shape. More... | |
xmlNodePtr | get_base_shape (xmlNodePtr shape3D_node, const char *shape_name, int nature, int allow_creation) |
Look for the specified basic shape. More... | |
xmlNodePtr | get_basebody_point (xmlDocPtr doc, const char *point_name, int allow_new) |
Look for the specified point node on the base. More... | |
xmlNodePtr | get_body_point (xmlDocPtr doc, const char *body_name, const char *point_name, int allow_new) |
Look for the specified point node on the specified body. More... | |
xmlNodePtr | get_links_node (xmlDocPtr doc, int create) |
Look for the node containing all the links. More... | |
int | mbs_info_coordinates_xml_binder (double *coordinates_pointer, xmlNodePtr node, int mission) |
Binders /////////////////////////////. More... | |
int | mbs_info_sensor_xml_binder (MbsInfoSensor *mbs_info_sensor, xmlNodePtr node, int mission) |
int | mbs_info_extforce_xml_binder (MbsInfoExtforce *mbs_info_extforce, xmlNodePtr node, int mission) |
int | mbs_info_joint_xml_binder (MbsInfoJoint *mbs_info_joint, xmlNodePtr node, int mission, int verbose) |
int | mbs_info_joint_list_xml_binder (MbsInfoJoint **joint_list, xmlNodePtr node, int mission, int verbose) |
int | mbs_info_point_xml_binder (MbsInfoPoint *mbs_info_point, xmlNodePtr node, int mission) |
int | mbs_info_point_list_xml_binder (MbsInfoPoint **point_list, xmlNodePtr node, int mission, char *body_name) |
int | mbs_info_ref_point_xml_binder (MbsInfoRefPoint *mbs_info_ref_point, xmlNodePtr node, int mission) |
int | mbs_info_base_xml_binder (MbsInfoBase *mbs_info_base, xmlNodePtr node, int mission) |
int | mbs_info_body_xml_binder (MbsInfoBody *mbs_info_body, xmlNodePtr node, int mission, int verbose) |
int | mbs_info_bodytree_xml_binder (MbsInfoBodytree *mbs_info_bodytree, xmlNodePtr node, int mission, int verbose) |
int | mbs_info_ball_xml_binder (MbsInfoBall *mbs_info_ball, xmlNodePtr node, int mission) |
int | mbs_info_rod_xml_binder (MbsInfoRod *mbs_info_rod, xmlNodePtr node, int mission) |
int | mbs_info_solid_xml_binder (MbsInfoSolid *mbs_info_solid, xmlNodePtr node, int mission) |
int | mbs_info_cuts_xml_binder (MbsInfoCuts *mbs_info_cuts, xmlNodePtr node, int mission) |
int | mbs_info_link_xml_binder (MbsInfoLink *mbs_info_link, xmlNodePtr node, int mission) |
int | mbs_info_links_xml_binder (MbsInfoLinks *mbs_info_links, xmlNodePtr node, int mission) |
int | mbs_info_parameter_xml_binder (MbsInfoParameter *mbs_info_parameter, xmlNodePtr node, int mission) |
int | mbs_info_user_model_xml_binder (MbsInfoUserModel *mbs_info_user_model, xmlNodePtr node, int mission) |
int | mbs_info_user_models_xml_binder (MbsInfoUserModels *mbs_info_user_models, xmlNodePtr node, int mission, int verbose) |
int | mbs_info_user_IO_xml_binder (MbsInfoUserIO *mbs_info_user_IO, xmlNodePtr node, int mission) |
int | mbs_info_user_IOs_xml_binder (MbsInfoUserIOs *mbs_info_user_IOs, xmlNodePtr node, int mission, int verbose) |
int | mbs_info_mbsDescR7_binder (MbsInfos *mbs_infos, xmlDocPtr doc, int mission) |
xmlDocPtr | mbs_xml_get_doc (const char *mbs_xml_name) |
Load an xml file to memory. More... | |
void * | mbs_xml_free_clean (xmlDocPtr doc) |
Free the xml document and clean the xml library parser. More... | |
int | mbs_xml_info_to_loader (MbsLoader *mbs_loader, const char *mbs_xml_name) |
Load and store the specified xml file into both MbsInfo and xmlDocPtr format. More... | |
int | mbs_info_mbs_linker (MbsInfos *mbs_info, int mission) |
int | mbs_info_init_and_binderXML (MbsInfos *mbs_infos, const char *mbs_xml_name, int mission) |
int | mbs_info_update_inlines_xml (MbsLoader *mbs_loader, UpdateInline *up_in, int allow_new) |
Update, or create this inline and all next inlines in the linked list. More... | |
int | mbs_info_update_shapes_xml (MbsLoader *mbs_loader, UpdateShape *up_in, int allow_new) |
Update, or create this 3D shape and all next 3D shapes in the linked list. More... | |
int | mbs_info_update_extforces_xml (MbsLoader *mbs_loader, UpdateExtForces *frc, int allow_new) |
Update, or create this external force all next ExtFrc in the linked list. More... | |
int | mbs_info_update_linkforce_xml (MbsLoader *mbs_loader, UpdateLinkForces *lnk, int allow_new) |
Update, or create the provided link force. More... | |
#define MSG_ERR ">> XML>> " |
#define MSG_PRE " >> " |
int cmp_string_xml_attr | ( | xmlAttrPtr | in_node, |
const char * | string | ||
) |
other functions /////////////////////
int compare_char_xml_node | ( | xmlNodePtr | in_node, |
const char * | text | ||
) |
COMPARE functions ///////////////////.
Compare the string in an XML node with a provided string.
[in] | in_node | The node whose content must be a string to be compared. |
[in] | text | The string to be compared with the node. |
xmlNodePtr create_shape | ( | xmlNodePtr | parent_node, |
const char * | shape_name, | ||
char * | shape_nature | ||
) |
xmlNodePtr find_xmlNodePtr | ( | xmlNodePtr | node, |
char * | name | ||
) |
xmlNodePtr get_base_shape | ( | xmlNodePtr | shape3D_node, |
const char * | shape_name, | ||
int | nature, | ||
int | allow_creation | ||
) |
Look for the specified basic shape.
[in] | shape3D_node | Pointer to the "x3D" node of a body or the base. |
[in] | shape_name | Name of the base shape to find. |
[in] | nature | Identifier of the base shape nature (SHAPE_BOX...). |
[in] | allow_creation | Create the shape node shape if not found in existing. |
xmlNodePtr get_basebody_3Dshapes | ( | xmlDocPtr | doc, |
int | create | ||
) |
Look for the node containing the 3D shape (x3D) of the base node.
[in] | doc | The pointer to the xml document |
[in] | create | If false (0), it does not create missing "x3D" node. If True, missing "x3D" node will be created. |
xmlNodePtr get_basebody_node | ( | xmlDocPtr | doc | ) |
Look for the base node in the document.
[in] | doc | The pointer to the xml document |
xmlNodePtr get_basebody_point | ( | xmlDocPtr | doc, |
const char * | point_name, | ||
int | allow_new | ||
) |
Look for the specified point node on the base.
[in] | doc | The pointer to the xml document. |
[in] | point_name | The name of the point. |
[in] | allow_new | Allow to create new items. |
xmlNodePtr get_body_3Dshapes | ( | xmlDocPtr | doc, |
const char * | body_name | ||
) |
Look for the node containing the 3D shape (x3D) of the specified body.
[in] | doc | The pointer to the xml document |
[in] | body_name | The name of the body. |
xmlNodePtr get_body_node | ( | xmlNodePtr | bodytree, |
const char * | body_name | ||
) |
Look for the specified body node in the tree.
[in] | bodytree | The pointer to the bodytree node. |
[in] | body_name | The name of the body. |
xmlNodePtr get_body_point | ( | xmlDocPtr | doc, |
const char * | body_name, | ||
const char * | point_name, | ||
int | allow_new | ||
) |
Look for the specified point node on the specified body.
[in] | doc | The pointer to the xml document. |
[in] | body_name | The name of the body. |
[in] | point_name | The name of the point. |
[in] | allow_new | Allow to create new items. |
xmlNodePtr get_bodytree_node | ( | xmlDocPtr | doc | ) |
Look for the bodytree node in the document.
[in] | doc | The pointer to the xml document |
double get_double_xlm_node | ( | xmlNodePtr | in_node | ) |
xmlNodePtr get_inline_shape | ( | xmlNodePtr | shape3D_node, |
const char * | shape_name, | ||
int | allow_creation | ||
) |
Look for the specified inline shape.
[in] | shape3D_node | Pointer to the "x3D" node of a body or the base. |
[in] | shape_name | Name of the inline shape to find. |
[in] | allow_creation | Create the inline node shape if not found in existing. |
int get_int_xlm_attr | ( | xmlAttrPtr | in_node | ) |
int get_int_xlm_node | ( | xmlNodePtr | in_node | ) |
GET functions ///////////////////////.
xmlNodePtr get_links_node | ( | xmlDocPtr | doc, |
int | create | ||
) |
Look for the node containing all the links.
doc | The pointer to the xml document |
create | If false (0), it does not create missing "links" node. If True, missing "links" node will be created. |
xmlNodePtr get_point_node | ( | xmlNodePtr | body_node, |
const char * | point_name, | ||
int | allow_new, | ||
double | coords_2d[2] | ||
) |
Look for the specified point node in the body or base node.
[in] | body_node | The pointer to the body or base node. |
[in] | point_name | The name of the point. |
[in] | allow_new | Allow to create new items. |
[in] | coords_2d | In case of new point creation, this set the [x, y] coordinates of the point. If NULL is provided, the default coordinates are [100, 100]. |
int get_string_xml_attr | ( | xmlAttrPtr | in_node, |
char ** | dest | ||
) |
int get_string_xml_node | ( | xmlNodePtr | in_node, |
char ** | dest | ||
) |
int get_string_xml_node_2 | ( | char ** | string_ptr, |
xmlNodePtr | in_node | ||
) |
int mbs_info_ball_xml_binder | ( | MbsInfoBall * | mbs_info_ball, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_base_xml_binder | ( | MbsInfoBase * | mbs_info_base, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_body_xml_binder | ( | MbsInfoBody * | mbs_info_body, |
xmlNodePtr | node, | ||
int | mission, | ||
int | verbose | ||
) |
int mbs_info_bodytree_xml_binder | ( | MbsInfoBodytree * | mbs_info_bodytree, |
xmlNodePtr | node, | ||
int | mission, | ||
int | verbose | ||
) |
int mbs_info_coordinates_xml_binder | ( | double * | coordinates_pointer, |
xmlNodePtr | node, | ||
int | mission | ||
) |
Binders /////////////////////////////.
int mbs_info_cuts_xml_binder | ( | MbsInfoCuts * | mbs_info_cuts, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_extforce_xml_binder | ( | MbsInfoExtforce * | mbs_info_extforce, |
xmlNodePtr | node, | ||
int | mission | ||
) |
xmlNodePtr mbs_info_find_children_xml | ( | xmlNodePtr | node, |
const char * | name | ||
) |
Return the children whose name matches.
[in] | node | The parent node. |
[in] | name | The name of the required children. |
int mbs_info_init_and_binderXML | ( | MbsInfos * | mbs_infos, |
const char * | mbs_xml_name, | ||
int | mission | ||
) |
int mbs_info_joint_list_xml_binder | ( | MbsInfoJoint ** | joint_list, |
xmlNodePtr | node, | ||
int | mission, | ||
int | verbose | ||
) |
int mbs_info_joint_xml_binder | ( | MbsInfoJoint * | mbs_info_joint, |
xmlNodePtr | node, | ||
int | mission, | ||
int | verbose | ||
) |
int mbs_info_link_xml_binder | ( | MbsInfoLink * | mbs_info_link, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_links_xml_binder | ( | MbsInfoLinks * | mbs_info_links, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_mbs_linker | ( | MbsInfos * | mbs_info, |
int | mission | ||
) |
int mbs_info_mbsDescR7_binder | ( | MbsInfos * | mbs_infos, |
xmlDocPtr | doc, | ||
int | mission | ||
) |
int mbs_info_parameter_xml_binder | ( | MbsInfoParameter * | mbs_info_parameter, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_point_list_xml_binder | ( | MbsInfoPoint ** | point_list, |
xmlNodePtr | node, | ||
int | mission, | ||
char * | body_name | ||
) |
int mbs_info_point_xml_binder | ( | MbsInfoPoint * | mbs_info_point, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_ref_point_xml_binder | ( | MbsInfoRefPoint * | mbs_info_ref_point, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_rod_xml_binder | ( | MbsInfoRod * | mbs_info_rod, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_sensor_xml_binder | ( | MbsInfoSensor * | mbs_info_sensor, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_solid_xml_binder | ( | MbsInfoSolid * | mbs_info_solid, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_update_extforces_xml | ( | MbsLoader * | mbs_loader, |
UpdateExtForces * | frc, | ||
int | allow_new | ||
) |
Update, or create this external force all next ExtFrc in the linked list.
The UpdateExtForces is a linked list, the function will parse all the UpdateExtForces::next items for updates until reaching the end of the list.
[in,out] | mbs_loader | The MbsLoader that contains all informations. |
[in] | frc | The description of the external force(s). |
[in] | allow_new | Allow to create new items. |
int mbs_info_update_inlines_xml | ( | MbsLoader * | mbs_loader, |
UpdateInline * | up_in, | ||
int | allow_creation | ||
) |
Update, or create this inline and all next inlines in the linked list.
The UpdateInline is a linked list, the function will parse all the UpdateInline::next items for updates until reaching the end of the list.
[in,out] | mbs_loader | The MbsLoader that contains all informations. |
[in] | up_in | The descriptions of the modification to set on the inline(s). |
[in] | allow_creation | Allow to create the inline shape. |
int mbs_info_update_linkforce_xml | ( | MbsLoader * | mbs_loader, |
UpdateLinkForces * | lnk, | ||
int | allow_new | ||
) |
Update, or create the provided link force.
WARNING, in the opposite of other update function, this one only update the current provided link force and does not parse the linked list for other updates.
[in,out] | mbs_loader | The MbsLoader that contains all informations. |
[in] | lnk | The description of the unique link force. |
[in] | allow_new | Allow to create new items. |
int mbs_info_update_shapes_xml | ( | MbsLoader * | mbs_loader, |
UpdateShape * | up_in, | ||
int | allow_new | ||
) |
Update, or create this 3D shape and all next 3D shapes in the linked list.
The UpdateShape is a linked list, the function will parse all the UpdateShape::next items for updates until reaching the end of the list.
[in,out] | mbs_loader | The MbsLoader that contains all informations. |
[in] | up_in | The descriptions of the modification to set on the shape(s). |
[in] | allow_new | Allow to create new items. |
int mbs_info_user_IO_xml_binder | ( | MbsInfoUserIO * | mbs_info_user_IO, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_user_IOs_xml_binder | ( | MbsInfoUserIOs * | mbs_info_user_IOs, |
xmlNodePtr | node, | ||
int | mission, | ||
int | verbose | ||
) |
int mbs_info_user_model_xml_binder | ( | MbsInfoUserModel * | mbs_info_user_model, |
xmlNodePtr | node, | ||
int | mission | ||
) |
int mbs_info_user_models_xml_binder | ( | MbsInfoUserModels * | mbs_info_user_models, |
xmlNodePtr | node, | ||
int | mission, | ||
int | verbose | ||
) |
void* mbs_xml_free_clean | ( | xmlDocPtr | doc | ) |
Free the xml document and clean the xml library parser.
[out] | doc | The xml document to be freed. |
xmlDocPtr mbs_xml_get_doc | ( | const char * | mbs_xml_name | ) |
Load an xml file to memory.
[in] | mbs_xml_name | The filepath to the document to be loaded. |
int mbs_xml_info_to_loader | ( | MbsLoader * | mbs_loader, |
const char * | mbs_xml_name | ||
) |
Load and store the specified xml file into both MbsInfo and xmlDocPtr format.
[in,out] | mbs_loader | The MbsLoader that contains all informations. |
[in] | mbs_xml_name | The filepathe to the mbs to be loaded. |
xmlNodePtr mbs_xmlNewDocNode_attr_rgb | ( | xmlDocPtr | doc, |
xmlNsPtr | ns, | ||
const xmlChar * | name, | ||
const xmlChar * | content, | ||
char * | R, | ||
char * | G, | ||
char * | B | ||
) |
xmlNodePtr mbs_xmlNewDocNode_xyz | ( | xmlDocPtr | doc, |
xmlNsPtr | ns, | ||
const xmlChar * | name, | ||
const xmlChar * | content, | ||
double | value | ||
) |
xmlNodePtr new_char_xlm_node | ( | xmlDocPtr | doc, |
xmlNsPtr | ns, | ||
const xmlChar * | name, | ||
const xmlChar * | content, | ||
const char * | text | ||
) |
xmlNodePtr new_double_xlm_node | ( | xmlDocPtr | doc, |
xmlNsPtr | ns, | ||
const xmlChar * | name, | ||
const xmlChar * | content, | ||
double | value | ||
) |
Creation functions //////////////////.
int set_char_xlm_node | ( | xmlNodePtr | in_node, |
const char * | text | ||
) |
int set_double_xlm_node | ( | xmlNodePtr | in_node, |
double | value | ||
) |
SET functions ///////////////////////.