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

package com.robotraconteur;

public class AutoResetEvent {
  private transient long swigCPtr;
  private transient boolean swigCMemOwn;

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

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

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwn = own;
  }

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

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

  public AutoResetEvent() {
    this(RobotRaconteurJavaJNI.new_AutoResetEvent(), true);
  }

  public void set() {
    RobotRaconteurJavaJNI.AutoResetEvent_set(swigCPtr, this);
  }

  public void reset() {
    RobotRaconteurJavaJNI.AutoResetEvent_reset(swigCPtr, this);
  }

  public void waitOne() {
    RobotRaconteurJavaJNI.AutoResetEvent_waitOne__SWIG_0(swigCPtr, this);
  }

  public boolean waitOne(int timeout) {
    return RobotRaconteurJavaJNI.AutoResetEvent_waitOne__SWIG_1(swigCPtr, this, timeout);
  }

}
