s3_arraylist.h

Go to the documentation of this file.
00001 
00002 #ifndef _S3_ARRAYLIST_H
00003 #define _S3_ARRAYLIST_H
00004 
00005 #include "sphinx3_export.h"
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 #define S3_ARRAYLIST_DEFAULT_SIZE       16
00011 
00012 /* s3_arraylist.h - Defines a storage structure for generic, dynamic
00013  * sequences.  It also implements fast queue and stack operations.
00014  */
00015 
00016 typedef struct s3_arraylist_s {
00017   void **array;
00018   int head;
00019   int count;
00020   int max;
00021 } s3_arraylist_t;
00022 
00023 /*----------------------------------
00024   | Initialization and destruction |
00025   ----------------------------------*/
00026 
00033 void
00034 s3_arraylist_init(s3_arraylist_t *_arraylist);
00035 
00043 void
00044 s3_arraylist_init_size(s3_arraylist_t *_arraylist, int _size);
00045 
00053 void
00054 s3_arraylist_close(s3_arraylist_t *_arraylist);
00055 
00063 void
00064 s3_arraylist_clear(s3_arraylist_t *_arraylist);
00065 
00066 /*--------------------------
00067   | Array style operations |
00068   --------------------------*/
00069 
00083 void
00084 s3_arraylist_set(s3_arraylist_t *_arraylist, int _pos, void *_ptr);
00085 
00094 void *
00095 s3_arraylist_get(s3_arraylist_t *_arraylist, int _pos);
00096 
00106 void *
00107 s3_arraylist_replace(s3_arraylist_t *_arraylist, int _pos, void *_ptr);
00108 
00109 /*-------------------------
00110   | List style operations |
00111   -------------------------*/
00112 
00121 void *
00122 s3_arraylist_remove(s3_arraylist_t *_arraylist, int _pos);
00123 
00133 void
00134 s3_arraylist_insert(s3_arraylist_t *_arraylist, int _pos, void *_ptr);
00135 
00143 void
00144 s3_arraylist_append(s3_arraylist_t *_arraylist, void *_ptr);
00145 
00153 void
00154 s3_arraylist_prepend(s3_arraylist_t *_arraylist, void *_ptr);
00155 
00162 void *
00163 s3_arraylist_pop(s3_arraylist_t *_arraylist);
00164 
00171 void *
00172 s3_arraylist_dequeue(s3_arraylist_t *_arraylist);
00173 
00174 /*---------------------------
00175   | Miscellaneus operations |
00176   ---------------------------*/
00177 
00184 S3DECODER_EXPORT
00185 int
00186 s3_arraylist_count(s3_arraylist_t *_arraylist);
00187 
00195 void **
00196 s3_arraylist_to_array(s3_arraylist_t *_arraylist);
00197 
00198 #ifdef __cplusplus
00199 }
00200 #endif
00201 #endif

Generated on 7 Mar 2010 by  doxygen 1.6.1