-
public final class RCPointer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classRCPointer.Companion
-
Method Summary
-
-
Constructor Detail
-
RCPointer
RCPointer(Long cppPointer, Function1<Long, Unit> onDelete, String label)
- Parameters:
cppPointer- The native pointer address.onDelete- A callback invoked when the reference count reaches zero to clean up the native resource.label- A label for the object pointed to, used for logging purposes, e.g.
-
-
Method Detail
-
getPointer
final Long getPointer()
-
getOnDelete
final Function1<Long, Unit> getOnDelete()
-
acquire
final Unit acquire(String source)
Acquires a reference to this pointer.
- Parameters:
source- A string indicating the source of the acquire call for logging purposes, e.g.
-
release
final Unit release(String source, String reason)
Releases a reference to this pointer. When the reference count reaches zero, the onDelete callback is invoked to clean up the native resource.
- Parameters:
source- A string indicating the source of the release call for logging purposes, e.g.reason- An optional reason for the release, for logging purposes.
-
-
-
-