-
Notifications
You must be signed in to change notification settings - Fork 18
Handle natives
native Handle:handle_new(AnyTag:value, bool:weak=false, TagTag:tag_id=tagof(value));
native Handle:handle_new_arr(const AnyTag:value[], bool:weak=false, size=sizeof(value), TagTag:tag_id=tagof(value));
native Handle:handle_new_var(ConstVariantTag:value, bool:weak=false);
Creates a new handle from a value. A "weak" handle will have access to the lifetime of the value, but will not destroy it upon collection. A non-weak handle invokes acquire
upon creation and release
upon destruction on the object.
native Handle:handle_alias(HandleTag:handle, AnyTag:value, TagTag:tag_id=tagof(value));
native Handle:handle_alias_arr(HandleTag:handle, const AnyTag:value[], size=sizeof(value), TagTag:tag_id=tagof(value));
native Handle:handle_alias_var(HandleTag:handle, ConstVariantTag:value);
Creates an aliasing handle from handle
, having a new value but sharing the lifetime.
native Handle:handle_acquire(HandleTag:handle);
Increases the reference count stored in the handle object.
native Handle:handle_release(HandleTag:handle);
Decreases the reference count stored in the handle object.
native handle_delete(HandleTag:handle);
Deletes a handle object. A deleted handle will try to destroy the resources owned by its value, if it was not created as a weak handle.
native bool:handle_valid(HandleTag:handle);
Returns true if the argument is a valid handle reference.
native bool:handle_linked(HandleTag:handle);
Returns true if the handle is linked with an existing object (i.e. observing its lifetime).
native bool:handle_alive(HandleTag:handle);
Returns true if the handle is linked with an existing object or wasn't linked to any object at all. Only handles that are alive will cause their resources to be released.
native bool:handle_weak(HandleTag:handle);
Returns true if the handle is a weak handle. Weak handles will not cause objects to be destroyed upon their collection.
native handle_get(HandleTag:handle, offset=0);
native handle_get_arr(HandleTag:handle, AnyTag:value[], size=sizeof(value));
native Variant:handle_get_var(HandleTag:handle);
native bool:handle_get_safe(HandleTag:handle, &AnyTag:value, offset=0, TagTag:tag_id=tagof(value));
native handle_get_arr_safe(ConstVariantTag:var, AnyTag:value[], size=sizeof(value), TagTag:tag_id=tagof(value));
Obtains the value stored in the handle. The handle can be in any state.
native bool:handle_eq(HandleTag:handle1, HandleTag:handle2);
Returns true if two handles are equal, i.e. watching the same object and having the same values.
native handle_tagof(HandleTag:handle);
Returns the tag of the value inside the handle.
native handle_sizeof(HandleTag:handle);
Returns the size of the value inside the handle.
native Iter:handle_iter(HandleTag:handle, count=1);
Creates an iterator that points to a handle. Count can be used to specify the number of copies of the element in the iterator.