Blender V2.61 - r43446

dynamiclist.h

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