/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.1
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package spinal.sim.vpi;

public class SharedMemIface {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected SharedMemIface(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(SharedMemIface obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        JNISharedMemIfaceJNI.delete_SharedMemIface(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public SharedMemIface(String shmem_name_, long shmem_size_) {
    this(JNISharedMemIfaceJNI.new_SharedMemIface(shmem_name_, shmem_size_), true);
  }

  public String print_signals() {
    return JNISharedMemIfaceJNI.SharedMemIface_print_signals(swigCPtr, this);
  }

  public long get_signal_handle(String handle_name) {
    return JNISharedMemIfaceJNI.SharedMemIface_get_signal_handle(swigCPtr, this, handle_name);
  }

  public VectorInt8 read(long handle) {
    return new VectorInt8(JNISharedMemIfaceJNI.SharedMemIface_read__SWIG_0(swigCPtr, this, handle), true);
  }

  public void read(long handle, VectorInt8 data) {
    JNISharedMemIfaceJNI.SharedMemIface_read__SWIG_1(swigCPtr, this, handle, VectorInt8.getCPtr(data), data);
  }

  public long read64(long handle) {
    return JNISharedMemIfaceJNI.SharedMemIface_read64(swigCPtr, this, handle);
  }

  public int read32(long handle) {
    return JNISharedMemIfaceJNI.SharedMemIface_read32(swigCPtr, this, handle);
  }

  public void write(long handle, VectorInt8 data) {
    JNISharedMemIfaceJNI.SharedMemIface_write(swigCPtr, this, handle, VectorInt8.getCPtr(data), data);
  }

  public void write64(long handle, long data) {
    JNISharedMemIfaceJNI.SharedMemIface_write64(swigCPtr, this, handle, data);
  }

  public void write32(long handle, int data) {
    JNISharedMemIfaceJNI.SharedMemIface_write32(swigCPtr, this, handle, data);
  }

  public VectorInt8 read_mem(long handle, long index) {
    return new VectorInt8(JNISharedMemIfaceJNI.SharedMemIface_read_mem__SWIG_0(swigCPtr, this, handle, index), true);
  }

  public void read_mem(long handle, VectorInt8 data, long index) {
    JNISharedMemIfaceJNI.SharedMemIface_read_mem__SWIG_1(swigCPtr, this, handle, VectorInt8.getCPtr(data), data, index);
  }

  public long read64_mem(long handle, long index) {
    return JNISharedMemIfaceJNI.SharedMemIface_read64_mem(swigCPtr, this, handle, index);
  }

  public int read32_mem(long handle, long index) {
    return JNISharedMemIfaceJNI.SharedMemIface_read32_mem(swigCPtr, this, handle, index);
  }

  public void write_mem(long handle, VectorInt8 data, long index) {
    JNISharedMemIfaceJNI.SharedMemIface_write_mem(swigCPtr, this, handle, VectorInt8.getCPtr(data), data, index);
  }

  public void write64_mem(long handle, long data, long index) {
    JNISharedMemIfaceJNI.SharedMemIface_write64_mem(swigCPtr, this, handle, data, index);
  }

  public void write32_mem(long handle, int data, long index) {
    JNISharedMemIfaceJNI.SharedMemIface_write32_mem(swigCPtr, this, handle, data, index);
  }

  public int get_time_precision() {
    return JNISharedMemIfaceJNI.SharedMemIface_get_time_precision(swigCPtr, this);
  }

  public void sleep(long sleep_cycles) {
    JNISharedMemIfaceJNI.SharedMemIface_sleep(swigCPtr, this, sleep_cycles);
  }

  public void eval() {
    JNISharedMemIfaceJNI.SharedMemIface_eval(swigCPtr, this);
  }

  public void set_seed(long seed) {
    JNISharedMemIfaceJNI.SharedMemIface_set_seed(swigCPtr, this, seed);
  }

  public void randomize(long seed) {
    JNISharedMemIfaceJNI.SharedMemIface_randomize(swigCPtr, this, seed);
  }

  public void close() {
    JNISharedMemIfaceJNI.SharedMemIface_close(swigCPtr, this);
  }

  public void check_ready() {
    JNISharedMemIfaceJNI.SharedMemIface_check_ready(swigCPtr, this);
  }

  public void set_crashed(long ret_code_) {
    JNISharedMemIfaceJNI.SharedMemIface_set_crashed(swigCPtr, this, ret_code_);
  }

  public boolean is_closed() {
    return JNISharedMemIfaceJNI.SharedMemIface_is_closed(swigCPtr, this);
  }

}
