Home | History | Annotate | Download | only in include
      1 /*---------------------------------------------------------------------------*
      2  *  IntArrayListImpl.h  *
      3  *                                                                           *
      4  *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
      5  *                                                                           *
      6  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
      7  *  you may not use this file except in compliance with the License.         *
      8  *                                                                           *
      9  *  You may obtain a copy of the License at                                  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0                           *
     11  *                                                                           *
     12  *  Unless required by applicable law or agreed to in writing, software      *
     13  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
     14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
     15  *  See the License for the specific language governing permissions and      *
     16  *  limitations under the License.                                           *
     17  *                                                                           *
     18  *---------------------------------------------------------------------------*/
     19 
     20 #ifndef __INTARRAYLISTIMPL_H
     21 #define __INTARRAYLISTIMPL_H
     22 
     23 
     24 
     25 #include "ESR_ReturnCode.h"
     26 #include "ESR_SharedPrefix.h"
     27 
     28 /**
     29  * IntArrayList implementation.
     30  */
     31 typedef struct IntArrayListImpl_t
     32 {
     33   /**
     34    * Interface functions that must be implemented.
     35    */
     36   IntArrayList Interface;
     37   /**
     38    * IntArrayList contents.
     39    */
     40   int* contents;
     41   /**
     42    * Virtual number of allocated element slots.
     43    */
     44   size_t virtualSize;
     45   /**
     46    * Actual number of allocated element slots.
     47    */
     48   size_t actualSize;
     49 }
     50 IntArrayListImpl;
     51 
     52 
     53 /**
     54  * Default implementation.
     55  */
     56 ESR_SHARED_API ESR_ReturnCode IntArrayList_Add(IntArrayList* self, const int element);
     57 
     58 /**
     59  * Default implementation.
     60  */
     61 ESR_SHARED_API ESR_ReturnCode IntArrayList_Remove(IntArrayList* self, const int element);
     62 
     63 /**
     64  * Default implementation.
     65  */
     66 ESR_SHARED_API ESR_ReturnCode IntArrayList_RemoveAll(IntArrayList* self);
     67 
     68 /**
     69  * Default implementation.
     70  */
     71 ESR_SHARED_API ESR_ReturnCode IntArrayList_Contains(IntArrayList* self, const int element, ESR_BOOL* exists);
     72 
     73 /**
     74  * Default implementation.
     75  */
     76 ESR_SHARED_API ESR_ReturnCode IntArrayList_Get(IntArrayList* self, size_t index, int* element);
     77 
     78 /**
     79  * Default implementation.
     80  */
     81 ESR_SHARED_API ESR_ReturnCode IntArrayList_Set(IntArrayList* self, size_t index, const int element);
     82 
     83 /**
     84  * Default implementation.
     85  */
     86 ESR_SHARED_API ESR_ReturnCode IntArrayList_GetSize(IntArrayList* self, size_t* size);
     87 
     88 /**
     89  * Default implementation.
     90  */
     91 ESR_SHARED_API ESR_ReturnCode IntArrayList_ToStaticArray(IntArrayList* self, int** newArray);
     92 
     93 /**
     94  * Default implementation.
     95  */
     96 ESR_SHARED_API ESR_ReturnCode IntArrayList_Destroy(IntArrayList* self);
     97 
     98 #endif /* __INTARRAYLIST_H */
     99