3 // Copyright (C) 2002,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef H_UTILVSERVER_VECTOR_VECTOR_H
20 #define H_UTILVSERVER_VECTOR_VECTOR_H
33 typedef enum { vecMOVE_FRONT, vecSHIFT_ONCE } VectorSelfOrgMethod;
35 void Vector_init(struct Vector *, size_t elem_size);
36 void Vector_free(struct Vector *);
37 void * Vector_search(struct Vector *, void const *key, int (*compar)(const void *, const void *));
38 void * Vector_searchSelfOrg(struct Vector *, void const *key,
39 int (*compar)(const void *, const void *),
40 VectorSelfOrgMethod method);
41 void Vector_sort(struct Vector *, int (*compar)(const void *, const void *));
42 void Vector_unique(struct Vector *, int (*compar)(const void *, const void *));
43 void * Vector_pushback(struct Vector *);
44 void * Vector_insert(struct Vector *, void const *key, int (*compar)(const void *, const void *));
45 void Vector_popback(struct Vector *);
46 void Vector_resize(struct Vector *vec);
47 void Vector_clear(struct Vector *vec);
48 void Vector_zeroEnd(struct Vector *vec);
49 void Vector_foreach(struct Vector *vec, void (*func)(void *, void *), void *);
51 static void Vector_foreach_const(struct Vector const *vec,
52 void (*func)(void const *, void *),
54 static void const * Vector_searchSelfOrg_const(struct Vector const *, void const *key,
55 int (*compar)(const void *, const void *),
56 VectorSelfOrgMethod method);
57 static void const * Vector_search_const(struct Vector const *, void const *key, int (*compar)(const void *, const void *));
58 static void * Vector_begin(struct Vector *);
59 static void * Vector_end(struct Vector *);
60 static void const * Vector_begin_const(struct Vector const *);
61 static void const * Vector_end_const(struct Vector const *);
62 static size_t Vector_count(struct Vector const *vec);
66 #endif // H_UTILVSERVER_VECTOR_VECTOR_H