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

namespace OSGeo.GDAL {

using System;
using System.Runtime.InteropServices;

public class Driver : MajorObject {
  private HandleRef swigCPtr;

  internal Driver(IntPtr cPtr, object cMemoryOwner) : base(GdalPINVOKE.DriverUpcast(cPtr), cMemoryOwner) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(Driver obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }
  internal static HandleRef getCPtrAndDisown(Driver obj, object cMemoryOwner) {
    obj.swigCMemOwner = cMemoryOwner;
    return getCPtr(obj);
  }

  public override void Dispose() {
  lock(this) {
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwner == null) {
        swigCMemOwner = new object();
        throw new MethodAccessException("C++ destructor does not have public access");
      }
      swigCPtr = new HandleRef(null, IntPtr.Zero);
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  public string ShortName {
    get {
      string ret = GdalPINVOKE.Driver_ShortName_get(swigCPtr);
      if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
      return ret;
    } 
  }

  public string LongName {
    get {
      string ret = GdalPINVOKE.Driver_LongName_get(swigCPtr);
      if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
      return ret;
    } 
  }

  public string HelpTopic {
    get {
      string ret = GdalPINVOKE.Driver_HelpTopic_get(swigCPtr);
      if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
      return ret;
    } 
  }

  public Dataset Create(string name, int xsize, int ysize, int bands, DataType eType, string[] options) {
    IntPtr cPtr = GdalPINVOKE.Driver_Create(swigCPtr, name, xsize, ysize, bands, (int)eType, new GdalPINVOKE.StringListMarshal(options)._ar);
    Dataset ret = (cPtr == IntPtr.Zero) ? null : new Dataset(cPtr, ThisOwn_true());
    if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Dataset CreateCopy(string name, Dataset src, int strict, string[] options, SWIGTYPE_p_GDALProgressFunc callback, SWIGTYPE_p_void callback_data) {
    IntPtr cPtr = GdalPINVOKE.Driver_CreateCopy(swigCPtr, name, Dataset.getCPtr(src), strict, new GdalPINVOKE.StringListMarshal(options)._ar, SWIGTYPE_p_GDALProgressFunc.getCPtr(callback), SWIGTYPE_p_void.getCPtr(callback_data));
    Dataset ret = (cPtr == IntPtr.Zero) ? null : new Dataset(cPtr, ThisOwn_true());
    if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public int Delete(string name) {
    int ret = GdalPINVOKE.Driver_Delete(swigCPtr, name);
    if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public int Rename(string newName, string oldName) {
    int ret = GdalPINVOKE.Driver_Rename(swigCPtr, newName, oldName);
    if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public int Register() {
    int ret = GdalPINVOKE.Driver_Register(swigCPtr);
    if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void Deregister() {
    GdalPINVOKE.Driver_Deregister(swigCPtr);
    if (GdalPINVOKE.SWIGPendingException.Pending) throw GdalPINVOKE.SWIGPendingException.Retrieve();
  }

}

}
