Robotran C Documentation
Macros | Functions
mbs_loader.c File Reference
#include "mbs_loader.h"
#include "mbs_binder_public.h"
#include "mbs_binder_private.h"
#include "mbs_load_libraries.h"
#include "useful_functions.h"
#include "mbs_path.h"
#include "mbs_message.h"
#include "mbs_check.h"
#include "mbs_errors_names.h"
#include <string.h>

Macros

#define mbs_new_user_model()   s->fct.user.mbs_new_user_model()
 
#define mbs_load_user_model(mbs_infos, um)   s->fct.user.mbs_load_user_model(mbs_infos, um)
 
#define mbs_bind_user_model(mbs_infos, um)   s->fct.user.mbs_bind_user_model(mbs_infos, um)
 
#define mbs_delete_user_model(um)   s->fct.user.mbs_delete_user_model(um)
 
#define mbs_get_user_model_size(n_usr_model)   s->fct.user.mbs_get_user_model_size(n_usr_model)
 
#define mbs_get_user_model_list(user_model_list)   s->fct.user.mbs_get_user_model_list(user_model_list)
 
#define mbs_new_user_IO(a)   s->fct.user.mbs_new_user_IO(a)
 
#define mbs_delete_user_IO(uio)   s->fct.user.mbs_delete_user_IO(uio)
 
#define mbs_get_user_IO_size(n_in, n_out, n_user_IO)   s->fct.user.mbs_get_user_IO_size(n_in, n_out, n_user_IO)
 
#define user_load_post(data)   s->fct.user.user_load_post(data);
 
#define user_free(data)   s->fct.user.user_free(data);
 

Functions

MbsDatambs_load (const char *mbs_filename, const char *build_path)
 Load the data from the given *.mbs file (data in the xml format). More...
 
MbsDatambs_load_with_loader (const char *mbs_filename, const char *build_path, MbsLoader *mbs_loader)
 Load the data from the given MbsInfos. More...
 
MbsLoadOptionsmbs_new_load_options ()
 Create a new structure with options for the loading. More...
 
void mbs_delete_load_options (MbsLoadOptions *opts)
 Free the memory associated to the given MbsLoadOptions. More...
 
MbsLoadermbs_new_loader ()
 Create a new structure loader used for the loading with options. More...
 
void mbs_delete_loader (MbsLoader *loader)
 Free the memory associated to the given MbsLoader. More...
 
void mbs_set_symb_fun_null (MbsData *s)
 Set the pointer to project symbolic functions to NULL. More...
 
void mbs_set_user_fun_null (MbsData *s)
 Set the pointer to project user functions to NULL. More...
 
void mbs_set_user_IO (UserIoInfo *ioInfo, double val)
 Implementation of utility function for user_IO ==> should be moved (see def in mbs_user_interface.h) More...
 
UserIoInfombs_xml_create_user_IO_info (MbsInfos *mbs_infos, MbsData *s)
 
void mbs_delete_user_IO_info (UserIoInfo *ioInfo)
 
int * MDS_translate_q (int *q_mds, int nq, int nj)
 return a (nj sized) vector (starting at index 1) of integer which is a copy of the provided (nq sized) vector (starting at index 0) with all value incremented by 1. If nj is greater than nq, the unused value are set to 0. More...
 
MbsDatambs_info_to_data (MbsInfos *mbs_infos, MbsData *s)
 Retrieve a MbsData structure from the given MbsInfos. More...
 
MbsDatambs_new_data ()
 Allocate an MbsData structure with default field values (NULL, 0). More...
 
void mbs_delete_data (MbsData *s)
 Free the memory used by the given MbsData structure. More...
 

Macro Definition Documentation

◆ mbs_bind_user_model

#define mbs_bind_user_model (   mbs_infos,
  um 
)    s->fct.user.mbs_bind_user_model(mbs_infos, um)

◆ mbs_delete_user_IO

#define mbs_delete_user_IO (   uio)    s->fct.user.mbs_delete_user_IO(uio)

◆ mbs_delete_user_model

#define mbs_delete_user_model (   um)    s->fct.user.mbs_delete_user_model(um)

◆ mbs_get_user_IO_size

#define mbs_get_user_IO_size (   n_in,
  n_out,
  n_user_IO 
)    s->fct.user.mbs_get_user_IO_size(n_in, n_out, n_user_IO)

◆ mbs_get_user_model_list

#define mbs_get_user_model_list (   user_model_list)    s->fct.user.mbs_get_user_model_list(user_model_list)

◆ mbs_get_user_model_size

#define mbs_get_user_model_size (   n_usr_model)    s->fct.user.mbs_get_user_model_size(n_usr_model)

◆ mbs_load_user_model

#define mbs_load_user_model (   mbs_infos,
  um 
)    s->fct.user.mbs_load_user_model(mbs_infos, um)

◆ mbs_new_user_IO

#define mbs_new_user_IO (   a)    s->fct.user.mbs_new_user_IO(a)

◆ mbs_new_user_model

#define mbs_new_user_model ( )    s->fct.user.mbs_new_user_model()

◆ user_free

#define user_free (   data)    s->fct.user.user_free(data);

◆ user_load_post

#define user_load_post (   data)    s->fct.user.user_load_post(data);

Function Documentation

◆ mbs_delete_data()

void mbs_delete_data ( MbsData s)

Free the memory used by the given MbsData structure.

Parameters
sthe structure to be freed.

◆ mbs_delete_load_options()

void mbs_delete_load_options ( MbsLoadOptions opts)

Free the memory associated to the given MbsLoadOptions.

! For the moment, does not free the char* fields !

Parameters
optsthe MbsLoadOptions to delete

◆ mbs_delete_loader()

void mbs_delete_loader ( MbsLoader loader)

Free the memory associated to the given MbsLoader.

Parameters
optsthe MbsLoader to delete

◆ mbs_delete_user_IO_info()

void mbs_delete_user_IO_info ( UserIoInfo ioInfo)

◆ mbs_info_to_data()

MbsData* mbs_info_to_data ( MbsInfos mbs_infos,
MbsData s 
)

Retrieve a MbsData structure from the given MbsInfos.

Parameters
[in]mbs_infosthe MbsInfos structure already filled to be used to fill the MbsData structure.
[in,out]sthe MbsData structure that will be completed according to the MbsInfos structure.

◆ mbs_load()

MbsData* mbs_load ( const char *  mbs_filename,
const char *  build_name 
)

Load the data from the given *.mbs file (data in the xml format).

The memory of a new MbsData is allocated.

Parameters
mbs_filenamepath to the file to load including filename and extension.
build_path,pathto the build folder (including build) of MBsysC libraries

◆ mbs_load_with_loader()

MbsData* mbs_load_with_loader ( const char *  mbs_filename,
const char *  build_path,
MbsLoader mbs_loader 
)

Load the data from the given MbsInfos.

The memory of a new MbsData is allocated. Options on paths (symbolic and/or user librairies) can be passed.

Parameters
mbs_filenamepath to the file to load including filename and extension.
build_pathpath to the build folder (including build) of MBsysC libraries
mbs_load_optsoptions for loading (mainly a collection of paths and names)
Returns
A fully loaded MbsData strucutre or NULL ptr in case of failure.

◆ mbs_new_data()

MbsData* mbs_new_data ( )

Allocate an MbsData structure with default field values (NULL, 0).

Returns
the allocated structure.

◆ mbs_new_load_options()

MbsLoadOptions* mbs_new_load_options ( )

Create a new structure with options for the loading.

The memory of a new MbsLoadOptions is allocated. The options mainly consist in char variables that can contain name and path for separate libraries.

◆ mbs_new_loader()

MbsLoader* mbs_new_loader ( )

Create a new structure loader used for the loading with options.

The memory of a new MbsLoader and its options is allocated. The memory for the "mds" field is not allocated (left to the user if needed)

◆ mbs_set_symb_fun_null()

void mbs_set_symb_fun_null ( MbsData s)

Set the pointer to project symbolic functions to NULL.

Parameters
[in,out]fctthe MbsData instance containing the pointer of functions

◆ mbs_set_user_fun_null()

void mbs_set_user_fun_null ( MbsData s)

Set the pointer to project user functions to NULL.

Parameters
[in,out]fctthe MbsData instance containing the pointer of functions

◆ mbs_set_user_IO()

void mbs_set_user_IO ( UserIoInfo ioInfo,
double  val 
)

Implementation of utility function for user_IO ==> should be moved (see def in mbs_user_interface.h)

Set all the user_IO to the given value (generic code)

◆ mbs_xml_create_user_IO_info()

UserIoInfo* mbs_xml_create_user_IO_info ( MbsInfos mbs_infos,
MbsData s 
)

◆ MDS_translate_q()

int* MDS_translate_q ( int *  q_mds,
int  nq,
int  nj 
)

return a (nj sized) vector (starting at index 1) of integer which is a copy of the provided (nq sized) vector (starting at index 0) with all value incremented by 1. If nj is greater than nq, the unused value are set to 0.

Parameters
[in]q_mdsthe original (nq sized) vector of integers, starting at index 0
[in]nqthe size of the q_mds vector
[in]njthe size of the returned (starting at index 1) vector (0 element not taken into account)
Returns
requested vector (element 0 receives nj: the size without this element)