Public Member Functions | |
| final java.lang.foreign.MemorySegment | rawPointer () |
| final boolean | isOwned () |
| final void | close () |
| final java.lang.foreign.MemorySegment | release () |
Protected Member Functions | |
| CppObject (java.lang.foreign.MemorySegment ptr, java.util.function.Consumer< java.lang.foreign.MemorySegment > destroy, java.lang.Object owner) | |
The base class of the wrappers of the opaque C++ classes.
An instance either owns its C++ object (then the object is destroyed when the wrapper is garbage-collected or closed), or is a reference to an object owned by something else. References returned by methods keep their owner alive.
|
protected |
Wraps a pointer from the C bindings. If destroy is not null, the object is owned and destroy is called on it when the wrapper dies. owner is kept alive as long as this wrapper is.
| final void meshlib.CppObject.close | ( | ) |
Destroys the C++ object now, if owned. The wrapper can't be used after this. Calling it again does nothing.
| final boolean meshlib.CppObject.isOwned | ( | ) |
Does this wrapper own its C++ object?
| final java.lang.foreign.MemorySegment meshlib.CppObject.rawPointer | ( | ) |
The address of the native object. For opaque classes it's a zero-length segment, for exposed structs it covers the struct.
Implements meshlib.Native.
| final java.lang.foreign.MemorySegment meshlib.CppObject.release | ( | ) |
Gives up the ownership of the C++ object and returns its pointer. The caller is responsible for destroying it. The wrapper can't be used after this.