s3_arraylist.h
Go to the documentation of this file.
1 
2 #ifndef _S3_ARRAYLIST_H
3 #define _S3_ARRAYLIST_H
4 
5 #include "sphinx3_export.h"
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #define S3_ARRAYLIST_DEFAULT_SIZE 16
11 
12 /* s3_arraylist.h - Defines a storage structure for generic, dynamic
13  * sequences. It also implements fast queue and stack operations.
14  */
15 
16 typedef struct s3_arraylist_s {
17  void **array;
18  int head;
19  int count;
20  int max;
22 
23 /*----------------------------------
24  | Initialization and destruction |
25  ----------------------------------*/
26 
33 void
35 
43 void
44 s3_arraylist_init_size(s3_arraylist_t *_arraylist, int _size);
45 
53 void
55 
63 void
65 
66 /*--------------------------
67  | Array style operations |
68  --------------------------*/
69 
83 void
84 s3_arraylist_set(s3_arraylist_t *_arraylist, int _pos, void *_ptr);
85 
94 void *
95 s3_arraylist_get(s3_arraylist_t *_arraylist, int _pos);
96 
106 void *
107 s3_arraylist_replace(s3_arraylist_t *_arraylist, int _pos, void *_ptr);
108 
109 /*-------------------------
110  | List style operations |
111  -------------------------*/
112 
121 void *
122 s3_arraylist_remove(s3_arraylist_t *_arraylist, int _pos);
123 
133 void
134 s3_arraylist_insert(s3_arraylist_t *_arraylist, int _pos, void *_ptr);
135 
143 void
144 s3_arraylist_append(s3_arraylist_t *_arraylist, void *_ptr);
145 
153 void
154 s3_arraylist_prepend(s3_arraylist_t *_arraylist, void *_ptr);
155 
162 void *
163 s3_arraylist_pop(s3_arraylist_t *_arraylist);
164 
171 void *
173 
174 /*---------------------------
175  | Miscellaneus operations |
176  ---------------------------*/
177 
185 int
187 
195 void **
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 #endif