| 1 |
// $Id$ --*- c++ -*-- |
|---|
| 2 |
|
|---|
| 3 |
// Copyright (C) 2002,2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> |
|---|
| 4 |
// |
|---|
| 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. |
|---|
| 8 |
// |
|---|
| 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. |
|---|
| 13 |
// |
|---|
| 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. |
|---|
| 17 |
// |
|---|
| 18 |
|
|---|
| 19 |
static inline UNUSED void * |
|---|
| 20 |
Vector_begin(struct Vector *vec) |
|---|
| 21 |
{ |
|---|
| 22 |
return vec->data; |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
static inline UNUSED void * |
|---|
| 26 |
Vector_end(struct Vector *vec) |
|---|
| 27 |
{ |
|---|
| 28 |
return (char *)(vec->data) + (vec->count * vec->elem_size); |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
static inline UNUSED void const * |
|---|
| 32 |
Vector_begin_const(struct Vector const *vec) |
|---|
| 33 |
{ |
|---|
| 34 |
return vec->data; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
static inline UNUSED void const * |
|---|
| 38 |
Vector_end_const(struct Vector const *vec) |
|---|
| 39 |
{ |
|---|
| 40 |
return (char *)(vec->data) + (vec->count * vec->elem_size); |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
static inline UNUSED size_t |
|---|
| 44 |
Vector_count(struct Vector const *vec) |
|---|
| 45 |
{ |
|---|
| 46 |
return vec->count; |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
static inline UNUSED void const * |
|---|
| 50 |
Vector_search_const(struct Vector const *vec, void const *key, int (*compar)(const void *, const void *)) |
|---|
| 51 |
{ |
|---|
| 52 |
return Vector_search((struct Vector *)(vec), key, compar); |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
static inline UNUSED void const * |
|---|
| 56 |
Vector_searchSelfOrg_const(struct Vector const *vec, void const *key, |
|---|
| 57 |
int (*compare)(const void *, const void *), |
|---|
| 58 |
VectorSelfOrgMethod method) |
|---|
| 59 |
{ |
|---|
| 60 |
return Vector_searchSelfOrg((struct Vector *)(vec), key, compare, method); |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
static inline UNUSED void |
|---|
| 64 |
Vector_foreach_const(struct Vector const *vec, void (*func)(void const *, void *), |
|---|
| 65 |
void *data) |
|---|
| 66 |
{ |
|---|
| 67 |
Vector_foreach((struct Vector *)(vec), |
|---|
| 68 |
(void (*)(void *, void *))(func), |
|---|
| 69 |
data); |
|---|
| 70 |
} |
|---|