00001 #ifndef _CP_VECTOR_H
00002 #define _CP_VECTOR_H
00003
00004 #include "common.h"
00005
00006 __BEGIN_DECLS
00007
00008 #include "config.h"
00009 #include "collection.h"
00010
00011
00012
00013
00014 typedef CPROPS_DLL struct _cp_vector
00015 {
00016 void **mem;
00017 int size;
00018 int head;
00019 int tail;
00020
00021 int mode;
00022 cp_copy_fn copy_item;
00023 cp_destructor_fn free_item;
00024 cp_lock *lock;
00025 } cp_vector;
00026
00027 CPROPS_DLL
00028 cp_vector *cp_vector_create_by_option(int size,
00029 int mode,
00030 cp_copy_fn copy_item,
00031 cp_destructor_fn free_item);
00032 CPROPS_DLL
00033 cp_vector *cp_vector_create(int size);
00034 CPROPS_DLL
00035 cp_vector *cp_vector_wrap(void **data, int len, int mode);
00036 CPROPS_DLL
00037 void cp_vector_destroy(cp_vector *v);
00038 CPROPS_DLL
00039 void cp_vector_destroy_custom(cp_vector *v, cp_destructor_fn dtr);
00040 CPROPS_DLL
00041 void *cp_vector_add_element(cp_vector *v, void *element);
00042 CPROPS_DLL
00043 void *cp_vector_element_at(cp_vector *v, int index);
00044 CPROPS_DLL
00045 void *cp_vector_set_element(cp_vector *v, int index, void *element);
00046 CPROPS_DLL
00047 void *cp_vector_remove_element_at(cp_vector *v, int index);
00048 CPROPS_DLL
00049 int cp_vector_size(cp_vector *v);
00050
00051
00052
00053 __END_DECLS
00054
00055
00056
00057 #endif
00058