Main Page | Data Structures | File List | Data Fields | Globals

mr_vector.h

Go to the documentation of this file.
00001 /* The Partitions Musics Recognition System project.
00002  * (c)2003 by Fabien Pelisson (fabien dot pelisson at wanadoo dot fr)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef MR_VECTOR_H
00020 #define MR_VECTOR_H
00021 
00022 #ifdef __cplusplus
00023 extern              "C"
00024 {
00025 #endif                          /* __cplusplus */
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                          /* __cplusplus */
00130 
00131 #endif /* MR_VECTOR_H */

Generated on Sun Apr 9 17:29:40 2006 for MusicReco by  doxygen 1.4.4