Robotran C Documentation
Functions
auto_output.c File Reference
#include "auto_output.h"
#include "useful_functions.h"
#include "mbs_message.h"
#include <stdlib.h>
#include <string.h>

Functions

AutoOutputinit_auto_output (int max_nb)
 initialize the AutoOutput structure More...
 
int define_auto_output_vector (AutoOutput *auto_output, char *label, int size)
 set memory for a vector in AutoOutput More...
 
void free_auto_output (AutoOutput *auto_output)
 release memory for AutoOutput More...
 
int update_auto_output (AutoOutput *auto_output, double value, char *label)
 update auto_output when a 'set_output' is encountered More...
 
int update_auto_output_vector (AutoOutput *auto_output, double *vector, char *label, int output_id)
 update auto_output when a 'set_output_vector' is encountered More...
 
int update_auto_output_value (AutoOutput *auto_output, double value, int val_index, char *label, int output_id)
 update auto_output when a 'set_output_value' is encountered It can take the label and/or the output_id as input. If the two are present, a check is done to assess these are coherent More...
 
int index_output_string (AutoOutput *auto_output, char *label)
 get index for a output with its label More...
 
int index_output_vector_string (AutoOutput *auto_output, char *label)
 get index for a output vector with its label More...
 
double get_output_value_auto (AutoOutput *auto_output, int index)
 get the output value corresponding to the requested index More...
 
double * get_output_vector_ptr_auto (AutoOutput *auto_output, int index)
 get the pointer to the output vector at the requested index More...
 
char * get_output_label_auto (AutoOutput *auto_output, int index)
 get the output label corresponding to the requested index More...
 
char * get_output_vector_label_auto (AutoOutput *auto_output, int index)
 get the output vector label corresponding to the requested index More...
 
int get_output_vector_size_auto (AutoOutput *auto_output, int index)
 get the output vector size corresponding to the requested index More...
 

Function Documentation

◆ define_auto_output_vector()

int define_auto_output_vector ( AutoOutput auto_output,
char *  label,
int  size 
)

set memory for a vector in AutoOutput

Parameters
[out]auto_outputAutoOutput structure to update
[in]sizenumber of element in the vector to output
[in]labeloutput vector label
Returns
The index of the new output vector, -2 if the maximum number of output vector is reached, -3 if the size is invalid.

◆ free_auto_output()

void free_auto_output ( AutoOutput auto_output)

release memory for AutoOutput

Parameters
[out]auto_outputAutoOutput structure to free

◆ get_output_label_auto()

char* get_output_label_auto ( AutoOutput auto_output,
int  index 
)

get the output label corresponding to the requested index

Parameters
[in]auto_outputAutoOutput structure
[in]indexrequested index
Returns
requested label or "no_output" if there is no output for the requested index

◆ get_output_value_auto()

double get_output_value_auto ( AutoOutput auto_output,
int  index 
)

get the output value corresponding to the requested index

Parameters
[in]auto_outputAutoOutput structure
[in]indexrequested index
Returns
requested value or -1 if there is no output for the requested index

◆ get_output_vector_label_auto()

char* get_output_vector_label_auto ( AutoOutput auto_output,
int  index 
)

get the output vector label corresponding to the requested index

Parameters
[in]auto_outputAutoOutput structure
[in]indexrequested index
Returns
requested vector label or "no_output" if there is no output for the requested index

◆ get_output_vector_ptr_auto()

double* get_output_vector_ptr_auto ( AutoOutput auto_output,
int  index 
)

get the pointer to the output vector at the requested index

Parameters
[in]auto_outputAutoOutput structure
[in]indexrequested index
Returns
requested pointer or NULL

◆ get_output_vector_size_auto()

int get_output_vector_size_auto ( AutoOutput auto_output,
int  index 
)

get the output vector size corresponding to the requested index

Parameters
[in]auto_outputAutoOutput structure
[in]indexrequested index
Returns
requested vector size for the requested index or -1 in case of error.

◆ index_output_string()

int index_output_string ( AutoOutput auto_output,
char *  label 
)

get index for a output with its label

Parameters
[in]auto_outputAutoOutput structure
[in]labellabel of the output
Returns
index of the output, -1 if not known

◆ index_output_vector_string()

int index_output_vector_string ( AutoOutput auto_output,
char *  label 
)

get index for a output vector with its label

Parameters
[in]auto_outputAutoOutput structure
[in]labellabel of the output vector
Returns
index of the output, -1 if not known

◆ init_auto_output()

AutoOutput* init_auto_output ( int  max_nb)

initialize the AutoOutput structure

Parameters
[in]max_nbmaximum number of user outputs
Returns
AutoOutput structure initialized

◆ update_auto_output()

int update_auto_output ( AutoOutput auto_output,
double  value,
char *  label 
)

update auto_output when a 'set_output' is encountered

Parameters
[out]auto_outputAutoOutput structure
[in]valuecurrent output value
[in]labelcurrent output label
Returns
The status:
  • 0: Existing output updated;
  • >0: Index of the newly created output;
  • <value -2 if the maximum number of output vector is reached.

◆ update_auto_output_value()

int update_auto_output_value ( AutoOutput auto_output,
double  value,
int  val_index,
char *  label,
int  output_id 
)

update auto_output when a 'set_output_value' is encountered It can take the label and/or the output_id as input. If the two are present, a check is done to assess these are coherent

Parameters
[out]auto_outputAutoOutput structure
[in]valuecurrent output value
[in]val_indexindex of the value in the saved vector
[in]labelcurrent output label (NULL if not known)
[in]output_idid of the output vector (if not known, put it to -1 : the function will search for the correct index)
Returns
Status:
  • ">0": Index of vector;
  • "-1": Invalid arguments;
  • "-2" if the vector is not defined;
  • "-3" if the index exceed the vector size;

◆ update_auto_output_vector()

int update_auto_output_vector ( AutoOutput auto_output,
double *  vector,
char *  label,
int  output_id 
)

update auto_output when a 'set_output_vector' is encountered

Parameters
[out]auto_outputAutoOutput structure
[in]vectorpointer to the current outputs vector
[in]labelcurrent output label (NULL if not know)
[in]output_idindex of the output vector (if not known, put it to -1 : the function will search for the correct index)
Returns
Status:
  • ">0": Index of vector;
  • "-2": The vector is not defined;