00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef AXIS2_ARRAY_LIST_H
00019 #define AXIS2_ARRAY_LIST_H
00020
00033 #include <axis2_utils_defines.h>
00034 #include <axis2_env.h>
00035
00036 #ifdef __cplusplus
00037 extern "C"
00038 {
00039 #endif
00040
00041 struct axis2_array_list;
00042 struct axis2_array_list_ops;
00043
00044 static const int AXIS2_ARRAY_LIST_DEFAULT_CAPACITY = 16;
00045
00049 typedef struct axis2_array_list_ops
00050 {
00060 axis2_status_t (AXIS2_CALL *
00061 ensure_capacity)(
00062 struct axis2_array_list *array_list,
00063 const axis2_env_t *env,
00064 int min_capacity);
00065
00072 int (AXIS2_CALL *
00073 size)(
00074 struct axis2_array_list *array_list,
00075 const axis2_env_t *env);
00076
00083 axis2_bool_t (AXIS2_CALL *
00084 is_empty)(
00085 struct axis2_array_list *array_list,
00086 const axis2_env_t *env);
00087
00095 axis2_bool_t (AXIS2_CALL *
00096 contains)(
00097 struct axis2_array_list *array_list,
00098 const axis2_env_t *env,
00099 void *e);
00100
00110 int (AXIS2_CALL *
00111 index_of)(
00112 struct axis2_array_list *array_list,
00113 const axis2_env_t *env,
00114 void *e);
00115
00125 int (AXIS2_CALL *
00126 last_index_of)(
00127 struct axis2_array_list *array_list,
00128 const axis2_env_t *env,
00129 void *e);
00130
00138 void** (AXIS2_CALL *
00139 to_array)(
00140 struct axis2_array_list *array_list,
00141 const axis2_env_t *env);
00142
00150 void* (AXIS2_CALL *
00151 get)(struct axis2_array_list *array_list,
00152 const axis2_env_t *env,
00153 int index);
00154
00164 void* (AXIS2_CALL *
00165 set)(
00166 struct axis2_array_list *array_list,
00167 const axis2_env_t *env,
00168 int index,
00169 void* e);
00170
00179 axis2_status_t (AXIS2_CALL *
00180 add)(
00181 struct axis2_array_list *array_list,
00182 const axis2_env_t *env,
00183 const void* e);
00184
00195 axis2_status_t (AXIS2_CALL *
00196 add_at)(
00197 struct axis2_array_list *array_list,
00198 const axis2_env_t *env,
00199 const int index,
00200 const void* e);
00201
00209 void* (AXIS2_CALL *
00210 remove)(struct axis2_array_list *array_list,
00211 const axis2_env_t *env,
00212 int index);
00213
00221 axis2_bool_t (AXIS2_CALL *
00222 check_bound_inclusive)(
00223 struct axis2_array_list *array_list,
00224 const axis2_env_t *env,
00225 int index);
00226
00234 axis2_bool_t (AXIS2_CALL *
00235 check_bound_exclusive)(
00236 struct axis2_array_list *array_list,
00237 const axis2_env_t *env,
00238 int index);
00239
00245 axis2_status_t (AXIS2_CALL *
00246 free)(
00247 struct axis2_array_list *array_list,
00248 const axis2_env_t *env);
00249
00250 }
00251 axis2_array_list_ops_t;
00252
00257 typedef struct axis2_array_list
00258 {
00260 axis2_array_list_ops_t *ops;
00261 }
00262 axis2_array_list_t;
00263
00270 AXIS2_EXTERN axis2_array_list_t* AXIS2_CALL axis2_array_list_create(
00271 const axis2_env_t *env,
00272 int capacity);
00273
00279 AXIS2_EXTERN axis2_status_t AXIS2_CALL
00280 axis2_array_list_free_void_arg(
00281 void *array_list,
00282 const axis2_env_t *env);
00283
00286 #define AXIS2_ARRAY_LIST_FREE(array_list, env) \
00287 ((array_list)->ops->free(array_list, env))
00288
00291 #define AXIS2_ARRAY_LIST_SIZE(array_list, env) \
00292 ((array_list)->ops->size(array_list, env))
00293
00296 #define AXIS2_ARRAY_LIST_IS_EMPTY(array_list, env) \
00297 ((array_list)->ops->is_empty(array_list, env))
00298
00301 #define AXIS2_ARRAY_LIST_CONTAINS(array_list, env, e) \
00302 ((array_list)->ops->contains(array_list, env, e))
00303
00306 #define AXIS2_ARRAY_LIST_INDEX_OF(array_list, env, e) \
00307 ((array_list)->ops->index_of(array_list, env, e))
00308
00311 #define AXIS2_ARRAY_LIST_LAST_INDEX_OF(array_list, env, e) \
00312 ((array_list)->ops->last_index_of(array_list, env, e))
00313
00316 #define AXIS2_ARRAY_LIST_TO_ARRAY(array_list, env) \
00317 ((array_list)->ops->index_of(array_list, env))
00318
00321 #define AXIS2_ARRAY_LIST_GET(array_list, env, index) \
00322 ((array_list)->ops->get(array_list, env, index))
00323
00326 #define AXIS2_ARRAY_LIST_SET(array_list, env, index, e) \
00327 ((array_list)->ops->set(array_list, env, index, e))
00328
00331 #define AXIS2_ARRAY_LIST_ADD(array_list, env, e) \
00332 ((array_list)->ops->add(array_list, env, e))
00333
00336 #define AXIS2_ARRAY_LIST_ADD_AT(array_list, env, index, e) \
00337 ((array_list)->ops->add_at(array_list, env, index, e))
00338
00341 #define AXIS2_ARRAY_LIST_REMOVE(array_list, env, index) \
00342 ((array_list)->ops->remove(array_list, env, index))
00343
00346 #ifdef __cplusplus
00347 }
00348 #endif
00349
00350 #endif