/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * 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 WallTimer extends Timer {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

  protected WallTimer(long cPtr, boolean cMemoryOwn) {
    super(RobotRaconteurJavaJNI.WallTimer_SWIGSmartPtrUpcast(cPtr), true);
    swigCMemOwnDerived = cMemoryOwn;
    swigCPtr = cPtr;
  }

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

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwnDerived = own;
    super.swigSetCMemOwn(own);
  }

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

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwnDerived) {
        swigCMemOwnDerived = false;
        RobotRaconteurJavaJNI.delete_WallTimer(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

	public WallTimer(int period, Action1<TimerEvent> handler, boolean oneshot)
	{
             this(period,oneshot,null,attachHandler(handler));




        }

	public WallTimer(int period, Action1<TimerEvent> handler, boolean oneshot, RobotRaconteurNode node)
	{
            this(period,oneshot,node,attachHandler(handler));




        }

        private static WallTimer_initstruct attachHandler(Action1<TimerEvent> handler)
        {
            WallTimer_initstruct s = new WallTimer_initstruct();
            AsyncTimerEventReturnDirectorImpl h=new AsyncTimerEventReturnDirectorImpl(handler);
            s.setHandler(h);
            s.setId(RRObjectHeap.addObject(h));
            return s;
        }

  public void start() {
    RobotRaconteurJavaJNI.WallTimer_start(swigCPtr, this);
  }

  public void stop() {
    RobotRaconteurJavaJNI.WallTimer_stop(swigCPtr, this);
  }

  public void tryStop() {
    RobotRaconteurJavaJNI.WallTimer_tryStop(swigCPtr, this);
  }

  public int getPeriod() {
    int t= RobotRaconteurJavaJNI.WallTimer_getPeriod(swigCPtr, this);
    return t;
}

  public void setPeriod(int period) {
    RobotRaconteurJavaJNI.WallTimer_setPeriod(swigCPtr, this, period);
  }

  public boolean isRunning() {
    return RobotRaconteurJavaJNI.WallTimer_isRunning(swigCPtr, this);
  }

   WallTimer(int period, boolean oneshot, RobotRaconteurNode node, WallTimer_initstruct init) {
    this(RobotRaconteurJavaJNI.new_WallTimer(period, oneshot, RobotRaconteurNode.getCPtr(node), node, WallTimer_initstruct.getCPtr(init), init), true);
  }

}
