/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.36
 *
 * 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 MajorObject : IDisposable {
  private HandleRef swigCPtr;
  protected object swigCMemOwner;

  internal MajorObject(IntPtr cPtr, object cMemoryOwner) {
    swigCMemOwner = cMemoryOwner;
    swigCPtr = new HandleRef(this, cPtr);
  }

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

  public virtual 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);
    }
  }

  public string GetDescription() {
    string ret = gdalPINVOKE.MajorObject_GetDescription(swigCPtr);
    if (gdalPINVOKE.SWIGPendingException.Pending) throw gdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void SetDescription(string pszNewDesc) {
    gdalPINVOKE.MajorObject_SetDescription(swigCPtr, pszNewDesc);
    if (gdalPINVOKE.SWIGPendingException.Pending) throw gdalPINVOKE.SWIGPendingException.Retrieve();
  }

  public SWIGTYPE_p_p_char GetMetadata_Dict(string pszDomain) {
    IntPtr cPtr = gdalPINVOKE.MajorObject_GetMetadata_Dict(swigCPtr, pszDomain);
    SWIGTYPE_p_p_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_char(cPtr, false? null : this);
    if (gdalPINVOKE.SWIGPendingException.Pending) throw gdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string[] GetMetadata_List(string pszDomain) {
    
    if (gdalPINVOKE.SWIGPendingException.Pending) throw gdalPINVOKE.SWIGPendingException.Retrieve();
    throw new System.NotSupportedException("Returning string arrays is not implemented yet.");
}

  public int SetMetadata(SWIGTYPE_p_p_char papszMetadata, string pszDomain) {
    int ret = gdalPINVOKE.MajorObject_SetMetadata__SWIG_0(swigCPtr, SWIGTYPE_p_p_char.getCPtr(papszMetadata), pszDomain);
    if (gdalPINVOKE.SWIGPendingException.Pending) throw gdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public int SetMetadata(string pszMetadataString, string pszDomain) {
    int ret = gdalPINVOKE.MajorObject_SetMetadata__SWIG_1(swigCPtr, pszMetadataString, pszDomain);
    if (gdalPINVOKE.SWIGPendingException.Pending) throw gdalPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
