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

package org.gdal.ogr;

public class FeatureDefn {
  private long swigCPtr;
  protected boolean swigCMemOwn;

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

  protected static long getCPtr(FeatureDefn obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      ogrJNI.delete_FeatureDefn(swigCPtr);
    }
    swigCPtr = 0;
  }

  protected static long getCPtrAndDisown(FeatureDefn obj) {
    if (obj != null) obj.swigCMemOwn= false;
    return getCPtr(obj);
  }

  public FeatureDefn(String name) {
    this(ogrJNI.new_FeatureDefn(name), true);
  }

  public String GetName() {
    return ogrJNI.FeatureDefn_GetName(swigCPtr);
  }

  public int GetFieldCount() {
    return ogrJNI.FeatureDefn_GetFieldCount(swigCPtr);
  }

  public FieldDefn GetFieldDefn(int i) {
    long cPtr = ogrJNI.FeatureDefn_GetFieldDefn(swigCPtr, i);
    return (cPtr == 0) ? null : new FieldDefn(cPtr, false);
  }

  public int GetFieldIndex(String name) {
    return ogrJNI.FeatureDefn_GetFieldIndex(swigCPtr, name);
  }

  public void AddFieldDefn(FieldDefn defn) {
    ogrJNI.FeatureDefn_AddFieldDefn(swigCPtr, FieldDefn.getCPtr(defn));
  }

  public int GetGeomType() {
    return ogrJNI.FeatureDefn_GetGeomType(swigCPtr);
  }

  public void SetGeomType(int geom_type) {
    ogrJNI.FeatureDefn_SetGeomType(swigCPtr, geom_type);
  }

  public int GetReferenceCount() {
    return ogrJNI.FeatureDefn_GetReferenceCount(swigCPtr);
  }

}
