ArrayList.h

00001 /*---------------------------------------------------------------------------*
00002  *  ArrayList.h  *
00003  *                                                                           *
00004  *  Copyright 2007 Nuance Communciations, Inc.                               *
00005  *                                                                           *
00006  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
00007  *  you may not use this file except in compliance with the License.         *
00008  *                                                                           *
00009  *  You may obtain a copy of the License at                                  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0                           *
00011  *                                                                           *
00012  *  Unless required by applicable law or agreed to in writing, software      *
00013  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
00014  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 
00015  *  See the License for the specific language governing permissions and      *
00016  *  limitations under the License.                                           *
00017  *                                                                           *
00018  *---------------------------------------------------------------------------*/
00019 
00020 #ifndef __ARRAYLIST_H
00021 #define __ARRAYLIST_H
00022 
00023 
00024 
00025 #include "ESR_ReturnCode.h"
00026 #include "PortPrefix.h"
00027 #include "ptypes.h"
00028 #include <stdlib.h>
00029 
00040 typedef struct ArrayList_t
00041 {
00049   ESR_ReturnCode(*add)(struct ArrayList_t* self, void* element);
00050   
00063   ESR_ReturnCode(*insertAt)(struct ArrayList_t* self, size_t index,
00064                             void *element);
00065                             
00073   ESR_ReturnCode(*remove)(struct ArrayList_t* self, const void* element);
00074   
00083   ESR_ReturnCode(*removeAtIndex)(struct ArrayList_t* self, size_t index);
00084   
00091   ESR_ReturnCode(*removeAll)(struct ArrayList_t* self);
00092   
00101   ESR_ReturnCode(*contains)(struct ArrayList_t* self, const void* element, ESR_BOOL* exists);
00102   
00110   ESR_ReturnCode(*getSize)(struct ArrayList_t* self, size_t* size);
00111   
00120   ESR_ReturnCode(*get)(struct ArrayList_t* self, size_t index, void** element);
00121   
00131   ESR_ReturnCode(*set)(struct ArrayList_t* self, size_t index, void* element);
00132   
00141   ESR_ReturnCode(*toStaticArray)(struct ArrayList_t* self, void** newArray);
00142   
00151   ESR_ReturnCode(*clone)(struct ArrayList_t* self, struct ArrayList_t* clone);
00152   
00159   ESR_ReturnCode(*destroy)(struct ArrayList_t* self);
00160 }
00161 ArrayList;
00162 
00169 PORTABLE_API ESR_ReturnCode ArrayListCreate(ArrayList** self);
00170 
00178 PORTABLE_API ESR_ReturnCode ArrayListCreateWithCapacity(ArrayList** self, size_t minCapacity);
00179 
00187 PORTABLE_API ESR_ReturnCode ArrayListAdd(ArrayList* self, void* element);
00188 
00189 
00203 PORTABLE_API ESR_ReturnCode ArrayListInsertAt(ArrayList* self,
00204     size_t index,
00205     void *element);
00206     
00214 PORTABLE_API ESR_ReturnCode ArrayListRemove(ArrayList* self, void* element);
00223 PORTABLE_API ESR_ReturnCode ArrayListRemoveAtIndex(ArrayList* self, size_t index);
00224 
00231 PORTABLE_API ESR_ReturnCode ArrayListRemoveAll(ArrayList* self);
00232 
00241 PORTABLE_API ESR_ReturnCode ArrayListContains(ArrayList* self, void* element, ESR_BOOL* exists);
00242 
00250 PORTABLE_API ESR_ReturnCode ArrayListGetSize(ArrayList* self, size_t* size);
00251 
00260 PORTABLE_API ESR_ReturnCode ArrayListGet(ArrayList* self, size_t index, void** element);
00261 
00271 PORTABLE_API ESR_ReturnCode ArrayListSet(ArrayList* self, size_t index, void* element);
00272 
00281 PORTABLE_API ESR_ReturnCode ArrayListClone(ArrayList* self, ArrayList* clone);
00282 
00289 PORTABLE_API ESR_ReturnCode ArrayListDestroy(ArrayList* self);
00290 
00295 #endif /* __ARRAYLIST_H */

Generated on Thu May 1 15:37:25 2008 for SREC by  doxygen 1.5.3