/* ----------------------------------------------------------------------------
 * 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.xsi;

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

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

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

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

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

  public XSIIface() {
    this(JNIXSIIfaceJNI.new_XSIIface(), true);
  }

  public int get_signal_handle(String handle_name) {
    return JNIXSIIfaceJNI.XSIIface_get_signal_handle(swigCPtr, this, handle_name);
  }

  public VecI8 read(int handle, int width) {
    return new VecI8(JNIXSIIfaceJNI.XSIIface_read(swigCPtr, this, handle, width), true);
  }

  public long read64(int handle) {
    return JNIXSIIfaceJNI.XSIIface_read64(swigCPtr, this, handle);
  }

  public int read32(int handle) {
    return JNIXSIIfaceJNI.XSIIface_read32(swigCPtr, this, handle);
  }

  public void write(int handle, int width, VecI8 data) {
    JNIXSIIfaceJNI.XSIIface_write(swigCPtr, this, handle, width, VecI8.getCPtr(data), data);
  }

  public void write64(int handle, long data) {
    JNIXSIIfaceJNI.XSIIface_write64(swigCPtr, this, handle, data);
  }

  public void write32(int handle, int data) {
    JNIXSIIfaceJNI.XSIIface_write32(swigCPtr, this, handle, data);
  }

  public int get_time_precision() {
    return JNIXSIIfaceJNI.XSIIface_get_time_precision(swigCPtr, this);
  }

  public void sleep(long sleep_cycles) {
    JNIXSIIfaceJNI.XSIIface_sleep(swigCPtr, this, sleep_cycles);
  }

  public void check_status() {
    JNIXSIIfaceJNI.XSIIface_check_status(swigCPtr, this);
  }

}
