// 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;

/** Device stream data */
public interface StreamData {
    @NonNull
    public ImgData img();

    @Nullable
    public Frame frame();

    public long frameId();

    static final class CppProxy implements StreamData
    {
        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 ImgData img()
        {
            assert !this.destroyed.get() : "trying to use a destroyed object";
            return native_img(this.nativeRef);
        }
        private native ImgData native_img(long _nativeRef);

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

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