// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from mynteye_types.djinni

package com.slightech.mynteye;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.concurrent.atomic.AtomicBoolean;

/** Frame with raw data */
public interface Frame {
    /** Get the width */
    public int width();

    /** Get the height */
    public int height();

    /** Get the pixel format */
    @NonNull
    public Format format();

    /** Get the size */
    public int size();

    /** Get the data */
    @NonNull
    public byte[] data();

    static final class CppProxy implements Frame
    {
        private final long nativeRef;
        private final AtomicBoolean destroyed = new AtomicBoolean(false);

        private CppProxy(long nativeRef)
        {
            if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
            this.nativeRef = nativeRef;
        }

        private native void nativeDestroy(long nativeRef);
        public void _djinni_private_destroy()
        {
            boolean destroyed = this.destroyed.getAndSet(true);
            if (!destroyed) nativeDestroy(this.nativeRef);
        }
        protected void finalize() throws java.lang.Throwable
        {
            _djinni_private_destroy();
            super.finalize();
        }

        @Override
        public int width()
        {
            assert !this.destroyed.get() : "trying to use a destroyed object";
            return native_width(this.nativeRef);
        }
        private native int native_width(long _nativeRef);

        @Override
        public int height()
        {
            assert !this.destroyed.get() : "trying to use a destroyed object";
            return native_height(this.nativeRef);
        }
        private native int native_height(long _nativeRef);

        @Override
        public Format format()
        {
            assert !this.destroyed.get() : "trying to use a destroyed object";
            return native_format(this.nativeRef);
        }
        private native Format native_format(long _nativeRef);

        @Override
        public int size()
        {
            assert !this.destroyed.get() : "trying to use a destroyed object";
            return native_size(this.nativeRef);
        }
        private native int native_size(long _nativeRef);

        @Override
        public byte[] data()
        {
            assert !this.destroyed.get() : "trying to use a destroyed object";
            return native_data(this.nativeRef);
        }
        private native byte[] native_data(long _nativeRef);
    }
}
