/* ----------------------------------------------------------------------------
 * 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 WrappedWireUnicastReceiver {
  private transient long swigCPtr;
  private transient boolean swigCMemOwn;

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

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

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

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

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

  public void init(WrappedWireServer wire) {
    RobotRaconteurJavaJNI.WrappedWireUnicastReceiver_init(swigCPtr, this, WrappedWireServer.getCPtr(wire), wire);
  }

  public MessageElement getInValue(TimeSpec ts, long[] ep) {
    long cPtr = RobotRaconteurJavaJNI.WrappedWireUnicastReceiver_getInValue(swigCPtr, this, TimeSpec.getCPtr(ts), ts, ep);
    return (cPtr == 0) ? null : new MessageElement(cPtr, true);
  }

  public void addInValueChangedListener(WrappedWireServerPokeValueDirector director, int id) {
    RobotRaconteurJavaJNI.WrappedWireUnicastReceiver_addInValueChangedListener(swigCPtr, this, WrappedWireServerPokeValueDirector.getCPtr(director), director, id);
  }

  public int getInValueLifespan() {
    return RobotRaconteurJavaJNI.WrappedWireUnicastReceiver_getInValueLifespan(swigCPtr, this);
  }

  public void setInValueLifespan(int millis) {
    RobotRaconteurJavaJNI.WrappedWireUnicastReceiver_setInValueLifespan(swigCPtr, this, millis);
  }

  public boolean tryGetInValue(WrappedService_typed_packet val, TimeSpec time) {
    return RobotRaconteurJavaJNI.WrappedWireUnicastReceiver_tryGetInValue(swigCPtr, this, WrappedService_typed_packet.getCPtr(val), val, TimeSpec.getCPtr(time), time);
  }

  public WrappedWireUnicastReceiver() {
    this(RobotRaconteurJavaJNI.new_WrappedWireUnicastReceiver(), true);
  }

}
