Robotran C Documentation
mbs_buffer.h
Go to the documentation of this file.
1 
11 #ifndef MBS_BUFFER_h
12 #define MBS_BUFFER_h
13 
24 };
25 
29 typedef struct AnimInfo
30 {
31  int save_anim;
32  int save_visu;
33 
34  double anim_period;
35  double last_print_t;
36 
37  char *filename;
38 
39 } AnimInfo;
40 
46 typedef struct MbsBuffer{
47 
52  double* tx;
53 
55  double* last_x;
56 
58  double last_t;
59 
62 
64  char *filename;
65 
67  int index;
68 
70  int size;
71 
73  int nx;
74 
76  int id;
77 
79  char* buf_format;
80 
83 
84 } MbsBuffer;
85 
92 typedef struct MbsGrowingBuffer{
93 
94  double* t;
95 
96  double** X;
97 
98  char **names;
99 
100  int index;
101 
102  int size;
103 
104  int nx;
105 
106  int max_nx;
107 
108  char *respath;
109 
111 
126 MbsBuffer* mbs_new_buffer(char* filename, char* anim_name, int nx, int size, int id, char* buf_format, int save_anim, int save_visu, double anim_period);
127 
135 MbsGrowingBuffer* mbs_new_growing_buffer(int max_nx, int size, const char *respath);
136 
142 
148 
161 int mbs_buffer_save(MbsBuffer* b, double t, double *x);
162 
174 int mbs_growing_buffer_save(MbsGrowingBuffer* b, double t);
175 
176 
185 
190 int mbs_anim_write(MbsBuffer* b);
191 
198 
199 
200 #endif
201 
202 
MbsBuffer::buf_format
char * buf_format
Format of the buffer output.
Definition: mbs_buffer.h:79
MbsBuffer::filename
char * filename
the name of the text file associated to this buffer
Definition: mbs_buffer.h:64
BUFFER_OTHER
@ BUFFER_OTHER
Definition: mbs_buffer.h:23
MbsBuffer::id
int id
ID of the buffer.
Definition: mbs_buffer.h:76
BUFFER_QC
@ BUFFER_QC
Definition: mbs_buffer.h:22
MbsBuffer::last_t
double last_t
the time corresponding to 'last_x'
Definition: mbs_buffer.h:58
get_char_cpy
char * get_char_cpy(const char *fmt,...)
Copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:191
set_output_nb_new
void set_output_nb_new(int nb)
set the number of new user inputs
Definition: set_output.c:268
BUFFER_LINK_ZD
@ BUFFER_LINK_ZD
Definition: mbs_buffer.h:22
useful_functions.h
mbs_anim_write
int mbs_anim_write(MbsBuffer *b)
Write the content of the q buffer as anim file to the disk.
Definition: mbs_buffer.c:415
MbsBuffer::tx
double * tx
the array in which the time and the value are saved.
Definition: mbs_buffer.h:52
BUFFER_X
@ BUFFER_X
Definition: mbs_buffer.h:23
MbsGrowingBuffer
buffer used to store the user variables to output
Definition: mbs_buffer.h:92
BUFFER_QQ
@ BUFFER_QQ
Definition: mbs_buffer.h:21
BUFFER_LINK_F
@ BUFFER_LINK_F
Definition: mbs_buffer.h:22
_MBS_ERR_LOW_FILES
#define _MBS_ERR_LOW_FILES
Low Level error number Error during opening/writing files = -9.
Definition: mbs_errors_names.h:147
AnimInfo::anim_period
double anim_period
time interval between two recorded values in .anim file
Definition: mbs_buffer.h:34
mbs_buffer_write
int mbs_buffer_write(MbsBuffer *b)
Write the content of the buffer to disk.
Definition: mbs_buffer.c:347
BUFFER_LINK_Z
@ BUFFER_LINK_Z
Definition: mbs_buffer.h:22
mbs_buffer.h
MbsBuffer::size
int size
the size of the buffer (i.e.
Definition: mbs_buffer.h:70
MbsGrowingBuffer::X
double ** X
the tabular (2 dimensions) in which the values are stored
Definition: mbs_buffer.h:96
mbs_buffer_save
int mbs_buffer_save(MbsBuffer *b, double t, double *x)
Save the given array to the specified buffer with the specified time.
Definition: mbs_buffer.c:212
get_output_nb_new
int get_output_nb_new()
get the number of new user inputs
Definition: set_output.c:249
MbsGrowingBuffer::size
int size
the size of the buffer (i.e. the number of different value of the array that can be stored)
Definition: mbs_buffer.h:102
MbsGrowingBuffer::respath
char * respath
path for the results
Definition: mbs_buffer.h:108
mbs_growing_buffer_write
int mbs_growing_buffer_write(MbsGrowingBuffer *b)
write the content of the growing buffer to disk
Definition: mbs_buffer.c:557
BUFFER_Q
@ BUFFER_Q
Definition: mbs_buffer.h:21
get_output_label
char * get_output_label(int index)
get the output label corresponding to the requested index
Definition: set_output.c:201
MbsBuffer::nx
int nx
the size of the array that is tracked by this buffer
Definition: mbs_buffer.h:73
MbsGrowingBuffer::names
char ** names
the names of the user variables to save
Definition: mbs_buffer.h:98
mbs_buffer_save
int mbs_buffer_save(MbsBuffer *b, double t, double *x)
Save the given array to the specified buffer with the specified time.
Definition: mbs_buffer.c:212
MbsGrowingBuffer::max_nx
int max_nx
maximal size for nx
Definition: mbs_buffer.h:106
MbsGrowingBuffer::t
double * t
the array in which the time value corresponding to each value of the array are stored
Definition: mbs_buffer.h:94
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsBuffer
Definition: mbs_buffer.h:46
mbs_growing_buffer_save
int mbs_growing_buffer_save(MbsGrowingBuffer *b, double t)
Save the given values of auto_output to the specified buffer with the specified time.
Definition: mbs_buffer.c:253
mbs_delete_buffer
void mbs_delete_buffer(MbsBuffer *b)
Free memory of the specified MbsBuffer.
Definition: mbs_buffer.c:164
mbs_delete_growing_buffer
void mbs_delete_growing_buffer(MbsGrowingBuffer *b)
release memory for growing buffer
Definition: mbs_buffer.c:188
MbsBuffer::last_x
double * last_x
the array in which the last values of 'x' are stored
Definition: mbs_buffer.h:55
BUFFER_UXD
@ BUFFER_UXD
Definition: mbs_buffer.h:21
BUFFER_QA
@ BUFFER_QA
Definition: mbs_buffer.h:23
get_output_value
double get_output_value(int index)
get the output value corresponding to the requested index
Definition: set_output.c:191
TIME_ID
#define TIME_ID(i)
Macro to get the id in tx array corresponding to index (assuming b->nx exist)
Definition: mbs_buffer.c:23
mbs_growing_buffer_write
int mbs_growing_buffer_write(MbsGrowingBuffer *b)
write the content of the growing buffer to disk
Definition: mbs_buffer.c:557
BUFFER_UX
@ BUFFER_UX
Definition: mbs_buffer.h:21
BUFFER_LAMBDA
@ BUFFER_LAMBDA
Definition: mbs_buffer.h:23
BUFFER_QD
@ BUFFER_QD
Definition: mbs_buffer.h:21
BUFFER_VISU
@ BUFFER_VISU
Definition: mbs_buffer.h:22
BUFFER_LINK3D
@ BUFFER_LINK3D
Definition: mbs_buffer.h:23
mbs_delete_buffer
void mbs_delete_buffer(MbsBuffer *b)
Free memory of the specified MbsBuffer.
Definition: mbs_buffer.c:164
MbsBuffer::flag_no_print
int flag_no_print
flag: 1 if it was not yet printed
Definition: mbs_buffer.h:61
mbs_delete_growing_buffer
void mbs_delete_growing_buffer(MbsGrowingBuffer *b)
release memory for growing buffer
Definition: mbs_buffer.c:188
mbs_new_growing_buffer
MbsGrowingBuffer * mbs_new_growing_buffer(int max_nx, int size, const char *respath)
create a new growing buffer for the user inputs to save
Definition: mbs_buffer.c:120
set_output.h
set_output function called by the user to output his own variables
mbs_message.h
get_output_nb
int get_output_nb()
get the number of user inputs
Definition: set_output.c:231
MbsGrowingBuffer::index
int index
indicate the index to which next values must be written
Definition: mbs_buffer.h:100
AnimInfo
animationR .anim file info
Definition: mbs_buffer.h:29
mbs_new_buffer
MbsBuffer * mbs_new_buffer(char *filename, char *anim_name, int nx, int size, int id, char *buf_format, int save_anim, int save_visu, double anim_period)
Allocate and initialize a MbsBuffer structure.
Definition: mbs_buffer.c:27
AnimInfo::last_print_t
double last_print_t
last time printed in the .anim file
Definition: mbs_buffer.h:35
BUFFER_R
@ BUFFER_R
Definition: mbs_buffer.h:23
BUFFER_QDD
@ BUFFER_QDD
Definition: mbs_buffer.h:21
AnimInfo::save_anim
int save_anim
1 to save the anim file, 0 otherwise (only valid if 'save2file' is set to 1)
Definition: mbs_buffer.h:31
BUFFER_F
@ BUFFER_F
Definition: mbs_buffer.h:23
mbs_growing_buffer_save
int mbs_growing_buffer_save(MbsGrowingBuffer *b, double t)
Save the given values of auto_output to the specified buffer with the specified time.
Definition: mbs_buffer.c:253
mbs_new_growing_buffer
MbsGrowingBuffer * mbs_new_growing_buffer(int max_nx, int size, const char *respath)
create a new growing buffer for the user inputs to save
Definition: mbs_buffer.c:120
mbs_anim_write
int mbs_anim_write(MbsBuffer *b)
Write the content of the q buffer as anim file to the disk.
Definition: mbs_buffer.c:415
AnimInfo::save_visu
int save_visu
1 to save the visu file (as in 'user_realtime_visu.c'), 0 otherwise (only valid if 'save2file' is set...
Definition: mbs_buffer.h:32
mbs_new_buffer
MbsBuffer * mbs_new_buffer(char *filename, char *anim_name, int nx, int size, int id, char *buf_format, int save_anim, int save_visu, double anim_period)
Allocate and initialize a MbsBuffer structure.
Definition: mbs_buffer.c:27
AnimInfo::filename
char * filename
anim file name
Definition: mbs_buffer.h:37
MbsBuffer::index
int index
indicate the index to which next values must be written
Definition: mbs_buffer.h:67
mbs_buffer_write
int mbs_buffer_write(MbsBuffer *b)
Write the content of the buffer to disk.
Definition: mbs_buffer.c:347
mbs_errors_names.h
MbsGrowingBuffer::nx
int nx
the current size of the array that is tracked by this buffer
Definition: mbs_buffer.h:104
MbsBuffer::anim
AnimInfo * anim
info for the .anim file
Definition: mbs_buffer.h:82