Class NDScope

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class NDScope
    extends java.lang.Object
    implements java.lang.AutoCloseable
    A class that tracks NDResource objects created in the try-with-resource block and close them automatically when out of the block scope.

    This class has been derived from org.bytedeco.javacpp.PointerScope by Samuel Audet

    • Constructor Detail

      • NDScope

        public NDScope()
        Constructs a new NDScope instance.
    • Method Detail

      • register

        public static void register​(NDArray array)
        Registers NDArray object to this scope.
        Parameters:
        array - the NDArray object
      • unregister

        public static void unregister​(NDArray array)
        Unregisters NDArray object from this scope.
        Parameters:
        array - the NDArray object
      • unregister

        public static void unregister​(NDArray... arrays)
        Unregisters NDArray object from this scope.
        Parameters:
        arrays - the array of NDArray object
      • unregister

        public static void unregister​(NDList ndlist)
        Unregisters NDArray object from this scope.
        Parameters:
        ndlist - the NDList object
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • suppressNotUsedWarning

        public void suppressNotUsedWarning()
        A method that does nothing.

        You may use it if you do not have a better way to suppress the warning of a created but not explicitly used scope.