Blender  V2.59
dynamiclist.h
Go to the documentation of this file.
00001 /*
00002  * $Id: dynamiclist.h 35246 2011-02-27 20:37:56Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Jiri Hnidek.
00021  *
00022  * Documentation of Two way dynamic list with access array can be found at:
00023  *
00024  * http://wiki.blender.org/bin/view.pl/Blenderwiki/DynamicListWithAccessArray
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00034 #ifndef B_DYNAMIC_LIST_H
00035 #define B_DYNAMIC_LIST_H
00036 
00037 #define PAGE_SIZE 4
00038 
00039 struct ListBase;
00040 
00041 /*
00042  * Access array using realloc 
00043  */
00044 typedef struct DynamicArray{
00045         unsigned int count;             /* count of items in list */
00046         unsigned int max_item_index;    /* max available index */
00047         unsigned int last_item_index;   /* max used index */
00048         void **items;                   /* dynamicaly allocated array of pointers
00049                                            pointing at items in list */
00050 } DynamicArray;
00051 
00052 /*
00053  * Two way dynamic list with access array
00054  */
00055 typedef struct DynamicList {
00056         struct DynamicArray da;         /* access array */
00057         struct ListBase lb;             /* two way linked dynamic list */
00058 } DynamicList;
00059 
00060 #endif