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

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

  protected static long getCPtr(WrappedPipeClient 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_WrappedPipeClient(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public WrappedPipeEndpoint connect(int index) {
    long cPtr = RobotRaconteurJavaJNI.WrappedPipeClient_connect(swigCPtr, this, index);
    return (cPtr == 0) ? null : new WrappedPipeEndpoint(cPtr, true);
  }

  public void asyncConnect(int index, int timeout, AsyncPipeEndpointReturnDirector handler, int id) {
    RobotRaconteurJavaJNI.WrappedPipeClient_asyncConnect(swigCPtr, this, index, timeout, AsyncPipeEndpointReturnDirector.getCPtr(handler), handler, id);
  }

  public String getMemberName() {
    return RobotRaconteurJavaJNI.WrappedPipeClient_getMemberName(swigCPtr, this);
  }

  public void setType(TypeDefinition value) {
    RobotRaconteurJavaJNI.WrappedPipeClient_Type_set(swigCPtr, this, TypeDefinition.getCPtr(value), value);
  }

  public TypeDefinition getType() {
    long cPtr = RobotRaconteurJavaJNI.WrappedPipeClient_Type_get(swigCPtr, this);
    return (cPtr == 0) ? null : new TypeDefinition(cPtr, true);
  }

  public RobotRaconteurNode getNode() {
    long cPtr = RobotRaconteurJavaJNI.WrappedPipeClient_getNode(swigCPtr, this);
    return (cPtr == 0) ? null : new RobotRaconteurNode(cPtr, true);
  }

  public MemberDefinition_Direction direction() {
    return MemberDefinition_Direction.swigToEnum(RobotRaconteurJavaJNI.WrappedPipeClient_direction(swigCPtr, this));
  }

}
