45 template <
typename item_t,
typename lock_t>
103 template <
typename T>
201 #define HB_OBJECT_HEADER_STATIC {}
208 template <
typename Type>
209 static inline void hb_object_trace (
const Type *
obj,
const char *
function)
214 obj ?
obj->header.ref_count.get_relaxed () : 0);
217 template <
typename Type>
218 static inline Type *hb_object_create ()
225 hb_object_init (
obj);
229 template <
typename Type>
230 static inline void hb_object_init (
Type *
obj)
232 obj->header.ref_count.init ();
233 obj->header.writable.set_relaxed (
true);
234 obj->header.user_data.init ();
236 template <
typename Type>
237 static inline bool hb_object_is_valid (
const Type *
obj)
239 return likely (
obj->header.ref_count.is_valid ());
241 template <
typename Type>
242 static inline bool hb_object_is_immutable (
const Type *
obj)
244 return !
obj->header.writable.get_relaxed ();
246 template <
typename Type>
247 static inline void hb_object_make_immutable (
const Type *
obj)
249 obj->header.writable.set_relaxed (
false);
251 template <
typename Type>
252 static inline Type *hb_object_reference (
Type *
obj)
258 obj->header.ref_count.inc ();
261 template <
typename Type>
262 static inline bool hb_object_destroy (
Type *
obj)
268 if (
obj->header.ref_count.dec () != 1)
271 hb_object_fini (
obj);
274 template <
typename Type>
275 static inline void hb_object_fini (
Type *
obj)
277 obj->header.ref_count.fini ();
286 template <
typename Type>
287 static inline bool hb_object_set_user_data (
Type *
obj,
316 template <
typename Type>
317 static inline void *hb_object_get_user_data (
Type *
obj,
small capitals from c petite p scientific i
[1]
#define DEBUG_MSG(WHAT, OBJ,...)
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
void(* hb_destroy_func_t)(void *user_data)
HB_BEGIN_DECLS typedef int hb_bool_t
HB_EXTERN hb_font_get_glyph_func_t void * user_data
HB_EXTERN hb_font_get_glyph_func_t void hb_destroy_func_t destroy
bool find(T v, item_t *i, lock_t &l)
void remove(T v, lock_t &l)
hb_vector_t< item_t > items
item_t * find_or_insert(T v, lock_t &l)
item_t * replace_or_insert(T v, lock_t &l, bool replace)
hb_atomic_int_t ref_count
bool operator==(const hb_user_data_key_t *other_key) const
hb_destroy_func_t destroy
HB_INTERNAL void * get(hb_user_data_key_t *key)
hb_lockable_set_t< hb_user_data_item_t, hb_mutex_t > items
HB_INTERNAL bool set(hb_user_data_key_t *key, void *data, hb_destroy_func_t destroy, hb_bool_t replace)
Type * lsearch(const T &x, Type *not_found=nullptr)