Blender V2.61 - r43446

MEM_CacheLimiterC-Api.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): Peter Schlaile <peter@schlaile.de> 2005
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #ifndef MEM_CACHELIMITERC_API_H
00029 #define MEM_CACHELIMITERC_API_H
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034     
00035 struct MEM_CacheLimiter_s;
00036 struct MEM_CacheLimiterHandle_s;
00037 
00038 typedef struct MEM_CacheLimiter_s MEM_CacheLimiterC;
00039 typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
00040 
00041 /* function used to remove data from memory */
00042 typedef void(*MEM_CacheLimiter_Destruct_Func)(void*);
00043 
00044 /* function used to measure stored data element size */
00045 typedef intptr_t(*MEM_CacheLimiter_DataSize_Func) (void*);
00046 
00047 #ifndef MEM_CACHELIMITER_H
00048 extern void MEM_CacheLimiter_set_maximum(int m);
00049 extern int MEM_CacheLimiter_get_maximum(void);
00050 #endif // MEM_CACHELIMITER_H
00051 
00059 extern MEM_CacheLimiterC * new_MEM_CacheLimiter(
00060     MEM_CacheLimiter_Destruct_Func data_destructor,
00061     MEM_CacheLimiter_DataSize_Func data_size);
00062 
00071 extern void delete_MEM_CacheLimiter(MEM_CacheLimiterC * This);
00072 
00080 extern MEM_CacheLimiterHandleC * MEM_CacheLimiter_insert(
00081     MEM_CacheLimiterC * This, void * data);
00082 
00089 extern void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC * This);
00090 
00098 extern void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC * handle);
00099 
00100 
00107 extern void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC * handle);
00108 
00116 extern void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC * handle);
00117 
00125 extern void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC * handle);
00126 
00133 extern int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC * handle);
00134 
00141 extern void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC * handle);
00142 
00143 #ifdef __cplusplus
00144 }
00145 #endif
00146 
00147 
00148 #endif // MEM_CACHELIMITERC_API_H