1 #ifndef TAB_FM 2 #define TAB_FM 3 4 #include <stdio.h> 5 #ifndef __cplusplus 6 #include <stdbool.h> 7 #endif 8 9 #include "fm.h" 10 11 typedef struct tabular_fm { 12 fm_t **tab; 13 int index; 14 int size; 15 } tabular_fm_t; 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 22 tabular_fm_t *tabular_fm_create(void); 23 24 void tabular_fm_free(tabular_fm_t * t); 25 26 void tabular_fm_realloc(tabular_fm_t * t); 27 28 int tabular_fm_get_index(tabular_fm_t * t); 29 30 fm_t *tabular_fm_get_fm(tabular_fm_t * t, int index); 31 32 void tabular_fm_add_fm(tabular_fm_t * t, fm_t * fm); 33 34 void 35 tabular_fm_add(tabular_fm_t * t, unsigned long *method, int len_method, 36 double *proba, int len_proba, double *time, int len_time, 37 int len_p_min); 38 39 void tabular_fm_set_fm_index(tabular_fm_t * t, fm_t * fm, int ind); 40 41 void 42 tabular_fm_set_index(tabular_fm_t * t, unsigned long *method, int len_method, 43 double *proba, int len_proba, double *time, int len_time, 44 int len_p_min, int ind); 45 46 /* concatenate t2 at the end of t1 */ 47 void tabular_fm_concat(tabular_fm_t * t1, tabular_fm_t * t2); 48 49 void tabular_fm_put_zero(tabular_fm_t * t, int index); 50 51 bool tabular_fm_is_zero(tabular_fm_t * t, int index); 52 53 tabular_fm_t *extract_fm_method(tabular_fm_t * t, int method, int curve); 54 55 int tabular_fm_fprint(FILE * output_file, tabular_fm_t * t); 56 57 int tabular_fm_print(tabular_fm_t * t); 58 59 tabular_fm_t * tabular_fm_fscan(FILE * file); 60 61 /************************************************************************/ 62 /* SORT_TAB_FM */ 63 /************************************************************************/ 64 /* the comparative is according to the probabilities! */ 65 int fm_cmp(fm_t * el1, fm_t * el2); 66 67 void fm_swap(tabular_fm_t * t, int index1, int index2); 68 69 //according to the probabilities! 70 void tabular_fm_sort(tabular_fm_t * t); 71 72 #ifdef __cplusplus 73 } 74 #endif 75 #endif /* TAB_FM */ 76