TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
This abstract class is the base of all TSDuck classes which are backed by a C++ object. More...
Public Member Functions | |
abstract void | delete () |
Explicitly free the underlying C++ object. | |
Protected Attributes | |
long | nativeObject = 0 |
The address of the underlying C++ object. | |
This abstract class is the base of all TSDuck classes which are backed by a C++ object.
There is an inherent problem when garbage-collected languages such as Java are interfaced with languages using explicit memory management. When a Java class encapsulates a native C++ object of the corresponding C++ class, when should the C++ object be deleted? This is a problem which has been discussed many times on the Internet and the answer is disappointing: there is no good solution.
In the Java TSDuck bindings, all classes which encapsulate a C++ object implement the interface NativeObject which provides the delete() method to explicitly delete the C++ object. In practice, users have the choice between solutions 2 or 3.
|
abstract |
Explicitly free the underlying C++ object.
After this call, the object becomes unusable. Most usages are unpredictable but most likely will do nothing.
Reimplemented in io.tsduck.AbstractAsyncReport, io.tsduck.AbstractPluginEventHandler, io.tsduck.AbstractSyncReport, io.tsduck.AsyncReport, io.tsduck.DuckContext, io.tsduck.ErrReport, io.tsduck.InputSwitcher, io.tsduck.NullReport, io.tsduck.SectionFile, io.tsduck.SystemMonitor, and io.tsduck.TSProcessor.
|
protected |
The address of the underlying C++ object.
It is normally accessed by native methods only.