Blender  V2.93
MEM_CacheLimiterC-Api.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #ifndef __MEM_CACHELIMITERC_API_H__
22 #define __MEM_CACHELIMITERC_API_H__
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "BLI_utildefines.h"
29 
30 struct MEM_CacheLimiter_s;
31 struct MEM_CacheLimiterHandle_s;
32 
33 typedef struct MEM_CacheLimiter_s MEM_CacheLimiterC;
34 typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
35 
36 /* function used to remove data from memory */
37 typedef void (*MEM_CacheLimiter_Destruct_Func)(void *);
38 
39 /* function used to measure stored data element size */
40 typedef size_t (*MEM_CacheLimiter_DataSize_Func)(void *);
41 
42 /* function used to measure priority of item when freeing memory */
43 typedef int (*MEM_CacheLimiter_ItemPriority_Func)(void *, int);
44 
45 /* function to check whether item could be destroyed */
46 typedef bool (*MEM_CacheLimiter_ItemDestroyable_Func)(void *);
47 
48 #ifndef __MEM_CACHELIMITER_H__
49 void MEM_CacheLimiter_set_maximum(size_t m);
50 size_t MEM_CacheLimiter_get_maximum(void);
51 void MEM_CacheLimiter_set_disabled(bool disabled);
53 #endif /* __MEM_CACHELIMITER_H__ */
54 
65 
75 
84 
92 
101 
109 
118 
127 
135 
143 
145  MEM_CacheLimiter_ItemPriority_Func item_priority_func);
146 
148  MEM_CacheLimiterC *This, MEM_CacheLimiter_ItemDestroyable_Func item_destroyable_func);
149 
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif // __MEM_CACHELIMITERC_API_H__
void MEM_CacheLimiter_ItemPriority_Func_set(MEM_CacheLimiterC *This, MEM_CacheLimiter_ItemPriority_Func item_priority_func)
struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC
void MEM_CacheLimiter_set_maximum(size_t m)
void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC *This)
int(* MEM_CacheLimiter_ItemPriority_Func)(void *, int)
bool(* MEM_CacheLimiter_ItemDestroyable_Func)(void *)
void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC *handle)
MEM_CacheLimiterHandleC * MEM_CacheLimiter_insert(MEM_CacheLimiterC *This, void *data)
void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC *handle)
void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This)
void(* MEM_CacheLimiter_Destruct_Func)(void *)
int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC *handle)
void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle)
void MEM_CacheLimiter_ItemDestroyable_Func_set(MEM_CacheLimiterC *This, MEM_CacheLimiter_ItemDestroyable_Func item_destroyable_func)
struct MEM_CacheLimiter_s MEM_CacheLimiterC
size_t MEM_CacheLimiter_get_maximum(void)
size_t MEM_CacheLimiter_get_memory_in_use(MEM_CacheLimiterC *This)
void MEM_CacheLimiter_set_disabled(bool disabled)
bool MEM_CacheLimiter_is_disabled(void)
size_t(* MEM_CacheLimiter_DataSize_Func)(void *)
void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC *handle)
void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC *handle)
MEM_CacheLimiterC * new_MEM_CacheLimiter(MEM_CacheLimiter_Destruct_Func data_destructor, MEM_CacheLimiter_DataSize_Func data_size)