Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

simplelist.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  * Verball Model Storage Library, Common Information Model Library 
00004  * for integration of Intelligent Services.
00005  * Copyright (C) 2005 Nikita Vinokurov, Orgway LLC.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; 
00010  * version 2.1 of the License.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00020  * Boston, MA  02110-1301  USA
00021  *
00022  * $Id: simplelist.h,v 1.4 2006/09/18 21:38:32 sbreg Exp $
00023  **********************************************************************/
00024 
00027 #ifndef __SIMPLELIST_H__
00028 #define __SIMPLELIST_H__
00029 
00030 #if defined(_WIN32) || defined(__declspec)
00031 
00032 #ifdef COMPILE_DLL
00033 #define STORAGE_TYPE __declspec(dllexport)
00034 #else // COMPILE_DLL
00035 #define STORAGE_TYPE __declspec(dllimport)
00036 #endif // COMPILE_DLL
00037 
00038 #else
00039 #define STORAGE_TYPE extern
00040 #endif // _WIN32 || __declspec
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 
00047 
00049 typedef void (*element_free_func)(void *);
00050 
00053 typedef struct 
00054 {
00056     unsigned count;
00058     size_t size;
00060     size_t capacity;
00061     void** list;
00062     unsigned current;
00064     element_free_func free_element;
00065 } SimpleList;
00066 
00071 STORAGE_TYPE SimpleList* new_list();
00077 STORAGE_TYPE SimpleList* new_list_with_destructor(element_free_func free_element);
00078 
00085 STORAGE_TYPE
00086 int append_element( SimpleList* list, void*  elt);
00092 STORAGE_TYPE void* pop_element( SimpleList* list, int index);
00098 STORAGE_TYPE
00099 void* get_element( SimpleList* list, int index);
00101 STORAGE_TYPE
00102 void remove_element( SimpleList* list, int index);
00105 STORAGE_TYPE
00106 int clear_list( SimpleList* list);
00108 STORAGE_TYPE
00109 int delete_list( SimpleList* list);
00112 STORAGE_TYPE
00113 int list_extend( SimpleList* list, SimpleList* addin, int flag );
00114     
00116 STORAGE_TYPE
00117 void *list_iterator(SimpleList *list);
00118 
00127 STORAGE_TYPE
00128 void *list_next(SimpleList *list);
00129 
00130 
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134 
00135 #endif

Generated on Wed Dec 27 16:52:17 2006 for VRB Online Server by  doxygen 1.4.4