/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.8
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace LizardTech.LidarSDK {

using System;
using System.Runtime.InteropServices;

public class ProgressDelegate : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  public ProgressDelegate(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

  public static HandleRef getCPtr(ProgressDelegate obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~ProgressDelegate() {
    Dispose();
  }

  public virtual void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          LidarDSDKPINVOKE.delete_ProgressDelegate(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
    }
  }

  public virtual void reportProgress(double progress, string message) {
    LidarDSDKPINVOKE.ProgressDelegate_reportProgress(swigCPtr, progress, message);
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
  }

  public virtual bool getCancelled() {
    bool ret = LidarDSDKPINVOKE.ProgressDelegate_getCancelled(swigCPtr);
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void setTotal(double total) {
    LidarDSDKPINVOKE.ProgressDelegate_setTotal(swigCPtr, total);
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
  }

  public void updateCompleted(double delta, string message) {
    LidarDSDKPINVOKE.ProgressDelegate_updateCompleted(swigCPtr, delta, message);
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
  }

  public double getProgress() {
    double ret = LidarDSDKPINVOKE.ProgressDelegate_getProgress(swigCPtr);
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void warning(string format) {
    LidarDSDKPINVOKE.ProgressDelegate_warning(swigCPtr, format);
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
  }

  public virtual void displayWarning(string message) {
    if (SwigDerivedClassHasMethod("displayWarning", swigMethodTypes2)) LidarDSDKPINVOKE.ProgressDelegate_displayWarningSwigExplicitProgressDelegate(swigCPtr, message); else LidarDSDKPINVOKE.ProgressDelegate_displayWarning(swigCPtr, message);
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
  }

  protected ProgressDelegate() : this(LidarDSDKPINVOKE.new_ProgressDelegate(), true) {
    if (LidarDSDKPINVOKE.SWIGPendingException.Pending) throw LidarDSDKPINVOKE.SWIGPendingException.Retrieve();
    SwigDirectorConnect();
  }

  private void SwigDirectorConnect() {
    if (SwigDerivedClassHasMethod("reportProgress", swigMethodTypes0))
      swigDelegate0 = new SwigDelegateProgressDelegate_0(SwigDirectorreportProgress);
    if (SwigDerivedClassHasMethod("getCancelled", swigMethodTypes1))
      swigDelegate1 = new SwigDelegateProgressDelegate_1(SwigDirectorgetCancelled);
    if (SwigDerivedClassHasMethod("displayWarning", swigMethodTypes2))
      swigDelegate2 = new SwigDelegateProgressDelegate_2(SwigDirectordisplayWarning);
    LidarDSDKPINVOKE.ProgressDelegate_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2);
  }

  private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
    System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
    bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProgressDelegate));
    return hasDerivedMethod;
  }

  private void SwigDirectorreportProgress(double progress, string message) {
    reportProgress(progress, message);
  }

  private bool SwigDirectorgetCancelled() {
    return getCancelled();
  }

  private void SwigDirectordisplayWarning(string message) {
    displayWarning(message);
  }

  public delegate void SwigDelegateProgressDelegate_0(double progress, string message);
  public delegate bool SwigDelegateProgressDelegate_1();
  public delegate void SwigDelegateProgressDelegate_2(string message);

  private SwigDelegateProgressDelegate_0 swigDelegate0;
  private SwigDelegateProgressDelegate_1 swigDelegate1;
  private SwigDelegateProgressDelegate_2 swigDelegate2;

  private static Type[] swigMethodTypes0 = new Type[] { typeof(double), typeof(string) };
  private static Type[] swigMethodTypes1 = new Type[] {  };
  private static Type[] swigMethodTypes2 = new Type[] { typeof(string) };
}

}
