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

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

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

    public <T> void addPipeBroadcaster(PipeBroadcaster<T> broadcaster)
    {
        _AddPipeBroadcaster(broadcaster.innerpipe);
    }

    public <T> void addWireBroadcaster(WireBroadcaster<T> broadcaster)
    {
        _AddWireBroadcaster(broadcaster.innerwire);
    }

    public BroadcastDownsampler(ServerContext context)
    {
        this();
        _Init(context);
    }

    public BroadcastDownsampler(ServerContext context, int default_downsample)
    {
        this();
        _Init(context,default_downsample);
    }


  private BroadcastDownsampler() {
    this(RobotRaconteurJavaJNI.new_BroadcastDownsampler(), true);
  }

  public void _Init(ServerContext context, long default_downsample) {
    RobotRaconteurJavaJNI.BroadcastDownsampler__Init__SWIG_0(swigCPtr, this, ServerContext.getCPtr(context), context, default_downsample);
  }

  public void _Init(ServerContext context) {
    RobotRaconteurJavaJNI.BroadcastDownsampler__Init__SWIG_1(swigCPtr, this, ServerContext.getCPtr(context), context);
  }

  public long getClientDownsample(long ep) {
    return RobotRaconteurJavaJNI.BroadcastDownsampler_getClientDownsample(swigCPtr, this, ep);
  }

  public void setClientDownsample(long ep, long downsample) {
    RobotRaconteurJavaJNI.BroadcastDownsampler_setClientDownsample(swigCPtr, this, ep, downsample);
  }

  public void beginStep() {
    RobotRaconteurJavaJNI.BroadcastDownsampler_beginStep(swigCPtr, this);
  }

  public void endStep() {
    RobotRaconteurJavaJNI.BroadcastDownsampler_endStep(swigCPtr, this);
  }

  private void _AddPipeBroadcaster(WrappedPipeBroadcaster broadcaster) {
    RobotRaconteurJavaJNI.BroadcastDownsampler__AddPipeBroadcaster(swigCPtr, this, WrappedPipeBroadcaster.getCPtr(broadcaster), broadcaster);
  }

  private void _AddWireBroadcaster(WrappedWireBroadcaster broadcaster) {
    RobotRaconteurJavaJNI.BroadcastDownsampler__AddWireBroadcaster(swigCPtr, this, WrappedWireBroadcaster.getCPtr(broadcaster), broadcaster);
  }

}
