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

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

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

  public void init(WrappedPipeServer pipe, int maximum_backlog) {
    RobotRaconteurJavaJNI.WrappedPipeBroadcaster_init__SWIG_0(swigCPtr, this, WrappedPipeServer.getCPtr(pipe), pipe, maximum_backlog);
  }

  public void init(WrappedPipeServer pipe) {
    RobotRaconteurJavaJNI.WrappedPipeBroadcaster_init__SWIG_1(swigCPtr, this, WrappedPipeServer.getCPtr(pipe), pipe);
  }

  public void sendPacket(MessageElement packet) {
    RobotRaconteurJavaJNI.WrappedPipeBroadcaster_sendPacket(swigCPtr, this, MessageElement.getCPtr(packet), packet);
  }

  public void asyncSendPacket(MessageElement packet, AsyncVoidNoErrReturnDirector handler, int id) {
    RobotRaconteurJavaJNI.WrappedPipeBroadcaster_asyncSendPacket(swigCPtr, this, MessageElement.getCPtr(packet), packet, AsyncVoidNoErrReturnDirector.getCPtr(handler), handler, id);
  }

  public long getActivePipeEndpointCount() {
    return RobotRaconteurJavaJNI.WrappedPipeBroadcaster_getActivePipeEndpointCount(swigCPtr, this);
  }

  public void setPredicateDirector(WrappedPipeBroadcasterPredicateDirector f, int id) {
    RobotRaconteurJavaJNI.WrappedPipeBroadcaster_setPredicateDirector(swigCPtr, this, WrappedPipeBroadcasterPredicateDirector.getCPtr(f), f, id);
  }

  public int getMaxBacklog() {
    return RobotRaconteurJavaJNI.WrappedPipeBroadcaster_getMaxBacklog(swigCPtr, this);
  }

  public void setMaxBacklog(int maximum_backlog) {
    RobotRaconteurJavaJNI.WrappedPipeBroadcaster_setMaxBacklog(swigCPtr, this, maximum_backlog);
  }

  public WrappedPipeBroadcaster() {
    this(RobotRaconteurJavaJNI.new_WrappedPipeBroadcaster(), true);
  }

}
