3
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version. The Blender
9
* Foundation also sells licenses for use in proprietary software under
10
* the Blender License. See http://www.blender.org/BL/ for information
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software Foundation,
20
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
* Contributor(s): Peter Schlaile <peter@schlaile.de> 2005
24
* ***** END GPL/BL DUAL LICENSE BLOCK *****
27
#ifndef __MEM_cache_limiter_c_api_h_included__
28
#define __MEM_cache_limiter_c_api_h_included__ 1
34
struct MEM_CacheLimiter_s;
35
struct MEM_CacheLimiterHandle_s;
37
typedef struct MEM_CacheLimiter_s MEM_CacheLimiterC;
38
typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
40
#ifndef __MEM_cache_limiter_h_included__
41
extern void MEM_CacheLimiter_set_maximum(int m);
42
extern int MEM_CacheLimiter_get_maximum();
45
* Create new MEM_CacheLimiter object
46
* managed objects are destructed with the data_destructor
48
* @param data_destructor
49
* @return A new MEM_CacheLimter object
52
extern MEM_CacheLimiterC * new_MEM_CacheLimiter(
53
void (*data_destructor) (void * data));
56
* Delete MEM_CacheLimiter
58
* Frees the memory of the CacheLimiter but does not touch managed objects!
60
* @param This "This" pointer
63
extern void delete_MEM_CacheLimiter(MEM_CacheLimiterC * This);
68
* @param This "This" pointer, data data object to manage
69
* @return CacheLimiterHandle to ref, unref, touch the managed object
72
extern MEM_CacheLimiterHandleC * MEM_CacheLimiter_insert(
73
MEM_CacheLimiterC * This, void * data);
76
* Free objects until memory constraints are satisfied
78
* @param This "This" pointer
81
extern void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC * This);
84
* Unmanage object previously inserted object.
85
* Does _not_ delete managed object!
87
* @param This "This" pointer, handle of object
90
extern void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC * handle);
94
* Raise priority of object (put it at the tail of the deletion chain)
96
* @param handle of object
99
extern void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC * handle);
102
* Increment reference counter. Objects with reference counter != 0 are _not_
105
* @param handle of object
108
extern void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC * handle);
111
* Decrement reference counter. Objects with reference counter != 0 are _not_
114
* @param handle of object
117
extern void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC * handle);
120
* Get reference counter.
122
* @param This "This" pointer, handle of object
125
extern int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC * handle);
128
* Get pointer to managed object
130
* @param handle of object
133
extern void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC * handle);