00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MR_VECTOR_H
00020 #define MR_VECTOR_H
00021
00022 #ifdef __cplusplus
00023 extern "C"
00024 {
00025 #endif
00026
00027 typedef struct MrVector MrVector;
00028
00029 typedef void (*mr_func_apply_t) (void*);
00030 typedef void* (*mr_func_init_t) (void);
00031 typedef short int (*mr_func_predicat_t)(void*,void*);
00032
00040 struct MrVector
00041 {
00043 void** data;
00045 unsigned int size;
00049 unsigned int allocated_size;
00050 };
00051
00053 MrVector* mr_vector_new();
00054
00058 MrVector* mr_vector_new_init(unsigned int n, mr_func_init_t func);
00059
00064 MrVector* mr_vector_new_n(unsigned int n);
00065
00070 void mr_vector_free(void* v);
00071
00073 void* mr_vector_get(MrVector* v, unsigned int pos);
00074
00076 void mr_vector_set(MrVector* v, unsigned int pos, void* data);
00077
00081 short int mr_vector_resize(MrVector* v, unsigned int n);
00082
00086 short int mr_vector_append(MrVector* v, void* data);
00087
00092 short int mr_vector_append_vector(MrVector* dst, MrVector* src);
00093
00098 short int mr_vector_remove(MrVector* v, unsigned int pos);
00099
00103 short int mr_vector_remove_range(MrVector* v, unsigned int start, unsigned int end);
00104
00108 void mr_vector_apply(MrVector* v, mr_func_apply_t func);
00109
00111 void mr_vector_apply_range(MrVector* v, mr_func_apply_t func, unsigned int start, unsigned int end);
00112
00114 void mr_vector_fill(MrVector* v, void* data);
00115
00117 void mr_vector_init(MrVector* v, mr_func_init_t func);
00118
00120 void mr_vector_sort(MrVector* v, mr_func_predicat_t func);
00121
00124 unsigned int mr_vector_contain(MrVector* v, void* p);
00125
00126
00127 #ifdef __cplusplus
00128 }
00129 #endif
00130
00131 #endif