~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/memutil/MEM_CacheLimiterC-Api.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#ifdef __cplusplus
32
32
extern "C" {
33
33
#endif
34
 
        
 
34
 
35
35
struct MEM_CacheLimiter_s;
36
36
struct MEM_CacheLimiterHandle_s;
37
37
 
39
39
typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
40
40
 
41
41
/* function used to remove data from memory */
42
 
typedef void(*MEM_CacheLimiter_Destruct_Func)(void*);
 
42
typedef void (*MEM_CacheLimiter_Destruct_Func)(void*);
43
43
 
44
44
/* function used to measure stored data element size */
45
 
typedef size_t(*MEM_CacheLimiter_DataSize_Func) (void*);
 
45
typedef size_t (*MEM_CacheLimiter_DataSize_Func) (void*);
 
46
 
 
47
/* function used to measure priority of item when freeing memory */
 
48
typedef int (*MEM_CacheLimiter_ItemPriority_Func) (void*, int);
46
49
 
47
50
#ifndef __MEM_CACHELIMITER_H__
48
 
extern void MEM_CacheLimiter_set_maximum(size_t m);
49
 
extern int MEM_CacheLimiter_get_maximum(void);
 
51
void MEM_CacheLimiter_set_maximum(size_t m);
 
52
int MEM_CacheLimiter_get_maximum(void);
50
53
#endif /* __MEM_CACHELIMITER_H__ */
51
 
/** 
52
 
 * Create new MEM_CacheLimiter object 
 
54
 
 
55
/**
 
56
 * Create new MEM_CacheLimiter object
53
57
 * managed objects are destructed with the data_destructor
54
58
 *
55
59
 * @param data_destructor
56
60
 * @return A new MEM_CacheLimter object
57
61
 */
58
62
 
59
 
extern MEM_CacheLimiterC * new_MEM_CacheLimiter(
60
 
        MEM_CacheLimiter_Destruct_Func data_destructor,
61
 
        MEM_CacheLimiter_DataSize_Func data_size);
 
63
MEM_CacheLimiterC *new_MEM_CacheLimiter(MEM_CacheLimiter_Destruct_Func data_destructor,
 
64
                                         MEM_CacheLimiter_DataSize_Func data_size);
62
65
 
63
 
/** 
 
66
/**
64
67
 * Delete MEM_CacheLimiter
65
 
 * 
 
68
 *
66
69
 * Frees the memory of the CacheLimiter but does not touch managed objects!
67
70
 *
68
71
 * @param This "This" pointer
69
72
 */
70
73
 
71
 
extern void delete_MEM_CacheLimiter(MEM_CacheLimiterC * This);
 
74
void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This);
72
75
 
73
 
/** 
 
76
/**
74
77
 * Manage object
75
 
 * 
 
78
 *
76
79
 * @param This "This" pointer, data data object to manage
77
80
 * @return CacheLimiterHandle to ref, unref, touch the managed object
78
81
 */
79
 
        
80
 
extern MEM_CacheLimiterHandleC * MEM_CacheLimiter_insert(
81
 
        MEM_CacheLimiterC * This, void * data);
82
 
 
83
 
/** 
 
82
 
 
83
MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC *This, void *data);
 
84
 
 
85
/**
84
86
 * Free objects until memory constraints are satisfied
85
 
 * 
 
87
 *
86
88
 * @param This "This" pointer
87
89
 */
88
90
 
89
 
extern void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC * This);
 
91
void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC *This);
90
92
 
91
 
/** 
92
 
 * Unmanage object previously inserted object. 
 
93
/**
 
94
 * Unmanage object previously inserted object.
93
95
 * Does _not_ delete managed object!
94
 
 * 
 
96
 *
95
97
 * @param This "This" pointer, handle of object
96
98
 */
97
 
        
98
 
extern void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC * handle);
99
 
 
100
 
 
101
 
/** 
 
99
 
 
100
void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC *handle);
 
101
 
 
102
 
 
103
/**
102
104
 * Raise priority of object (put it at the tail of the deletion chain)
103
 
 * 
 
105
 *
104
106
 * @param handle of object
105
107
 */
106
 
        
107
 
extern void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC * handle);
108
 
 
109
 
/** 
 
108
 
 
109
void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC *handle);
 
110
 
 
111
/**
110
112
 * Increment reference counter. Objects with reference counter != 0 are _not_
111
113
 * deleted.
112
 
 * 
 
114
 *
113
115
 * @param handle of object
114
116
 */
115
 
        
116
 
extern void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC * handle);
117
 
 
118
 
/** 
 
117
 
 
118
void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC *handle);
 
119
 
 
120
/**
119
121
 * Decrement reference counter. Objects with reference counter != 0 are _not_
120
122
 * deleted.
121
 
 * 
 
123
 *
122
124
 * @param handle of object
123
125
 */
124
 
        
125
 
extern void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC * handle);
126
 
 
127
 
/** 
 
126
 
 
127
void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC *handle);
 
128
 
 
129
/**
128
130
 * Get reference counter.
129
 
 * 
 
131
 *
130
132
 * @param This "This" pointer, handle of object
131
133
 */
132
 
        
133
 
extern int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC * handle);
134
 
 
135
 
/** 
 
134
 
 
135
int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC *handle);
 
136
 
 
137
/**
136
138
 * Get pointer to managed object
137
 
 * 
 
139
 *
138
140
 * @param handle of object
139
141
 */
140
 
        
141
 
extern void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC * handle);
 
142
 
 
143
void *MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle);
 
144
 
 
145
void MEM_CacheLimiter_ItemPriority_Func_set(MEM_CacheLimiterC *This,
 
146
                                            MEM_CacheLimiter_ItemPriority_Func item_priority_func);
142
147
 
143
148
#ifdef __cplusplus
144
149
}