/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.40
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG 
 * interface file instead. 
 * ----------------------------------------------------------------------------- */

#define SWIGRUBY


#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
  struct SwigMovePointer {
    T *ptr;
    SwigMovePointer(T *p) : ptr(p) { }
    ~SwigMovePointer() { delete ptr; }
    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
  } pointer;
  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
  SwigValueWrapper() : pointer(0) { }
  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
  operator T&() const { return *pointer.ptr; }
  T *operator&() { return pointer.ptr; }
};

template <typename T> T SwigValueInit() {
  return T();
}
#endif

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__)) 
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__)) 
# else
#   define SWIGUNUSED 
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif 
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif 
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif


/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__)) 
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__)) 
# else
#   define SWIGUNUSED 
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif 
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif 
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif


/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
 * This file contains generic C API SWIG runtime support for pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"

/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  creating a static or dynamic library from the SWIG runtime code.
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
  
  But only do this if strictly necessary, ie, if you have problems
  with your compiler or suchlike.
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif

/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif

/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1
#define SWIG_CAST_NEW_MEMORY       0x2

/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1


/* 
   Flags/methods for returning states.
   
   The SWIG conversion methods, as ConvertPtr, return and integer 
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).
   
   Use the following macros/flags to set or process the returning
   states.
   
   In old versions of SWIG, code such as the following was usually written:

     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }

   Now you can be more explicit:

    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }

   which is the same really, but now you can also do

    Type *ptr;
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
      if (SWIG_IsNewObj(res) {
        ...
	delete *ptr;
      } else {
        ...
      }
    } else {
      // fail code
    }
    
   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
   also requires SWIG_ConvertPtr to return new result values, such as

      int SWIG_ConvertPtr(obj, ptr,...) {         
        if (<obj is ok>) {			       
          if (<need new object>) {		       
            *ptr = <ptr to new allocated object>; 
            return SWIG_NEWOBJ;		       
          } else {				       
            *ptr = <ptr to old object>;	       
            return SWIG_OLDOBJ;		       
          } 				       
        } else {				       
          return SWIG_BADOBJ;		       
        }					       
      }

   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
   SWIG errors code.

   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
   allows to return the 'cast rank', for example, if you have this

       int food(double)
       int fooi(int);

   and you call
 
      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()
*/

#define SWIG_OK                    (0) 
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  

/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT         (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ                (SWIG_ERROR)
#define SWIG_OLDOBJ                (SWIG_OK)
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))

/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
#  ifndef SWIG_TypeRank
#    define SWIG_TypeRank             unsigned long
#  endif
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
#    define SWIG_MAXCASTRANK          (2)
#  endif
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) { 
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) { 
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
}
#else /* no cast-rank mode */
#  define SWIG_AddCast
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif


#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);

/* Structure to store information on one type */
typedef struct swig_type_info {
  const char             *name;			/* mangled name of this type */
  const char             *str;			/* human readable name of this type */
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
  void                   *clientdata;		/* language specific type data */
  int                    owndata;		/* flag if the structure owns the clientdata */
} swig_type_info;

/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
  swig_converter_func     converter;		/* function to cast the void pointers */
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
} swig_cast_info;

/* Structure used to store module information
 * Each module generates one structure like this, and the runtime collects
 * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
  size_t                 size;		        /* Number of types in this module */
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
  void                    *clientdata;		/* Language specific module data */
} swig_module_info;

/* 
  Compare two type names skipping the space characters, therefore
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.

  Return 0 when the two name types are equivalent, as in
  strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
		  const char *f2, const char *l2) {
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  }
  return (int)((l1 - f1) - (l2 - f2));
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
  int equiv = 0;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (!equiv && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    if (*ne) ++ne;
  }
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) {
  int equiv = 0;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (!equiv && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    if (*ne) ++ne;
  }
  return equiv;
}


/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (strcmp(iter->type->name, c) == 0) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/* 
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (iter->type == from) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}

/* 
   Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  swig_type_info *lastty = ty;
  if (!ty || !ty->dcast) return ty;
  while (ty && (ty->dcast)) {
    ty = (*ty->dcast)(ptr);
    if (ty) lastty = ty;
  }
  return lastty;
}

/*
  Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
  return ty->name;
}

/*
  Return the pretty name associated with this type,
  that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
  /* The "str" field contains the equivalent pretty names of the
     type, separated by vertical-bar characters.  We choose
     to print the last name, as it is often (?) the most
     specific. */
  if (!type) return NULL;
  if (type->str != NULL) {
    const char *last_name = type->str;
    const char *s;
    for (s = type->str; *s; s++)
      if (*s == '|') last_name = s+1;
    return last_name;
  }
  else
    return type->name;
}

/* 
   Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  swig_cast_info *cast = ti->cast;
  /* if (ti->clientdata == clientdata) return; */
  ti->clientdata = clientdata;
  
  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
      }
    }    
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}
  
/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)
  
  We start searching at module start, and finish searching when start == end.  
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start, 
                            swig_module_info *end, 
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
      register size_t l = 0;
      register size_t r = iter->size - 1;
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
	register size_t i = (l + r) >> 1; 
	const char *iname = iter->types[i]->name;
	if (iname) {
	  register int compare = strcmp(name, iname);
	  if (compare == 0) {	    
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
	    }
	  } else if (compare > 0) {
	    l = i + 1;
	  }
	} else {
	  break; /* should never happen */
	}
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}

/*
  Search for a swig_type_info structure for either a mangled name or a human readable name.
  It first searches the mangled names of the types, which is a O(log #types)
  If a type is not found it then searches the human readable names, which is O(#types).
  
  We start searching at module start, and finish searching when start == end.  
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start, 
                     swig_module_info *end, 
		     const char *name) {
  /* STEP 1: Search the name field using binary search */
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  if (ret) {
    return ret;
  } else {
    /* STEP 2: If the type hasn't been found, do a complete search
       of the str field (the human readable name) */
    swig_module_info *iter = start;
    do {
      register size_t i = 0;
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
      }
      iter = iter->next;
    } while (iter != end);
  }
  
  /* neither found a match */
  return 0;
}

/* 
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
  register const unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu =  u + sz;
  for (; u != eu; ++u) {
    register unsigned char uu = *u;
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

/* 
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  register unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu = u + sz;
  for (; u != eu; ++u) {
    register char d = *(c++);
    register unsigned char uu;
    if ((d >= '0') && (d <= '9'))
      uu = ((d - '0') << 4);
    else if ((d >= 'a') && (d <= 'f'))
      uu = ((d - ('a'-10)) << 4);
    else 
      return (char *) 0;
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
      uu |= (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      uu |= (d - ('a'-10));
    else 
      return (char *) 0;
    *u = uu;
  }
  return c;
}

/* 
   Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  char *r = buff;
  if ((2*sizeof(void *) + 2) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,&ptr,sizeof(void *));
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  strcpy(r,name);
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      *ptr = (void *) 0;
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
}

SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  char *r = buff;
  size_t lname = (name ? strlen(name) : 0);
  if ((2*sz + 2 + lname) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  if (lname) {
    strncpy(r,name,lname+1);
  } else {
    *r = 0;
  }
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      memset(ptr,0,sz);
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sz);
}

#ifdef __cplusplus
}
#endif

/*  Errors in SWIG */
#define  SWIG_UnknownError    	   -1 
#define  SWIG_IOError        	   -2 
#define  SWIG_RuntimeError   	   -3 
#define  SWIG_IndexError     	   -4 
#define  SWIG_TypeError      	   -5 
#define  SWIG_DivisionByZero 	   -6 
#define  SWIG_OverflowError  	   -7 
#define  SWIG_SyntaxError    	   -8 
#define  SWIG_ValueError     	   -9 
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
#define  SWIG_MemoryError    	   -12 
#define  SWIG_NullReferenceError   -13



#include <ruby.h>

/* Remove global macros defined in Ruby's win32.h */
#ifdef write
# undef write
#endif
#ifdef read
# undef read
#endif
#ifdef bind
# undef bind
#endif
#ifdef close
# undef close
#endif
#ifdef connect
# undef connect
#endif


/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
#ifndef NUM2LL
#define NUM2LL(x) NUM2LONG((x))
#endif
#ifndef LL2NUM
#define LL2NUM(x) INT2NUM((long) (x))
#endif
#ifndef ULL2NUM
#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
#endif

/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
#ifndef NUM2ULL
#ifdef HAVE_LONG_LONG
#define NUM2ULL(x) rb_num2ull((x))
#else
#define NUM2ULL(x) NUM2ULONG(x)
#endif
#endif

/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
/* Define these for older versions so we can just write code the new way */
#ifndef RSTRING_LEN
# define RSTRING_LEN(x) RSTRING(x)->len
#endif
#ifndef RSTRING_PTR
# define RSTRING_PTR(x) RSTRING(x)->ptr
#endif
#ifndef RSTRING_END
# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
#endif
#ifndef RARRAY_LEN
# define RARRAY_LEN(x) RARRAY(x)->len
#endif
#ifndef RARRAY_PTR
# define RARRAY_PTR(x) RARRAY(x)->ptr
#endif
#ifndef RFLOAT_VALUE
# define RFLOAT_VALUE(x) RFLOAT(x)->value
#endif
#ifndef DOUBLE2NUM
# define DOUBLE2NUM(x) rb_float_new(x)
#endif
#ifndef RHASH_TBL
# define RHASH_TBL(x) (RHASH(x)->tbl)
#endif
#ifndef RHASH_ITER_LEV
# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
#endif
#ifndef RHASH_IFNONE
# define RHASH_IFNONE(x) (RHASH(x)->ifnone)
#endif
#ifndef RHASH_SIZE
# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
#endif
#ifndef RHASH_EMPTY_P
# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
#endif
#ifndef RSTRUCT_LEN
# define RSTRUCT_LEN(x) RSTRUCT(x)->len
#endif
#ifndef RSTRUCT_PTR
# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
#endif



/*
 * Need to be very careful about how these macros are defined, especially
 * when compiling C++ code or C code with an ANSI C compiler.
 *
 * VALUEFUNC(f) is a macro used to typecast a C function that implements
 * a Ruby method so that it can be passed as an argument to API functions
 * like rb_define_method() and rb_define_singleton_method().
 *
 * VOIDFUNC(f) is a macro used to typecast a C function that implements
 * either the "mark" or "free" stuff for a Ruby Data object, so that it
 * can be passed as an argument to API functions like Data_Wrap_Struct()
 * and Data_Make_Struct().
 */
 
#ifdef __cplusplus
#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
#    define PROTECTFUNC(f) ((VALUE (*)()) f)
#    define VALUEFUNC(f) ((VALUE (*)()) f)
#    define VOIDFUNC(f)  ((void (*)()) f)
#  else
#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
#      define PROTECTFUNC(f) ((VALUE (*)()) f)
#      define VALUEFUNC(f) ((VALUE (*)()) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    else /* These definitions should work for Ruby 1.7+ */
#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    endif
#  endif
#else
#  define VALUEFUNC(f) (f)
#  define VOIDFUNC(f) (f)
#endif

/* Don't use for expressions have side effect */
#ifndef RB_STRING_VALUE
#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
#endif
#ifndef StringValue
#define StringValue(s) RB_STRING_VALUE(s)
#endif
#ifndef StringValuePtr
#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
#endif
#ifndef StringValueLen
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
#endif
#ifndef SafeStringValue
#define SafeStringValue(v) do {\
    StringValue(v);\
    rb_check_safe_str(v);\
} while (0)
#endif

#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
#endif

static VALUE _mSWIG = Qnil;

/* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */


/* Define some additional error types */
#define SWIG_ObjectPreviouslyDeletedError  -100


/* Define custom exceptions for errors that do not map to existing Ruby
   exceptions.  Note this only works for C++ since a global cannot be
   initialized by a funtion in C.  For C, fallback to rb_eRuntimeError.*/

SWIGINTERN VALUE 
getNullReferenceError(void) {
  static int init = 0;
  static VALUE rb_eNullReferenceError ;
  if (!init) {
    init = 1;
    rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
  }
  return rb_eNullReferenceError;
} 

SWIGINTERN VALUE 
getObjectPreviouslyDeletedError(void) {
  static int init = 0;
  static VALUE rb_eObjectPreviouslyDeleted ;
  if (!init) {
    init = 1;
    rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
  }
  return rb_eObjectPreviouslyDeleted;
} 


SWIGINTERN VALUE
SWIG_Ruby_ErrorType(int SWIG_code) {
  VALUE type;
  switch (SWIG_code) {
  case SWIG_MemoryError:
    type = rb_eNoMemError;
    break;
  case SWIG_IOError:
    type = rb_eIOError;
    break;
  case SWIG_RuntimeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_IndexError:
    type = rb_eIndexError;
    break;
  case SWIG_TypeError:
    type = rb_eTypeError;
    break;
  case SWIG_DivisionByZero:
    type = rb_eZeroDivError;
    break;
  case SWIG_OverflowError:
    type = rb_eRangeError;
    break;
  case SWIG_SyntaxError:
    type = rb_eSyntaxError;
    break;
  case SWIG_ValueError:
    type = rb_eArgError;
    break;
  case SWIG_SystemError:
    type = rb_eFatal;
    break;
  case SWIG_AttributeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_NullReferenceError:
    type = getNullReferenceError();
    break;
  case SWIG_ObjectPreviouslyDeletedError:
    type = getObjectPreviouslyDeletedError();
    break;
  case SWIG_UnknownError:
    type = rb_eRuntimeError;
    break;
  default:
    type = rb_eRuntimeError;
  }
  return type;
}


/* This function is called when a user inputs a wrong argument to
   a method.
 */
SWIGINTERN 
const char* Ruby_Format_TypeError( const char* msg,
				   const char* type, 
				   const char* name, 
				   const int argn,
				   VALUE input )
{
  char buf[128];
  VALUE str;
  VALUE asStr;
  if ( msg && *msg )
    {
      str = rb_str_new2(msg);
    }
  else
    {
      str = rb_str_new(NULL, 0);
    }

  str = rb_str_cat2( str, "Expected argument " );
  sprintf( buf, "%d of type ", argn-1 );
  str = rb_str_cat2( str, buf );
  str = rb_str_cat2( str, type );
  str = rb_str_cat2( str, ", but got " );
  str = rb_str_cat2( str, rb_obj_classname(input) );
  str = rb_str_cat2( str, " " );
  asStr = rb_inspect(input);
  if ( RSTRING_LEN(asStr) > 30 )
    {
      str = rb_str_cat( str, StringValuePtr(asStr), 30 );
      str = rb_str_cat2( str, "..." );
    }
  else
    {
      str = rb_str_append( str, asStr );
    }

  if ( name )
    {
      str = rb_str_cat2( str, "\n\tin SWIG method '" );
      str = rb_str_cat2( str, name );
      str = rb_str_cat2( str, "'" );
    }

  return StringValuePtr( str );
}

/* This function is called when an overloaded method fails */
SWIGINTERN 
void Ruby_Format_OverloadedError(
				 const int argc,
				 const int maxargs,
				 const char* method, 
				 const char* prototypes 
				 )
{
  const char* msg = "Wrong # of arguments";
  if ( argc <= maxargs ) msg = "Wrong arguments";
  rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"  
	   "Possible C/C++ prototypes are:\n%s",
	   msg, method, prototypes);
}

/* -----------------------------------------------------------------------------
 * See the LICENSE file for information on copyright, usage and redistribution
 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
 *
 * rubytracking.swg
 *
 * This file contains support for tracking mappings from 
 * Ruby objects to C++ objects.  This functionality is needed
 * to implement mark functions for Ruby's mark and sweep
 * garbage collector.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

/* Ruby 1.8 actually assumes the first case. */
#if SIZEOF_VOIDP == SIZEOF_LONG
#  define SWIG2NUM(v) LONG2NUM((unsigned long)v)
#  define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
#  define SWIG2NUM(v) LL2NUM((unsigned long long)v)
#  define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
#else
#  error sizeof(void*) is not the same as long or long long
#endif


/* Global Ruby hash table to store Trackings from C/C++
   structs to Ruby Objects. 
*/
static VALUE swig_ruby_trackings = Qnil;

/* Global variable that stores a reference to the ruby
   hash table delete function. */
static ID swig_ruby_hash_delete;

/* Setup a Ruby hash table to store Trackings */
SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
  /* Create a ruby hash table to store Trackings from C++ 
     objects to Ruby objects. */

  /* Try to see if some other .so has already created a 
     tracking hash table, which we keep hidden in an instance var
     in the SWIG module.
     This is done to allow multiple DSOs to share the same
     tracking table.
  */
  ID trackings_id = rb_intern( "@__trackings__" );
  VALUE verbose = rb_gv_get("VERBOSE");
  rb_gv_set("VERBOSE", Qfalse);
  swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
  rb_gv_set("VERBOSE", verbose);

  /* No, it hasn't.  Create one ourselves */ 
  if ( swig_ruby_trackings == Qnil )
    {
      swig_ruby_trackings = rb_hash_new();
      rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
    }

  /* Now store a reference to the hash table delete function
     so that we only have to look it up once.*/
  swig_ruby_hash_delete = rb_intern("delete");
}

/* Get a Ruby number to reference a pointer */
SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
  /* We cast the pointer to an unsigned long
     and then store a reference to it using
     a Ruby number object. */

  /* Convert the pointer to a Ruby number */
  return SWIG2NUM(ptr);
}

/* Get a Ruby number to reference an object */
SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
  /* We cast the object to an unsigned long
     and then store a reference to it using
     a Ruby number object. */

  /* Convert the Object to a Ruby number */
  return SWIG2NUM(object);
}

/* Get a Ruby object from a previously stored reference */
SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
  /* The provided Ruby number object is a reference
     to the Ruby object we want.*/

  /* Convert the Ruby number to a Ruby object */
  return NUM2SWIG(reference);
}

/* Add a Tracking from a C/C++ struct to a Ruby object */
SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
  /* In a Ruby hash table we store the pointer and
     the associated Ruby object.  The trick here is
     that we cannot store the Ruby object directly - if
     we do then it cannot be garbage collected.  So
     instead we typecast it as a unsigned long and
     convert it to a Ruby number object.*/

  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Get a reference to the Ruby object as a Ruby number */
  VALUE value = SWIG_RubyObjectToReference(object);

  /* Store the mapping to the global hash table. */
  rb_hash_aset(swig_ruby_trackings, key, value);
}

/* Get the Ruby object that owns the specified C/C++ struct */
SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Now lookup the value stored in the global hash table */
  VALUE value = rb_hash_aref(swig_ruby_trackings, key);
	
  if (value == Qnil) {
    /* No object exists - return nil. */
    return Qnil;
  }
  else {
    /* Convert this value to Ruby object */
    return SWIG_RubyReferenceToObject(value);
  }
}

/* Remove a Tracking from a C/C++ struct to a Ruby object.  It
   is very important to remove objects once they are destroyed
   since the same memory address may be reused later to create
   a new object. */
SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Delete the object from the hash table by calling Ruby's
     do this we need to call the Hash.delete method.*/
  rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
}

/* This is a helper method that unlinks a Ruby object from its
   underlying C++ object.  This is needed if the lifetime of the
   Ruby object is longer than the C++ object */
SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
  VALUE object = SWIG_RubyInstanceFor(ptr);

  if (object != Qnil) {
    DATA_PTR(object) = 0;
  }
}


#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------
 * Ruby API portion that goes into the runtime
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

SWIGINTERN VALUE
SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
  if (NIL_P(target)) {
    target = o;
  } else {
    if (TYPE(target) != T_ARRAY) {
      VALUE o2 = target;
      target = rb_ary_new();
      rb_ary_push(target, o2);
    }
    rb_ary_push(target, o);
  }
  return target;
}

/* For ruby1.8.4 and earlier. */
#ifndef RUBY_INIT_STACK
   RUBY_EXTERN void Init_stack(VALUE* addr);
#  define RUBY_INIT_STACK \
   VALUE variable_in_this_stack_frame; \
   Init_stack(&variable_in_this_stack_frame);
#endif


#ifdef __cplusplus
}
#endif


/* -----------------------------------------------------------------------------
 * See the LICENSE file for information on copyright, usage and redistribution
 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
 *
 * rubyrun.swg
 *
 * This file contains the runtime support for Ruby modules
 * and includes code for managing global variables and pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* For backward compatibility only */
#define SWIG_POINTER_EXCEPTION  0

/* for raw pointers */
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Ruby_NewPointerObj(ptr, type, flags)
#define SWIG_AcquirePtr(ptr, own)                       SWIG_Ruby_AcquirePtr(ptr, own)
#define swig_owntype                                    ruby_owntype

/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)

/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)

/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)

/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)


/* Runtime API */

#define SWIG_GetModule(clientdata)                      SWIG_Ruby_GetModule()	
#define SWIG_SetModule(clientdata, pointer) 		SWIG_Ruby_SetModule(pointer)


/* Error manipulation */

#define SWIG_ErrorType(code)                            SWIG_Ruby_ErrorType(code)               
#define SWIG_Error(code, msg)            		rb_raise(SWIG_Ruby_ErrorType(code), msg)
#define SWIG_fail                        		goto fail				 


/* Ruby-specific SWIG API */

#define SWIG_InitRuntime()                              SWIG_Ruby_InitRuntime()              
#define SWIG_define_class(ty)                        	SWIG_Ruby_define_class(ty)
#define SWIG_NewClassInstance(value, ty)             	SWIG_Ruby_NewClassInstance(value, ty)
#define SWIG_MangleStr(value)                        	SWIG_Ruby_MangleStr(value)		  
#define SWIG_CheckConvert(value, ty)                 	SWIG_Ruby_CheckConvert(value, ty)	  

#include "assert.h"

/* -----------------------------------------------------------------------------
 * pointers/data manipulation
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  VALUE klass;
  VALUE mImpl;
  void  (*mark)(void *);
  void  (*destroy)(void *);
  int trackObjects;
} swig_class;


/* Global pointer used to keep some internal SWIG stuff */
static VALUE _cSWIG_Pointer = Qnil;
static VALUE swig_runtime_data_type_pointer = Qnil;

/* Global IDs used to keep some internal SWIG stuff */
static ID swig_arity_id = 0;
static ID swig_call_id  = 0;

/*
  If your swig extension is to be run within an embedded ruby and has
  director callbacks, you should set -DRUBY_EMBEDDED during compilation.  
  This will reset ruby's stack frame on each entry point from the main 
  program the first time a virtual director function is invoked (in a 
  non-recursive way).
  If this is not done, you run the risk of Ruby trashing the stack.
*/

#ifdef RUBY_EMBEDDED

#  define SWIG_INIT_STACK                            \
      if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
      ++swig_virtual_calls;
#  define SWIG_RELEASE_STACK --swig_virtual_calls;
#  define Ruby_DirectorTypeMismatchException(x) \
          rb_raise( rb_eTypeError, x ); return c_result;

      static unsigned int swig_virtual_calls = 0;

#else  /* normal non-embedded extension */

#  define SWIG_INIT_STACK
#  define SWIG_RELEASE_STACK
#  define Ruby_DirectorTypeMismatchException(x) \
          throw Swig::DirectorTypeMismatchException( x );

#endif  /* RUBY_EMBEDDED */


SWIGRUNTIME VALUE 
getExceptionClass(void) {
  static int init = 0;
  static VALUE rubyExceptionClass ;
  if (!init) {
    init = 1;
    rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
  }
  return rubyExceptionClass;
} 

/* This code checks to see if the Ruby object being raised as part
   of an exception inherits from the Ruby class Exception.  If so,
   the object is simply returned.  If not, then a new Ruby exception
   object is created and that will be returned to Ruby.*/
SWIGRUNTIME VALUE
SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
  VALUE exceptionClass = getExceptionClass();
  if (rb_obj_is_kind_of(obj, exceptionClass)) {
    return obj;
  }  else {
    return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
  }
}

/* Initialize Ruby runtime support */
SWIGRUNTIME void
SWIG_Ruby_InitRuntime(void)
{
  if (_mSWIG == Qnil) {
    _mSWIG = rb_define_module("SWIG");
    swig_call_id  = rb_intern("call");
    swig_arity_id = rb_intern("arity");
  }
}

/* Define Ruby class for C type */
SWIGRUNTIME void
SWIG_Ruby_define_class(swig_type_info *type)
{
  VALUE klass;
  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
  sprintf(klass_name, "TYPE%s", type->name);
  if (NIL_P(_cSWIG_Pointer)) {
    _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
    rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
  }
  klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
  free((void *) klass_name);
}

/* Create a new pointer object */
SWIGRUNTIME VALUE
SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
{
  int own =  flags & SWIG_POINTER_OWN; 
  int track;
  char *klass_name;
  swig_class *sklass;
  VALUE klass;
  VALUE obj;
  
  if (!ptr)
    return Qnil;
  
  if (type->clientdata) {
    sklass = (swig_class *) type->clientdata;
		
    /* Are we tracking this class and have we already returned this Ruby object? */
    track = sklass->trackObjects;
    if (track) {
      obj = SWIG_RubyInstanceFor(ptr);
      
      /* Check the object's type and make sure it has the correct type.
        It might not in cases where methods do things like 
        downcast methods. */
      if (obj != Qnil) {
        VALUE value = rb_iv_get(obj, "@__swigtype__");
        char* type_name = RSTRING_PTR(value);
				
        if (strcmp(type->name, type_name) == 0) {
          return obj;
        }
      }
    }

    /* Create a new Ruby object */
    obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), 
			   ( own ? VOIDFUNC(sklass->destroy) : 
			     (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
			     ), ptr);

    /* If tracking is on for this class then track this object. */
    if (track) {
      SWIG_RubyAddTracking(ptr, obj);
    }
  } else {
    klass_name = (char *) malloc(4 + strlen(type->name) + 1);
    sprintf(klass_name, "TYPE%s", type->name);
    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
    free((void *) klass_name);
    obj = Data_Wrap_Struct(klass, 0, 0, ptr);
  }
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
  
  return obj;
}

/* Create a new class instance (always owned) */
SWIGRUNTIME VALUE
SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
{
  VALUE obj;
  swig_class *sklass = (swig_class *) type->clientdata;
  obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
  return obj;
}

/* Get type mangle from class name */
SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)
{
  VALUE stype = rb_iv_get(obj, "@__swigtype__");
  return StringValuePtr(stype);
}

/* Acquire a pointer value */
typedef void (*ruby_owntype)(void*);

SWIGRUNTIME ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
  if (obj) {
    ruby_owntype oldown = RDATA(obj)->dfree;
    RDATA(obj)->dfree = own;
    return oldown;
  } else {
    return 0;
  }
}

/* Convert a pointer value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
{
  char *c;
  swig_cast_info *tc;
  void *vptr = 0;

  /* Grab the pointer */
  if (NIL_P(obj)) {
    *ptr = 0;
    return SWIG_OK;
  } else {
    if (TYPE(obj) != T_DATA) {
      return SWIG_ERROR;
    }
    Data_Get_Struct(obj, void, vptr);
  }
  
  if (own) *own = RDATA(obj)->dfree;
    
  /* Check to see if the input object is giving up ownership
     of the underlying C struct or C++ object.  If so then we
     need to reset the destructor since the Ruby object no 
     longer owns the underlying C++ object.*/ 
  if (flags & SWIG_POINTER_DISOWN) {
    /* Is tracking on for this class? */
    int track = 0;
    if (ty && ty->clientdata) {
      swig_class *sklass = (swig_class *) ty->clientdata;
      track = sklass->trackObjects;
    }
		
    if (track) {
      /* We are tracking objects for this class.  Thus we change the destructor
       * to SWIG_RubyRemoveTracking.  This allows us to
       * remove the mapping from the C++ to Ruby object
       * when the Ruby object is garbage collected.  If we don't
       * do this, then it is possible we will return a reference 
       * to a Ruby object that no longer exists thereby crashing Ruby. */
      RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
    } else {    
      RDATA(obj)->dfree = 0;
    }
  }

  /* Do type-checking if type info was provided */
  if (ty) {
    if (ty->clientdata) {
      if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
        if (vptr == 0) {
          /* The object has already been deleted */
          return SWIG_ObjectPreviouslyDeletedError;
        }
        *ptr = vptr;
        return SWIG_OK;
      }
    }
    if ((c = SWIG_MangleStr(obj)) == NULL) {
      return SWIG_ERROR;
    }
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) {
      return SWIG_ERROR;
    } else {
      int newmemory = 0;
      *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
      assert(!newmemory); /* newmemory handling not yet implemented */
    }
  } else {
    *ptr = vptr;
  }
  
  return SWIG_OK;
}

/* Check convert */
SWIGRUNTIMEINLINE int
SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
{
  char *c = SWIG_MangleStr(obj);
  if (!c) return 0;
  return SWIG_TypeCheck(c,ty) != 0;
}

SWIGRUNTIME VALUE
SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
  char result[1024];
  char *r = result;
  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r, ptr, sz);
  strcpy(r, type->name);
  return rb_str_new2(result);
}

/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
  swig_cast_info *tc;
  const char  *c;

  if (TYPE(obj) != T_STRING) goto type_error;
  c = StringValuePtr(obj);
  /* Pointer values must start with leading underscore */
  if (*c != '_') goto type_error;
  c++;
  c = SWIG_UnpackData(c, ptr, sz);
  if (ty) {
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) goto type_error;
  }
  return SWIG_OK;

 type_error:
  return SWIG_ERROR;
}

SWIGRUNTIME swig_module_info *
SWIG_Ruby_GetModule(void)
{
  VALUE pointer;
  swig_module_info *ret = 0;
  VALUE verbose = rb_gv_get("VERBOSE");

 /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
  rb_gv_set("VERBOSE", Qfalse);
  
  /* first check if pointer already created */
  pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
  if (pointer != Qnil) {
    Data_Get_Struct(pointer, swig_module_info, ret);
  }

  /* reinstate warnings */
  rb_gv_set("VERBOSE", verbose);
  return ret;
}

SWIGRUNTIME void 
SWIG_Ruby_SetModule(swig_module_info *pointer)
{
  /* register a new class */
  VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
  /* create and store the structure pointer to a global variable */
  swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
  rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
}

/* This function can be used to check whether a proc or method or similarly
   callable function has been passed.  Usually used in a %typecheck, like:

   %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
        $result = SWIG_Ruby_isCallable( $input );
   }
 */
SWIGINTERN
int SWIG_Ruby_isCallable( VALUE proc )
{
  if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
    return 1;
  return 0;
}

/* This function can be used to check the arity (number of arguments)
   a proc or method can take.  Usually used in a %typecheck.
   Valid arities will be that equal to minimal or those < 0
   which indicate a variable number of parameters at the end.
 */
SWIGINTERN
int SWIG_Ruby_arity( VALUE proc, int minimal )
{
  if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
    {
      VALUE num = rb_funcall( proc, swig_arity_id, 0 );
      int arity = NUM2INT(num);
      if ( arity < 0 && (arity+1) < -minimal ) return 1;
      if ( arity == minimal ) return 1;
      return 1;
    }
  return 0;
}


#ifdef __cplusplus
}
#endif



#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 

#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 



  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) 


/* -------- TYPES TABLE (BEGIN) -------- */

#define SWIGTYPE_p_CPLErrorHandler swig_types[0]
#define SWIGTYPE_p_CPLXMLNode swig_types[1]
#define SWIGTYPE_p_GByte swig_types[2]
#define SWIGTYPE_p_GDALAsyncReaderShadow swig_types[3]
#define SWIGTYPE_p_GDALColorEntry swig_types[4]
#define SWIGTYPE_p_GDALColorTableShadow swig_types[5]
#define SWIGTYPE_p_GDALDatasetShadow swig_types[6]
#define SWIGTYPE_p_GDALDriverShadow swig_types[7]
#define SWIGTYPE_p_GDALMajorObjectShadow swig_types[8]
#define SWIGTYPE_p_GDALProgressFunc swig_types[9]
#define SWIGTYPE_p_GDALRasterAttributeTableShadow swig_types[10]
#define SWIGTYPE_p_GDALRasterBandShadow swig_types[11]
#define SWIGTYPE_p_GDALTransformerInfoShadow swig_types[12]
#define SWIGTYPE_p_GDAL_GCP swig_types[13]
#define SWIGTYPE_p_OGRLayerShadow swig_types[14]
#define SWIGTYPE_p_char swig_types[15]
#define SWIGTYPE_p_double swig_types[16]
#define SWIGTYPE_p_f_double_p_q_const__char_p_void__int swig_types[17]
#define SWIGTYPE_p_int swig_types[18]
#define SWIGTYPE_p_p_GDALRasterBandShadow swig_types[19]
#define SWIGTYPE_p_p_GDAL_GCP swig_types[20]
#define SWIGTYPE_p_p_char swig_types[21]
#define SWIGTYPE_p_p_int swig_types[22]
static swig_type_info *swig_types[24];
static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

/* -------- TYPES TABLE (END) -------- */

#define SWIG_init    Init_gdal
#define SWIG_name    "Gdal::Gdal"

static VALUE mGdal;

#define SWIG_RUBY_THREAD_BEGIN_BLOCK
#define SWIG_RUBY_THREAD_END_BLOCK


#define SWIGVERSION 0x010340 
#define SWIG_VERSION SWIGVERSION


#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 


#include <stdexcept>


#include <iostream>
using namespace std;

#include "cpl_port.h"
#include "cpl_string.h"
#include "cpl_multiproc.h"

#include "gdal.h"
#include "gdal_priv.h"
#include "gdal_alg.h"
#include "gdalwarper.h"

typedef void GDALMajorObjectShadow;
typedef void GDALDriverShadow;
typedef void GDALDatasetShadow;
typedef void GDALRasterBandShadow;
typedef void GDALColorTableShadow;
typedef void GDALRasterAttributeTableShadow;
typedef void GDALTransformerInfoShadow;
typedef void GDALAsyncReaderShadow;

/* use this to not return the int returned by GDAL */
typedef int RETURN_NONE;



void VeryQuiteErrorHandler(CPLErr eclass, int code, const char *msg ) {
  /* If the error class is CE_Fatal, we want to have a message issued
     because the CPL support code does an abort() before any exception
     can be generated */
  if (eclass == CE_Fatal ) {
    CPLDefaultErrorHandler(eclass, code, msg );
  }
}


void UseExceptions() {
  CPLSetErrorHandler( (CPLErrorHandler) VeryQuiteErrorHandler );
}

void DontUseExceptions() {
  CPLSetErrorHandler( CPLDefaultErrorHandler );
}



static CPLXMLNode *RubyArrayToXMLTree(VALUE rubyArray)
{
    int      nChildCount = 0, iChild, nType;
    CPLXMLNode *psThisNode;
    CPLXMLNode *psChild;
    char       *pszText = NULL;

    nChildCount = RARRAY(rubyArray)->len - 2;
    if( nChildCount < 0 )
    {
		 rb_raise(rb_eRuntimeError, "Error in input XMLTree, child count is less than zero.");
    }

	 VALUE item1 = rb_ary_entry(rubyArray, 0);
	 nType = NUM2INT(item1);

	 VALUE item2 = rb_ary_entry(rubyArray, 1);
	 pszText = StringValuePtr(item2);

    psThisNode = CPLCreateXMLNode( NULL, (CPLXMLNodeType) nType, pszText );

    for( iChild = 0; iChild < nChildCount; iChild++ )
    {
        psChild = RubyArrayToXMLTree( rb_ary_entry(rubyArray,iChild+2) );
        CPLAddXMLChild( psThisNode, psChild );
    }

    return psThisNode;
}

static VALUE XMLTreeToRubyArray( CPLXMLNode *psTree )
{
    int      nChildCount = 0, iChild;
    CPLXMLNode *psChild;

    for( psChild = psTree->psChild; 
         psChild != NULL; 
         psChild = psChild->psNext )
        nChildCount++;

    VALUE rubyArray = rb_ary_new2(nChildCount+2);

	 rb_ary_store(rubyArray, 0, INT2NUM((int) psTree->eType));
	 rb_ary_store(rubyArray, 1, rb_str_new2(psTree->pszValue));

    for( psChild = psTree->psChild, iChild = 2; 
         psChild != NULL; 
         psChild = psChild->psNext, iChild++ )
    {
        rb_ary_store(rubyArray, iChild, XMLTreeToRubyArray(psChild));
    }

    return rubyArray; 
}


typedef char retStringAndCPLFree;


  void Debug( const char *msg_class, const char *message ) {
    CPLDebug( msg_class, "%s", message );
  }

  CPLErr PushErrorHandler( char const * pszCallbackName = NULL ) {
    CPLErrorHandler pfnHandler = NULL;
    if( pszCallbackName == NULL || EQUAL(pszCallbackName,"CPLQuietErrorHandler") )
      pfnHandler = CPLQuietErrorHandler;
    else if( EQUAL(pszCallbackName,"CPLDefaultErrorHandler") )
      pfnHandler = CPLDefaultErrorHandler;
    else if( EQUAL(pszCallbackName,"CPLLoggingErrorHandler") )
      pfnHandler = CPLLoggingErrorHandler;

    if ( pfnHandler == NULL )
      return CE_Fatal;

    CPLPushErrorHandler( pfnHandler );

    return CE_None;
  }



SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
  static int init = 0;
  static swig_type_info* info = 0;
  if (!init) {
    info = SWIG_TypeQuery("_p_char");
    init = 1;
  }
  return info;
}


SWIGINTERN int
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
{
  if (TYPE(obj) == T_STRING) {
    #if defined(StringValuePtr)
    char *cstr = StringValuePtr(obj); 
    #else
    char *cstr = STR2CSTR(obj);
    #endif
    size_t size = RSTRING_LEN(obj) + 1;
    if (cptr)  {
      if (alloc) {
	if (*alloc == SWIG_NEWOBJ) {
	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
	} else {
	  *cptr = cstr;
	  *alloc = SWIG_OLDOBJ;
	}
      }
    }
    if (psize) *psize = size;
    return SWIG_OK;
  } else {
    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
    if (pchar_descriptor) {
      void* vptr = 0;
      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
	if (cptr) *cptr = (char *)vptr;
	if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
	if (alloc) *alloc = SWIG_OLDOBJ;
	return SWIG_OK;
      }
    }
  }  
  return SWIG_TypeError;
}





  void Error( CPLErr msg_class = CE_Failure, int err_code = 0, const char* msg = "error" ) {
    CPLError( msg_class, err_code, "%s", msg );
  }


#include <limits.h>
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
#   define LLONG_MAX __LONG_LONG_MAX__
#   define LLONG_MIN (-LLONG_MAX - 1LL)
#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
# endif
#endif


SWIGINTERN VALUE
SWIG_ruby_failed(void)
{
  return Qnil;
} 


/*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  long *res = (long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_long (VALUE obj, long* val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_int (VALUE obj, int *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v < INT_MIN || v > INT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< int >(v);
    }
  }  
  return res;
}


char* EscapeString(int len, char *bin_string , int scheme=CPLES_SQL) {
    return CPLEscapeString(bin_string, len, scheme);
} 


SWIGINTERNINLINE VALUE 
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
  if (carray) {
    if (size > LONG_MAX) {
      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
      return pchar_descriptor ? 
	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
    } else {
      return rb_str_new(carray, static_cast< long >(size));
    }
  } else {
    return Qnil;
  }
}


SWIGINTERNINLINE VALUE 
SWIG_FromCharPtr(const char *cptr)
{ 
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}


  #define SWIG_From_long   LONG2NUM 


SWIGINTERNINLINE VALUE
SWIG_From_int  (int value)
{    
  return SWIG_From_long  (value);
}


const char *wrapper_CPLGetConfigOption( const char * pszKey, const char * pszDefault = NULL )
{
    return CPLGetConfigOption( pszKey, pszDefault );
}

SWIGINTERN char const *GDALMajorObjectShadow_GetDescription(GDALMajorObjectShadow *self){
    return GDALGetDescription( self );
  }
SWIGINTERN void GDALMajorObjectShadow_SetDescription(GDALMajorObjectShadow *self,char const *pszNewDesc){
    GDALSetDescription( self, pszNewDesc );
  }
SWIGINTERN char **GDALMajorObjectShadow_GetMetadata_Dict(GDALMajorObjectShadow *self,char const *pszDomain=""){
    return GDALGetMetadata( self, pszDomain );
  }
SWIGINTERN char **GDALMajorObjectShadow_GetMetadata_List(GDALMajorObjectShadow *self,char const *pszDomain=""){
    return GDALGetMetadata( self, pszDomain );
  }
SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadata__SWIG_0(GDALMajorObjectShadow *self,char **papszMetadata,char const *pszDomain=""){
    return GDALSetMetadata( self, papszMetadata, pszDomain );
  }
SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadata__SWIG_1(GDALMajorObjectShadow *self,char *pszMetadataString,char const *pszDomain=""){
    char *tmpList[2];
    tmpList[0] = pszMetadataString;
    tmpList[1] = 0;
    return GDALSetMetadata( self, tmpList, pszDomain );
  }
SWIGINTERN char const *GDALMajorObjectShadow_GetMetadataItem(GDALMajorObjectShadow *self,char const *pszName,char const *pszDomain=""){
    return GDALGetMetadataItem( self, pszName, pszDomain);
  }
SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadataItem(GDALMajorObjectShadow *self,char const *pszName,char const *pszValue,char const *pszDomain=""){
    return GDALSetMetadataItem( self, pszName, pszValue, pszDomain);
  }
SWIGINTERN GDALDatasetShadow *GDALDriverShadow_Create(GDALDriverShadow *self,char const *utf8_path,int xsize,int ysize,int bands=1,GDALDataType eType=GDT_Byte,char **options=0){

    GDALDatasetShadow* ds = (GDALDatasetShadow*) GDALCreate(    self, 
                                                                utf8_path, 
                                                                xsize, 
                                                                ysize, 
                                                                bands, 
                                                                eType, 
                                                                options );
    return ds;
  }
SWIGINTERN GDALDatasetShadow *GDALDriverShadow_CreateCopy(GDALDriverShadow *self,char const *utf8_path,GDALDatasetShadow *src,int strict=1,char **options=0,GDALProgressFunc callback=NULL,void *callback_data=NULL){

    GDALDatasetShadow *ds = (GDALDatasetShadow*) GDALCreateCopy(    self, 
                                                                    utf8_path, 
                                                                    src, 
                                                                    strict, 
                                                                    options, 
                                                                    callback, 
                                                                    callback_data );
    return ds;
  }
SWIGINTERN int GDALDriverShadow_Delete(GDALDriverShadow *self,char const *utf8_path){
    return GDALDeleteDataset( self, utf8_path );
  }
SWIGINTERN int GDALDriverShadow_Rename(GDALDriverShadow *self,char const *newName,char const *oldName){
    return GDALRenameDataset( self, newName, oldName );
  }
SWIGINTERN int GDALDriverShadow_Register(GDALDriverShadow *self){
    return GDALRegisterDriver( self );
  }
SWIGINTERN void GDALDriverShadow_Deregister(GDALDriverShadow *self){
    GDALDeregisterDriver( self );
  }

char const *GDALDriverShadow_ShortName_get( GDALDriverShadow *h ) {
  return GDALGetDriverShortName( h );
}
char const *GDALDriverShadow_LongName_get( GDALDriverShadow *h ) {
  return GDALGetDriverLongName( h );
}
char const *GDALDriverShadow_HelpTopic_get( GDALDriverShadow *h ) {
  return GDALGetDriverHelpTopic( h );
}


SWIGINTERN int
SWIG_AsVal_short (VALUE obj, short *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v < SHRT_MIN || v > SHRT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< short >(v);
    }
  }  
  return res;
}


SWIGINTERNINLINE VALUE
SWIG_From_short  (short value)
{    
  return SWIG_From_long  (value);
}


/*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  double *res = (double *)(args[1]);
  *res = NUM2DBL(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_double (VALUE obj, double *val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
    double v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


  #define SWIG_From_double   rb_float_new 

SWIGINTERN GDAL_GCP *new_GDAL_GCP(double x=0.0,double y=0.0,double z=0.0,double pixel=0.0,double line=0.0,char const *info="",char const *id=""){

    GDAL_GCP *self = (GDAL_GCP*) CPLMalloc( sizeof( GDAL_GCP ) );
    self->dfGCPX = x;
    self->dfGCPY = y;
    self->dfGCPZ = z;
    self->dfGCPPixel = pixel;
    self->dfGCPLine = line;
    self->pszInfo =  CPLStrdup( (info == 0) ? "" : info );
    self->pszId = CPLStrdup( (id==0)? "" : id );
    return self;
  }


double GDAL_GCP_GCPX_get( GDAL_GCP *gcp ) {
  return gcp->dfGCPX;
}
void GDAL_GCP_GCPX_set( GDAL_GCP *gcp, double dfGCPX ) {
  gcp->dfGCPX = dfGCPX;
}
double GDAL_GCP_GCPY_get( GDAL_GCP *gcp ) {
  return gcp->dfGCPY;
}
void GDAL_GCP_GCPY_set( GDAL_GCP *gcp, double dfGCPY ) {
  gcp->dfGCPY = dfGCPY;
}
double GDAL_GCP_GCPZ_get( GDAL_GCP *gcp ) {
  return gcp->dfGCPZ;
}
void GDAL_GCP_GCPZ_set( GDAL_GCP *gcp, double dfGCPZ ) {
  gcp->dfGCPZ = dfGCPZ;
}
double GDAL_GCP_GCPPixel_get( GDAL_GCP *gcp ) {
  return gcp->dfGCPPixel;
}
void GDAL_GCP_GCPPixel_set( GDAL_GCP *gcp, double dfGCPPixel ) {
  gcp->dfGCPPixel = dfGCPPixel;
}
double GDAL_GCP_GCPLine_get( GDAL_GCP *gcp ) {
  return gcp->dfGCPLine;
}
void GDAL_GCP_GCPLine_set( GDAL_GCP *gcp, double dfGCPLine ) {
  gcp->dfGCPLine = dfGCPLine;
}
const char * GDAL_GCP_Info_get( GDAL_GCP *gcp ) {
  return gcp->pszInfo;
}
void GDAL_GCP_Info_set( GDAL_GCP *gcp, const char * pszInfo ) {
  if ( gcp->pszInfo ) 
    CPLFree( gcp->pszInfo );
  gcp->pszInfo = CPLStrdup(pszInfo);
}
const char * GDAL_GCP_Id_get( GDAL_GCP *gcp ) {
  return gcp->pszId;
}
void GDAL_GCP_Id_set( GDAL_GCP *gcp, const char * pszId ) {
  if ( gcp->pszId ) 
    CPLFree( gcp->pszId );
  gcp->pszId = CPLStrdup(pszId);
}



/* Duplicate, but transposed names for C# because 
*  the C# module outputs backwards names
*/
double GDAL_GCP_get_GCPX( GDAL_GCP *gcp ) {
  return gcp->dfGCPX;
}
void GDAL_GCP_set_GCPX( GDAL_GCP *gcp, double dfGCPX ) {
  gcp->dfGCPX = dfGCPX;
}
double GDAL_GCP_get_GCPY( GDAL_GCP *gcp ) {
  return gcp->dfGCPY;
}
void GDAL_GCP_set_GCPY( GDAL_GCP *gcp, double dfGCPY ) {
  gcp->dfGCPY = dfGCPY;
}
double GDAL_GCP_get_GCPZ( GDAL_GCP *gcp ) {
  return gcp->dfGCPZ;
}
void GDAL_GCP_set_GCPZ( GDAL_GCP *gcp, double dfGCPZ ) {
  gcp->dfGCPZ = dfGCPZ;
}
double GDAL_GCP_get_GCPPixel( GDAL_GCP *gcp ) {
  return gcp->dfGCPPixel;
}
void GDAL_GCP_set_GCPPixel( GDAL_GCP *gcp, double dfGCPPixel ) {
  gcp->dfGCPPixel = dfGCPPixel;
}
double GDAL_GCP_get_GCPLine( GDAL_GCP *gcp ) {
  return gcp->dfGCPLine;
}
void GDAL_GCP_set_GCPLine( GDAL_GCP *gcp, double dfGCPLine ) {
  gcp->dfGCPLine = dfGCPLine;
}
const char * GDAL_GCP_get_Info( GDAL_GCP *gcp ) {
  return gcp->pszInfo;
}
void GDAL_GCP_set_Info( GDAL_GCP *gcp, const char * pszInfo ) {
  if ( gcp->pszInfo ) 
    CPLFree( gcp->pszInfo );
  gcp->pszInfo = CPLStrdup(pszInfo);
}
const char * GDAL_GCP_get_Id( GDAL_GCP *gcp ) {
  return gcp->pszId;
}
void GDAL_GCP_set_Id( GDAL_GCP *gcp, const char * pszId ) {
  if ( gcp->pszId ) 
    CPLFree( gcp->pszId );
  gcp->pszId = CPLStrdup(pszId);
}



/* Returned size is in bytes or 0 if an error occured */
static
GIntBig ComputeDatasetRasterIOSize (int buf_xsize, int buf_ysize, int nPixelSize,
                                int nBands, int* bandMap, int nBandMapArrayLength,
                                int nPixelSpace, int nLineSpace, int nBandSpace,
                                int bSpacingShouldBeMultipleOfPixelSize )
{
#if SIZEOF_VOIDP == 8
    const GIntBig MAX_INT = (((GIntBig)0x7fffffff) << 32) | 0xffffffff;
#else
    const GIntBig MAX_INT = 0x7fffffff;
#endif
    const GIntBig MAX_INT32 = 0x7fffffff;
    if (buf_xsize <= 0 || buf_ysize <= 0)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for buffer size");
        return 0;
    }

    if (nPixelSpace < 0 || nLineSpace < 0 || nBandSpace < 0)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for space arguments");
        return 0;
    }

    if (nPixelSize == 0)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal value for data type");
        return 0;
    }

    if( nPixelSpace == 0 )
        nPixelSpace = nPixelSize;
    else if ( bSpacingShouldBeMultipleOfPixelSize && (nPixelSpace % nPixelSize) != 0 )
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "nPixelSpace should be a multiple of nPixelSize");
        return 0;
    }

    if( nLineSpace == 0 )
    {
        if (nPixelSpace > MAX_INT32 / buf_xsize)
        {
            CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow for nLineSpace");
            return 0;
        }
        nLineSpace = nPixelSpace * buf_xsize;
    }
    else if ( bSpacingShouldBeMultipleOfPixelSize && (nLineSpace % nPixelSize) != 0 )
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "nLineSpace should be a multiple of nPixelSize");
        return 0;
    }

    if( nBandSpace == 0 )
    {
        if (nLineSpace > MAX_INT32 / buf_ysize)
        {
            CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow for nBandSpace");
            return 0;
        }
        nBandSpace = nLineSpace * buf_ysize;
    }
    else if ( bSpacingShouldBeMultipleOfPixelSize && (nBandSpace % nPixelSize) != 0 )
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "nLineSpace should be a multiple of nPixelSize");
        return 0;
    }

    if (nBands <= 0 || (bandMap != NULL && nBands > nBandMapArrayLength))
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Invalid band count");
        return 0;
    }

    GIntBig nRet = (GIntBig)(buf_ysize - 1) * nLineSpace + (GIntBig)(buf_xsize - 1) * nPixelSpace + (GIntBig)(nBands - 1) * nBandSpace + nPixelSize;
    if (nRet > MAX_INT)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow");
        return 0;
    }

    return nRet;
}


static
CPLErr DSReadRaster_internal( GDALDatasetShadow *obj, 
                            int xoff, int yoff, int xsize, int ysize,
                            int buf_xsize, int buf_ysize,
                            GDALDataType buf_type,
                            int *buf_size, char **buf,
                            int band_list, int *pband_list,
                            int pixel_space, int line_space, int band_space)
{
  CPLErr result;

  GIntBig nRequiredSize = ComputeDatasetRasterIOSize (buf_xsize, buf_ysize, GDALGetDataTypeSize( buf_type ) / 8,
                                          band_list ? band_list : GDALGetRasterCount(obj), pband_list, band_list,
                                          pixel_space, line_space, band_space, FALSE);
  if (nRequiredSize > 0x7fffffff)
  {
     CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow");
     nRequiredSize = 0;
  }
  *buf_size = (int)nRequiredSize;
  if (*buf_size == 0)
  {
      *buf = 0;
      return CE_Failure;
  }
  
  *buf = (char*) malloc( *buf_size );
  if (*buf)
  {
    result = GDALDatasetRasterIO(obj, GF_Read, xoff, yoff, xsize, ysize,
                                    (void*) *buf, buf_xsize, buf_ysize, buf_type,
                                    band_list, pband_list, pixel_space, line_space, band_space );
    if ( result != CE_None ) {
        free( *buf );
        *buf = 0;
        *buf_size = 0;
    }
  }
  else
  {
    CPLError(CE_Failure, CPLE_OutOfMemory, "Not enough memory to allocate %d bytes", *buf_size);
    result = CE_Failure;
    *buf = 0;
    *buf_size = 0;
  }
  return result;
}


typedef struct
{
    GDALAsyncReaderH  hAsyncReader;
    void             *pyObject;
} GDALAsyncReaderWrapper;

typedef void* GDALAsyncReaderWrapperH;

static GDALAsyncReaderH AsyncReaderWrapperGetReader(GDALAsyncReaderWrapperH hWrapper)
{
    GDALAsyncReaderWrapper* psWrapper = (GDALAsyncReaderWrapper*)hWrapper;
    if (psWrapper->hAsyncReader == NULL)
    {
        CPLError(CE_Failure, CPLE_AppDefined, "AsyncReader object is defunct");
    }
    return psWrapper->hAsyncReader;
}

static void* AsyncReaderWrapperGetPyObject(GDALAsyncReaderWrapperH hWrapper)
{
    GDALAsyncReaderWrapper* psWrapper = (GDALAsyncReaderWrapper*)hWrapper;
    return psWrapper->pyObject;
}

static void DeleteAsyncReaderWrapper(GDALAsyncReaderWrapperH hWrapper)
{
    GDALAsyncReaderWrapper* psWrapper = (GDALAsyncReaderWrapper*)hWrapper;
    if (psWrapper->hAsyncReader != NULL)
    {
        CPLError(CE_Failure, CPLE_AppDefined,
                 "Native AsyncReader object will leak. EndAsyncReader() should have been called before");
    }
    CPLFree(psWrapper);
}


SWIGINTERN GDALAsyncStatusType GDALAsyncReaderShadow_GetNextUpdatedRegion(GDALAsyncReaderShadow *self,double timeout,int *xoff,int *yoff,int *buf_xsize,int *buf_ysize){
        GDALAsyncReaderH hReader = AsyncReaderWrapperGetReader(self);
        if (hReader == NULL)
        {
            *xoff = 0;
            *yoff = 0;
            *buf_xsize = 0;
            *buf_ysize = 0;
            return GARIO_ERROR;
        }
        return GDALARGetNextUpdatedRegion(hReader, timeout, xoff, yoff, buf_xsize, buf_ysize );
    }
SWIGINTERN int GDALAsyncReaderShadow_LockBuffer(GDALAsyncReaderShadow *self,double timeout){
        GDALAsyncReaderH hReader = AsyncReaderWrapperGetReader(self);
        if (hReader == NULL)
        {
            return 0;
        }
        return GDALARLockBuffer(hReader,timeout);
    }
SWIGINTERN void GDALAsyncReaderShadow_UnlockBuffer(GDALAsyncReaderShadow *self){
        GDALAsyncReaderH hReader = AsyncReaderWrapperGetReader(self);
        if (hReader == NULL)
        {
            return;
        }
        GDALARUnlockBuffer(hReader);
    }
SWIGINTERN GDALDriverShadow *GDALDatasetShadow_GetDriver(GDALDatasetShadow *self){
    return (GDALDriverShadow*) GDALGetDatasetDriver( self );
  }
SWIGINTERN GDALRasterBandShadow *GDALDatasetShadow_GetRasterBand(GDALDatasetShadow *self,int nBand){
    return (GDALRasterBandShadow*) GDALGetRasterBand( self, nBand );
  }
SWIGINTERN char const *GDALDatasetShadow_GetProjection(GDALDatasetShadow *self){
    return GDALGetProjectionRef( self );
  }
SWIGINTERN char const *GDALDatasetShadow_GetProjectionRef(GDALDatasetShadow *self){
    return GDALGetProjectionRef( self );
  }
SWIGINTERN CPLErr GDALDatasetShadow_SetProjection(GDALDatasetShadow *self,char const *prj){
    return GDALSetProjection( self, prj );
  }
SWIGINTERN void GDALDatasetShadow_GetGeoTransform(GDALDatasetShadow *self,double argout[6]){
    if ( GDALGetGeoTransform( self, argout ) != CE_None ) {
      argout[0] = 0.0;
      argout[1] = 1.0;
      argout[2] = 0.0;
      argout[3] = 0.0;
      argout[4] = 0.0;
      argout[5] = 1.0;
    }
  }
SWIGINTERN CPLErr GDALDatasetShadow_SetGeoTransform(GDALDatasetShadow *self,double argin[6]){
    return GDALSetGeoTransform( self, argin );
  }
SWIGINTERN int GDALDatasetShadow_BuildOverviews(GDALDatasetShadow *self,char const *resampling="NEAREST",int overviewlist=0,int *pOverviews=0,GDALProgressFunc callback=NULL,void *callback_data=NULL){

    return GDALBuildOverviews(  self, 
                                resampling ? resampling : "NEAREST", 
                                overviewlist, 
                                pOverviews, 
                                0, 
                                0, 
                                callback, 
                                callback_data);
  }
SWIGINTERN int GDALDatasetShadow_GetGCPCount(GDALDatasetShadow *self){
    return GDALGetGCPCount( self );
  }
SWIGINTERN char const *GDALDatasetShadow_GetGCPProjection(GDALDatasetShadow *self){
    return GDALGetGCPProjection( self );
  }
SWIGINTERN void GDALDatasetShadow_GetGCPs(GDALDatasetShadow *self,int *nGCPs,GDAL_GCP const **pGCPs){
    *nGCPs = GDALGetGCPCount( self );
    *pGCPs = GDALGetGCPs( self );
  }
SWIGINTERN CPLErr GDALDatasetShadow_SetGCPs(GDALDatasetShadow *self,int nGCPs,GDAL_GCP const *pGCPs,char const *pszGCPProjection){
    return GDALSetGCPs( self, nGCPs, pGCPs, pszGCPProjection );
  }
SWIGINTERN void GDALDatasetShadow_FlushCache(GDALDatasetShadow *self){
    GDALFlushCache( self );
  }
SWIGINTERN CPLErr GDALDatasetShadow_AddBand(GDALDatasetShadow *self,GDALDataType datatype=GDT_Byte,char **options=0){
    return GDALAddBand( self, datatype, options );
  }
SWIGINTERN CPLErr GDALDatasetShadow_CreateMaskBand(GDALDatasetShadow *self,int nFlags){
      return GDALCreateDatasetMaskBand( self, nFlags );
  }
SWIGINTERN char **GDALDatasetShadow_GetFileList(GDALDatasetShadow *self){
    return GDALGetFileList( self );
  }
SWIGINTERN CPLErr GDALDatasetShadow_WriteRaster(GDALDatasetShadow *self,int xoff,int yoff,int xsize,int ysize,int buf_len,char *buf_string,int *buf_xsize=0,int *buf_ysize=0,GDALDataType *buf_type=0,int band_list=0,int *pband_list=0,int *buf_pixel_space=0,int *buf_line_space=0,int *buf_band_space=0){
    CPLErr eErr;
    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
    GDALDataType ntype;
    if ( buf_type != 0 ) {
      ntype = (GDALDataType) *buf_type;
    } else {
      int lastband = GDALGetRasterCount( self ) - 1;
      if (lastband < 0)
        return CE_Failure;
      ntype = GDALGetRasterDataType( GDALGetRasterBand( self, lastband ) );
    }

    int pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
    int line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
    int band_space = (buf_band_space == 0) ? 0 : *buf_band_space;

    GIntBig min_buffer_size =
      ComputeDatasetRasterIOSize (nxsize, nysize, GDALGetDataTypeSize( ntype ) / 8,
                                  band_list ? band_list : GDALGetRasterCount(self), pband_list, band_list,
                                  pixel_space, line_space, band_space, FALSE);
    if (min_buffer_size == 0)
        return CE_Failure;

    if ( buf_len < min_buffer_size )
    {
        CPLError(CE_Failure, CPLE_AppDefined, "Buffer too small");
        return CE_Failure;
    }
  
    eErr = GDALDatasetRasterIO( self, GF_Write, xoff, yoff, xsize, ysize,
                                (void*) buf_string, nxsize, nysize, ntype,
                                band_list, pband_list, pixel_space, line_space, band_space );

    return eErr;
  }
SWIGINTERN CPLErr GDALDatasetShadow_ReadRaster(GDALDatasetShadow *self,int xoff,int yoff,int xsize,int ysize,int *buf_len,char **buf,int *buf_xsize=0,int *buf_ysize=0,GDALDataType *buf_type=0,int band_list=0,int *pband_list=0,int *buf_pixel_space=0,int *buf_line_space=0,int *buf_band_space=0){
    CPLErr eErr;
    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
    GDALDataType ntype;
    if ( buf_type != 0 ) {
      ntype = (GDALDataType) *buf_type;
    } else {
      int lastband = GDALGetRasterCount( self ) - 1;
      if (lastband < 0)
        return CE_Failure;
      ntype = GDALGetRasterDataType( GDALGetRasterBand( self, lastband ) );
    }

    int pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
    int line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
    int band_space = (buf_band_space == 0) ? 0 : *buf_band_space;
                            
    eErr = DSReadRaster_internal( self, xoff, yoff, xsize, ysize,
                                nxsize, nysize, ntype,
                                buf_len, buf, 
                                band_list, pband_list,
                                pixel_space, line_space, band_space);

    return eErr;
}

int GDALDatasetShadow_RasterXSize_get( GDALDatasetShadow *h ) {
  return GDALGetRasterXSize( h );
}
int GDALDatasetShadow_RasterYSize_get( GDALDatasetShadow *h ) {
  return GDALGetRasterYSize( h );
}
int GDALDatasetShadow_RasterCount_get( GDALDatasetShadow *h ) {
  return GDALGetRasterCount( h );
}


/* Returned size is in bytes or 0 if an error occured */
static
GIntBig ComputeBandRasterIOSize (int buf_xsize, int buf_ysize, int nPixelSize,
                             int nPixelSpace, int nLineSpace,
                             int bSpacingShouldBeMultipleOfPixelSize )
{
#if SIZEOF_VOIDP == 8
    const GIntBig MAX_INT = (((GIntBig)0x7fffffff) << 32) | 0xffffffff;
#else
    const GIntBig MAX_INT = 0x7fffffff;
#endif
    const GIntBig MAX_INT32 = 0x7fffffff;
    if (buf_xsize <= 0 || buf_ysize <= 0)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for buffer size");
        return 0;
    }

    if (nPixelSpace < 0 || nLineSpace < 0)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for space arguments");
        return 0;
    }

    if (nPixelSize == 0)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal value for data type");
        return 0;
    }

    if( nPixelSpace == 0 )
        nPixelSpace = nPixelSize;
    else if ( bSpacingShouldBeMultipleOfPixelSize && (nPixelSpace % nPixelSize) != 0 )
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "nPixelSpace should be a multiple of nPixelSize");
        return 0;
    }

    if( nLineSpace == 0 )
    {
        if (nPixelSpace > MAX_INT32 / buf_xsize)
        {
            CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow for nLineSpace");
            return 0;
        }
        nLineSpace = nPixelSpace * buf_xsize;
    }
    else if ( bSpacingShouldBeMultipleOfPixelSize && (nLineSpace % nPixelSize) != 0 )
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "nLineSpace should be a multiple of nPixelSize");
        return 0;
    }

    GIntBig nRet = (GIntBig)(buf_ysize - 1) * nLineSpace + (GIntBig)(buf_xsize - 1) * nPixelSpace + nPixelSize;
    if (nRet > MAX_INT)
    {
        CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow");
        return 0;
    }

    return nRet;
}


static
CPLErr ReadRaster_internal( GDALRasterBandShadow *obj, 
                            int xoff, int yoff, int xsize, int ysize,
                            int buf_xsize, int buf_ysize,
                            GDALDataType buf_type,
                            int *buf_size, char **buf,
                            int pixel_space, int line_space )
{
  CPLErr result;

  GIntBig nRequiredSize = ComputeBandRasterIOSize( buf_xsize, buf_ysize, GDALGetDataTypeSize( buf_type ) / 8,
                                       pixel_space, line_space, FALSE );
  if (nRequiredSize > 0x7fffffff)
  {
     CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow");
     nRequiredSize = 0;
  }
  *buf_size = (int)nRequiredSize;
  
  if ( *buf_size == 0 )
  {
      *buf = 0;
      return CE_Failure;
  }
  
  *buf = (char*) malloc( *buf_size );
  if ( *buf )
  {
    result =  GDALRasterIO( obj, GF_Read, xoff, yoff, xsize, ysize,
                                    (void *) *buf, buf_xsize, buf_ysize,
                                    buf_type, pixel_space, line_space );
    if ( result != CE_None )
    {
        free( *buf );
        *buf = 0;
        *buf_size = 0;
    }
  }
  else
  {
    CPLError(CE_Failure, CPLE_OutOfMemory, "Not enough memory to allocate %d bytes", *buf_size);
    result = CE_Failure;
    *buf = 0;
    *buf_size = 0;
  }

  return result;
}


static
CPLErr WriteRaster_internal( GDALRasterBandShadow *obj,
                             int xoff, int yoff, int xsize, int ysize,
                             int buf_xsize, int buf_ysize,
                             GDALDataType buf_type,
                             GIntBig buf_size, char *buffer,
                             int pixel_space, int line_space)
{
    GIntBig min_buffer_size = ComputeBandRasterIOSize (buf_xsize, buf_ysize, GDALGetDataTypeSize( buf_type ) / 8,
                                                   pixel_space, line_space, FALSE );
    if ( min_buffer_size == 0 )
      return CE_Failure;
      
    if ( buf_size < min_buffer_size ) {
      CPLError(CE_Failure, CPLE_AppDefined, "Buffer too small");
      return CE_Failure;
    }

    return GDALRasterIO( obj, GF_Write, xoff, yoff, xsize, ysize, 
		        (void *) buffer, buf_xsize, buf_ysize, buf_type, pixel_space, line_space );
}

SWIGINTERN int GDALRasterBandShadow_GetBand(GDALRasterBandShadow *self){
    return GDALGetBandNumber(self);
  }
SWIGINTERN void GDALRasterBandShadow_GetBlockSize(GDALRasterBandShadow *self,int *pnBlockXSize,int *pnBlockYSize){
      GDALGetBlockSize(self, pnBlockXSize, pnBlockYSize);
  }
SWIGINTERN GDALColorInterp GDALRasterBandShadow_GetColorInterpretation(GDALRasterBandShadow *self){
    return GDALGetRasterColorInterpretation( self );
  }
SWIGINTERN GDALColorInterp GDALRasterBandShadow_GetRasterColorInterpretation(GDALRasterBandShadow *self){
    return GDALGetRasterColorInterpretation( self );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetColorInterpretation(GDALRasterBandShadow *self,GDALColorInterp val){
    return GDALSetRasterColorInterpretation( self, val );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetRasterColorInterpretation(GDALRasterBandShadow *self,GDALColorInterp val){
    return GDALSetRasterColorInterpretation( self, val );
  }
SWIGINTERN void GDALRasterBandShadow_GetNoDataValue(GDALRasterBandShadow *self,double *val,int *hasval){
    *val = GDALGetRasterNoDataValue( self, hasval );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetNoDataValue(GDALRasterBandShadow *self,double d){
    return GDALSetRasterNoDataValue( self, d );
  }
SWIGINTERN char const *GDALRasterBandShadow_GetUnitType(GDALRasterBandShadow *self){
      return GDALGetRasterUnitType( self );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetUnitType(GDALRasterBandShadow *self,char const *val){
    return GDALSetRasterUnitType( self, val );
  }
SWIGINTERN char **GDALRasterBandShadow_GetRasterCategoryNames(GDALRasterBandShadow *self){
    return GDALGetRasterCategoryNames( self );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetRasterCategoryNames(GDALRasterBandShadow *self,char **names){
    return GDALSetRasterCategoryNames( self, names );
  }
SWIGINTERN void GDALRasterBandShadow_GetMinimum(GDALRasterBandShadow *self,double *val,int *hasval){
    *val = GDALGetRasterMinimum( self, hasval );
  }
SWIGINTERN void GDALRasterBandShadow_GetMaximum(GDALRasterBandShadow *self,double *val,int *hasval){
    *val = GDALGetRasterMaximum( self, hasval );
  }
SWIGINTERN void GDALRasterBandShadow_GetOffset(GDALRasterBandShadow *self,double *val,int *hasval){
    *val = GDALGetRasterOffset( self, hasval );
  }
SWIGINTERN void GDALRasterBandShadow_GetScale(GDALRasterBandShadow *self,double *val,int *hasval){
    *val = GDALGetRasterScale( self, hasval );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetOffset(GDALRasterBandShadow *self,double val){
    return GDALSetRasterOffset( self, val );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetScale(GDALRasterBandShadow *self,double val){
    return GDALSetRasterScale( self, val );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_GetStatistics(GDALRasterBandShadow *self,int approx_ok,int force,double *min,double *max,double *mean,double *stddev){
    if (min) *min = 0;
    if (max) *max = 0;
    if (mean) *mean = 0;
    if (stddev) *stddev = -1; /* This is the only way to recognize from Python if GetRasterStatistics() has updated the values */
    return GDALGetRasterStatistics( self, approx_ok, force, 
				    min, max, mean, stddev );
  }

SWIGINTERN int
SWIG_AsVal_bool (VALUE obj, bool *val)
{
  if (obj == Qtrue) {
    if (val) *val = true;
    return SWIG_OK;
  } else if (obj == Qfalse) {
    if (val) *val = false;
    return SWIG_OK;
  } else {
    int res = 0;
    if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {    
      if (val) *val = res ? true : false;
      return SWIG_OK;
    }
  }  
  return SWIG_TypeError;
}

SWIGINTERN CPLErr GDALRasterBandShadow_ComputeStatistics(GDALRasterBandShadow *self,bool approx_ok,double *min=NULL,double *max=NULL,double *mean=NULL,double *stddev=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
    return GDALComputeRasterStatistics( self, approx_ok, min, max, mean, stddev, callback, callback_data );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_SetStatistics(GDALRasterBandShadow *self,double min,double max,double mean,double stddev){
    return GDALSetRasterStatistics( self, min, max, mean, stddev );
  }
SWIGINTERN int GDALRasterBandShadow_GetOverviewCount(GDALRasterBandShadow *self){
    return GDALGetOverviewCount( self );
  }
SWIGINTERN GDALRasterBandShadow *GDALRasterBandShadow_GetOverview(GDALRasterBandShadow *self,int i){
    return (GDALRasterBandShadow*) GDALGetOverview( self, i );
  }
SWIGINTERN int GDALRasterBandShadow_Checksum(GDALRasterBandShadow *self,int xoff=0,int yoff=0,int *xsize=0,int *ysize=0){
    int nxsize = (xsize!=0) ? *xsize : GDALGetRasterBandXSize( self );
    int nysize = (ysize!=0) ? *ysize : GDALGetRasterBandYSize( self );
    return GDALChecksumImage( self, xoff, yoff, nxsize, nysize );
  }
SWIGINTERN void GDALRasterBandShadow_ComputeRasterMinMax(GDALRasterBandShadow *self,double argout[2],int approx_ok=0){
    GDALComputeRasterMinMax( self, approx_ok, argout );
  }
SWIGINTERN void GDALRasterBandShadow_ComputeBandStats(GDALRasterBandShadow *self,double argout[2],int samplestep=1){
    GDALComputeBandStats( self, samplestep, argout+0, argout+1, 
                          NULL, NULL );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_Fill(GDALRasterBandShadow *self,double real_fill,double imag_fill=0.0){
    return GDALFillRaster( self, real_fill, imag_fill );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_ReadRaster(GDALRasterBandShadow *self,int xoff,int yoff,int xsize,int ysize,int *buf_len,char **buf,int *buf_xsize=0,int *buf_ysize=0,int *buf_type=0,int *buf_pixel_space=0,int *buf_line_space=0){
    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
    GDALDataType ntype  = (buf_type==0) ? GDALGetRasterDataType(self)
                                        : (GDALDataType)*buf_type;
    int pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
    int line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
    return ReadRaster_internal( self, xoff, yoff, xsize, ysize,
                                nxsize, nysize, ntype, buf_len, buf, pixel_space, line_space );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_WriteRaster(GDALRasterBandShadow *self,int xoff,int yoff,int xsize,int ysize,int buf_len,char *buf_string,int *buf_xsize=0,int *buf_ysize=0,int *buf_type=0,int *buf_pixel_space=0,int *buf_line_space=0){
    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
    GDALDataType ntype  = (buf_type==0) ? GDALGetRasterDataType(self)
                                        : (GDALDataType)*buf_type;
    int pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
    int line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
    return WriteRaster_internal( self, xoff, yoff, xsize, ysize,
                                 nxsize, nysize, ntype, buf_len, buf_string, pixel_space, line_space );
  }
SWIGINTERN void GDALRasterBandShadow_FlushCache(GDALRasterBandShadow *self){
    GDALFlushRasterCache( self );
  }
SWIGINTERN GDALColorTableShadow *GDALRasterBandShadow_GetRasterColorTable(GDALRasterBandShadow *self){
    return (GDALColorTableShadow*) GDALGetRasterColorTable( self );
  }
SWIGINTERN GDALColorTableShadow *GDALRasterBandShadow_GetColorTable(GDALRasterBandShadow *self){
    return (GDALColorTableShadow*) GDALGetRasterColorTable( self );
  }
SWIGINTERN int GDALRasterBandShadow_SetRasterColorTable(GDALRasterBandShadow *self,GDALColorTableShadow *arg){
    return GDALSetRasterColorTable( self, arg );
  }
SWIGINTERN int GDALRasterBandShadow_SetColorTable(GDALRasterBandShadow *self,GDALColorTableShadow *arg){
    return GDALSetRasterColorTable( self, arg );
  }
SWIGINTERN GDALRasterAttributeTableShadow *GDALRasterBandShadow_GetDefaultRAT(GDALRasterBandShadow *self){ 
      return (GDALRasterAttributeTableShadow*) GDALGetDefaultRAT(self);
  }
SWIGINTERN int GDALRasterBandShadow_SetDefaultRAT(GDALRasterBandShadow *self,GDALRasterAttributeTableShadow *table){
      return GDALSetDefaultRAT(self, table);
  }
SWIGINTERN GDALRasterBandShadow *GDALRasterBandShadow_GetMaskBand(GDALRasterBandShadow *self){
      return (GDALRasterBandShadow *) GDALGetMaskBand( self );
  }
SWIGINTERN int GDALRasterBandShadow_GetMaskFlags(GDALRasterBandShadow *self){
      return GDALGetMaskFlags( self );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_CreateMaskBand(GDALRasterBandShadow *self,int nFlags){
      return GDALCreateMaskBand( self, nFlags );
  }
SWIGINTERN CPLErr GDALRasterBandShadow_GetHistogram(GDALRasterBandShadow *self,double min=-0.5,double max=255.5,int buckets=256,int *panHistogram=NULL,int include_out_of_range=0,int approx_ok=1,GDALProgressFunc callback=NULL,void *callback_data=NULL){
    CPLErrorReset(); 
    CPLErr err = GDALGetRasterHistogram( self, min, max, buckets, panHistogram,
                                         include_out_of_range, approx_ok,
                                         callback, callback_data );
    return err;
  }
SWIGINTERN CPLErr GDALRasterBandShadow_GetDefaultHistogram(GDALRasterBandShadow *self,double *min_ret=NULL,double *max_ret=NULL,int *buckets_ret=NULL,int **ppanHistogram=NULL,int force=1,GDALProgressFunc callback=NULL,void *callback_data=NULL){
    return GDALGetDefaultHistogram( self, min_ret, max_ret, buckets_ret,
                                    ppanHistogram, force, 
                                    callback, callback_data );
}
SWIGINTERN CPLErr GDALRasterBandShadow_SetDefaultHistogram(GDALRasterBandShadow *self,double min,double max,int buckets_in,int *panHistogram_in){
    return GDALSetDefaultHistogram( self, min, max, 
    	   			    buckets_in, panHistogram_in );
}
SWIGINTERN bool GDALRasterBandShadow_HasArbitraryOverviews(GDALRasterBandShadow *self){
      return (GDALHasArbitraryOverviews( self ) != 0) ? true : false;
  }

SWIGINTERNINLINE VALUE
SWIG_From_bool  (bool value)
{
  return value ? Qtrue : Qfalse;
}


GDALDataType GDALRasterBandShadow_DataType_get( GDALRasterBandShadow *h ) {
  return GDALGetRasterDataType( h );
}
int GDALRasterBandShadow_XSize_get( GDALRasterBandShadow *h ) {
  return GDALGetRasterBandXSize( h );
}
int GDALRasterBandShadow_YSize_get( GDALRasterBandShadow *h ) {
  return GDALGetRasterBandYSize( h );
}

SWIGINTERN GDALColorTableShadow *new_GDALColorTableShadow(GDALPaletteInterp palette=GPI_RGB){
        return (GDALColorTableShadow*) GDALCreateColorTable(palette);
    }
SWIGINTERN GDALColorTableShadow *GDALColorTableShadow_Clone(GDALColorTableShadow *self){
        return (GDALColorTableShadow*) GDALCloneColorTable (self);
    }
SWIGINTERN GDALPaletteInterp GDALColorTableShadow_GetPaletteInterpretation(GDALColorTableShadow *self){
        return GDALGetPaletteInterpretation(self);
    }
SWIGINTERN int GDALColorTableShadow_GetColorEntryCount(GDALColorTableShadow *self){
        return GDALGetColorEntryCount(self);
    }
SWIGINTERN GDALColorEntry *GDALColorTableShadow_GetColorEntry(GDALColorTableShadow *self,int entry){
        return (GDALColorEntry*) GDALGetColorEntry(self, entry);
    }
SWIGINTERN int GDALColorTableShadow_GetColorEntryAsRGB(GDALColorTableShadow *self,int entry,GDALColorEntry *centry){
        return GDALGetColorEntryAsRGB(self, entry, centry);
    }
SWIGINTERN void GDALColorTableShadow_SetColorEntry(GDALColorTableShadow *self,int entry,GDALColorEntry const *centry){
        GDALSetColorEntry(self, entry, centry);
    }
SWIGINTERN void GDALColorTableShadow_CreateColorRamp(GDALColorTableShadow *self,int nStartIndex,GDALColorEntry const *startcolor,int nEndIndex,GDALColorEntry const *endcolor){
        GDALCreateColorRamp(self, nStartIndex, startcolor, nEndIndex, endcolor);
    }
SWIGINTERN GDALRasterAttributeTableShadow *new_GDALRasterAttributeTableShadow(){
        return (GDALRasterAttributeTableShadow*) 
		GDALCreateRasterAttributeTable();
    }
SWIGINTERN GDALRasterAttributeTableShadow *GDALRasterAttributeTableShadow_Clone(GDALRasterAttributeTableShadow *self){
        return (GDALRasterAttributeTableShadow*) GDALRATClone(self);
    }
SWIGINTERN int GDALRasterAttributeTableShadow_GetColumnCount(GDALRasterAttributeTableShadow *self){ 
        return GDALRATGetColumnCount( self );
    }
SWIGINTERN char const *GDALRasterAttributeTableShadow_GetNameOfCol(GDALRasterAttributeTableShadow *self,int iCol){ 
        return GDALRATGetNameOfCol( self, iCol );
    }
SWIGINTERN GDALRATFieldUsage GDALRasterAttributeTableShadow_GetUsageOfCol(GDALRasterAttributeTableShadow *self,int iCol){
        return GDALRATGetUsageOfCol( self, iCol );
    }
SWIGINTERN GDALRATFieldType GDALRasterAttributeTableShadow_GetTypeOfCol(GDALRasterAttributeTableShadow *self,int iCol){
        return GDALRATGetTypeOfCol( self, iCol );
    }
SWIGINTERN int GDALRasterAttributeTableShadow_GetColOfUsage(GDALRasterAttributeTableShadow *self,GDALRATFieldUsage eUsage){
        return GDALRATGetColOfUsage( self, eUsage );
    }
SWIGINTERN int GDALRasterAttributeTableShadow_GetRowCount(GDALRasterAttributeTableShadow *self){ 
        return GDALRATGetRowCount( self );
    }
SWIGINTERN char const *GDALRasterAttributeTableShadow_GetValueAsString(GDALRasterAttributeTableShadow *self,int iRow,int iCol){ 
        return GDALRATGetValueAsString( self, iRow, iCol );
    }
SWIGINTERN int GDALRasterAttributeTableShadow_GetValueAsInt(GDALRasterAttributeTableShadow *self,int iRow,int iCol){ 
        return GDALRATGetValueAsInt( self, iRow, iCol );
    }
SWIGINTERN double GDALRasterAttributeTableShadow_GetValueAsDouble(GDALRasterAttributeTableShadow *self,int iRow,int iCol){ 
        return GDALRATGetValueAsDouble( self, iRow, iCol );
    }
SWIGINTERN void GDALRasterAttributeTableShadow_SetValueAsString(GDALRasterAttributeTableShadow *self,int iRow,int iCol,char const *pszValue){ 
        GDALRATSetValueAsString( self, iRow, iCol, pszValue );
    }
SWIGINTERN void GDALRasterAttributeTableShadow_SetValueAsInt(GDALRasterAttributeTableShadow *self,int iRow,int iCol,int nValue){ 
        GDALRATSetValueAsInt( self, iRow, iCol, nValue );
    }
SWIGINTERN void GDALRasterAttributeTableShadow_SetValueAsDouble(GDALRasterAttributeTableShadow *self,int iRow,int iCol,double dfValue){ 
        GDALRATSetValueAsDouble( self, iRow, iCol, dfValue );
    }
SWIGINTERN void GDALRasterAttributeTableShadow_SetRowCount(GDALRasterAttributeTableShadow *self,int nCount){
        GDALRATSetRowCount( self, nCount );
    }
SWIGINTERN int GDALRasterAttributeTableShadow_CreateColumn(GDALRasterAttributeTableShadow *self,char const *pszName,GDALRATFieldType eType,GDALRATFieldUsage eUsage){
        return GDALRATCreateColumn( self, pszName, eType, eUsage );
    }
SWIGINTERN bool GDALRasterAttributeTableShadow_GetLinearBinning(GDALRasterAttributeTableShadow *self,double *pdfRow0Min,double *pdfBinSize){
        return (GDALRATGetLinearBinning(self, pdfRow0Min, pdfBinSize) != 0) ? true : false;
    }
SWIGINTERN int GDALRasterAttributeTableShadow_SetLinearBinning(GDALRasterAttributeTableShadow *self,double dfRow0Min,double dfBinSize){
        return GDALRATSetLinearBinning(self, dfRow0Min, dfBinSize);
    }
SWIGINTERN int GDALRasterAttributeTableShadow_GetRowOfValue(GDALRasterAttributeTableShadow *self,double dfValue){
        return GDALRATGetRowOfValue( self, dfValue );
    }

#include "gdalgrid.h"

#ifdef DEBUG 
typedef struct OGRLayerHS OGRLayerShadow;
typedef struct OGRGeometryHS OGRGeometryShadow;
#else
typedef void OGRLayerShadow;
typedef void OGRGeometryShadow;
#endif


int GDALTermProgress_nocb( double dfProgress, const char * pszMessage=NULL, void *pData=NULL ) {
  return GDALTermProgress( dfProgress, pszMessage, pData);
}


int  ComputeMedianCutPCT ( GDALRasterBandShadow *red,
                              GDALRasterBandShadow *green,
                              GDALRasterBandShadow *blue,
                              int num_colors,
                              GDALColorTableShadow* colors,
                              GDALProgressFunc callback = NULL,
                              void* callback_data=NULL) {

    CPLErrorReset();

    int err = GDALComputeMedianCutPCT( red,
                                          green,
                                          blue,
                                          NULL,
                                          num_colors,
                                          colors,
                                          callback,
                                          callback_data);
    
    return err;
}


int  DitherRGB2PCT ( GDALRasterBandShadow *red,
                     GDALRasterBandShadow *green,
                     GDALRasterBandShadow *blue,
                     GDALRasterBandShadow *target,
                     GDALColorTableShadow *colors,
                     GDALProgressFunc callback = NULL,
                     void* callback_data=NULL) {

    CPLErrorReset();
    int err;
    err = GDALDitherRGB2PCT(  red,
                                  green,
                                  blue,
                                  target,
                                  colors,
                                  callback,
                                  callback_data);
    
    return err;
}


CPLErr  ReprojectImage ( GDALDatasetShadow *src_ds,
                         GDALDatasetShadow *dst_ds,
                         const char *src_wkt=NULL,
                         const char *dst_wkt=NULL,
                         GDALResampleAlg eResampleAlg=GRA_NearestNeighbour,
                         double WarpMemoryLimit=0.0,
                         double maxerror = 0.0,
			 GDALProgressFunc callback = NULL,
                     	 void* callback_data=NULL) {

    CPLErrorReset();

    CPLErr err = GDALReprojectImage( src_ds,
                                     src_wkt,
                                     dst_ds,
                                     dst_wkt,
                                     eResampleAlg,
                                     WarpMemoryLimit,
                                     maxerror,
                                     callback,
                                     callback_data,
                                     NULL);
    
    return err;
}


int  ComputeProximity( GDALRasterBandShadow *srcBand,
                       GDALRasterBandShadow *proximityBand,
                       char **options = NULL,
                       GDALProgressFunc callback=NULL,
                       void* callback_data=NULL) {

    CPLErrorReset();

    return GDALComputeProximity( srcBand, proximityBand, options,
                                 callback, callback_data );
}


int  RasterizeLayer( GDALDatasetShadow *dataset,
                 int bands, int *band_list,
                 OGRLayerShadow *layer,
                 void *pfnTransformer = NULL,
                 void *pTransformArg = NULL, 
		 int burn_values = 0, double *burn_values_list = NULL, 
                 char **options = NULL,
                 GDALProgressFunc callback=NULL,
                 void* callback_data=NULL) {

    CPLErr eErr;

    CPLErrorReset();

    if( burn_values == 0 )
    {
        burn_values_list = (double *) CPLMalloc(sizeof(double)*bands);
        for( int i = 0; i < bands; i++ )
            burn_values_list[i] = 255.0;
    }
    else if( burn_values != bands )
    {
        CPLError( CE_Failure, CPLE_AppDefined, 
                  "Did not get the expected number of burn values in RasterizeLayer()" );
        return CE_Failure;
    }

    eErr = GDALRasterizeLayers( dataset, bands, band_list,
                                1, &layer, 
                                (GDALTransformerFunc) pfnTransformer, 
                                pTransformArg,
                                burn_values_list, options, 
                                callback, callback_data );

    if( burn_values == 0 )
        CPLFree( burn_values_list );

    return eErr;
}


int  Polygonize( GDALRasterBandShadow *srcBand,
     		 GDALRasterBandShadow *maskBand,
  	         OGRLayerShadow *outLayer, 
                 int iPixValField,
                 char **options = NULL,
                 GDALProgressFunc callback=NULL,
                 void* callback_data=NULL) {

    CPLErrorReset();

    return GDALPolygonize( srcBand, maskBand, outLayer, iPixValField,
                           options, callback, callback_data );
}


int  FillNodata( GDALRasterBandShadow *targetBand,
     		 GDALRasterBandShadow *maskBand,
                 double maxSearchDist,
                 int smoothingIterations,
                 char **options = NULL,
                 GDALProgressFunc callback=NULL,
                 void* callback_data=NULL) {

    CPLErrorReset();

    return GDALFillNodata( targetBand, maskBand, maxSearchDist, 
    	   		   0, smoothingIterations, options, 
			   callback, callback_data );
}


int  SieveFilter( GDALRasterBandShadow *srcBand,
     		  GDALRasterBandShadow *maskBand,
  	          GDALRasterBandShadow *dstBand,
                  int threshold, int connectedness=4,
                  char **options = NULL,
                  GDALProgressFunc callback=NULL,
                  void* callback_data=NULL) {

    CPLErrorReset();

    return GDALSieveFilter( srcBand, maskBand, dstBand, 
                            threshold, connectedness,
                            options, callback, callback_data );
}


int  RegenerateOverviews( GDALRasterBandShadow *srcBand,
     			  int overviewBandCount,
                          GDALRasterBandShadow **overviewBands,
                          const char *resampling = "average",
                          GDALProgressFunc callback=NULL,
                          void* callback_data=NULL) {

    CPLErrorReset();

    return GDALRegenerateOverviews( srcBand, overviewBandCount, overviewBands,
    	   			    resampling ? resampling : "average", callback, callback_data );
}


int  RegenerateOverview( GDALRasterBandShadow *srcBand,
                          GDALRasterBandShadow *overviewBand,
                          const char *resampling = "average",
                          GDALProgressFunc callback=NULL,
                          void* callback_data=NULL) {

    CPLErrorReset();

    return GDALRegenerateOverviews( srcBand, 1, &overviewBand,
    	   			    resampling ? resampling : "average", callback, callback_data );
}


int ContourGenerate( GDALRasterBandShadow *srcBand,
                     double contourInterval,
                     double contourBase,
                     int fixedLevelCount,
                     double *fixedLevels,
                     int useNoData,
                     double noDataValue,
                     OGRLayerShadow* dstLayer, 
                     int idField,
                     int elevField,
                     GDALProgressFunc callback = NULL,
                     void* callback_data = NULL)
{
    CPLErr eErr;

    CPLErrorReset();

    eErr =  GDALContourGenerate( srcBand,
                                 contourInterval,
                                 contourBase,
                                 fixedLevelCount,
                                 fixedLevels,
                                 useNoData,
                                 noDataValue,
                                 dstLayer,
                                 idField,
                                 elevField,
                                 callback,
                                 callback_data);

    return eErr;
}


GDALDatasetShadow *AutoCreateWarpedVRT( GDALDatasetShadow *src_ds,
                                        const char *src_wkt = 0,
                                        const char *dst_wkt = 0,
                                        GDALResampleAlg eResampleAlg = GRA_NearestNeighbour,
                                        double maxerror = 0.0 ) {
  GDALDatasetShadow *ds = GDALAutoCreateWarpedVRT( src_ds, src_wkt,
                                                   dst_wkt,
                                                   eResampleAlg,
                                                   maxerror,
                                                   0 );
  if (ds == 0) {
    /*throw CPLGetLastErrorMsg(); causes a SWIG_exception later*/
  }
  return ds;
  
}

SWIGINTERN GDALTransformerInfoShadow *new_GDALTransformerInfoShadow(GDALDatasetShadow *src,GDALDatasetShadow *dst,char **options){
    GDALTransformerInfoShadow *obj = (GDALTransformerInfoShadow*) 
       GDALCreateGenImgProjTransformer2( (GDALDatasetH)src, (GDALDatasetH)dst, 
                                         options );
    return obj;
  }
SWIGINTERN int GDALTransformerInfoShadow_TransformPoint__SWIG_0(GDALTransformerInfoShadow *self,int bDstToSrc,double inout[3]){
    int nRet, nSuccess = TRUE;

    nRet = GDALUseTransformer( self, bDstToSrc, 
                               1, &inout[0], &inout[1], &inout[2], 
                               &nSuccess );

    return nRet && nSuccess;
  }
SWIGINTERN int GDALTransformerInfoShadow_TransformPoint__SWIG_1(GDALTransformerInfoShadow *self,double argout[3],int bDstToSrc,double x,double y,double z=0.0){
    int nRet, nSuccess = TRUE;
    
    argout[0] = x;
    argout[1] = y;
    argout[2] = z;
    nRet = GDALUseTransformer( self, bDstToSrc, 
                               1, &argout[0], &argout[1], &argout[2], 
                               &nSuccess );

    return nRet && nSuccess;
  }
SWIGINTERN int GDALTransformerInfoShadow_TransformPoints(GDALTransformerInfoShadow *self,int bDstToSrc,int nCount,double *x,double *y,double *z,int *panSuccess){
    int nRet;

    nRet = GDALUseTransformer( self, bDstToSrc, nCount, x, y, z, panSuccess );

    return nRet;
  }

int wrapper_GDALGetCacheMax()
{
    return GDALGetCacheMax();
}


int wrapper_GDALGetCacheUsed()
{
    return GDALGetCacheUsed();
}


void wrapper_GDALSetCacheMax(int nBytes)
{
    return GDALSetCacheMax(nBytes);
}


int GetDriverCount() {
  return GDALGetDriverCount();
}


GDALDriverShadow* GetDriverByName( char const *name ) {
  return (GDALDriverShadow*) GDALGetDriverByName( name );
}


GDALDriverShadow* GetDriver( int i ) {
  return (GDALDriverShadow*) GDALGetDriver( i );
}


GDALDatasetShadow* Open( char const* utf8_path, GDALAccess eAccess = GA_ReadOnly ) {
  CPLErrorReset();
  GDALDatasetShadow *ds = GDALOpen( utf8_path, eAccess );
  if( ds != NULL && CPLGetLastErrorType() == CE_Failure )
  {
      if ( GDALDereferenceDataset( ds ) <= 0 )
          GDALClose(ds);
      ds = NULL;
  }
  return (GDALDatasetShadow*) ds;
}


GDALDatasetShadow* OpenShared( char const* utf8_path, GDALAccess eAccess = GA_ReadOnly ) {
  CPLErrorReset();
  GDALDatasetShadow *ds = GDALOpenShared( utf8_path, eAccess );
  if( ds != NULL && CPLGetLastErrorType() == CE_Failure )
  {
      if ( GDALDereferenceDataset( ds ) <= 0 )
          GDALClose(ds);
      ds = NULL;
  }
  return (GDALDatasetShadow*) ds;
}


GDALDriverShadow *IdentifyDriver( const char *utf8_path, 
                                  char **papszSiblings = NULL ) {
    return (GDALDriverShadow *) GDALIdentifyDriver( utf8_path, 
	                                            papszSiblings );
}


  char **GeneralCmdLineProcessor( char **papszArgv, int nOptions = 0 ) {
    int nResArgCount;

    nResArgCount = 
      GDALGeneralCmdLineProcessor( CSLCount(papszArgv), &papszArgv, nOptions ); 

    if( nResArgCount <= 0 )
        return NULL;
    else
        return papszArgv;
  }

SWIGINTERN VALUE
_wrap_use_exceptions(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  UseExceptions();
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_dont_use_exceptions(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  DontUseExceptions();
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_debug(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","Debug", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","Debug", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    CPLErrorReset();
    Debug((char const *)arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_push_error_handler__SWIG_0(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) NULL ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  if (argc > 0) {
    res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","PushErrorHandler", 1, argv[0] ));
    }
    arg1 = reinterpret_cast< char * >(buf1);
  }
  {
    CPLErrorReset();
    result = (CPLErr)PushErrorHandler((char const *)arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_error(int argc, VALUE *argv, VALUE self) {
  CPLErr arg1 = (CPLErr) CE_Failure ;
  int arg2 = (int) 0 ;
  char *arg3 = (char *) "error" ;
  int val2 ;
  int ecode2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  
  if ((argc < 0) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  if (argc > 0) {
    {
      /* %typemap(in) CPLErr */
      arg1 = (CPLErr) NUM2INT(argv[0]);
    }
  }
  if (argc > 1) {
    ecode2 = SWIG_AsVal_int(argv[1], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Error", 2, argv[1] ));
    } 
    arg2 = static_cast< int >(val2);
  }
  if (argc > 2) {
    res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","Error", 3, argv[2] ));
    }
    arg3 = reinterpret_cast< char * >(buf3);
  }
  {
    CPLErrorReset();
    Error(arg1,arg2,(char const *)arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
fail:
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_push_error_handler__SWIG_1(int argc, VALUE *argv, VALUE self) {
  CPLErrorHandler arg1 ;
  void *argp1 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CPLErrorHandler,  0 );
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CPLErrorHandler","CPLPushErrorHandler", 1, argv[0] )); 
    }  
    if (!argp1) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "CPLErrorHandler","CPLPushErrorHandler", 1, argv[0]));
    } else {
      arg1 = *(reinterpret_cast< CPLErrorHandler * >(argp1));
    }
  }
  {
    CPLErrorReset();
    CPLPushErrorHandler(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_push_error_handler(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if ((argc >= 0) && (argc <= 1)) {
    int _v;
    if (argc <= 0) {
      return _wrap_push_error_handler__SWIG_0(nargs, args, self);
    }
    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_push_error_handler__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CPLErrorHandler, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_push_error_handler__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "push_error_handler", 
    "    void push_error_handler(char const *pszCallbackName)\n"
    "    void push_error_handler(CPLErrorHandler)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_pop_error_handler(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    CPLPopErrorHandler();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_error_reset(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    CPLErrorReset();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_escape_string(int argc, VALUE *argv, VALUE self) {
  int arg1 ;
  char *arg2 = (char *) 0 ;
  int arg3 = (int) CPLES_SQL ;
  int res1 ;
  char *buf1 = 0 ;
  size_t size1 = 0 ;
  int alloc1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  char *kwnames[] = {
    "len","scheme", NULL 
  };
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "int","EscapeString", 1, argv[0] ));
  }  
  arg2 = reinterpret_cast< char * >(buf1) ;
  arg1 = static_cast< int >(size1 - 1) ;
  if (argc > 1) {
    ecode3 = SWIG_AsVal_int(argv[1], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","EscapeString", 3, argv[1] ));
    } 
    arg3 = static_cast< int >(val3);
  }
  {
    CPLErrorReset();
    result = (char *)EscapeString(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_last_error_no(int argc, VALUE *argv, VALUE self) {
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (int)CPLGetLastErrorNo();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_last_error_type(int argc, VALUE *argv, VALUE self) {
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (CPLErr)CPLGetLastErrorType();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_last_error_msg(int argc, VALUE *argv, VALUE self) {
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (char *)CPLGetLastErrorMsg();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_push_finder_location(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","CPLPushFinderLocation", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  {
    CPLErrorReset();
    CPLPushFinderLocation((char const *)arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_pop_finder_location(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    CPLPopFinderLocation();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_finder_clean(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    CPLFinderClean();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_find_file(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","CPLFindFile", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","CPLFindFile", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    CPLErrorReset();
    result = (char *)CPLFindFile((char const *)arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_read_dir(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  char **result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","VSIReadDir", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  {
    CPLErrorReset();
    result = (char **)VSIReadDir((char const *)arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 |  0 );
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_set_config_option(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","CPLSetConfigOption", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","CPLSetConfigOption", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    CPLSetConfigOption((char const *)arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_config_option(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) NULL ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","wrapper_CPLGetConfigOption", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  if (argc > 1) {
    res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","wrapper_CPLGetConfigOption", 2, argv[1] ));
    }
    arg2 = reinterpret_cast< char * >(buf2);
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (char *)wrapper_CPLGetConfigOption((char const *)arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_binary_to_hex(int argc, VALUE *argv, VALUE self) {
  int arg1 ;
  GByte *arg2 = (GByte *) 0 ;
  int res1 ;
  GByte *buf1 = 0 ;
  size_t size1 = 0 ;
  int alloc1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /*%typemap(in,numinputs=1,fragment="SWIG_AsCharPtrAndSize") (int nBytes, const GByte *pabyData) */
    
    res1 = SWIG_AsCharPtrAndSize(argv[0], (char**)&buf1, &size1, &alloc1);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "(GByte*, int)","CPLBinaryToHex", 1, argv[0] ));
    }
    arg1 = (int) size1 - 1;				       
    arg2 = (GByte *) buf1;					       
  }
  {
    CPLErrorReset();
    result = (char *)CPLBinaryToHex(arg1,(GByte const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  {
    /* %typemap(freearg) (int nBytes, const GByte *pabyData) */
    CPLFree(result);
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) (int nBytes, const GByte *pabyData) */
    CPLFree(result);
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_hex_to_binary(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  int *arg2 = (int *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int size1 = 0 ;
  int alloc1 = 0 ;
  GByte *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /*% typemap(in,numinputs=1,fragment="SWIG_AsCharPtrAndSize") (const char *pszHex, int *pnBytes) */
    arg2 = &size1;
    res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","CPLHexToBinary", 1, argv[0] ));
    }
    arg1 = buf1;
  }
  {
    CPLErrorReset();
    result = (GByte *)CPLHexToBinary((char const *)arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) GByte* */
    
    /* Stops insertion of default type map. */
  }
  {
    /* %typemap(argout) (const char *pszHex, int *pnBytes) */
    vresult = SWIG_FromCharPtrAndSize((char*)result, (size_t)*arg2);
    CPLFree(result);
  }
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassMajorObject;

SWIGINTERN VALUE
_wrap_MajorObject_get_description(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","GetDescription", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALMajorObjectShadow_GetDescription(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MajorObject_set_description(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","SetDescription", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","SetDescription", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    CPLErrorReset();
    GDALMajorObjectShadow_SetDescription(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MajorObject_get_metadata_dict(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  char *arg2 = (char *) "" ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  char **result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","GetMetadata_Dict", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  if (argc > 0) {
    res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GetMetadata_Dict", 2, argv[0] ));
    }
    arg2 = reinterpret_cast< char * >(buf2);
  }
  {
    CPLErrorReset();
    result = (char **)GDALMajorObjectShadow_GetMetadata_Dict(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) char **dict */
    
    /* Get a pointer to the c array */
    char **stringarray = result;
    
    /* Create a new hash table, this will be returned to Ruby.  */
    vresult = rb_hash_new();
    if ( stringarray != NULL ) {
      while (*stringarray != NULL ) {
        /* Get the key and value */
        char const *valptr;
        char *keyptr;
        valptr = CPLParseNameValue( *stringarray, &keyptr );
        
        if ( valptr != 0 ) {
          /* Convert the key and value to Ruby strings */
          VALUE nm = rb_str_new2( keyptr );
          VALUE val = rb_str_new2( valptr );
          /* Save the key, value pair to the hash table. */
          rb_hash_aset(vresult, nm, val);
          CPLFree( keyptr );
        }
        stringarray++;
      }
    }
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MajorObject_get_metadata_list(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  char *arg2 = (char *) "" ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  char **result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","GetMetadata_List", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  if (argc > 0) {
    res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GetMetadata_List", 2, argv[0] ));
    }
    arg2 = reinterpret_cast< char * >(buf2);
  }
  {
    CPLErrorReset();
    result = (char **)GDALMajorObjectShadow_GetMetadata_List(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) char **options */
    
    char **stringarray = result;
    if ( stringarray == NULL ) {
      vresult = Qnil;
    }
    else {
      int len = CSLCount( stringarray );
      vresult = rb_ary_new2( len );
      for ( int i = 0; i < len; ++i, ++stringarray ) {
        VALUE nm = rb_str_new2( *stringarray );
        rb_ary_push(vresult, nm);
      }
    }
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MajorObject_set_metadata__SWIG_0(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  char **arg2 = (char **) 0 ;
  char *arg3 = (char *) "" ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","SetMetadata", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  {
    /* %typemap(in) char **dict */
    
    arg2 = NULL;
    
    /* is the provided object an array or a hash? */
    if ( TYPE(argv[0]) == T_ARRAY) {
      /* get the size of the array */
      int size = RARRAY(argv[0])->len;
      
      for (int i = 0; i < size; i++) {
        /* get the ruby object */
        VALUE value = rb_ary_entry(argv[0], i);
        
        /* Convert the value to a string via ruby duck typing 
               * (i.e., the object might not actually be a string)
               */
        char *pszItem = StringValuePtr(value);
        arg2 = CSLAddString( arg2, pszItem );
      }
    }
    
    else if ( TYPE(argv[0]) == T_HASH) {
      /* This is a hash - get the size by calling via the ruby method */
      int size = NUM2INT(rb_funcall(argv[0], rb_intern("size"), 0, NULL));
      
      if ( size > 0 ) {
        /* Get the keys by caling via ruby */
        VALUE keys_arr = rb_funcall(argv[0], rb_intern("keys"), 0, NULL);
        
        for( int i=0; i<size; i++ ) {
          /* Get the key and value as ruby objects */
          VALUE key = rb_ary_entry(keys_arr, i);
          VALUE value = rb_hash_aref(argv[0], key);
          
          /* Convert the key and value to strings via ruby duck typing 
                   * (i.e., the objects might not actually be strings)
                   */
          char *nm = StringValuePtr(key);
          char *val = StringValuePtr(value);
          
          /* Add the value */
          arg2 = CSLAddNameValue( arg2, nm, val );
        }
      }
    }
    else {
      rb_raise(rb_eTypeError, "Argument must be dictionary or sequence of strings");
    }
  }
  if (argc > 1) {
    res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","SetMetadata", 3, argv[1] ));
    }
    arg3 = reinterpret_cast< char * >(buf3);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALMajorObjectShadow_SetMetadata__SWIG_0(arg1,arg2,(char const *)arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  {
    /* %typemap(freearg) char **dict */
    CSLDestroy( arg2 );
  }
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return vresult;
fail:
  {
    /* %typemap(freearg) char **dict */
    CSLDestroy( arg2 );
  }
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MajorObject_set_metadata__SWIG_1(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) "" ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","SetMetadata", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","SetMetadata", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  if (argc > 1) {
    res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","SetMetadata", 3, argv[1] ));
    }
    arg3 = reinterpret_cast< char * >(buf3);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALMajorObjectShadow_SetMetadata__SWIG_1(arg1,arg2,(char const *)arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


SWIGINTERN VALUE _wrap_MajorObject_set_metadata(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if ((argc >= 2) && (argc <= 3)) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_GDALMajorObjectShadow, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        /* %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) (char **dict) */
        _v = ((TYPE(argv[1]) == T_HASH) || (TYPE(argv[1]) == T_ARRAY)) ? 1 : 0;
      }
      if (_v) {
        if (argc <= 2) {
          return _wrap_MajorObject_set_metadata__SWIG_0(nargs, args, self);
        }
        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_MajorObject_set_metadata__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  if ((argc >= 2) && (argc <= 3)) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_GDALMajorObjectShadow, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        if (argc <= 2) {
          return _wrap_MajorObject_set_metadata__SWIG_1(nargs, args, self);
        }
        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_MajorObject_set_metadata__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "set_metadata", 
    "    CPLErr set_metadata(char **papszMetadata, char const *pszDomain)\n"
    "    CPLErr set_metadata(char *pszMetadataString, char const *pszDomain)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MajorObject_get_metadata_item(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) "" ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","GetMetadataItem", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GetMetadataItem", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  if (argc > 1) {
    res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","GetMetadataItem", 3, argv[1] ));
    }
    arg3 = reinterpret_cast< char * >(buf3);
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (char *)GDALMajorObjectShadow_GetMetadataItem(arg1,(char const *)arg2,(char const *)arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MajorObject_set_metadata_item(int argc, VALUE *argv, VALUE self) {
  GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  char *arg4 = (char *) "" ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALMajorObjectShadow *","SetMetadataItem", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","SetMetadataItem", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","SetMetadataItem", 3, argv[1] ));
  }
  arg3 = reinterpret_cast< char * >(buf3);
  if (argc > 2) {
    res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","SetMetadataItem", 4, argv[2] ));
    }
    arg4 = reinterpret_cast< char * >(buf4);
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALMajorObjectShadow_SetMetadataItem(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return Qnil;
}


swig_class SwigClassDriver;

SWIGINTERN VALUE
_wrap_Driver_ShortName_get(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","ShortName", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALDriverShadow_ShortName_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_LongName_get(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","LongName", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALDriverShadow_LongName_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_HelpTopic_get(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","HelpTopic", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALDriverShadow_HelpTopic_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_create(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  int arg4 ;
  int arg5 = (int) 1 ;
  GDALDataType arg6 = (GDALDataType) GDT_Byte ;
  char **arg7 = (char **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  char *kwnames[] = {
    "self","utf8_path","xsize","ysize","bands","eType","options", NULL 
  };
  GDALDatasetShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 6)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","Create", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","Create", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Create", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","Create", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  if (argc > 3) {
    ecode5 = SWIG_AsVal_int(argv[3], &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","Create", 5, argv[3] ));
    } 
    arg5 = static_cast< int >(val5);
  }
  if (argc > 4) {
    {
      /* %typemap(in) CPLErr */
      arg6 = (GDALDataType) NUM2INT(argv[4]);
    }
  }
  if (argc > 5) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[5], T_ARRAY);
      
      int size = RARRAY(argv[5])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[5], i);
        char *pszItem = StringValuePtr(item);
        arg7 = CSLAddString( arg7, pszItem );
      }
    }
  }
  {
    CPLErrorReset();
    result = (GDALDatasetShadow *)GDALDriverShadow_Create(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_POINTER_OWN |  0 );
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg7 );
  }
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg7 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_create_copy(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  GDALDatasetShadow *arg3 = (GDALDatasetShadow *) 0 ;
  int arg4 = (int) 1 ;
  char **arg5 = (char **) 0 ;
  GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
  void *arg7 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp6 ;
  int res6 = 0 ;
  int res7 ;
  char *kwnames[] = {
    "self","utf8_path","src","strict","options","callback","callback_data", NULL 
  };
  GDALDatasetShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 6)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","CreateCopy", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","CreateCopy", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALDatasetShadow *","CreateCopy", 3, argv[1] )); 
  }
  arg3 = reinterpret_cast< GDALDatasetShadow * >(argp3);
  if (argc > 2) {
    ecode4 = SWIG_AsVal_int(argv[2], &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","CreateCopy", 4, argv[2] ));
    } 
    arg4 = static_cast< int >(val4);
  }
  if (argc > 3) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[3], T_ARRAY);
      
      int size = RARRAY(argv[3])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[3], i);
        char *pszItem = StringValuePtr(item);
        arg5 = CSLAddString( arg5, pszItem );
      }
    }
  }
  if (argc > 4) {
    {
      res6 = SWIG_ConvertPtr(argv[4], &argp6, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res6)) {
        SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "GDALProgressFunc","CreateCopy", 6, argv[4] )); 
      }  
      if (!argp6) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","CreateCopy", 6, argv[4]));
      } else {
        arg6 = *(reinterpret_cast< GDALProgressFunc * >(argp6));
      }
    }
  }
  if (argc > 5) {
    res7 = SWIG_ConvertPtr(argv[5],SWIG_as_voidptrptr(&arg7), 0, 0);
    if (!SWIG_IsOK(res7)) {
      SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "void *","CreateCopy", 7, argv[5] )); 
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (GDALDatasetShadow *)GDALDriverShadow_CreateCopy(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_POINTER_OWN |  0 );
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg5 );
  }
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg5 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_delete(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","Delete", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","Delete", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    CPLErrorReset();
    result = (int)GDALDriverShadow_Delete(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_rename(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","Rename", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","Rename", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","Rename", 3, argv[1] ));
  }
  arg3 = reinterpret_cast< char * >(buf3);
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)GDALDriverShadow_Rename(arg1,(char const *)arg2,(char const *)arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_register(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","Register", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALDriverShadow_Register(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Driver_deregister(int argc, VALUE *argv, VALUE self) {
  GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDriverShadow *","Deregister", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
  {
    CPLErrorReset();
    GDALDriverShadow_Deregister(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassColorEntry;

SWIGINTERN VALUE
_wrap_ColorEntry_c1_set(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  short arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c1", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  ecode2 = SWIG_AsVal_short(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "short","c1", 2, argv[0] ));
  } 
  arg2 = static_cast< short >(val2);
  if (arg1) (arg1)->c1 = arg2;
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorEntry_c1_get(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c1", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  result = (short) ((arg1)->c1);
  vresult = SWIG_From_short(static_cast< short >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorEntry_c2_set(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  short arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c2", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  ecode2 = SWIG_AsVal_short(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "short","c2", 2, argv[0] ));
  } 
  arg2 = static_cast< short >(val2);
  if (arg1) (arg1)->c2 = arg2;
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorEntry_c2_get(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c2", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  result = (short) ((arg1)->c2);
  vresult = SWIG_From_short(static_cast< short >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorEntry_c3_set(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  short arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c3", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  ecode2 = SWIG_AsVal_short(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "short","c3", 2, argv[0] ));
  } 
  arg2 = static_cast< short >(val2);
  if (arg1) (arg1)->c3 = arg2;
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorEntry_c3_get(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c3", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  result = (short) ((arg1)->c3);
  vresult = SWIG_From_short(static_cast< short >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorEntry_c4_set(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  short arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c4", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  ecode2 = SWIG_AsVal_short(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "short","c4", 2, argv[0] ));
  } 
  arg2 = static_cast< short >(val2);
  if (arg1) (arg1)->c4 = arg2;
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorEntry_c4_get(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *arg1 = (GDALColorEntry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  short result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorEntry *","c4", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorEntry * >(argp1);
  result = (short) ((arg1)->c4);
  vresult = SWIG_From_short(static_cast< short >(result));
  return vresult;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ColorEntry_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ColorEntry_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GDALColorEntry);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ColorEntry(int argc, VALUE *argv, VALUE self) {
  GDALColorEntry *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (GDALColorEntry *)new GDALColorEntry();
    DATA_PTR(self) = result;
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_GDALColorEntry(GDALColorEntry *arg1) {
    delete arg1;
}

swig_class SwigClassGCP;

SWIGINTERN VALUE
_wrap_GCP_GCPX_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPX", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GCPX", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    GDAL_GCP_GCPX_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPX_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPX", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPX_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPY_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPY", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GCPY", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    GDAL_GCP_GCPY_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPY_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPY", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPY_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPZ_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPZ", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GCPZ", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    GDAL_GCP_GCPZ_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPZ_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPZ", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPZ_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPPixel_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPPixel", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GCPPixel", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    GDAL_GCP_GCPPixel_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPPixel_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPPixel", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPPixel_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPLine_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPLine", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GCPLine", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    GDAL_GCP_GCPLine_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_GCPLine_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GCPLine", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPLine_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_Info_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","Info", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","Info", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    CPLErrorReset();
    
    /* char* Info memberin typemap */
    GDAL_GCP_Info_set(arg1,arg2);
    
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_Info_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","Info", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDAL_GCP_Info_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_Id_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","Id", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","Id", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    CPLErrorReset();
    
    /* char* Info memberin typemap */
    GDAL_GCP_Id_set(arg1,arg2);
    
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_GCP_Id_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","Id", 1, self )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDAL_GCP_Id_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_GCP_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_GCP_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GDAL_GCP);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_GCP(int argc, VALUE *argv, VALUE self) {
  double arg1 = (double) 0.0 ;
  double arg2 = (double) 0.0 ;
  double arg3 = (double) 0.0 ;
  double arg4 = (double) 0.0 ;
  double arg5 = (double) 0.0 ;
  char *arg6 = (char *) "" ;
  char *arg7 = (char *) "" ;
  double val1 ;
  int ecode1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  double val4 ;
  int ecode4 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  int res6 ;
  char *buf6 = 0 ;
  int alloc6 = 0 ;
  int res7 ;
  char *buf7 = 0 ;
  int alloc7 = 0 ;
  GDAL_GCP *result = 0 ;
  
  if ((argc < 0) || (argc > 7)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  if (argc > 0) {
    ecode1 = SWIG_AsVal_double(argv[0], &val1);
    if (!SWIG_IsOK(ecode1)) {
      SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","GDAL_GCP", 1, argv[0] ));
    } 
    arg1 = static_cast< double >(val1);
  }
  if (argc > 1) {
    ecode2 = SWIG_AsVal_double(argv[1], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP", 2, argv[1] ));
    } 
    arg2 = static_cast< double >(val2);
  }
  if (argc > 2) {
    ecode3 = SWIG_AsVal_double(argv[2], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","GDAL_GCP", 3, argv[2] ));
    } 
    arg3 = static_cast< double >(val3);
  }
  if (argc > 3) {
    ecode4 = SWIG_AsVal_double(argv[3], &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","GDAL_GCP", 4, argv[3] ));
    } 
    arg4 = static_cast< double >(val4);
  }
  if (argc > 4) {
    ecode5 = SWIG_AsVal_double(argv[4], &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","GDAL_GCP", 5, argv[4] ));
    } 
    arg5 = static_cast< double >(val5);
  }
  if (argc > 5) {
    res6 = SWIG_AsCharPtrAndSize(argv[5], &buf6, NULL, &alloc6);
    if (!SWIG_IsOK(res6)) {
      SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "char const *","GDAL_GCP", 6, argv[5] ));
    }
    arg6 = reinterpret_cast< char * >(buf6);
  }
  if (argc > 6) {
    res7 = SWIG_AsCharPtrAndSize(argv[6], &buf7, NULL, &alloc7);
    if (!SWIG_IsOK(res7)) {
      SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "char const *","GDAL_GCP", 7, argv[6] ));
    }
    arg7 = reinterpret_cast< char * >(buf7);
  }
  {
    CPLErrorReset();
    result = (GDAL_GCP *)new_GDAL_GCP(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7);
    DATA_PTR(self) = result;
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
  return self;
fail:
  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
  return Qnil;
}


SWIGINTERN void delete_GDAL_GCP(GDAL_GCP *self){
    if ( self->pszInfo )
      CPLFree( self->pszInfo );
    if ( self->pszId )
      CPLFree( self->pszId );
    CPLFree( self );
  }
SWIGINTERN void
free_GDAL_GCP(GDAL_GCP *arg1) {
    delete_GDAL_GCP(arg1);
}

SWIGINTERN VALUE
_wrap_gdal_gcp_gcpx_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPX_get", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPX_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcpx_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPX_set", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_GCPX_set", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_GCPX_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcpy_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPY_get", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPY_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcpy_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPY_set", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_GCPY_set", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_GCPY_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcpz_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPZ_get", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPZ_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcpz_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPZ_set", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_GCPZ_set", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_GCPZ_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcppixel_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPPixel_get", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPPixel_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcppixel_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPPixel_set", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_GCPPixel_set", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_GCPPixel_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcpline_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPLine_get", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_GCPLine_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_gcpline_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_GCPLine_set", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_GCPLine_set", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_GCPLine_set(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_info_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_Info_get", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (char *)GDAL_GCP_Info_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_info_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_Info_set", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GDAL_GCP_Info_set", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_Info_set(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_id_get(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_Id_get", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (char *)GDAL_GCP_Id_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_id_set(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_Id_set", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GDAL_GCP_Id_set", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_Id_set(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_get_gcpx(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_get_GCPX", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_get_GCPX(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_set_gcpx(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_set_GCPX", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_set_GCPX", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_set_GCPX(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_get_gcpy(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_get_GCPY", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_get_GCPY(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_set_gcpy(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_set_GCPY", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_set_GCPY", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_set_GCPY(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_get_gcpz(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_get_GCPZ", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_get_GCPZ(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_set_gcpz(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_set_GCPZ", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_set_GCPZ", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_set_GCPZ(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_get_gcppixel(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_get_GCPPixel", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_get_GCPPixel(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_set_gcppixel(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_set_GCPPixel", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_set_GCPPixel", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_set_GCPPixel(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_get_gcpline(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_get_GCPLine", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (double)GDAL_GCP_get_GCPLine(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_set_gcpline(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_set_GCPLine", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDAL_GCP_set_GCPLine", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_set_GCPLine(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_get_info(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_get_Info", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (char *)GDAL_GCP_get_Info(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_set_info(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_set_Info", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GDAL_GCP_set_Info", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_set_Info(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_get_id(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_get_Id", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (char *)GDAL_GCP_get_Id(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdal_gcp_set_id(int argc, VALUE *argv, VALUE self) {
  GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDAL_GCP *","GDAL_GCP_set_Id", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GDAL_GCP_set_Id", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    GDAL_GCP_set_Id(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gcps_to_geo_transform(int argc, VALUE *argv, VALUE self) {
  int arg1 ;
  GDAL_GCP *arg2 = (GDAL_GCP *) 0 ;
  double *arg3 ;
  int arg4 = (int) 1 ;
  GDAL_GCP *tmpGCPList1 ;
  double argout3[6] ;
  int val4 ;
  int ecode4 = 0 ;
  RETURN_NONE result;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double argout3[ANY]) */
    arg3 = argout3;
  }
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap( in,numinputs=1) (int nGCPs, GDAL_GCP const *pGCPs ) */
    
    /* Check if is a list */
    Check_Type(argv[0], T_ARRAY);
    
    arg1 = RARRAY(argv[0])->len;
    tmpGCPList1 = (GDAL_GCP*) malloc(arg1*sizeof(GDAL_GCP));
    arg2 = tmpGCPList1;
    
    for( int i = 0; i<arg1; i++ ) {
      VALUE rubyItem = rb_ary_entry(argv[0],i);
      GDAL_GCP *item = 0;
      
      SWIG_ConvertPtr( rubyItem, (void**)&item, SWIGTYPE_p_GDAL_GCP, SWIG_POINTER_EXCEPTION | 0 );
      
      if (!item) {
        rb_raise(rb_eRuntimeError, "GDAL_GCP item cannot be nil");
      }
      
      memcpy( (void*) item, (void*) tmpGCPList1, sizeof( GDAL_GCP ) );
      ++tmpGCPList1;
    }
  }
  if (argc > 1) {
    ecode4 = SWIG_AsVal_int(argv[1], &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","GDALGCPsToGeoTransform", 4, argv[1] ));
    } 
    arg4 = static_cast< int >(val4);
  }
  {
    CPLErrorReset();
    result = GDALGCPsToGeoTransform(arg1,(GDAL_GCP const *)arg2,arg3,arg4);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) IF_FALSE_RETURN_NONE */
    if (result == 0 ) {
      vresult = Qnil;
    }
  }
  {
    /* %typemap(argout) (double argout[ANY]) */
    VALUE outArr = rb_ary_new();
    
    for(int i=0; i<6; i++)
    {
      VALUE value = rb_float_new((arg3)[i]);
      rb_ary_push(outArr, value);
    }
    
    /* Add the output to the result */
    vresult = SWIG_Ruby_AppendOutput(vresult, outArr);	
  }
  {
    /* %typemap( freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
    if (arg2) {
      free( (void*) arg2 );
    }
  }
  return vresult;
fail:
  {
    /* %typemap( freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
    if (arg2) {
      free( (void*) arg2 );
    }
  }
  return Qnil;
}


swig_class SwigClassAsyncReader;

SWIGINTERN void delete_GDALAsyncReaderShadow(GDALAsyncReaderShadow *self){
        DeleteAsyncReaderWrapper(self);
    }
SWIGINTERN void
free_GDALAsyncReaderShadow(GDALAsyncReaderShadow *arg1) {
    delete_GDALAsyncReaderShadow(arg1);
}

SWIGINTERN VALUE
_wrap_AsyncReader_get_next_updated_region(int argc, VALUE *argv, VALUE self) {
  GDALAsyncReaderShadow *arg1 = (GDALAsyncReaderShadow *) 0 ;
  double arg2 ;
  int *arg3 = (int *) 0 ;
  int *arg4 = (int *) 0 ;
  int *arg5 = (int *) 0 ;
  int *arg6 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  int temp3 ;
  int res3 = SWIG_TMPOBJ ;
  int temp4 ;
  int res4 = SWIG_TMPOBJ ;
  int temp5 ;
  int res5 = SWIG_TMPOBJ ;
  int temp6 ;
  int res6 = SWIG_TMPOBJ ;
  GDALAsyncStatusType result;
  VALUE vresult = Qnil;
  
  arg3 = &temp3;
  arg4 = &temp4;
  arg5 = &temp5;
  arg6 = &temp6;
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALAsyncReaderShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALAsyncReaderShadow *","GetNextUpdatedRegion", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALAsyncReaderShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GetNextUpdatedRegion", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    result = (GDALAsyncStatusType)GDALAsyncReaderShadow_GetNextUpdatedRegion(arg1,arg2,arg3,arg4,arg5,arg6);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (SWIG_IsTmpObj(res3)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_int((*arg3)));
  } else {
    int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
  }
  if (SWIG_IsTmpObj(res4)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_int((*arg4)));
  } else {
    int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
  }
  if (SWIG_IsTmpObj(res5)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_int((*arg5)));
  } else {
    int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags));
  }
  if (SWIG_IsTmpObj(res6)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_int((*arg6)));
  } else {
    int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags));
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_AsyncReader_lock_buffer(int argc, VALUE *argv, VALUE self) {
  GDALAsyncReaderShadow *arg1 = (GDALAsyncReaderShadow *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALAsyncReaderShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALAsyncReaderShadow *","LockBuffer", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALAsyncReaderShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","LockBuffer", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    result = (int)GDALAsyncReaderShadow_LockBuffer(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_AsyncReader_unlock_buffer(int argc, VALUE *argv, VALUE self) {
  GDALAsyncReaderShadow *arg1 = (GDALAsyncReaderShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALAsyncReaderShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALAsyncReaderShadow *","UnlockBuffer", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALAsyncReaderShadow * >(argp1);
  {
    CPLErrorReset();
    GDALAsyncReaderShadow_UnlockBuffer(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassDataset;

SWIGINTERN VALUE
_wrap_Dataset_RasterXSize_get(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","RasterXSize", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALDatasetShadow_RasterXSize_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_RasterYSize_get(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","RasterYSize", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALDatasetShadow_RasterYSize_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_RasterCount_get(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","RasterCount", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALDatasetShadow_RasterCount_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void delete_GDALDatasetShadow(GDALDatasetShadow *self){
    if ( GDALDereferenceDataset( self ) <= 0 ) {
      GDALClose(self);
    }
  }
SWIGINTERN void
free_GDALDatasetShadow(GDALDatasetShadow *arg1) {
    delete_GDALDatasetShadow(arg1);
}

SWIGINTERN VALUE
_wrap_Dataset_get_driver(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALDriverShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetDriver", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALDriverShadow *)GDALDatasetShadow_GetDriver(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_raster_band(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  GDALRasterBandShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetRasterBand", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetRasterBand", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (GDALRasterBandShadow *)GDALDatasetShadow_GetRasterBand(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_projection(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetProjection", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALDatasetShadow_GetProjection(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_projection_ref(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetProjectionRef", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALDatasetShadow_GetProjectionRef(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_set_projection(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","SetProjection", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","SetProjection", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALDatasetShadow_SetProjection(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_geo_transform(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  double *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double argout2[6] ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double argout2[ANY]) */
    arg2 = argout2;
  }
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetGeoTransform", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    GDALDatasetShadow_GetGeoTransform(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double argout[ANY]) */
    VALUE outArr = rb_ary_new();
    
    for(int i=0; i<6; i++)
    {
      VALUE value = rb_float_new((arg2)[i]);
      rb_ary_push(outArr, value);
    }
    
    /* Add the output to the result */
    vresult = SWIG_Ruby_AppendOutput(vresult, outArr);	
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_set_geo_transform(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  double *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double temp2[6] ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","SetGeoTransform", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    /* %typemap(in) (double argin[ANY]) (double temp2[6]) */
    /* Make sure this is an array. */
    Check_Type(argv[0], T_ARRAY);
    
    /* Get the length */
    int seq_size = RARRAY(argv[0])->len;
    
    if ( seq_size != 6 ) {
      rb_raise(rb_eRangeError, "sequence must have length %i.", seq_size);
    }
    
    for( int i = 0; i<6; i++ ) {
      /* Get the Ruby Object */
      VALUE item = rb_ary_entry(argv[0],i);
      
      /* Convert to double and store in array*/
      temp2[i] = NUM2DBL(item);
    }
    
    /* Set argument arg2 equal to the temp2 array */
    arg2 = temp2;
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALDatasetShadow_SetGeoTransform(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_build_overviews(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  char *arg2 = (char *) "NEAREST" ;
  int arg3 = (int) 0 ;
  int *arg4 = (int *) 0 ;
  GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
  void *arg6 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  void *argp5 ;
  int res5 = 0 ;
  int res6 ;
  char *kwnames[] = {
    "self","resampling","overviewlist","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","BuildOverviews", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  if (argc > 0) {
    res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","BuildOverviews", 2, argv[0] ));
    }
    arg2 = reinterpret_cast< char * >(buf2);
  }
  if (argc > 1) {
    {
      /* %typemap(in,numinputs=1) (int nList, int* pList) */
      
      /* Make sure this is an array. */
      Check_Type(argv[1], T_ARRAY);
      
      /* Get the length */
      arg3 = RARRAY(argv[1])->len;
      
      /* Allocate space for the C array. */
      arg4 = (int*) malloc(arg3*sizeof(int));
      
      for( int i = 0; i<arg3; i++ ) {
        /* Get the Ruby Object */
        VALUE item = rb_ary_entry(argv[1],i);
        /* Conver to an integer */
        arg4[i] = NUM2INT(item);
      }
    }
  }
  if (argc > 2) {
    {
      res5 = SWIG_ConvertPtr(argv[2], &argp5, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res5)) {
        SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "GDALProgressFunc","BuildOverviews", 5, argv[2] )); 
      }  
      if (!argp5) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","BuildOverviews", 5, argv[2]));
      } else {
        arg5 = *(reinterpret_cast< GDALProgressFunc * >(argp5));
      }
    }
  }
  if (argc > 3) {
    res6 = SWIG_ConvertPtr(argv[3],SWIG_as_voidptrptr(&arg6), 0, 0);
    if (!SWIG_IsOK(res6)) {
      SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","BuildOverviews", 6, argv[3] )); 
    }
  }
  {
    CPLErrorReset();
    result = (int)GDALDatasetShadow_BuildOverviews(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg4) {
      free((void*) arg4);
    }
  }
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg4) {
      free((void*) arg4);
    }
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_gcpcount(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetGCPCount", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALDatasetShadow_GetGCPCount(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_gcpprojection(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetGCPProjection", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALDatasetShadow_GetGCPProjection(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_gcps(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  int *arg2 = (int *) 0 ;
  GDAL_GCP **arg3 = (GDAL_GCP **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int nGCPs2 = 0 ;
  GDAL_GCP *pGCPs2 = 0 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap( in,numinputs=0) (int *nGCPs2, GDAL_GCP const **pGCPs2 ) */
    arg2 = &nGCPs2;
    arg3 = &pGCPs2;
  }
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetGCPs", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    GDALDatasetShadow_GetGCPs(arg1,arg2,(GDAL_GCP const **)arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap( argout) (int *nGCPs, GDAL_GCP const **pGCPs ) */
    
    /*  vresult = rb_ary_new2(*arg2);
    
      for( int i = 0; i < *arg2; i++ ) {
        GDAL_GCP *o = new_GDAL_GCP( (*arg3)[i].dfGCPX,
                                    (*arg3)[i].dfGCPY,
                                    (*arg3)[i].dfGCPZ,
                                    (*arg3)[i].dfGCPPixel,
                                    (*arg3)[i].dfGCPLine,
                                    (*arg3)[i].pszInfo,
                                    (*arg3)[i].pszId );
    	
    	 rb_ary_store(vresult, i, 
    					  SWIG_NewPointerObj((void*)o, SWIGTYPE_p_GDAL_GCP,1));
      }*/
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_set_gcps(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  int arg2 ;
  GDAL_GCP *arg3 = (GDAL_GCP *) 0 ;
  char *arg4 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDAL_GCP *tmpGCPList2 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","SetGCPs", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    /* %typemap( in,numinputs=1) (int nGCPs, GDAL_GCP const *pGCPs ) */
    
    /* Check if is a list */
    Check_Type(argv[0], T_ARRAY);
    
    arg2 = RARRAY(argv[0])->len;
    tmpGCPList2 = (GDAL_GCP*) malloc(arg2*sizeof(GDAL_GCP));
    arg3 = tmpGCPList2;
    
    for( int i = 0; i<arg2; i++ ) {
      VALUE rubyItem = rb_ary_entry(argv[0],i);
      GDAL_GCP *item = 0;
      
      SWIG_ConvertPtr( rubyItem, (void**)&item, SWIGTYPE_p_GDAL_GCP, SWIG_POINTER_EXCEPTION | 0 );
      
      if (!item) {
        rb_raise(rb_eRuntimeError, "GDAL_GCP item cannot be nil");
      }
      
      memcpy( (void*) item, (void*) tmpGCPList2, sizeof( GDAL_GCP ) );
      ++tmpGCPList2;
    }
  }
  res4 = SWIG_AsCharPtrAndSize(argv[1], &buf4, NULL, &alloc4);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","SetGCPs", 4, argv[1] ));
  }
  arg4 = reinterpret_cast< char * >(buf4);
  {
    CPLErrorReset();
    result = (CPLErr)GDALDatasetShadow_SetGCPs(arg1,arg2,(GDAL_GCP const *)arg3,(char const *)arg4);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  {
    /* %typemap( freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
    if (arg3) {
      free( (void*) arg3 );
    }
  }
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return vresult;
fail:
  {
    /* %typemap( freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
    if (arg3) {
      free( (void*) arg3 );
    }
  }
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_flush_cache(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","FlushCache", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    GDALDatasetShadow_FlushCache(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_add_band(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  GDALDataType arg2 = (GDALDataType) GDT_Byte ;
  char **arg3 = (char **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *kwnames[] = {
    "self","datatype","options", NULL 
  };
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","AddBand", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  if (argc > 0) {
    {
      /* %typemap(in) CPLErr */
      arg2 = (GDALDataType) NUM2INT(argv[0]);
    }
  }
  if (argc > 1) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[1], T_ARRAY);
      
      int size = RARRAY(argv[1])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[1], i);
        char *pszItem = StringValuePtr(item);
        arg3 = CSLAddString( arg3, pszItem );
      }
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALDatasetShadow_AddBand(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg3 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg3 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_create_mask_band(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","CreateMaskBand", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CreateMaskBand", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (CPLErr)GDALDatasetShadow_CreateMaskBand(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_get_file_list(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char **result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GetFileList", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char **)GDALDatasetShadow_GetFileList(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_write_raster(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  int arg5 ;
  int arg6 ;
  char *arg7 = (char *) 0 ;
  int *arg8 = (int *) 0 ;
  int *arg9 = (int *) 0 ;
  GDALDataType *arg10 = (GDALDataType *) 0 ;
  int arg11 = (int) 0 ;
  int *arg12 = (int *) 0 ;
  int *arg13 = (int *) 0 ;
  int *arg14 = (int *) 0 ;
  int *arg15 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  int res6 ;
  char *buf6 = 0 ;
  size_t size6 = 0 ;
  int alloc6 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  void *argp9 = 0 ;
  int res9 = 0 ;
  void *argp10 = 0 ;
  int res10 = 0 ;
  void *argp13 = 0 ;
  int res13 = 0 ;
  void *argp14 = 0 ;
  int res14 = 0 ;
  void *argp15 = 0 ;
  int res15 = 0 ;
  char *kwnames[] = {
    "self","xoff","yoff","xsize","ysize","buf_len","buf_xsize","buf_ysize","buf_type","band_list","buf_pixel_space","buf_line_space","buf_band_space", NULL 
  };
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 5) || (argc > 12)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","WriteRaster", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","WriteRaster", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","WriteRaster", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","WriteRaster", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  ecode5 = SWIG_AsVal_int(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","WriteRaster", 5, argv[3] ));
  } 
  arg5 = static_cast< int >(val5);
  res6 = SWIG_AsCharPtrAndSize(argv[4], &buf6, &size6, &alloc6);
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "int","WriteRaster", 6, argv[4] ));
  }  
  arg7 = reinterpret_cast< char * >(buf6) ;
  arg6 = static_cast< int >(size6 - 1) ;
  if (argc > 5) {
    res8 = SWIG_ConvertPtr(argv[5], &argp8,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "int *","WriteRaster", 8, argv[5] )); 
    }
    arg8 = reinterpret_cast< int * >(argp8);
  }
  if (argc > 6) {
    res9 = SWIG_ConvertPtr(argv[6], &argp9,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res9)) {
      SWIG_exception_fail(SWIG_ArgError(res9), Ruby_Format_TypeError( "", "int *","WriteRaster", 9, argv[6] )); 
    }
    arg9 = reinterpret_cast< int * >(argp9);
  }
  if (argc > 7) {
    res10 = SWIG_ConvertPtr(argv[7], &argp10,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res10)) {
      SWIG_exception_fail(SWIG_ArgError(res10), Ruby_Format_TypeError( "", "GDALDataType *","WriteRaster", 10, argv[7] )); 
    }
    arg10 = reinterpret_cast< GDALDataType * >(argp10);
  }
  if (argc > 8) {
    {
      /* %typemap(in,numinputs=1) (int nList, int* pList) */
      
      /* Make sure this is an array. */
      Check_Type(argv[8], T_ARRAY);
      
      /* Get the length */
      arg11 = RARRAY(argv[8])->len;
      
      /* Allocate space for the C array. */
      arg12 = (int*) malloc(arg11*sizeof(int));
      
      for( int i = 0; i<arg11; i++ ) {
        /* Get the Ruby Object */
        VALUE item = rb_ary_entry(argv[8],i);
        /* Conver to an integer */
        arg12[i] = NUM2INT(item);
      }
    }
  }
  if (argc > 9) {
    res13 = SWIG_ConvertPtr(argv[9], &argp13,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res13)) {
      SWIG_exception_fail(SWIG_ArgError(res13), Ruby_Format_TypeError( "", "int *","WriteRaster", 13, argv[9] )); 
    }
    arg13 = reinterpret_cast< int * >(argp13);
  }
  if (argc > 10) {
    res14 = SWIG_ConvertPtr(argv[10], &argp14,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res14)) {
      SWIG_exception_fail(SWIG_ArgError(res14), Ruby_Format_TypeError( "", "int *","WriteRaster", 14, argv[10] )); 
    }
    arg14 = reinterpret_cast< int * >(argp14);
  }
  if (argc > 11) {
    res15 = SWIG_ConvertPtr(argv[11], &argp15,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res15)) {
      SWIG_exception_fail(SWIG_ArgError(res15), Ruby_Format_TypeError( "", "int *","WriteRaster", 15, argv[11] )); 
    }
    arg15 = reinterpret_cast< int * >(argp15);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALDatasetShadow_WriteRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg12) {
      free((void*) arg12);
    }
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg12) {
      free((void*) arg12);
    }
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Dataset_read_raster(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  int arg5 ;
  int *arg6 = (int *) 0 ;
  char **arg7 = (char **) 0 ;
  int *arg8 = (int *) 0 ;
  int *arg9 = (int *) 0 ;
  GDALDataType *arg10 = (GDALDataType *) 0 ;
  int arg11 = (int) 0 ;
  int *arg12 = (int *) 0 ;
  int *arg13 = (int *) 0 ;
  int *arg14 = (int *) 0 ;
  int *arg15 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  int nLen6 = 0 ;
  char *pBuf6 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  void *argp9 = 0 ;
  int res9 = 0 ;
  void *argp10 = 0 ;
  int res10 = 0 ;
  void *argp13 = 0 ;
  int res13 = 0 ;
  void *argp14 = 0 ;
  int res14 = 0 ;
  void *argp15 = 0 ;
  int res15 = 0 ;
  char *kwnames[] = {
    "self","xoff","yoff","xsize","ysize","buf_xsize","buf_ysize","buf_type","band_list","buf_pixel_space","buf_line_space","buf_band_space", NULL 
  };
  CPLErr result;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (int *nLen6, char **pBuf6 ) ( int nLen6 = 0, char *pBuf6 = 0 ) */
    arg6 = &nLen6;
    arg7 = &pBuf6;
  }
  if ((argc < 4) || (argc > 11)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","ReadRaster", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ReadRaster", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","ReadRaster", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","ReadRaster", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  ecode5 = SWIG_AsVal_int(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","ReadRaster", 5, argv[3] ));
  } 
  arg5 = static_cast< int >(val5);
  if (argc > 4) {
    res8 = SWIG_ConvertPtr(argv[4], &argp8,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "int *","ReadRaster", 8, argv[4] )); 
    }
    arg8 = reinterpret_cast< int * >(argp8);
  }
  if (argc > 5) {
    res9 = SWIG_ConvertPtr(argv[5], &argp9,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res9)) {
      SWIG_exception_fail(SWIG_ArgError(res9), Ruby_Format_TypeError( "", "int *","ReadRaster", 9, argv[5] )); 
    }
    arg9 = reinterpret_cast< int * >(argp9);
  }
  if (argc > 6) {
    res10 = SWIG_ConvertPtr(argv[6], &argp10,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res10)) {
      SWIG_exception_fail(SWIG_ArgError(res10), Ruby_Format_TypeError( "", "GDALDataType *","ReadRaster", 10, argv[6] )); 
    }
    arg10 = reinterpret_cast< GDALDataType * >(argp10);
  }
  if (argc > 7) {
    {
      /* %typemap(in,numinputs=1) (int nList, int* pList) */
      
      /* Make sure this is an array. */
      Check_Type(argv[7], T_ARRAY);
      
      /* Get the length */
      arg11 = RARRAY(argv[7])->len;
      
      /* Allocate space for the C array. */
      arg12 = (int*) malloc(arg11*sizeof(int));
      
      for( int i = 0; i<arg11; i++ ) {
        /* Get the Ruby Object */
        VALUE item = rb_ary_entry(argv[7],i);
        /* Conver to an integer */
        arg12[i] = NUM2INT(item);
      }
    }
  }
  if (argc > 8) {
    res13 = SWIG_ConvertPtr(argv[8], &argp13,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res13)) {
      SWIG_exception_fail(SWIG_ArgError(res13), Ruby_Format_TypeError( "", "int *","ReadRaster", 13, argv[8] )); 
    }
    arg13 = reinterpret_cast< int * >(argp13);
  }
  if (argc > 9) {
    res14 = SWIG_ConvertPtr(argv[9], &argp14,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res14)) {
      SWIG_exception_fail(SWIG_ArgError(res14), Ruby_Format_TypeError( "", "int *","ReadRaster", 14, argv[9] )); 
    }
    arg14 = reinterpret_cast< int * >(argp14);
  }
  if (argc > 10) {
    res15 = SWIG_ConvertPtr(argv[10], &argp15,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res15)) {
      SWIG_exception_fail(SWIG_ArgError(res15), Ruby_Format_TypeError( "", "int *","ReadRaster", 15, argv[10] )); 
    }
    arg15 = reinterpret_cast< int * >(argp15);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALDatasetShadow_ReadRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  {
    /* %typemap(argout) (int *nLen, char **pBuf ) */
    vresult = rb_str_new(*arg7, *arg6);
  }
  {
    /* %typemap(freearg) (int *nLen, char **pBuf ) */
    if( *arg7 ) {
      free( *arg7 );
    }
  }
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg12) {
      free((void*) arg12);
    }
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) (int *nLen, char **pBuf ) */
    if( *arg7 ) {
      free( *arg7 );
    }
  }
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg12) {
      free((void*) arg12);
    }
  }
  return Qnil;
}


swig_class SwigClassBand;

SWIGINTERN VALUE
_wrap_Band_XSize_get(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","XSize", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_XSize_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_YSize_get(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","YSize", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_YSize_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_DataType_get(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALDataType result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","DataType", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALDataType)GDALRasterBandShadow_DataType_get(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_band(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetBand", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_GetBand(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_block_size(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int *arg2 = (int *) 0 ;
  int *arg3 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int temp2 ;
  int res2 = SWIG_TMPOBJ ;
  int temp3 ;
  int res3 = SWIG_TMPOBJ ;
  VALUE vresult = Qnil;
  
  arg2 = &temp2;
  arg3 = &temp3;
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetBlockSize", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    GDALRasterBandShadow_GetBlockSize(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = rb_ary_new();
  if (SWIG_IsTmpObj(res2)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_int((*arg2)));
  } else {
    int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags));
  }
  if (SWIG_IsTmpObj(res3)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_int((*arg3)));
  } else {
    int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_color_interpretation(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALColorInterp result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetColorInterpretation", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALColorInterp)GDALRasterBandShadow_GetColorInterpretation(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_raster_color_interpretation(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALColorInterp result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetRasterColorInterpretation", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALColorInterp)GDALRasterBandShadow_GetRasterColorInterpretation(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_color_interpretation(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALColorInterp arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetColorInterpretation", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    /* %typemap(in) CPLErr */
    arg2 = (GDALColorInterp) NUM2INT(argv[0]);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetColorInterpretation(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_raster_color_interpretation(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALColorInterp arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetRasterColorInterpretation", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    /* %typemap(in) CPLErr */
    arg2 = (GDALColorInterp) NUM2INT(argv[0]);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetRasterColorInterpretation(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_no_data_value(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 = (double *) 0 ;
  int *arg3 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double tmpval2 ;
  int tmphasval2 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double *val, int*hasval) */
    arg2 = &tmpval2;
    arg3 = &tmphasval2;
  }
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetNoDataValue", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    GDALRasterBandShadow_GetNoDataValue(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double *val, int *hasval) */
    VALUE argOut;
    
    if ( !*arg3 ) {
      argOut = Qnil;
    }
    else {
      argOut = rb_float_new(*arg2);
    }
    
    vresult = SWIG_Ruby_AppendOutput(vresult, argOut);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_no_data_value(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetNoDataValue", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","SetNoDataValue", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetNoDataValue(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_unit_type(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetUnitType", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char *)GDALRasterBandShadow_GetUnitType(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_unit_type(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetUnitType", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","SetUnitType", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetUnitType(arg1,(char const *)arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_raster_category_names(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char **result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetRasterCategoryNames", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (char **)GDALRasterBandShadow_GetRasterCategoryNames(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) char **options */
    
    char **stringarray = result;
    if ( stringarray == NULL ) {
      vresult = Qnil;
    }
    else {
      int len = CSLCount( stringarray );
      vresult = rb_ary_new2( len );
      for ( int i = 0; i < len; ++i, ++stringarray ) {
        VALUE nm = rb_str_new2( *stringarray );
        rb_ary_push(vresult, nm);
      }
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_raster_category_names(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  char **arg2 = (char **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetRasterCategoryNames", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    /* %typemap(in) char **options */
    
    /* Check if is a list */
    Check_Type(argv[0], T_ARRAY);
    
    int size = RARRAY(argv[0])->len;
    for (int i = 0; i < size; i++) {
      VALUE item = rb_ary_entry(argv[0], i);
      char *pszItem = StringValuePtr(item);
      arg2 = CSLAddString( arg2, pszItem );
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetRasterCategoryNames(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg2 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg2 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_minimum(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 = (double *) 0 ;
  int *arg3 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double tmpval2 ;
  int tmphasval2 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double *val, int*hasval) */
    arg2 = &tmpval2;
    arg3 = &tmphasval2;
  }
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetMinimum", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    GDALRasterBandShadow_GetMinimum(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double *val, int *hasval) */
    VALUE argOut;
    
    if ( !*arg3 ) {
      argOut = Qnil;
    }
    else {
      argOut = rb_float_new(*arg2);
    }
    
    vresult = SWIG_Ruby_AppendOutput(vresult, argOut);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_maximum(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 = (double *) 0 ;
  int *arg3 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double tmpval2 ;
  int tmphasval2 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double *val, int*hasval) */
    arg2 = &tmpval2;
    arg3 = &tmphasval2;
  }
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetMaximum", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    GDALRasterBandShadow_GetMaximum(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double *val, int *hasval) */
    VALUE argOut;
    
    if ( !*arg3 ) {
      argOut = Qnil;
    }
    else {
      argOut = rb_float_new(*arg2);
    }
    
    vresult = SWIG_Ruby_AppendOutput(vresult, argOut);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_offset(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 = (double *) 0 ;
  int *arg3 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double tmpval2 ;
  int tmphasval2 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double *val, int*hasval) */
    arg2 = &tmpval2;
    arg3 = &tmphasval2;
  }
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetOffset", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    GDALRasterBandShadow_GetOffset(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double *val, int *hasval) */
    VALUE argOut;
    
    if ( !*arg3 ) {
      argOut = Qnil;
    }
    else {
      argOut = rb_float_new(*arg2);
    }
    
    vresult = SWIG_Ruby_AppendOutput(vresult, argOut);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_scale(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 = (double *) 0 ;
  int *arg3 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double tmpval2 ;
  int tmphasval2 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double *val, int*hasval) */
    arg2 = &tmpval2;
    arg3 = &tmphasval2;
  }
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetScale", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    GDALRasterBandShadow_GetScale(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double *val, int *hasval) */
    VALUE argOut;
    
    if ( !*arg3 ) {
      argOut = Qnil;
    }
    else {
      argOut = rb_float_new(*arg2);
    }
    
    vresult = SWIG_Ruby_AppendOutput(vresult, argOut);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_offset(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetOffset", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","SetOffset", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetOffset(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_scale(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetScale", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","SetScale", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetScale(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_statistics(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  double *arg4 = (double *) 0 ;
  double *arg5 = (double *) 0 ;
  double *arg6 = (double *) 0 ;
  double *arg7 = (double *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  double temp4 ;
  int res4 = SWIG_TMPOBJ ;
  double temp5 ;
  int res5 = SWIG_TMPOBJ ;
  double temp6 ;
  int res6 = SWIG_TMPOBJ ;
  double temp7 ;
  int res7 = SWIG_TMPOBJ ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  arg4 = &temp4;
  arg5 = &temp5;
  arg6 = &temp6;
  arg7 = &temp7;
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetStatistics", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetStatistics", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","GetStatistics", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_GetStatistics(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) CPLErr */
    vresult = (CPLErr)LONG2NUM(result);
  }
  if (SWIG_IsTmpObj(res4)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg4)));
  } else {
    int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res5)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg5)));
  } else {
    int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res6)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg6)));
  } else {
    int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res7)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg7)));
  } else {
    int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_double, new_flags));
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_compute_statistics(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  bool arg2 ;
  double *arg3 = (double *) NULL ;
  double *arg4 = (double *) NULL ;
  double *arg5 = (double *) NULL ;
  double *arg6 = (double *) NULL ;
  GDALProgressFunc arg7 = (GDALProgressFunc) NULL ;
  void *arg8 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  double temp3 ;
  int res3 = SWIG_TMPOBJ ;
  double temp4 ;
  int res4 = SWIG_TMPOBJ ;
  double temp5 ;
  int res5 = SWIG_TMPOBJ ;
  double temp6 ;
  int res6 = SWIG_TMPOBJ ;
  void *argp7 ;
  int res7 = 0 ;
  int res8 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  arg3 = &temp3;
  arg4 = &temp4;
  arg5 = &temp5;
  arg6 = &temp6;
  if ((argc < 1) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeStatistics", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_bool(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","ComputeStatistics", 2, argv[0] ));
  } 
  arg2 = static_cast< bool >(val2);
  if (argc > 1) {
    {
      res7 = SWIG_ConvertPtr(argv[1], &argp7, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res7)) {
        SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "GDALProgressFunc","ComputeStatistics", 7, argv[1] )); 
      }  
      if (!argp7) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","ComputeStatistics", 7, argv[1]));
      } else {
        arg7 = *(reinterpret_cast< GDALProgressFunc * >(argp7));
      }
    }
  }
  if (argc > 2) {
    res8 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg8), 0, 0);
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "void *","ComputeStatistics", 8, argv[2] )); 
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_ComputeStatistics(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (SWIG_IsTmpObj(res3)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg3)));
  } else {
    int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res4)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg4)));
  } else {
    int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res5)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg5)));
  } else {
    int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res6)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg6)));
  } else {
    int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_double, new_flags));
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_statistics(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 ;
  double arg3 ;
  double arg4 ;
  double arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  double val4 ;
  int ecode4 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetStatistics", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","SetStatistics", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","SetStatistics", 3, argv[1] ));
  } 
  arg3 = static_cast< double >(val3);
  ecode4 = SWIG_AsVal_double(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","SetStatistics", 4, argv[2] ));
  } 
  arg4 = static_cast< double >(val4);
  ecode5 = SWIG_AsVal_double(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","SetStatistics", 5, argv[3] ));
  } 
  arg5 = static_cast< double >(val5);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetStatistics(arg1,arg2,arg3,arg4,arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_overview_count(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetOverviewCount", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_GetOverviewCount(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_overview(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  GDALRasterBandShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetOverview", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetOverview", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (GDALRasterBandShadow *)GDALRasterBandShadow_GetOverview(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_checksum(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int arg2 = (int) 0 ;
  int arg3 = (int) 0 ;
  int *arg4 = (int *) 0 ;
  int *arg5 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  char *kwnames[] = {
    "self","xoff","yoff","xsize","ysize", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","Checksum", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  if (argc > 0) {
    ecode2 = SWIG_AsVal_int(argv[0], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Checksum", 2, argv[0] ));
    } 
    arg2 = static_cast< int >(val2);
  }
  if (argc > 1) {
    ecode3 = SWIG_AsVal_int(argv[1], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Checksum", 3, argv[1] ));
    } 
    arg3 = static_cast< int >(val3);
  }
  if (argc > 2) {
    res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "int *","Checksum", 4, argv[2] )); 
    }
    arg4 = reinterpret_cast< int * >(argp4);
  }
  if (argc > 3) {
    res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "int *","Checksum", 5, argv[3] )); 
    }
    arg5 = reinterpret_cast< int * >(argp5);
  }
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_Checksum(arg1,arg2,arg3,arg4,arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_compute_raster_min_max(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 ;
  int arg3 = (int) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double argout2[2] ;
  int val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double argout2[ANY]) */
    arg2 = argout2;
  }
  if ((argc < 0) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeRasterMinMax", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  if (argc > 0) {
    ecode3 = SWIG_AsVal_int(argv[0], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","ComputeRasterMinMax", 3, argv[0] ));
    } 
    arg3 = static_cast< int >(val3);
  }
  {
    CPLErrorReset();
    GDALRasterBandShadow_ComputeRasterMinMax(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double argout[ANY]) */
    VALUE outArr = rb_ary_new();
    
    for(int i=0; i<2; i++)
    {
      VALUE value = rb_float_new((arg2)[i]);
      rb_ary_push(outArr, value);
    }
    
    /* Add the output to the result */
    vresult = SWIG_Ruby_AppendOutput(vresult, outArr);	
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_compute_band_stats(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 ;
  int arg3 = (int) 1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double argout2[2] ;
  int val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double argout2[ANY]) */
    arg2 = argout2;
  }
  if ((argc < 0) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeBandStats", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  if (argc > 0) {
    ecode3 = SWIG_AsVal_int(argv[0], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","ComputeBandStats", 3, argv[0] ));
    } 
    arg3 = static_cast< int >(val3);
  }
  {
    CPLErrorReset();
    GDALRasterBandShadow_ComputeBandStats(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(argout) (double argout[ANY]) */
    VALUE outArr = rb_ary_new();
    
    for(int i=0; i<2; i++)
    {
      VALUE value = rb_float_new((arg2)[i]);
      rb_ary_push(outArr, value);
    }
    
    /* Add the output to the result */
    vresult = SWIG_Ruby_AppendOutput(vresult, outArr);	
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_fill(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 ;
  double arg3 = (double) 0.0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","Fill", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Fill", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  if (argc > 1) {
    ecode3 = SWIG_AsVal_double(argv[1], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Fill", 3, argv[1] ));
    } 
    arg3 = static_cast< double >(val3);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_Fill(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_read_raster(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  int arg5 ;
  int *arg6 = (int *) 0 ;
  char **arg7 = (char **) 0 ;
  int *arg8 = (int *) 0 ;
  int *arg9 = (int *) 0 ;
  int *arg10 = (int *) 0 ;
  int *arg11 = (int *) 0 ;
  int *arg12 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  int nLen6 = 0 ;
  char *pBuf6 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  void *argp9 = 0 ;
  int res9 = 0 ;
  void *argp10 = 0 ;
  int res10 = 0 ;
  void *argp11 = 0 ;
  int res11 = 0 ;
  void *argp12 = 0 ;
  int res12 = 0 ;
  char *kwnames[] = {
    "self","xoff","yoff","xsize","ysize","buf_xsize","buf_ysize","buf_type","buf_pixel_space","buf_line_space", NULL 
  };
  CPLErr result;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (int *nLen6, char **pBuf6 ) ( int nLen6 = 0, char *pBuf6 = 0 ) */
    arg6 = &nLen6;
    arg7 = &pBuf6;
  }
  if ((argc < 4) || (argc > 9)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ReadRaster", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ReadRaster", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","ReadRaster", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","ReadRaster", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  ecode5 = SWIG_AsVal_int(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","ReadRaster", 5, argv[3] ));
  } 
  arg5 = static_cast< int >(val5);
  if (argc > 4) {
    res8 = SWIG_ConvertPtr(argv[4], &argp8,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "int *","ReadRaster", 8, argv[4] )); 
    }
    arg8 = reinterpret_cast< int * >(argp8);
  }
  if (argc > 5) {
    res9 = SWIG_ConvertPtr(argv[5], &argp9,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res9)) {
      SWIG_exception_fail(SWIG_ArgError(res9), Ruby_Format_TypeError( "", "int *","ReadRaster", 9, argv[5] )); 
    }
    arg9 = reinterpret_cast< int * >(argp9);
  }
  if (argc > 6) {
    res10 = SWIG_ConvertPtr(argv[6], &argp10,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res10)) {
      SWIG_exception_fail(SWIG_ArgError(res10), Ruby_Format_TypeError( "", "int *","ReadRaster", 10, argv[6] )); 
    }
    arg10 = reinterpret_cast< int * >(argp10);
  }
  if (argc > 7) {
    res11 = SWIG_ConvertPtr(argv[7], &argp11,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res11)) {
      SWIG_exception_fail(SWIG_ArgError(res11), Ruby_Format_TypeError( "", "int *","ReadRaster", 11, argv[7] )); 
    }
    arg11 = reinterpret_cast< int * >(argp11);
  }
  if (argc > 8) {
    res12 = SWIG_ConvertPtr(argv[8], &argp12,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res12)) {
      SWIG_exception_fail(SWIG_ArgError(res12), Ruby_Format_TypeError( "", "int *","ReadRaster", 12, argv[8] )); 
    }
    arg12 = reinterpret_cast< int * >(argp12);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_ReadRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(argout) (int *nLen, char **pBuf ) */
    vresult = rb_str_new(*arg7, *arg6);
  }
  {
    /* %typemap(freearg) (int *nLen, char **pBuf ) */
    if( *arg7 ) {
      free( *arg7 );
    }
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) (int *nLen, char **pBuf ) */
    if( *arg7 ) {
      free( *arg7 );
    }
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_write_raster(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  int arg5 ;
  int arg6 ;
  char *arg7 = (char *) 0 ;
  int *arg8 = (int *) 0 ;
  int *arg9 = (int *) 0 ;
  int *arg10 = (int *) 0 ;
  int *arg11 = (int *) 0 ;
  int *arg12 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  int res6 ;
  char *buf6 = 0 ;
  size_t size6 = 0 ;
  int alloc6 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  void *argp9 = 0 ;
  int res9 = 0 ;
  void *argp10 = 0 ;
  int res10 = 0 ;
  void *argp11 = 0 ;
  int res11 = 0 ;
  void *argp12 = 0 ;
  int res12 = 0 ;
  char *kwnames[] = {
    "self","xoff","yoff","xsize","ysize","buf_len","buf_xsize","buf_ysize","buf_type","buf_pixel_space","buf_line_space", NULL 
  };
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 5) || (argc > 10)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","WriteRaster", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","WriteRaster", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","WriteRaster", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","WriteRaster", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  ecode5 = SWIG_AsVal_int(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","WriteRaster", 5, argv[3] ));
  } 
  arg5 = static_cast< int >(val5);
  res6 = SWIG_AsCharPtrAndSize(argv[4], &buf6, &size6, &alloc6);
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "int","WriteRaster", 6, argv[4] ));
  }  
  arg7 = reinterpret_cast< char * >(buf6) ;
  arg6 = static_cast< int >(size6 - 1) ;
  if (argc > 5) {
    res8 = SWIG_ConvertPtr(argv[5], &argp8,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "int *","WriteRaster", 8, argv[5] )); 
    }
    arg8 = reinterpret_cast< int * >(argp8);
  }
  if (argc > 6) {
    res9 = SWIG_ConvertPtr(argv[6], &argp9,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res9)) {
      SWIG_exception_fail(SWIG_ArgError(res9), Ruby_Format_TypeError( "", "int *","WriteRaster", 9, argv[6] )); 
    }
    arg9 = reinterpret_cast< int * >(argp9);
  }
  if (argc > 7) {
    res10 = SWIG_ConvertPtr(argv[7], &argp10,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res10)) {
      SWIG_exception_fail(SWIG_ArgError(res10), Ruby_Format_TypeError( "", "int *","WriteRaster", 10, argv[7] )); 
    }
    arg10 = reinterpret_cast< int * >(argp10);
  }
  if (argc > 8) {
    res11 = SWIG_ConvertPtr(argv[8], &argp11,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res11)) {
      SWIG_exception_fail(SWIG_ArgError(res11), Ruby_Format_TypeError( "", "int *","WriteRaster", 11, argv[8] )); 
    }
    arg11 = reinterpret_cast< int * >(argp11);
  }
  if (argc > 9) {
    res12 = SWIG_ConvertPtr(argv[9], &argp12,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res12)) {
      SWIG_exception_fail(SWIG_ArgError(res12), Ruby_Format_TypeError( "", "int *","WriteRaster", 12, argv[9] )); 
    }
    arg12 = reinterpret_cast< int * >(argp12);
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_WriteRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_flush_cache(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","FlushCache", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    GDALRasterBandShadow_FlushCache(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_raster_color_table(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALColorTableShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetRasterColorTable", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALColorTableShadow *)GDALRasterBandShadow_GetRasterColorTable(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_color_table(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALColorTableShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetColorTable", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALColorTableShadow *)GDALRasterBandShadow_GetColorTable(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_raster_color_table(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALColorTableShadow *arg2 = (GDALColorTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetRasterColorTable", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALColorTableShadow *","SetRasterColorTable", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< GDALColorTableShadow * >(argp2);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_SetRasterColorTable(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_color_table(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALColorTableShadow *arg2 = (GDALColorTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetColorTable", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALColorTableShadow *","SetColorTable", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< GDALColorTableShadow * >(argp2);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_SetColorTable(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_default_rat(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALRasterAttributeTableShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetDefaultRAT", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALRasterAttributeTableShadow *)GDALRasterBandShadow_GetDefaultRAT(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_default_rat(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterAttributeTableShadow *arg2 = (GDALRasterAttributeTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetDefaultRAT", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","SetDefaultRAT", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp2);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_SetDefaultRAT(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_mask_band(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALRasterBandShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetMaskBand", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALRasterBandShadow *)GDALRasterBandShadow_GetMaskBand(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_mask_flags(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetMaskFlags", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALRasterBandShadow_GetMaskFlags(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_create_mask_band(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","CreateMaskBand", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CreateMaskBand", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_CreateMaskBand(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_histogram(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 = (double) -0.5 ;
  double arg3 = (double) 255.5 ;
  int arg4 = (int) 256 ;
  int *arg5 = (int *) NULL ;
  int arg6 = (int) 0 ;
  int arg7 = (int) 1 ;
  GDALProgressFunc arg8 = (GDALProgressFunc) NULL ;
  void *arg9 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  int val7 ;
  int ecode7 = 0 ;
  void *argp8 ;
  int res8 = 0 ;
  int res9 ;
  char *kwnames[] = {
    "self","min","max","buckets","panHistogram","include_out_of_range","approx_ok","callback","callback_data", NULL 
  };
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 8)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetHistogram", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  if (argc > 0) {
    ecode2 = SWIG_AsVal_double(argv[0], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GetHistogram", 2, argv[0] ));
    } 
    arg2 = static_cast< double >(val2);
  }
  if (argc > 1) {
    ecode3 = SWIG_AsVal_double(argv[1], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","GetHistogram", 3, argv[1] ));
    } 
    arg3 = static_cast< double >(val3);
  }
  if (argc > 2) {
    ecode4 = SWIG_AsVal_int(argv[2], &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","GetHistogram", 4, argv[2] ));
    } 
    arg4 = static_cast< int >(val4);
  }
  if (argc > 3) {
    res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "int *","GetHistogram", 5, argv[3] )); 
    }
    arg5 = reinterpret_cast< int * >(argp5);
  }
  if (argc > 4) {
    ecode6 = SWIG_AsVal_int(argv[4], &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "int","GetHistogram", 6, argv[4] ));
    } 
    arg6 = static_cast< int >(val6);
  }
  if (argc > 5) {
    ecode7 = SWIG_AsVal_int(argv[5], &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "int","GetHistogram", 7, argv[5] ));
    } 
    arg7 = static_cast< int >(val7);
  }
  if (argc > 6) {
    {
      res8 = SWIG_ConvertPtr(argv[6], &argp8, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res8)) {
        SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "GDALProgressFunc","GetHistogram", 8, argv[6] )); 
      }  
      if (!argp8) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","GetHistogram", 8, argv[6]));
      } else {
        arg8 = *(reinterpret_cast< GDALProgressFunc * >(argp8));
      }
    }
  }
  if (argc > 7) {
    res9 = SWIG_ConvertPtr(argv[7],SWIG_as_voidptrptr(&arg9), 0, 0);
    if (!SWIG_IsOK(res9)) {
      SWIG_exception_fail(SWIG_ArgError(res9), Ruby_Format_TypeError( "", "void *","GetHistogram", 9, argv[7] )); 
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_GetHistogram(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_get_default_histogram(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double *arg2 = (double *) NULL ;
  double *arg3 = (double *) NULL ;
  int *arg4 = (int *) NULL ;
  int **arg5 = (int **) NULL ;
  int arg6 = (int) 1 ;
  GDALProgressFunc arg7 = (GDALProgressFunc) NULL ;
  void *arg8 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  void *argp7 ;
  int res7 = 0 ;
  int res8 ;
  char *kwnames[] = {
    "self","min_ret","max_ret","buckets_ret","ppanHistogram","force","callback","callback_data", NULL 
  };
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 7)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","GetDefaultHistogram", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  if (argc > 0) {
    res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_double, 0 |  0 );
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "double *","GetDefaultHistogram", 2, argv[0] )); 
    }
    arg2 = reinterpret_cast< double * >(argp2);
  }
  if (argc > 1) {
    res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_double, 0 |  0 );
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "double *","GetDefaultHistogram", 3, argv[1] )); 
    }
    arg3 = reinterpret_cast< double * >(argp3);
  }
  if (argc > 2) {
    res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "int *","GetDefaultHistogram", 4, argv[2] )); 
    }
    arg4 = reinterpret_cast< int * >(argp4);
  }
  if (argc > 3) {
    res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_p_int, 0 |  0 );
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "int **","GetDefaultHistogram", 5, argv[3] )); 
    }
    arg5 = reinterpret_cast< int ** >(argp5);
  }
  if (argc > 4) {
    ecode6 = SWIG_AsVal_int(argv[4], &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "int","GetDefaultHistogram", 6, argv[4] ));
    } 
    arg6 = static_cast< int >(val6);
  }
  if (argc > 5) {
    {
      res7 = SWIG_ConvertPtr(argv[5], &argp7, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res7)) {
        SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "GDALProgressFunc","GetDefaultHistogram", 7, argv[5] )); 
      }  
      if (!argp7) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","GetDefaultHistogram", 7, argv[5]));
      } else {
        arg7 = *(reinterpret_cast< GDALProgressFunc * >(argp7));
      }
    }
  }
  if (argc > 6) {
    res8 = SWIG_ConvertPtr(argv[6],SWIG_as_voidptrptr(&arg8), 0, 0);
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "void *","GetDefaultHistogram", 8, argv[6] )); 
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_GetDefaultHistogram(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_set_default_histogram(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 ;
  double arg3 ;
  int arg4 ;
  int *arg5 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SetDefaultHistogram", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","SetDefaultHistogram", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","SetDefaultHistogram", 3, argv[1] ));
  } 
  arg3 = static_cast< double >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","SetDefaultHistogram", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_int, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "int *","SetDefaultHistogram", 5, argv[3] )); 
  }
  arg5 = reinterpret_cast< int * >(argp5);
  {
    CPLErrorReset();
    result = (CPLErr)GDALRasterBandShadow_SetDefaultHistogram(arg1,arg2,arg3,arg4,arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Band_has_arbitrary_overviews(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","HasArbitraryOverviews", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  {
    CPLErrorReset();
    result = (bool)GDALRasterBandShadow_HasArbitraryOverviews(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassColorTable;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ColorTable_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ColorTable_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GDALColorTableShadow);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ColorTable(int argc, VALUE *argv, VALUE self) {
  GDALPaletteInterp arg1 = (GDALPaletteInterp) GPI_RGB ;
  char *kwnames[] = {
    "palette", NULL 
  };
  GDALColorTableShadow *result = 0 ;
  
  if ((argc < 0) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  if (argc > 0) {
    {
      /* %typemap(in) CPLErr */
      arg1 = (GDALPaletteInterp) NUM2INT(argv[0]);
    }
  }
  {
    CPLErrorReset();
    result = (GDALColorTableShadow *)new_GDALColorTableShadow(arg1);
    DATA_PTR(self) = result;
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void delete_GDALColorTableShadow(GDALColorTableShadow *self){
        GDALDestroyColorTable(self);
    }
SWIGINTERN void
free_GDALColorTableShadow(GDALColorTableShadow *arg1) {
    delete_GDALColorTableShadow(arg1);
}

SWIGINTERN VALUE
_wrap_ColorTable_clone(int argc, VALUE *argv, VALUE self) {
  GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALColorTableShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorTableShadow *","Clone", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALColorTableShadow *)GDALColorTableShadow_Clone(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorTableShadow, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorTable_get_palette_interpretation(int argc, VALUE *argv, VALUE self) {
  GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALPaletteInterp result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorTableShadow *","GetPaletteInterpretation", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALPaletteInterp)GDALColorTableShadow_GetPaletteInterpretation(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorTable_get_count(int argc, VALUE *argv, VALUE self) {
  GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorTableShadow *","GetColorEntryCount", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALColorTableShadow_GetColorEntryCount(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorTable_get_color_entry(int argc, VALUE *argv, VALUE self) {
  GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  GDALColorEntry *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorTableShadow *","GetColorEntry", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetColorEntry", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (GDALColorEntry *)GDALColorTableShadow_GetColorEntry(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorTable_get_color_entry_as_rgb(int argc, VALUE *argv, VALUE self) {
  GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
  int arg2 ;
  GDALColorEntry *arg3 = (GDALColorEntry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorTableShadow *","GetColorEntryAsRGB", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetColorEntryAsRGB", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALColorEntry *","GetColorEntryAsRGB", 3, argv[1] )); 
  }
  arg3 = reinterpret_cast< GDALColorEntry * >(argp3);
  {
    CPLErrorReset();
    result = (int)GDALColorTableShadow_GetColorEntryAsRGB(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorTable_set_color_entry(int argc, VALUE *argv, VALUE self) {
  GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
  int arg2 ;
  GDALColorEntry *arg3 = (GDALColorEntry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorTableShadow *","SetColorEntry", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","SetColorEntry", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALColorEntry const *","SetColorEntry", 3, argv[1] )); 
  }
  arg3 = reinterpret_cast< GDALColorEntry * >(argp3);
  {
    CPLErrorReset();
    GDALColorTableShadow_SetColorEntry(arg1,arg2,(GDALColorEntry const *)arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ColorTable_create_color_ramp(int argc, VALUE *argv, VALUE self) {
  GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
  int arg2 ;
  GDALColorEntry *arg3 = (GDALColorEntry *) 0 ;
  int arg4 ;
  GDALColorEntry *arg5 = (GDALColorEntry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALColorTableShadow *","CreateColorRamp", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CreateColorRamp", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALColorEntry const *","CreateColorRamp", 3, argv[1] )); 
  }
  arg3 = reinterpret_cast< GDALColorEntry * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","CreateColorRamp", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_GDALColorEntry, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "GDALColorEntry const *","CreateColorRamp", 5, argv[3] )); 
  }
  arg5 = reinterpret_cast< GDALColorEntry * >(argp5);
  {
    CPLErrorReset();
    GDALColorTableShadow_CreateColorRamp(arg1,arg2,(GDALColorEntry const *)arg3,arg4,(GDALColorEntry const *)arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassRasterAttributeTable;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_RasterAttributeTable_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_RasterAttributeTable_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GDALRasterAttributeTableShadow);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_RasterAttributeTable(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (GDALRasterAttributeTableShadow *)new_GDALRasterAttributeTableShadow();
    DATA_PTR(self) = result;
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void delete_GDALRasterAttributeTableShadow(GDALRasterAttributeTableShadow *self){
        GDALDestroyRasterAttributeTable(self);
    }
SWIGINTERN void
free_GDALRasterAttributeTableShadow(GDALRasterAttributeTableShadow *arg1) {
    delete_GDALRasterAttributeTableShadow(arg1);
}

SWIGINTERN VALUE
_wrap_RasterAttributeTable_clone(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  GDALRasterAttributeTableShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","Clone", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  {
    CPLErrorReset();
    result = (GDALRasterAttributeTableShadow *)GDALRasterAttributeTableShadow_Clone(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterAttributeTableShadow, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_column_count(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetColumnCount", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALRasterAttributeTableShadow_GetColumnCount(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_name_of_col(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetNameOfCol", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetNameOfCol", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (char *)GDALRasterAttributeTableShadow_GetNameOfCol(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_usage_of_col(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  GDALRATFieldUsage result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetUsageOfCol", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetUsageOfCol", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (GDALRATFieldUsage)GDALRasterAttributeTableShadow_GetUsageOfCol(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_type_of_col(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  GDALRATFieldType result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetTypeOfCol", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetTypeOfCol", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    result = (GDALRATFieldType)GDALRasterAttributeTableShadow_GetTypeOfCol(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_col_of_usage(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  GDALRATFieldUsage arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetColOfUsage", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "GDALRATFieldUsage","GetColOfUsage", 2, argv[0] ));
  } 
  arg2 = static_cast< GDALRATFieldUsage >(val2);
  {
    CPLErrorReset();
    result = (int)GDALRasterAttributeTableShadow_GetColOfUsage(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_row_count(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetRowCount", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  {
    CPLErrorReset();
    result = (int)GDALRasterAttributeTableShadow_GetRowCount(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_value_as_string(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetValueAsString", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetValueAsString", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","GetValueAsString", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    CPLErrorReset();
    result = (char *)GDALRasterAttributeTableShadow_GetValueAsString(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_value_as_int(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetValueAsInt", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetValueAsInt", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","GetValueAsInt", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    CPLErrorReset();
    result = (int)GDALRasterAttributeTableShadow_GetValueAsInt(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_value_as_double(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetValueAsDouble", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetValueAsDouble", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","GetValueAsDouble", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    CPLErrorReset();
    result = (double)GDALRasterAttributeTableShadow_GetValueAsDouble(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_set_value_as_string(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  char *arg4 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","SetValueAsString", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","SetValueAsString", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","SetValueAsString", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","SetValueAsString", 4, argv[2] ));
  }
  arg4 = reinterpret_cast< char * >(buf4);
  {
    CPLErrorReset();
    GDALRasterAttributeTableShadow_SetValueAsString(arg1,arg2,arg3,(char const *)arg4);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return Qnil;
fail:
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_set_value_as_int(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","SetValueAsInt", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","SetValueAsInt", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","SetValueAsInt", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","SetValueAsInt", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  {
    CPLErrorReset();
    GDALRasterAttributeTableShadow_SetValueAsInt(arg1,arg2,arg3,arg4);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_set_value_as_double(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  double arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  double val4 ;
  int ecode4 = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","SetValueAsDouble", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","SetValueAsDouble", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","SetValueAsDouble", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_double(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","SetValueAsDouble", 4, argv[2] ));
  } 
  arg4 = static_cast< double >(val4);
  {
    CPLErrorReset();
    GDALRasterAttributeTableShadow_SetValueAsDouble(arg1,arg2,arg3,arg4);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_set_row_count(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","SetRowCount", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","SetRowCount", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    CPLErrorReset();
    GDALRasterAttributeTableShadow_SetRowCount(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_create_column(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  GDALRATFieldType arg3 ;
  GDALRATFieldUsage arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","CreateColumn", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","CreateColumn", 2, argv[0] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "GDALRATFieldType","CreateColumn", 3, argv[1] ));
  } 
  arg3 = static_cast< GDALRATFieldType >(val3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "GDALRATFieldUsage","CreateColumn", 4, argv[2] ));
  } 
  arg4 = static_cast< GDALRATFieldUsage >(val4);
  {
    CPLErrorReset();
    result = (int)GDALRasterAttributeTableShadow_CreateColumn(arg1,(char const *)arg2,arg3,arg4);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_linear_binning(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  double *arg2 = (double *) 0 ;
  double *arg3 = (double *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double temp2 ;
  int res2 = SWIG_TMPOBJ ;
  double temp3 ;
  int res3 = SWIG_TMPOBJ ;
  bool result;
  VALUE vresult = Qnil;
  
  arg2 = &temp2;
  arg3 = &temp3;
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetLinearBinning", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  {
    CPLErrorReset();
    result = (bool)GDALRasterAttributeTableShadow_GetLinearBinning(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsTmpObj(res2)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg2)));
  } else {
    int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res3)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg3)));
  } else {
    int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_double, new_flags));
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_set_linear_binning(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  double arg2 ;
  double arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","SetLinearBinning", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","SetLinearBinning", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","SetLinearBinning", 3, argv[1] ));
  } 
  arg3 = static_cast< double >(val3);
  {
    CPLErrorReset();
    result = (int)GDALRasterAttributeTableShadow_SetLinearBinning(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RasterAttributeTable_get_row_of_value(int argc, VALUE *argv, VALUE self) {
  GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterAttributeTableShadow *","GetRowOfValue", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GetRowOfValue", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    CPLErrorReset();
    result = (int)GDALRasterAttributeTableShadow_GetRowOfValue(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermProgress_nocb(int argc, VALUE *argv, VALUE self) {
  double arg1 ;
  char *arg2 = (char *) NULL ;
  void *arg3 = (void *) NULL ;
  double val1 ;
  int ecode1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *kwnames[] = {
    "dfProgress","pszMessage","pData", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","GDALTermProgress_nocb", 1, argv[0] ));
  } 
  arg1 = static_cast< double >(val1);
  if (argc > 1) {
    res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GDALTermProgress_nocb", 2, argv[1] ));
    }
    arg2 = reinterpret_cast< char * >(buf2);
  }
  if (argc > 2) {
    res3 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg3), 0, 0);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "void *","GDALTermProgress_nocb", 3, argv[2] )); 
    }
  }
  {
    CPLErrorReset();
    result = (int)GDALTermProgress_nocb(arg1,(char const *)arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_compute_median_cut_pct(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg3 = (GDALRasterBandShadow *) 0 ;
  int arg4 ;
  GDALColorTableShadow *arg5 = (GDALColorTableShadow *) 0 ;
  GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
  void *arg7 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 ;
  int res6 = 0 ;
  int res7 ;
  char *kwnames[] = {
    "red","green","blue","num_colors","colors","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 5) || (argc > 7)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeMedianCutPCT", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeMedianCutPCT", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
  res3 = SWIG_ConvertPtr(argv[2], &argp3,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeMedianCutPCT", 3, argv[2] )); 
  }
  arg3 = reinterpret_cast< GDALRasterBandShadow * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","ComputeMedianCutPCT", 4, argv[3] ));
  } 
  arg4 = static_cast< int >(val4);
  res5 = SWIG_ConvertPtr(argv[4], &argp5,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "GDALColorTableShadow *","ComputeMedianCutPCT", 5, argv[4] )); 
  }
  arg5 = reinterpret_cast< GDALColorTableShadow * >(argp5);
  if (argc > 5) {
    {
      res6 = SWIG_ConvertPtr(argv[5], &argp6, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res6)) {
        SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "GDALProgressFunc","ComputeMedianCutPCT", 6, argv[5] )); 
      }  
      if (!argp6) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","ComputeMedianCutPCT", 6, argv[5]));
      } else {
        arg6 = *(reinterpret_cast< GDALProgressFunc * >(argp6));
      }
    }
  }
  if (argc > 6) {
    res7 = SWIG_ConvertPtr(argv[6],SWIG_as_voidptrptr(&arg7), 0, 0);
    if (!SWIG_IsOK(res7)) {
      SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "void *","ComputeMedianCutPCT", 7, argv[6] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg5) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)ComputeMedianCutPCT(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_dither_rgb_2pct(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg3 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg4 = (GDALRasterBandShadow *) 0 ;
  GDALColorTableShadow *arg5 = (GDALColorTableShadow *) 0 ;
  GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
  void *arg7 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 ;
  int res6 = 0 ;
  int res7 ;
  char *kwnames[] = {
    "red","green","blue","target","colors","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 5) || (argc > 7)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","DitherRGB2PCT", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","DitherRGB2PCT", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
  res3 = SWIG_ConvertPtr(argv[2], &argp3,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","DitherRGB2PCT", 3, argv[2] )); 
  }
  arg3 = reinterpret_cast< GDALRasterBandShadow * >(argp3);
  res4 = SWIG_ConvertPtr(argv[3], &argp4,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","DitherRGB2PCT", 4, argv[3] )); 
  }
  arg4 = reinterpret_cast< GDALRasterBandShadow * >(argp4);
  res5 = SWIG_ConvertPtr(argv[4], &argp5,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "GDALColorTableShadow *","DitherRGB2PCT", 5, argv[4] )); 
  }
  arg5 = reinterpret_cast< GDALColorTableShadow * >(argp5);
  if (argc > 5) {
    {
      res6 = SWIG_ConvertPtr(argv[5], &argp6, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res6)) {
        SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "GDALProgressFunc","DitherRGB2PCT", 6, argv[5] )); 
      }  
      if (!argp6) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","DitherRGB2PCT", 6, argv[5]));
      } else {
        arg6 = *(reinterpret_cast< GDALProgressFunc * >(argp6));
      }
    }
  }
  if (argc > 6) {
    res7 = SWIG_ConvertPtr(argv[6],SWIG_as_voidptrptr(&arg7), 0, 0);
    if (!SWIG_IsOK(res7)) {
      SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "void *","DitherRGB2PCT", 7, argv[6] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg5) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)DitherRGB2PCT(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_reproject_image(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
  char *arg3 = (char *) NULL ;
  char *arg4 = (char *) NULL ;
  GDALResampleAlg arg5 = (GDALResampleAlg) GRA_NearestNeighbour ;
  double arg6 = (double) 0.0 ;
  double arg7 = (double) 0.0 ;
  GDALProgressFunc arg8 = (GDALProgressFunc) NULL ;
  void *arg9 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  double val6 ;
  int ecode6 = 0 ;
  double val7 ;
  int ecode7 = 0 ;
  void *argp8 ;
  int res8 = 0 ;
  int res9 ;
  CPLErr result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 9)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","ReprojectImage", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALDatasetShadow *","ReprojectImage", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALDatasetShadow * >(argp2);
  if (argc > 2) {
    res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","ReprojectImage", 3, argv[2] ));
    }
    arg3 = reinterpret_cast< char * >(buf3);
  }
  if (argc > 3) {
    res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","ReprojectImage", 4, argv[3] ));
    }
    arg4 = reinterpret_cast< char * >(buf4);
  }
  if (argc > 4) {
    {
      /* %typemap(in) CPLErr */
      arg5 = (GDALResampleAlg) NUM2INT(argv[4]);
    }
  }
  if (argc > 5) {
    ecode6 = SWIG_AsVal_double(argv[5], &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "double","ReprojectImage", 6, argv[5] ));
    } 
    arg6 = static_cast< double >(val6);
  }
  if (argc > 6) {
    ecode7 = SWIG_AsVal_double(argv[6], &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "double","ReprojectImage", 7, argv[6] ));
    } 
    arg7 = static_cast< double >(val7);
  }
  if (argc > 7) {
    {
      res8 = SWIG_ConvertPtr(argv[7], &argp8, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res8)) {
        SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "GDALProgressFunc","ReprojectImage", 8, argv[7] )); 
      }  
      if (!argp8) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","ReprojectImage", 8, argv[7]));
      } else {
        arg8 = *(reinterpret_cast< GDALProgressFunc * >(argp8));
      }
    }
  }
  if (argc > 8) {
    res9 = SWIG_ConvertPtr(argv[8],SWIG_as_voidptrptr(&arg9), 0, 0);
    if (!SWIG_IsOK(res9)) {
      SWIG_exception_fail(SWIG_ArgError(res9), Ruby_Format_TypeError( "", "void *","ReprojectImage", 9, argv[8] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (CPLErr)ReprojectImage(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8,arg9);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return vresult;
fail:
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_compute_proximity(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
  char **arg3 = (char **) NULL ;
  GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
  void *arg5 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp4 ;
  int res4 = 0 ;
  int res5 ;
  char *kwnames[] = {
    "srcBand","proximityBand","options","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 5)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeProximity", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ComputeProximity", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
  if (argc > 2) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[2], T_ARRAY);
      
      int size = RARRAY(argv[2])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[2], i);
        char *pszItem = StringValuePtr(item);
        arg3 = CSLAddString( arg3, pszItem );
      }
    }
  }
  if (argc > 3) {
    {
      res4 = SWIG_ConvertPtr(argv[3], &argp4, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "GDALProgressFunc","ComputeProximity", 4, argv[3] )); 
      }  
      if (!argp4) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","ComputeProximity", 4, argv[3]));
      } else {
        arg4 = *(reinterpret_cast< GDALProgressFunc * >(argp4));
      }
    }
  }
  if (argc > 4) {
    res5 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg5), 0, 0);
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "void *","ComputeProximity", 5, argv[4] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)ComputeProximity(arg1,arg2,arg3,arg4,arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg3 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg3 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_rasterize_layer(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  int arg2 ;
  int *arg3 = (int *) 0 ;
  OGRLayerShadow *arg4 = (OGRLayerShadow *) 0 ;
  void *arg5 = (void *) NULL ;
  void *arg6 = (void *) NULL ;
  int arg7 = (int) 0 ;
  double *arg8 = (double *) NULL ;
  char **arg9 = (char **) NULL ;
  GDALProgressFunc arg10 = (GDALProgressFunc) NULL ;
  void *arg11 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  int res5 ;
  int res6 ;
  int val7 ;
  int ecode7 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  void *argp10 ;
  int res10 = 0 ;
  int res11 ;
  char *kwnames[] = {
    "dataset","bands","layer","pfnTransformer","pTransformArg","burn_values","burn_values_list","options","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 10)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","RasterizeLayer", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  {
    /* %typemap(in,numinputs=1) (int nList, int* pList) */
    
    /* Make sure this is an array. */
    Check_Type(argv[1], T_ARRAY);
    
    /* Get the length */
    arg2 = RARRAY(argv[1])->len;
    
    /* Allocate space for the C array. */
    arg3 = (int*) malloc(arg2*sizeof(int));
    
    for( int i = 0; i<arg2; i++ ) {
      /* Get the Ruby Object */
      VALUE item = rb_ary_entry(argv[1],i);
      /* Conver to an integer */
      arg3[i] = NUM2INT(item);
    }
  }
  res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "OGRLayerShadow *","RasterizeLayer", 4, argv[2] )); 
  }
  arg4 = reinterpret_cast< OGRLayerShadow * >(argp4);
  if (argc > 3) {
    res5 = SWIG_ConvertPtr(argv[3],SWIG_as_voidptrptr(&arg5), 0, 0);
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "void *","RasterizeLayer", 5, argv[3] )); 
    }
  }
  if (argc > 4) {
    res6 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg6), 0, 0);
    if (!SWIG_IsOK(res6)) {
      SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","RasterizeLayer", 6, argv[4] )); 
    }
  }
  if (argc > 5) {
    ecode7 = SWIG_AsVal_int(argv[5], &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "int","RasterizeLayer", 7, argv[5] ));
    } 
    arg7 = static_cast< int >(val7);
  }
  if (argc > 6) {
    res8 = SWIG_ConvertPtr(argv[6], &argp8,SWIGTYPE_p_double, 0 |  0 );
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "double *","RasterizeLayer", 8, argv[6] )); 
    }
    arg8 = reinterpret_cast< double * >(argp8);
  }
  if (argc > 7) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[7], T_ARRAY);
      
      int size = RARRAY(argv[7])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[7], i);
        char *pszItem = StringValuePtr(item);
        arg9 = CSLAddString( arg9, pszItem );
      }
    }
  }
  if (argc > 8) {
    {
      res10 = SWIG_ConvertPtr(argv[8], &argp10, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res10)) {
        SWIG_exception_fail(SWIG_ArgError(res10), Ruby_Format_TypeError( "", "GDALProgressFunc","RasterizeLayer", 10, argv[8] )); 
      }  
      if (!argp10) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","RasterizeLayer", 10, argv[8]));
      } else {
        arg10 = *(reinterpret_cast< GDALProgressFunc * >(argp10));
      }
    }
  }
  if (argc > 9) {
    res11 = SWIG_ConvertPtr(argv[9],SWIG_as_voidptrptr(&arg11), 0, 0);
    if (!SWIG_IsOK(res11)) {
      SWIG_exception_fail(SWIG_ArgError(res11), Ruby_Format_TypeError( "", "void *","RasterizeLayer", 11, argv[9] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)RasterizeLayer(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg3) {
      free((void*) arg3);
    }
  }
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg9 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) (int nList, int* pList) */
    if (arg3) {
      free((void*) arg3);
    }
  }
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg9 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_polygonize(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
  OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
  int arg4 ;
  char **arg5 = (char **) NULL ;
  GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
  void *arg7 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp6 ;
  int res6 = 0 ;
  int res7 ;
  char *kwnames[] = {
    "srcBand","maskBand","outLayer","iPixValField","options","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 7)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","Polygonize", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","Polygonize", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
  res3 = SWIG_ConvertPtr(argv[2], &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "OGRLayerShadow *","Polygonize", 3, argv[2] )); 
  }
  arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","Polygonize", 4, argv[3] ));
  } 
  arg4 = static_cast< int >(val4);
  if (argc > 4) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[4], T_ARRAY);
      
      int size = RARRAY(argv[4])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[4], i);
        char *pszItem = StringValuePtr(item);
        arg5 = CSLAddString( arg5, pszItem );
      }
    }
  }
  if (argc > 5) {
    {
      res6 = SWIG_ConvertPtr(argv[5], &argp6, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res6)) {
        SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "GDALProgressFunc","Polygonize", 6, argv[5] )); 
      }  
      if (!argp6) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","Polygonize", 6, argv[5]));
      } else {
        arg6 = *(reinterpret_cast< GDALProgressFunc * >(argp6));
      }
    }
  }
  if (argc > 6) {
    res7 = SWIG_ConvertPtr(argv[6],SWIG_as_voidptrptr(&arg7), 0, 0);
    if (!SWIG_IsOK(res7)) {
      SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "void *","Polygonize", 7, argv[6] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)Polygonize(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg5 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg5 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_fill_nodata(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
  double arg3 ;
  int arg4 ;
  char **arg5 = (char **) NULL ;
  GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
  void *arg7 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp6 ;
  int res6 = 0 ;
  int res7 ;
  char *kwnames[] = {
    "targetBand","maskBand","maxSearchDist","smoothingIterations","options","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 7)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","FillNodata", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","FillNodata", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
  ecode3 = SWIG_AsVal_double(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","FillNodata", 3, argv[2] ));
  } 
  arg3 = static_cast< double >(val3);
  ecode4 = SWIG_AsVal_int(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","FillNodata", 4, argv[3] ));
  } 
  arg4 = static_cast< int >(val4);
  if (argc > 4) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[4], T_ARRAY);
      
      int size = RARRAY(argv[4])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[4], i);
        char *pszItem = StringValuePtr(item);
        arg5 = CSLAddString( arg5, pszItem );
      }
    }
  }
  if (argc > 5) {
    {
      res6 = SWIG_ConvertPtr(argv[5], &argp6, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res6)) {
        SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "GDALProgressFunc","FillNodata", 6, argv[5] )); 
      }  
      if (!argp6) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","FillNodata", 6, argv[5]));
      } else {
        arg6 = *(reinterpret_cast< GDALProgressFunc * >(argp6));
      }
    }
  }
  if (argc > 6) {
    res7 = SWIG_ConvertPtr(argv[6],SWIG_as_voidptrptr(&arg7), 0, 0);
    if (!SWIG_IsOK(res7)) {
      SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "void *","FillNodata", 7, argv[6] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)FillNodata(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg5 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg5 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_sieve_filter(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg3 = (GDALRasterBandShadow *) 0 ;
  int arg4 ;
  int arg5 = (int) 4 ;
  char **arg6 = (char **) NULL ;
  GDALProgressFunc arg7 = (GDALProgressFunc) NULL ;
  void *arg8 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  void *argp7 ;
  int res7 = 0 ;
  int res8 ;
  char *kwnames[] = {
    "srcBand","maskBand","dstBand","threshold","connectedness","options","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 8)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SieveFilter", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SieveFilter", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
  res3 = SWIG_ConvertPtr(argv[2], &argp3,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","SieveFilter", 3, argv[2] )); 
  }
  arg3 = reinterpret_cast< GDALRasterBandShadow * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","SieveFilter", 4, argv[3] ));
  } 
  arg4 = static_cast< int >(val4);
  if (argc > 4) {
    ecode5 = SWIG_AsVal_int(argv[4], &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","SieveFilter", 5, argv[4] ));
    } 
    arg5 = static_cast< int >(val5);
  }
  if (argc > 5) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[5], T_ARRAY);
      
      int size = RARRAY(argv[5])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[5], i);
        char *pszItem = StringValuePtr(item);
        arg6 = CSLAddString( arg6, pszItem );
      }
    }
  }
  if (argc > 6) {
    {
      res7 = SWIG_ConvertPtr(argv[6], &argp7, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res7)) {
        SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "GDALProgressFunc","SieveFilter", 7, argv[6] )); 
      }  
      if (!argp7) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","SieveFilter", 7, argv[6]));
      } else {
        arg7 = *(reinterpret_cast< GDALProgressFunc * >(argp7));
      }
    }
  }
  if (argc > 7) {
    res8 = SWIG_ConvertPtr(argv[7],SWIG_as_voidptrptr(&arg8), 0, 0);
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "void *","SieveFilter", 8, argv[7] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)SieveFilter(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg6 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg6 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_regenerate_overviews(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  int arg2 ;
  GDALRasterBandShadow **arg3 = (GDALRasterBandShadow **) 0 ;
  char *arg4 = (char *) "average" ;
  GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
  void *arg6 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  void *argp5 ;
  int res5 = 0 ;
  int res6 ;
  char *kwnames[] = {
    "srcBand","overviewBandCount","overviewBands","resampling","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 6)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","RegenerateOverviews", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","RegenerateOverviews", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(argv[2], &argp3,SWIGTYPE_p_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "GDALRasterBandShadow **","RegenerateOverviews", 3, argv[2] )); 
  }
  arg3 = reinterpret_cast< GDALRasterBandShadow ** >(argp3);
  if (argc > 3) {
    res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","RegenerateOverviews", 4, argv[3] ));
    }
    arg4 = reinterpret_cast< char * >(buf4);
  }
  if (argc > 4) {
    {
      res5 = SWIG_ConvertPtr(argv[4], &argp5, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res5)) {
        SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "GDALProgressFunc","RegenerateOverviews", 5, argv[4] )); 
      }  
      if (!argp5) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","RegenerateOverviews", 5, argv[4]));
      } else {
        arg5 = *(reinterpret_cast< GDALProgressFunc * >(argp5));
      }
    }
  }
  if (argc > 5) {
    res6 = SWIG_ConvertPtr(argv[5],SWIG_as_voidptrptr(&arg6), 0, 0);
    if (!SWIG_IsOK(res6)) {
      SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","RegenerateOverviews", 6, argv[5] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)RegenerateOverviews(arg1,arg2,arg3,(char const *)arg4,arg5,arg6);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return vresult;
fail:
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_regenerate_overview(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
  char *arg3 = (char *) "average" ;
  GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
  void *arg5 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  void *argp4 ;
  int res4 = 0 ;
  int res5 ;
  char *kwnames[] = {
    "srcBand","overviewBand","resampling","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 5)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","RegenerateOverview", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","RegenerateOverview", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
  if (argc > 2) {
    res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","RegenerateOverview", 3, argv[2] ));
    }
    arg3 = reinterpret_cast< char * >(buf3);
  }
  if (argc > 3) {
    {
      res4 = SWIG_ConvertPtr(argv[3], &argp4, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "GDALProgressFunc","RegenerateOverview", 4, argv[3] )); 
      }  
      if (!argp4) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","RegenerateOverview", 4, argv[3]));
      } else {
        arg4 = *(reinterpret_cast< GDALProgressFunc * >(argp4));
      }
    }
  }
  if (argc > 4) {
    res5 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg5), 0, 0);
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "void *","RegenerateOverview", 5, argv[4] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)RegenerateOverview(arg1,arg2,(char const *)arg3,arg4,arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return vresult;
fail:
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_contour_generate(int argc, VALUE *argv, VALUE self) {
  GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
  double arg2 ;
  double arg3 ;
  int arg4 ;
  double *arg5 = (double *) 0 ;
  int arg6 ;
  double arg7 ;
  OGRLayerShadow *arg8 = (OGRLayerShadow *) 0 ;
  int arg9 ;
  int arg10 ;
  GDALProgressFunc arg11 = (GDALProgressFunc) NULL ;
  void *arg12 = (void *) NULL ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  double val7 ;
  int ecode7 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  int val9 ;
  int ecode9 = 0 ;
  int val10 ;
  int ecode10 = 0 ;
  void *argp11 ;
  int res11 = 0 ;
  int res12 ;
  char *kwnames[] = {
    "srcBand","contourInterval","contourBase","fixedLevelCount","fixedLevels","useNoData","noDataValue","dstLayer","idField","elevField","callback","callback_data", NULL 
  };
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 10) || (argc > 12)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 10)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALRasterBandShadow *","ContourGenerate", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","ContourGenerate", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  ecode3 = SWIG_AsVal_double(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","ContourGenerate", 3, argv[2] ));
  } 
  arg3 = static_cast< double >(val3);
  ecode4 = SWIG_AsVal_int(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","ContourGenerate", 4, argv[3] ));
  } 
  arg4 = static_cast< int >(val4);
  res5 = SWIG_ConvertPtr(argv[4], &argp5,SWIGTYPE_p_double, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "double *","ContourGenerate", 5, argv[4] )); 
  }
  arg5 = reinterpret_cast< double * >(argp5);
  ecode6 = SWIG_AsVal_int(argv[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "int","ContourGenerate", 6, argv[5] ));
  } 
  arg6 = static_cast< int >(val6);
  ecode7 = SWIG_AsVal_double(argv[6], &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "double","ContourGenerate", 7, argv[6] ));
  } 
  arg7 = static_cast< double >(val7);
  res8 = SWIG_ConvertPtr(argv[7], &argp8,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
  if (!SWIG_IsOK(res8)) {
    SWIG_exception_fail(SWIG_ArgError(res8), Ruby_Format_TypeError( "", "OGRLayerShadow *","ContourGenerate", 8, argv[7] )); 
  }
  arg8 = reinterpret_cast< OGRLayerShadow * >(argp8);
  ecode9 = SWIG_AsVal_int(argv[8], &val9);
  if (!SWIG_IsOK(ecode9)) {
    SWIG_exception_fail(SWIG_ArgError(ecode9), Ruby_Format_TypeError( "", "int","ContourGenerate", 9, argv[8] ));
  } 
  arg9 = static_cast< int >(val9);
  ecode10 = SWIG_AsVal_int(argv[9], &val10);
  if (!SWIG_IsOK(ecode10)) {
    SWIG_exception_fail(SWIG_ArgError(ecode10), Ruby_Format_TypeError( "", "int","ContourGenerate", 10, argv[9] ));
  } 
  arg10 = static_cast< int >(val10);
  if (argc > 10) {
    {
      res11 = SWIG_ConvertPtr(argv[10], &argp11, SWIGTYPE_p_GDALProgressFunc,  0 );
      if (!SWIG_IsOK(res11)) {
        SWIG_exception_fail(SWIG_ArgError(res11), Ruby_Format_TypeError( "", "GDALProgressFunc","ContourGenerate", 11, argv[10] )); 
      }  
      if (!argp11) {
        SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "GDALProgressFunc","ContourGenerate", 11, argv[10]));
      } else {
        arg11 = *(reinterpret_cast< GDALProgressFunc * >(argp11));
      }
    }
  }
  if (argc > 11) {
    res12 = SWIG_ConvertPtr(argv[11],SWIG_as_voidptrptr(&arg12), 0, 0);
    if (!SWIG_IsOK(res12)) {
      SWIG_exception_fail(SWIG_ArgError(res12), Ruby_Format_TypeError( "", "void *","ContourGenerate", 12, argv[11] )); 
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg8) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (int)ContourGenerate(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_auto_create_warped_vrt(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  GDALResampleAlg arg4 = (GDALResampleAlg) GRA_NearestNeighbour ;
  double arg5 = (double) 0.0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  GDALDatasetShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 5)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","AutoCreateWarpedVRT", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  if (argc > 1) {
    res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","AutoCreateWarpedVRT", 2, argv[1] ));
    }
    arg2 = reinterpret_cast< char * >(buf2);
  }
  if (argc > 2) {
    res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","AutoCreateWarpedVRT", 3, argv[2] ));
    }
    arg3 = reinterpret_cast< char * >(buf3);
  }
  if (argc > 3) {
    {
      /* %typemap(in) CPLErr */
      arg4 = (GDALResampleAlg) NUM2INT(argv[3]);
    }
  }
  if (argc > 4) {
    ecode5 = SWIG_AsVal_double(argv[4], &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","AutoCreateWarpedVRT", 5, argv[4] ));
    } 
    arg5 = static_cast< double >(val5);
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (GDALDatasetShadow *)AutoCreateWarpedVRT(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_POINTER_OWN |  0 );
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


swig_class SwigClassTransformer;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Transformer_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Transformer_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GDALTransformerInfoShadow);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Transformer(int argc, VALUE *argv, VALUE self) {
  GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
  GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
  char **arg3 = (char **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  GDALTransformerInfoShadow *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GDALTransformerInfoShadow", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< GDALDatasetShadow * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "GDALDatasetShadow *","GDALTransformerInfoShadow", 2, argv[1] )); 
  }
  arg2 = reinterpret_cast< GDALDatasetShadow * >(argp2);
  {
    /* %typemap(in) char **options */
    
    /* Check if is a list */
    Check_Type(argv[2], T_ARRAY);
    
    int size = RARRAY(argv[2])->len;
    for (int i = 0; i < size; i++) {
      VALUE item = rb_ary_entry(argv[2], i);
      char *pszItem = StringValuePtr(item);
      arg3 = CSLAddString( arg3, pszItem );
    }
  }
  {
    CPLErrorReset();
    result = (GDALTransformerInfoShadow *)new_GDALTransformerInfoShadow(arg1,arg2,arg3);
    DATA_PTR(self) = result;
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg3 );
  }
  return self;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg3 );
  }
  return Qnil;
}


SWIGINTERN void delete_GDALTransformerInfoShadow(GDALTransformerInfoShadow *self){
    GDALDestroyTransformer( self );
  }
SWIGINTERN void
free_GDALTransformerInfoShadow(GDALTransformerInfoShadow *arg1) {
    delete_GDALTransformerInfoShadow(arg1);
}

SWIGINTERN VALUE
_wrap_Transformer_transform_point__SWIG_0(int argc, VALUE *argv, VALUE self) {
  GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
  int arg2 ;
  double *arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  double temp3[3] ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALTransformerInfoShadow *","TransformPoint", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","TransformPoint", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    /* %typemap(in) (double argin[ANY]) (double temp3[3]) */
    /* Make sure this is an array. */
    Check_Type(argv[1], T_ARRAY);
    
    /* Get the length */
    int seq_size = RARRAY(argv[1])->len;
    
    if ( seq_size != 3 ) {
      rb_raise(rb_eRangeError, "sequence must have length %i.", seq_size);
    }
    
    for( int i = 0; i<3; i++ ) {
      /* Get the Ruby Object */
      VALUE item = rb_ary_entry(argv[1],i);
      
      /* Convert to double and store in array*/
      temp3[i] = NUM2DBL(item);
    }
    
    /* Set argument arg3 equal to the temp3 array */
    arg3 = temp3;
  }
  {
    CPLErrorReset();
    result = (int)GDALTransformerInfoShadow_TransformPoint__SWIG_0(arg1,arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(argout) (double argout[ANY]) */
    VALUE outArr = rb_ary_new();
    
    for(int i=0; i<3; i++)
    {
      VALUE value = rb_float_new((arg3)[i]);
      rb_ary_push(outArr, value);
    }
    
    /* Add the output to the result */
    vresult = SWIG_Ruby_AppendOutput(vresult, outArr);	
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Transformer_transform_point__SWIG_1(int argc, VALUE *argv, VALUE self) {
  GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
  double *arg2 ;
  int arg3 ;
  double arg4 ;
  double arg5 ;
  double arg6 = (double) 0.0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double argout2[3] ;
  int val3 ;
  int ecode3 = 0 ;
  double val4 ;
  int ecode4 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  double val6 ;
  int ecode6 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double argout2[ANY]) */
    arg2 = argout2;
  }
  if ((argc < 3) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALTransformerInfoShadow *","TransformPoint", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
  ecode3 = SWIG_AsVal_int(argv[0], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","TransformPoint", 3, argv[0] ));
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_double(argv[1], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","TransformPoint", 4, argv[1] ));
  } 
  arg4 = static_cast< double >(val4);
  ecode5 = SWIG_AsVal_double(argv[2], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","TransformPoint", 5, argv[2] ));
  } 
  arg5 = static_cast< double >(val5);
  if (argc > 3) {
    ecode6 = SWIG_AsVal_double(argv[3], &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "double","TransformPoint", 6, argv[3] ));
    } 
    arg6 = static_cast< double >(val6);
  }
  {
    CPLErrorReset();
    result = (int)GDALTransformerInfoShadow_TransformPoint__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(argout) (double argout[ANY]) */
    VALUE outArr = rb_ary_new();
    
    for(int i=0; i<3; i++)
    {
      VALUE value = rb_float_new((arg2)[i]);
      rb_ary_push(outArr, value);
    }
    
    /* Add the output to the result */
    vresult = SWIG_Ruby_AppendOutput(vresult, outArr);	
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Transformer_transform_point(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[6];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 6) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_GDALTransformerInfoShadow, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_double, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_Transformer_transform_point__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  if ((argc >= 4) && (argc <= 5)) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_GDALTransformerInfoShadow, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_double(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_double(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            if (argc <= 4) {
              return _wrap_Transformer_transform_point__SWIG_1(nargs, args, self);
            }
            {
              int res = SWIG_AsVal_double(argv[4], NULL);
              _v = SWIG_CheckState(res);
            }
            if (_v) {
              return _wrap_Transformer_transform_point__SWIG_1(nargs, args, self);
            }
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 6, "transform_point", 
    "    int transform_point(int bDstToSrc, double inout[3])\n"
    "    int transform_point(double argout[3], int bDstToSrc, double x, double y, double z)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Transformer_transform_points(int argc, VALUE *argv, VALUE self) {
  GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
  int arg2 ;
  int arg3 ;
  double *arg4 = (double *) 0 ;
  double *arg5 = (double *) 0 ;
  double *arg6 = (double *) 0 ;
  int *arg7 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 6) || (argc > 6)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "GDALTransformerInfoShadow *","TransformPoints", 1, self )); 
  }
  arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","TransformPoints", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","TransformPoints", 3, argv[1] ));
  } 
  arg3 = static_cast< int >(val3);
  res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_double, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "double *","TransformPoints", 4, argv[2] )); 
  }
  arg4 = reinterpret_cast< double * >(argp4);
  res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_double, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "double *","TransformPoints", 5, argv[3] )); 
  }
  arg5 = reinterpret_cast< double * >(argp5);
  res6 = SWIG_ConvertPtr(argv[4], &argp6,SWIGTYPE_p_double, 0 |  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "double *","TransformPoints", 6, argv[4] )); 
  }
  arg6 = reinterpret_cast< double * >(argp6);
  res7 = SWIG_ConvertPtr(argv[5], &argp7,SWIGTYPE_p_int, 0 |  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "int *","TransformPoints", 7, argv[5] )); 
  }
  arg7 = reinterpret_cast< int * >(argp7);
  {
    CPLErrorReset();
    result = (int)GDALTransformerInfoShadow_TransformPoints(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdalapply_geo_transform(int argc, VALUE *argv, VALUE self) {
  double *arg1 ;
  double arg2 ;
  double arg3 ;
  double *arg4 = (double *) 0 ;
  double *arg5 = (double *) 0 ;
  double temp1[6] ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  double temp4 ;
  int res4 = SWIG_TMPOBJ ;
  double temp5 ;
  int res5 = SWIG_TMPOBJ ;
  VALUE vresult = Qnil;
  
  arg4 = &temp4;
  arg5 = &temp5;
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) (double argin[ANY]) (double temp1[6]) */
    /* Make sure this is an array. */
    Check_Type(argv[0], T_ARRAY);
    
    /* Get the length */
    int seq_size = RARRAY(argv[0])->len;
    
    if ( seq_size != 6 ) {
      rb_raise(rb_eRangeError, "sequence must have length %i.", seq_size);
    }
    
    for( int i = 0; i<6; i++ ) {
      /* Get the Ruby Object */
      VALUE item = rb_ary_entry(argv[0],i);
      
      /* Convert to double and store in array*/
      temp1[i] = NUM2DBL(item);
    }
    
    /* Set argument arg1 equal to the temp1 array */
    arg1 = temp1;
  }
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","GDALApplyGeoTransform", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  ecode3 = SWIG_AsVal_double(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","GDALApplyGeoTransform", 3, argv[2] ));
  } 
  arg3 = static_cast< double >(val3);
  {
    CPLErrorReset();
    GDALApplyGeoTransform(arg1,arg2,arg3,arg4,arg5);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = rb_ary_new();
  if (SWIG_IsTmpObj(res4)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg4)));
  } else {
    int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_double, new_flags));
  }
  if (SWIG_IsTmpObj(res5)) {
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_double((*arg5)));
  } else {
    int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
    vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags));
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdalinv_geo_transform(int argc, VALUE *argv, VALUE self) {
  double *arg1 ;
  double *arg2 ;
  double temp1[6] ;
  double argout2[6] ;
  int result;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in,numinputs=0) (double argout2[ANY]) */
    arg2 = argout2;
  }
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) (double argin[ANY]) (double temp1[6]) */
    /* Make sure this is an array. */
    Check_Type(argv[0], T_ARRAY);
    
    /* Get the length */
    int seq_size = RARRAY(argv[0])->len;
    
    if ( seq_size != 6 ) {
      rb_raise(rb_eRangeError, "sequence must have length %i.", seq_size);
    }
    
    for( int i = 0; i<6; i++ ) {
      /* Get the Ruby Object */
      VALUE item = rb_ary_entry(argv[0],i);
      
      /* Convert to double and store in array*/
      temp1[i] = NUM2DBL(item);
    }
    
    /* Set argument arg1 equal to the temp1 array */
    arg1 = temp1;
  }
  {
    CPLErrorReset();
    result = (int)GDALInvGeoTransform(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  {
    /* %typemap(argout) (double argout[ANY]) */
    VALUE outArr = rb_ary_new();
    
    for(int i=0; i<6; i++)
    {
      VALUE value = rb_float_new((arg2)[i]);
      rb_ary_push(outArr, value);
    }
    
    /* Add the output to the result */
    vresult = SWIG_Ruby_AppendOutput(vresult, outArr);	
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdalversion_info(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) "VERSION_NUM" ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  if (argc > 0) {
    res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","GDALVersionInfo", 1, argv[0] ));
    }
    arg1 = reinterpret_cast< char * >(buf1);
  }
  {
    CPLErrorReset();
    result = (char *)GDALVersionInfo((char const *)arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_all_register(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    GDALAllRegister();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_gdaldestroy_driver_manager(int argc, VALUE *argv, VALUE self) {
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    GDALDestroyDriverManager();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_cache_max(int argc, VALUE *argv, VALUE self) {
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (int)wrapper_GDALGetCacheMax();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_cache_used(int argc, VALUE *argv, VALUE self) {
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (int)wrapper_GDALGetCacheUsed();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_set_cache_max(int argc, VALUE *argv, VALUE self) {
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","wrapper_GDALSetCacheMax", 1, argv[0] ));
  } 
  arg1 = static_cast< int >(val1);
  {
    CPLErrorReset();
    wrapper_GDALSetCacheMax(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_data_type_size(int argc, VALUE *argv, VALUE self) {
  GDALDataType arg1 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) CPLErr */
    arg1 = (GDALDataType) NUM2INT(argv[0]);
  }
  {
    CPLErrorReset();
    result = (int)GDALGetDataTypeSize(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_data_type_is_complex(int argc, VALUE *argv, VALUE self) {
  GDALDataType arg1 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) CPLErr */
    arg1 = (GDALDataType) NUM2INT(argv[0]);
  }
  {
    CPLErrorReset();
    result = (int)GDALDataTypeIsComplex(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_data_type_name(int argc, VALUE *argv, VALUE self) {
  GDALDataType arg1 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) CPLErr */
    arg1 = (GDALDataType) NUM2INT(argv[0]);
  }
  {
    CPLErrorReset();
    result = (char *)GDALGetDataTypeName(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_data_type_by_name(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  GDALDataType result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","GDALGetDataTypeByName", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  {
    CPLErrorReset();
    result = (GDALDataType)GDALGetDataTypeByName((char const *)arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_color_interpretation_name(int argc, VALUE *argv, VALUE self) {
  GDALColorInterp arg1 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) CPLErr */
    arg1 = (GDALColorInterp) NUM2INT(argv[0]);
  }
  {
    CPLErrorReset();
    result = (char *)GDALGetColorInterpretationName(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_palette_interpretation_name(int argc, VALUE *argv, VALUE self) {
  GDALPaletteInterp arg1 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) CPLErr */
    arg1 = (GDALPaletteInterp) NUM2INT(argv[0]);
  }
  {
    CPLErrorReset();
    result = (char *)GDALGetPaletteInterpretationName(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_dec_to_dms(int argc, VALUE *argv, VALUE self) {
  double arg1 ;
  char *arg2 = (char *) 0 ;
  int arg3 = (int) 2 ;
  double val1 ;
  int ecode1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","GDALDecToDMS", 1, argv[0] ));
  } 
  arg1 = static_cast< double >(val1);
  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","GDALDecToDMS", 2, argv[1] ));
  }
  arg2 = reinterpret_cast< char * >(buf2);
  if (argc > 2) {
    ecode3 = SWIG_AsVal_int(argv[2], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","GDALDecToDMS", 3, argv[2] ));
    } 
    arg3 = static_cast< int >(val3);
  }
  {
    CPLErrorReset();
    result = (char *)GDALDecToDMS(arg1,(char const *)arg2,arg3);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_packed_dms_to_dec(int argc, VALUE *argv, VALUE self) {
  double arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","GDALPackedDMSToDec", 1, argv[0] ));
  } 
  arg1 = static_cast< double >(val1);
  {
    CPLErrorReset();
    result = (double)GDALPackedDMSToDec(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_dec_to_packed_dms(int argc, VALUE *argv, VALUE self) {
  double arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","GDALDecToPackedDMS", 1, argv[0] ));
  } 
  arg1 = static_cast< double >(val1);
  {
    CPLErrorReset();
    result = (double)GDALDecToPackedDMS(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_parse_xml_string(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  CPLXMLNode *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","CPLParseXMLString", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  {
    CPLErrorReset();
    result = (CPLXMLNode *)CPLParseXMLString(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) (CPLXMLNode*) */
    
    vresult = XMLTreeToRubyArray(result);
  }
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  {
    /* %typemap(ret) (CPLXMLNode*) */
    if ( result ) {
      CPLDestroyXMLNode( result );
    }
  }    return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_serialize_xml_tree(int argc, VALUE *argv, VALUE self) {
  CPLXMLNode *arg1 = (CPLXMLNode *) 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) (CPLXMLNode* xmlnode ) */
    arg1 = RubyArrayToXMLTree(argv[0]);
    
    if ( !arg1 ) {
      rb_raise(rb_eRuntimeError, "Could not convert Ruby Array to XML tree.");
    }
  }
  {
    CPLErrorReset();
    result = (char *)CPLSerializeXMLTree(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  {
    /* %typemap(freearg) (CPLXMLNode *xmlnode) */
    
    if ( arg1 ) {
      CPLDestroyXMLNode( arg1 );
    }
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) (CPLXMLNode *xmlnode) */
    
    if ( arg1 ) {
      CPLDestroyXMLNode( arg1 );
    }
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_driver_count(int argc, VALUE *argv, VALUE self) {
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    CPLErrorReset();
    result = (int)GetDriverCount();
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_driver_by_name(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  GDALDriverShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","GetDriverByName", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    CPLErrorReset();
    result = (GDALDriverShadow *)GetDriverByName((char const *)arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_get_driver(int argc, VALUE *argv, VALUE self) {
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  GDALDriverShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","GetDriver", 1, argv[0] ));
  } 
  arg1 = static_cast< int >(val1);
  {
    CPLErrorReset();
    result = (GDALDriverShadow *)GetDriver(arg1);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_open(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  GDALAccess arg2 = (GDALAccess) GA_ReadOnly ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  GDALDatasetShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","Open", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  if (argc > 1) {
    {
      /* %typemap(in) CPLErr */
      arg2 = (GDALAccess) NUM2INT(argv[1]);
    }
  }
  {
    CPLErrorReset();
    result = (GDALDatasetShadow *)Open((char const *)arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_POINTER_OWN |  0 );
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_open_shared(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  GDALAccess arg2 = (GDALAccess) GA_ReadOnly ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  GDALDatasetShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","OpenShared", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  if (argc > 1) {
    {
      /* %typemap(in) CPLErr */
      arg2 = (GDALAccess) NUM2INT(argv[1]);
    }
  }
  {
    CPLErrorReset();
    result = (GDALDatasetShadow *)OpenShared((char const *)arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_POINTER_OWN |  0 );
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_identify_driver(int argc, VALUE *argv, VALUE self) {
  char *arg1 = (char *) 0 ;
  char **arg2 = (char **) NULL ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  GDALDriverShadow *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","IdentifyDriver", 1, argv[0] ));
  }
  arg1 = reinterpret_cast< char * >(buf1);
  if (argc > 1) {
    {
      /* %typemap(in) char **options */
      
      /* Check if is a list */
      Check_Type(argv[1], T_ARRAY);
      
      int size = RARRAY(argv[1])->len;
      for (int i = 0; i < size; i++) {
        VALUE item = rb_ary_entry(argv[1], i);
        char *pszItem = StringValuePtr(item);
        arg2 = CSLAddString( arg2, pszItem );
      }
    }
  }
  {
    CPLErrorReset();
    result = (GDALDriverShadow *)IdentifyDriver((char const *)arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg2 );
  }
  return vresult;
fail:
  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg2 );
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_general_cmd_line_processor(int argc, VALUE *argv, VALUE self) {
  char **arg1 = (char **) 0 ;
  int arg2 = (int) 0 ;
  int val2 ;
  int ecode2 = 0 ;
  char **result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    /* %typemap(in) char **options */
    
    /* Check if is a list */
    Check_Type(argv[0], T_ARRAY);
    
    int size = RARRAY(argv[0])->len;
    for (int i = 0; i < size; i++) {
      VALUE item = rb_ary_entry(argv[0], i);
      char *pszItem = StringValuePtr(item);
      arg1 = CSLAddString( arg1, pszItem );
    }
  }
  if (argc > 1) {
    ecode2 = SWIG_AsVal_int(argv[1], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GeneralCmdLineProcessor", 2, argv[1] ));
    } 
    arg2 = static_cast< int >(val2);
  }
  {
    CPLErrorReset();
    result = (char **)GeneralCmdLineProcessor(arg1,arg2);
    CPLErr eclass = CPLGetLastErrorType();
    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
      SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
      
    }
    
    
    
    
    
    
    
    
    
    
    
  }
  {
    /* %typemap(out) char **options */
    
    char **stringarray = result;
    if ( stringarray == NULL ) {
      vresult = Qnil;
    }
    else {
      int len = CSLCount( stringarray );
      vresult = rb_ary_new2( len );
      for ( int i = 0; i < len; ++i, ++stringarray ) {
        VALUE nm = rb_str_new2( *stringarray );
        rb_ary_push(vresult, nm);
      }
    }
  }
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg1 );
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) char **options */
    
    CSLDestroy( arg1 );
  }
  return Qnil;
}



/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */

static void *_p_GDALDriverShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((GDALMajorObjectShadow *)  ((GDALDriverShadow *) x));
}
static void *_p_GDALDatasetShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((GDALMajorObjectShadow *)  ((GDALDatasetShadow *) x));
}
static void *_p_GDALRasterBandShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((GDALMajorObjectShadow *)  ((GDALRasterBandShadow *) x));
}
static swig_type_info _swigt__p_CPLErrorHandler = {"_p_CPLErrorHandler", "CPLErrorHandler *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CPLXMLNode = {"_p_CPLXMLNode", "CPLXMLNode *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GByte = {"_p_GByte", "GByte *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALAsyncReaderShadow = {"_p_GDALAsyncReaderShadow", "GDALAsyncReaderShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALColorEntry = {"_p_GDALColorEntry", "GDALColorEntry *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALColorTableShadow = {"_p_GDALColorTableShadow", "GDALColorTableShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALDatasetShadow = {"_p_GDALDatasetShadow", "GDALDatasetShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALDriverShadow = {"_p_GDALDriverShadow", "GDALDriverShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALMajorObjectShadow = {"_p_GDALMajorObjectShadow", "GDALMajorObjectShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALProgressFunc = {"_p_GDALProgressFunc", "GDALProgressFunc *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALRasterAttributeTableShadow = {"_p_GDALRasterAttributeTableShadow", "GDALRasterAttributeTableShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALRasterBandShadow = {"_p_GDALRasterBandShadow", "GDALRasterBandShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDALTransformerInfoShadow = {"_p_GDALTransformerInfoShadow", "GDALTransformerInfoShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDAL_GCP = {"_p_GDAL_GCP", "GDAL_GCP *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_OGRLayerShadow = {"_p_OGRLayerShadow", "OGRLayerShadow *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_double_p_q_const__char_p_void__int = {"_p_f_double_p_q_const__char_p_void__int", "int (*)(double,char const *,void *)", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "CPLErr *|GDALRATFieldType *|int *|GDALColorInterp *|GDALAccess *|GDALPaletteInterp *|GDALDataType *|GDALAsyncStatusType *|GDALRATFieldUsage *|GDALResampleAlg *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_GDALRasterBandShadow = {"_p_p_GDALRasterBandShadow", "GDALRasterBandShadow **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_GDAL_GCP = {"_p_p_GDAL_GCP", "GDAL_GCP **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_int = {"_p_p_int", "int **", 0, 0, (void*)0, 0};

static swig_type_info *swig_type_initial[] = {
  &_swigt__p_CPLErrorHandler,
  &_swigt__p_CPLXMLNode,
  &_swigt__p_GByte,
  &_swigt__p_GDALAsyncReaderShadow,
  &_swigt__p_GDALColorEntry,
  &_swigt__p_GDALColorTableShadow,
  &_swigt__p_GDALDatasetShadow,
  &_swigt__p_GDALDriverShadow,
  &_swigt__p_GDALMajorObjectShadow,
  &_swigt__p_GDALProgressFunc,
  &_swigt__p_GDALRasterAttributeTableShadow,
  &_swigt__p_GDALRasterBandShadow,
  &_swigt__p_GDALTransformerInfoShadow,
  &_swigt__p_GDAL_GCP,
  &_swigt__p_OGRLayerShadow,
  &_swigt__p_char,
  &_swigt__p_double,
  &_swigt__p_f_double_p_q_const__char_p_void__int,
  &_swigt__p_int,
  &_swigt__p_p_GDALRasterBandShadow,
  &_swigt__p_p_GDAL_GCP,
  &_swigt__p_p_char,
  &_swigt__p_p_int,
};

static swig_cast_info _swigc__p_CPLErrorHandler[] = {  {&_swigt__p_CPLErrorHandler, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CPLXMLNode[] = {  {&_swigt__p_CPLXMLNode, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GByte[] = {  {&_swigt__p_GByte, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALAsyncReaderShadow[] = {  {&_swigt__p_GDALAsyncReaderShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALColorEntry[] = {  {&_swigt__p_GDALColorEntry, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALColorTableShadow[] = {  {&_swigt__p_GDALColorTableShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALDatasetShadow[] = {  {&_swigt__p_GDALDatasetShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALDriverShadow[] = {  {&_swigt__p_GDALDriverShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALMajorObjectShadow[] = {  {&_swigt__p_GDALMajorObjectShadow, 0, 0, 0},  {&_swigt__p_GDALDriverShadow, _p_GDALDriverShadowTo_p_GDALMajorObjectShadow, 0, 0},  {&_swigt__p_GDALDatasetShadow, _p_GDALDatasetShadowTo_p_GDALMajorObjectShadow, 0, 0},  {&_swigt__p_GDALRasterBandShadow, _p_GDALRasterBandShadowTo_p_GDALMajorObjectShadow, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALProgressFunc[] = {  {&_swigt__p_GDALProgressFunc, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALRasterAttributeTableShadow[] = {  {&_swigt__p_GDALRasterAttributeTableShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALRasterBandShadow[] = {  {&_swigt__p_GDALRasterBandShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDALTransformerInfoShadow[] = {  {&_swigt__p_GDALTransformerInfoShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDAL_GCP[] = {  {&_swigt__p_GDAL_GCP, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_OGRLayerShadow[] = {  {&_swigt__p_OGRLayerShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_double_p_q_const__char_p_void__int[] = {  {&_swigt__p_f_double_p_q_const__char_p_void__int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_GDALRasterBandShadow[] = {  {&_swigt__p_p_GDALRasterBandShadow, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_GDAL_GCP[] = {  {&_swigt__p_p_GDAL_GCP, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_int[] = {  {&_swigt__p_p_int, 0, 0, 0},{0, 0, 0, 0}};

static swig_cast_info *swig_cast_initial[] = {
  _swigc__p_CPLErrorHandler,
  _swigc__p_CPLXMLNode,
  _swigc__p_GByte,
  _swigc__p_GDALAsyncReaderShadow,
  _swigc__p_GDALColorEntry,
  _swigc__p_GDALColorTableShadow,
  _swigc__p_GDALDatasetShadow,
  _swigc__p_GDALDriverShadow,
  _swigc__p_GDALMajorObjectShadow,
  _swigc__p_GDALProgressFunc,
  _swigc__p_GDALRasterAttributeTableShadow,
  _swigc__p_GDALRasterBandShadow,
  _swigc__p_GDALTransformerInfoShadow,
  _swigc__p_GDAL_GCP,
  _swigc__p_OGRLayerShadow,
  _swigc__p_char,
  _swigc__p_double,
  _swigc__p_f_double_p_q_const__char_p_void__int,
  _swigc__p_int,
  _swigc__p_p_GDALRasterBandShadow,
  _swigc__p_p_GDAL_GCP,
  _swigc__p_p_char,
  _swigc__p_p_int,
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */

/* -----------------------------------------------------------------------------
 * Type initialization:
 * This problem is tough by the requirement that no dynamic 
 * memory is used. Also, since swig_type_info structures store pointers to 
 * swig_cast_info structures and swig_cast_info structures store pointers back
 * to swig_type_info structures, we need some lookup code at initialization. 
 * The idea is that swig generates all the structures that are needed. 
 * The runtime then collects these partially filled structures. 
 * The SWIG_InitializeModule function takes these initial arrays out of 
 * swig_module, and does all the lookup, filling in the swig_module.types
 * array with the correct data and linking the correct swig_cast_info
 * structures together.
 *
 * The generated swig_type_info structures are assigned staticly to an initial 
 * array. We just loop through that array, and handle each type individually.
 * First we lookup if this type has been already loaded, and if so, use the
 * loaded structure instead of the generated one. Then we have to fill in the
 * cast linked list. The cast data is initially stored in something like a
 * two-dimensional array. Each row corresponds to a type (there are the same
 * number of rows as there are in the swig_type_initial array). Each entry in
 * a column is one of the swig_cast_info structures for that type.
 * The cast_initial array is actually an array of arrays, because each row has
 * a variable number of columns. So to actually build the cast linked list,
 * we find the array of casts associated with the type, and loop through it 
 * adding the casts to the list. The one last trick we need to do is making
 * sure the type pointer in the swig_cast_info struct is correct.
 *
 * First off, we lookup the cast->type name to see if it is already loaded. 
 * There are three cases to handle:
 *  1) If the cast->type has already been loaded AND the type we are adding
 *     casting info to has not been loaded (it is in this module), THEN we
 *     replace the cast->type pointer with the type pointer that has already
 *     been loaded.
 *  2) If BOTH types (the one we are adding casting info to, and the 
 *     cast->type) are loaded, THEN the cast info has already been loaded by
 *     the previous module so we just ignore it.
 *  3) Finally, if cast->type has not already been loaded, then we add that
 *     swig_cast_info to the linked list (because the cast->type) pointer will
 *     be correct.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif

#if 0
#define SWIGRUNTIME_DEBUG
#endif


SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
  size_t i;
  swig_module_info *module_head, *iter;
  int found, init;

  clientdata = clientdata;

  /* check to see if the circular list has been setup, if not, set it up */
  if (swig_module.next==0) {
    /* Initialize the swig_module */
    swig_module.type_initial = swig_type_initial;
    swig_module.cast_initial = swig_cast_initial;
    swig_module.next = &swig_module;
    init = 1;
  } else {
    init = 0;
  }

  /* Try and load any already created modules */
  module_head = SWIG_GetModule(clientdata);
  if (!module_head) {
    /* This is the first module loaded for this interpreter */
    /* so set the swig module into the interpreter */
    SWIG_SetModule(clientdata, &swig_module);
    module_head = &swig_module;
  } else {
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    found=0;
    iter=module_head;
    do {
      if (iter==&swig_module) {
        found=1;
        break;
      }
      iter=iter->next;
    } while (iter!= module_head);

    /* if the is found in the list, then all is done and we may leave */
    if (found) return;
    /* otherwise we must add out module into the list */
    swig_module.next = module_head->next;
    module_head->next = &swig_module;
  }

  /* When multiple interpeters are used, a module could have already been initialized in
     a different interpreter, but not yet have a pointer in this interpreter.
     In this case, we do not want to continue adding types... everything should be
     set up already */
  if (init == 0) return;

  /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
  for (i = 0; i < swig_module.size; ++i) {
    swig_type_info *type = 0;
    swig_type_info *ret;
    swig_cast_info *cast;
  
#ifdef SWIGRUNTIME_DEBUG
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif

    /* if there is another module already loaded */
    if (swig_module.next != &swig_module) {
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
    }
    if (type) {
      /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
      if (swig_module.type_initial[i]->clientdata) {
	type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
      }
    } else {
      type = swig_module.type_initial[i];
    }

    /* Insert casting types */
    cast = swig_module.cast_initial[i];
    while (cast->type) {
    
      /* Don't need to add information already in the list */
      ret = 0;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
      if (swig_module.next != &swig_module) {
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
      }
      if (ret) {
	if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
	  cast->type = ret;
	  ret = 0;
	} else {
	  /* Check for casting already in the list */
	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
	  if (!ocast) ret = 0;
	}
      }

      if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
        if (type->cast) {
          type->cast->prev = cast;
          cast->next = type->cast;
        }
        type->cast = cast;
      }
      cast++;
    }
    /* Set entry in modules->types array equal to the type */
    swig_module.types[i] = type;
  }
  swig_module.types[i] = 0;

#ifdef SWIGRUNTIME_DEBUG
  printf("**** SWIG_InitializeModule: Cast List ******\n");
  for (i = 0; i < swig_module.size; ++i) {
    int j = 0;
    swig_cast_info *cast = swig_module.cast_initial[i];
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
    while (cast->type) {
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
      cast++;
      ++j;
    }
  printf("---- Total casts: %d\n",j);
  }
  printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}

/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types.  It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
  size_t i;
  swig_cast_info *equiv;
  static int init_run = 0;

  if (init_run) return;
  init_run = 1;

  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)
            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        equiv = equiv->next;
      }
    }
  }
}

#ifdef __cplusplus
#if 0
{ /* c-mode */
#endif
}
#endif

/*

*/
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void Init_gdal(void) {
  size_t i;
  
  SWIG_InitRuntime();
  mGdal = rb_define_module("Gdal");
  mGdal = rb_define_module_under(mGdal, "Gdal");
  
  SWIG_InitializeModule(0);
  for (i = 0; i < swig_module.size; i++) {
    SWIG_define_class(swig_module.types[i]);
  }
  
  SWIG_RubyInitializeTrackings();
  
  /* gdal_ruby.i %init code */
  if ( GDALGetDriverCount() == 0 ) {
    GDALAllRegister();
  }
  
  rb_define_module_function(mGdal, "use_exceptions", VALUEFUNC(_wrap_use_exceptions), -1);
  rb_define_module_function(mGdal, "dont_use_exceptions", VALUEFUNC(_wrap_dont_use_exceptions), -1);
  rb_define_module_function(mGdal, "debug", VALUEFUNC(_wrap_debug), -1);
  rb_define_module_function(mGdal, "error", VALUEFUNC(_wrap_error), -1);
  rb_define_module_function(mGdal, "push_error_handler", VALUEFUNC(_wrap_push_error_handler), -1);
  rb_define_module_function(mGdal, "pop_error_handler", VALUEFUNC(_wrap_pop_error_handler), -1);
  rb_define_module_function(mGdal, "error_reset", VALUEFUNC(_wrap_error_reset), -1);
  rb_define_module_function(mGdal, "escape_string", VALUEFUNC(_wrap_escape_string), -1);
  rb_define_module_function(mGdal, "get_last_error_no", VALUEFUNC(_wrap_get_last_error_no), -1);
  rb_define_module_function(mGdal, "get_last_error_type", VALUEFUNC(_wrap_get_last_error_type), -1);
  rb_define_module_function(mGdal, "get_last_error_msg", VALUEFUNC(_wrap_get_last_error_msg), -1);
  rb_define_module_function(mGdal, "push_finder_location", VALUEFUNC(_wrap_push_finder_location), -1);
  rb_define_module_function(mGdal, "pop_finder_location", VALUEFUNC(_wrap_pop_finder_location), -1);
  rb_define_module_function(mGdal, "finder_clean", VALUEFUNC(_wrap_finder_clean), -1);
  rb_define_module_function(mGdal, "find_file", VALUEFUNC(_wrap_find_file), -1);
  rb_define_module_function(mGdal, "read_dir", VALUEFUNC(_wrap_read_dir), -1);
  rb_define_module_function(mGdal, "set_config_option", VALUEFUNC(_wrap_set_config_option), -1);
  rb_define_module_function(mGdal, "get_config_option", VALUEFUNC(_wrap_get_config_option), -1);
  rb_define_module_function(mGdal, "binary_to_hex", VALUEFUNC(_wrap_binary_to_hex), -1);
  rb_define_module_function(mGdal, "hex_to_binary", VALUEFUNC(_wrap_hex_to_binary), -1);
  
  SwigClassMajorObject.klass = rb_define_class_under(mGdal, "MajorObject", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GDALMajorObjectShadow, (void *) &SwigClassMajorObject);
  rb_undef_alloc_func(SwigClassMajorObject.klass);
  rb_define_method(SwigClassMajorObject.klass, "get_description", VALUEFUNC(_wrap_MajorObject_get_description), -1);
  rb_define_method(SwigClassMajorObject.klass, "set_description", VALUEFUNC(_wrap_MajorObject_set_description), -1);
  rb_define_method(SwigClassMajorObject.klass, "get_metadata_dict", VALUEFUNC(_wrap_MajorObject_get_metadata_dict), -1);
  rb_define_method(SwigClassMajorObject.klass, "get_metadata_list", VALUEFUNC(_wrap_MajorObject_get_metadata_list), -1);
  rb_define_method(SwigClassMajorObject.klass, "set_metadata", VALUEFUNC(_wrap_MajorObject_set_metadata), -1);
  rb_define_method(SwigClassMajorObject.klass, "get_metadata_item", VALUEFUNC(_wrap_MajorObject_get_metadata_item), -1);
  rb_define_method(SwigClassMajorObject.klass, "set_metadata_item", VALUEFUNC(_wrap_MajorObject_set_metadata_item), -1);
  SwigClassMajorObject.mark = 0;
  SwigClassMajorObject.trackObjects = 0;
  
  SwigClassDriver.klass = rb_define_class_under(mGdal, "Driver", ((swig_class *) SWIGTYPE_p_GDALMajorObjectShadow->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GDALDriverShadow, (void *) &SwigClassDriver);
  rb_undef_alloc_func(SwigClassDriver.klass);
  rb_define_method(SwigClassDriver.klass, "ShortName", VALUEFUNC(_wrap_Driver_ShortName_get), -1);
  rb_define_method(SwigClassDriver.klass, "LongName", VALUEFUNC(_wrap_Driver_LongName_get), -1);
  rb_define_method(SwigClassDriver.klass, "HelpTopic", VALUEFUNC(_wrap_Driver_HelpTopic_get), -1);
  rb_define_method(SwigClassDriver.klass, "create", VALUEFUNC(_wrap_Driver_create), -1);
  rb_define_method(SwigClassDriver.klass, "create_copy", VALUEFUNC(_wrap_Driver_create_copy), -1);
  rb_define_method(SwigClassDriver.klass, "delete", VALUEFUNC(_wrap_Driver_delete), -1);
  rb_define_method(SwigClassDriver.klass, "rename", VALUEFUNC(_wrap_Driver_rename), -1);
  rb_define_method(SwigClassDriver.klass, "register", VALUEFUNC(_wrap_Driver_register), -1);
  rb_define_method(SwigClassDriver.klass, "deregister", VALUEFUNC(_wrap_Driver_deregister), -1);
  SwigClassDriver.mark = 0;
  SwigClassDriver.trackObjects = 0;
  
  SwigClassColorEntry.klass = rb_define_class_under(mGdal, "ColorEntry", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GDALColorEntry, (void *) &SwigClassColorEntry);
  rb_define_alloc_func(SwigClassColorEntry.klass, _wrap_ColorEntry_allocate);
  rb_define_method(SwigClassColorEntry.klass, "initialize", VALUEFUNC(_wrap_new_ColorEntry), -1);
  rb_define_method(SwigClassColorEntry.klass, "c1=", VALUEFUNC(_wrap_ColorEntry_c1_set), -1);
  rb_define_method(SwigClassColorEntry.klass, "c1", VALUEFUNC(_wrap_ColorEntry_c1_get), -1);
  rb_define_method(SwigClassColorEntry.klass, "c2=", VALUEFUNC(_wrap_ColorEntry_c2_set), -1);
  rb_define_method(SwigClassColorEntry.klass, "c2", VALUEFUNC(_wrap_ColorEntry_c2_get), -1);
  rb_define_method(SwigClassColorEntry.klass, "c3=", VALUEFUNC(_wrap_ColorEntry_c3_set), -1);
  rb_define_method(SwigClassColorEntry.klass, "c3", VALUEFUNC(_wrap_ColorEntry_c3_get), -1);
  rb_define_method(SwigClassColorEntry.klass, "c4=", VALUEFUNC(_wrap_ColorEntry_c4_set), -1);
  rb_define_method(SwigClassColorEntry.klass, "c4", VALUEFUNC(_wrap_ColorEntry_c4_get), -1);
  SwigClassColorEntry.mark = 0;
  SwigClassColorEntry.destroy = (void (*)(void *)) free_GDALColorEntry;
  SwigClassColorEntry.trackObjects = 0;
  
  SwigClassGCP.klass = rb_define_class_under(mGdal, "GCP", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GDAL_GCP, (void *) &SwigClassGCP);
  rb_define_alloc_func(SwigClassGCP.klass, _wrap_GCP_allocate);
  rb_define_method(SwigClassGCP.klass, "initialize", VALUEFUNC(_wrap_new_GCP), -1);
  rb_define_method(SwigClassGCP.klass, "GCPX=", VALUEFUNC(_wrap_GCP_GCPX_set), -1);
  rb_define_method(SwigClassGCP.klass, "GCPX", VALUEFUNC(_wrap_GCP_GCPX_get), -1);
  rb_define_method(SwigClassGCP.klass, "GCPY=", VALUEFUNC(_wrap_GCP_GCPY_set), -1);
  rb_define_method(SwigClassGCP.klass, "GCPY", VALUEFUNC(_wrap_GCP_GCPY_get), -1);
  rb_define_method(SwigClassGCP.klass, "GCPZ=", VALUEFUNC(_wrap_GCP_GCPZ_set), -1);
  rb_define_method(SwigClassGCP.klass, "GCPZ", VALUEFUNC(_wrap_GCP_GCPZ_get), -1);
  rb_define_method(SwigClassGCP.klass, "GCPPixel=", VALUEFUNC(_wrap_GCP_GCPPixel_set), -1);
  rb_define_method(SwigClassGCP.klass, "GCPPixel", VALUEFUNC(_wrap_GCP_GCPPixel_get), -1);
  rb_define_method(SwigClassGCP.klass, "GCPLine=", VALUEFUNC(_wrap_GCP_GCPLine_set), -1);
  rb_define_method(SwigClassGCP.klass, "GCPLine", VALUEFUNC(_wrap_GCP_GCPLine_get), -1);
  rb_define_method(SwigClassGCP.klass, "Info=", VALUEFUNC(_wrap_GCP_Info_set), -1);
  rb_define_method(SwigClassGCP.klass, "Info", VALUEFUNC(_wrap_GCP_Info_get), -1);
  rb_define_method(SwigClassGCP.klass, "Id=", VALUEFUNC(_wrap_GCP_Id_set), -1);
  rb_define_method(SwigClassGCP.klass, "Id", VALUEFUNC(_wrap_GCP_Id_get), -1);
  SwigClassGCP.mark = 0;
  SwigClassGCP.destroy = (void (*)(void *)) free_GDAL_GCP;
  SwigClassGCP.trackObjects = 0;
  rb_define_module_function(mGdal, "gdal_gcp_gcpx_get", VALUEFUNC(_wrap_gdal_gcp_gcpx_get), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcpx_set", VALUEFUNC(_wrap_gdal_gcp_gcpx_set), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcpy_get", VALUEFUNC(_wrap_gdal_gcp_gcpy_get), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcpy_set", VALUEFUNC(_wrap_gdal_gcp_gcpy_set), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcpz_get", VALUEFUNC(_wrap_gdal_gcp_gcpz_get), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcpz_set", VALUEFUNC(_wrap_gdal_gcp_gcpz_set), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcppixel_get", VALUEFUNC(_wrap_gdal_gcp_gcppixel_get), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcppixel_set", VALUEFUNC(_wrap_gdal_gcp_gcppixel_set), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcpline_get", VALUEFUNC(_wrap_gdal_gcp_gcpline_get), -1);
  rb_define_module_function(mGdal, "gdal_gcp_gcpline_set", VALUEFUNC(_wrap_gdal_gcp_gcpline_set), -1);
  rb_define_module_function(mGdal, "gdal_gcp_info_get", VALUEFUNC(_wrap_gdal_gcp_info_get), -1);
  rb_define_module_function(mGdal, "gdal_gcp_info_set", VALUEFUNC(_wrap_gdal_gcp_info_set), -1);
  rb_define_module_function(mGdal, "gdal_gcp_id_get", VALUEFUNC(_wrap_gdal_gcp_id_get), -1);
  rb_define_module_function(mGdal, "gdal_gcp_id_set", VALUEFUNC(_wrap_gdal_gcp_id_set), -1);
  rb_define_module_function(mGdal, "gdal_gcp_get_gcpx", VALUEFUNC(_wrap_gdal_gcp_get_gcpx), -1);
  rb_define_module_function(mGdal, "gdal_gcp_set_gcpx", VALUEFUNC(_wrap_gdal_gcp_set_gcpx), -1);
  rb_define_module_function(mGdal, "gdal_gcp_get_gcpy", VALUEFUNC(_wrap_gdal_gcp_get_gcpy), -1);
  rb_define_module_function(mGdal, "gdal_gcp_set_gcpy", VALUEFUNC(_wrap_gdal_gcp_set_gcpy), -1);
  rb_define_module_function(mGdal, "gdal_gcp_get_gcpz", VALUEFUNC(_wrap_gdal_gcp_get_gcpz), -1);
  rb_define_module_function(mGdal, "gdal_gcp_set_gcpz", VALUEFUNC(_wrap_gdal_gcp_set_gcpz), -1);
  rb_define_module_function(mGdal, "gdal_gcp_get_gcppixel", VALUEFUNC(_wrap_gdal_gcp_get_gcppixel), -1);
  rb_define_module_function(mGdal, "gdal_gcp_set_gcppixel", VALUEFUNC(_wrap_gdal_gcp_set_gcppixel), -1);
  rb_define_module_function(mGdal, "gdal_gcp_get_gcpline", VALUEFUNC(_wrap_gdal_gcp_get_gcpline), -1);
  rb_define_module_function(mGdal, "gdal_gcp_set_gcpline", VALUEFUNC(_wrap_gdal_gcp_set_gcpline), -1);
  rb_define_module_function(mGdal, "gdal_gcp_get_info", VALUEFUNC(_wrap_gdal_gcp_get_info), -1);
  rb_define_module_function(mGdal, "gdal_gcp_set_info", VALUEFUNC(_wrap_gdal_gcp_set_info), -1);
  rb_define_module_function(mGdal, "gdal_gcp_get_id", VALUEFUNC(_wrap_gdal_gcp_get_id), -1);
  rb_define_module_function(mGdal, "gdal_gcp_set_id", VALUEFUNC(_wrap_gdal_gcp_set_id), -1);
  rb_define_module_function(mGdal, "gcps_to_geo_transform", VALUEFUNC(_wrap_gcps_to_geo_transform), -1);
  
  SwigClassAsyncReader.klass = rb_define_class_under(mGdal, "AsyncReader", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GDALAsyncReaderShadow, (void *) &SwigClassAsyncReader);
  rb_undef_alloc_func(SwigClassAsyncReader.klass);
  rb_define_method(SwigClassAsyncReader.klass, "get_next_updated_region", VALUEFUNC(_wrap_AsyncReader_get_next_updated_region), -1);
  rb_define_method(SwigClassAsyncReader.klass, "lock_buffer", VALUEFUNC(_wrap_AsyncReader_lock_buffer), -1);
  rb_define_method(SwigClassAsyncReader.klass, "unlock_buffer", VALUEFUNC(_wrap_AsyncReader_unlock_buffer), -1);
  SwigClassAsyncReader.mark = 0;
  SwigClassAsyncReader.destroy = (void (*)(void *)) free_GDALAsyncReaderShadow;
  SwigClassAsyncReader.trackObjects = 0;
  
  SwigClassDataset.klass = rb_define_class_under(mGdal, "Dataset", ((swig_class *) SWIGTYPE_p_GDALMajorObjectShadow->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GDALDatasetShadow, (void *) &SwigClassDataset);
  rb_undef_alloc_func(SwigClassDataset.klass);
  rb_define_method(SwigClassDataset.klass, "RasterXSize", VALUEFUNC(_wrap_Dataset_RasterXSize_get), -1);
  rb_define_method(SwigClassDataset.klass, "RasterYSize", VALUEFUNC(_wrap_Dataset_RasterYSize_get), -1);
  rb_define_method(SwigClassDataset.klass, "RasterCount", VALUEFUNC(_wrap_Dataset_RasterCount_get), -1);
  rb_define_method(SwigClassDataset.klass, "get_driver", VALUEFUNC(_wrap_Dataset_get_driver), -1);
  rb_define_method(SwigClassDataset.klass, "get_raster_band", VALUEFUNC(_wrap_Dataset_get_raster_band), -1);
  rb_define_method(SwigClassDataset.klass, "get_projection", VALUEFUNC(_wrap_Dataset_get_projection), -1);
  rb_define_method(SwigClassDataset.klass, "get_projection_ref", VALUEFUNC(_wrap_Dataset_get_projection_ref), -1);
  rb_define_method(SwigClassDataset.klass, "set_projection", VALUEFUNC(_wrap_Dataset_set_projection), -1);
  rb_define_method(SwigClassDataset.klass, "get_geo_transform", VALUEFUNC(_wrap_Dataset_get_geo_transform), -1);
  rb_define_method(SwigClassDataset.klass, "set_geo_transform", VALUEFUNC(_wrap_Dataset_set_geo_transform), -1);
  rb_define_method(SwigClassDataset.klass, "build_overviews", VALUEFUNC(_wrap_Dataset_build_overviews), -1);
  rb_define_method(SwigClassDataset.klass, "get_gcpcount", VALUEFUNC(_wrap_Dataset_get_gcpcount), -1);
  rb_define_method(SwigClassDataset.klass, "get_gcpprojection", VALUEFUNC(_wrap_Dataset_get_gcpprojection), -1);
  rb_define_method(SwigClassDataset.klass, "get_gcps", VALUEFUNC(_wrap_Dataset_get_gcps), -1);
  rb_define_method(SwigClassDataset.klass, "set_gcps", VALUEFUNC(_wrap_Dataset_set_gcps), -1);
  rb_define_method(SwigClassDataset.klass, "flush_cache", VALUEFUNC(_wrap_Dataset_flush_cache), -1);
  rb_define_method(SwigClassDataset.klass, "add_band", VALUEFUNC(_wrap_Dataset_add_band), -1);
  rb_define_method(SwigClassDataset.klass, "create_mask_band", VALUEFUNC(_wrap_Dataset_create_mask_band), -1);
  rb_define_method(SwigClassDataset.klass, "get_file_list", VALUEFUNC(_wrap_Dataset_get_file_list), -1);
  rb_define_method(SwigClassDataset.klass, "write_raster", VALUEFUNC(_wrap_Dataset_write_raster), -1);
  rb_define_method(SwigClassDataset.klass, "read_raster", VALUEFUNC(_wrap_Dataset_read_raster), -1);
  SwigClassDataset.mark = 0;
  SwigClassDataset.destroy = (void (*)(void *)) free_GDALDatasetShadow;
  SwigClassDataset.trackObjects = 0;
  
  SwigClassBand.klass = rb_define_class_under(mGdal, "Band", ((swig_class *) SWIGTYPE_p_GDALMajorObjectShadow->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GDALRasterBandShadow, (void *) &SwigClassBand);
  rb_undef_alloc_func(SwigClassBand.klass);
  rb_define_method(SwigClassBand.klass, "XSize", VALUEFUNC(_wrap_Band_XSize_get), -1);
  rb_define_method(SwigClassBand.klass, "YSize", VALUEFUNC(_wrap_Band_YSize_get), -1);
  rb_define_method(SwigClassBand.klass, "DataType", VALUEFUNC(_wrap_Band_DataType_get), -1);
  rb_define_method(SwigClassBand.klass, "get_band", VALUEFUNC(_wrap_Band_get_band), -1);
  rb_define_method(SwigClassBand.klass, "get_block_size", VALUEFUNC(_wrap_Band_get_block_size), -1);
  rb_define_method(SwigClassBand.klass, "get_color_interpretation", VALUEFUNC(_wrap_Band_get_color_interpretation), -1);
  rb_define_method(SwigClassBand.klass, "get_raster_color_interpretation", VALUEFUNC(_wrap_Band_get_raster_color_interpretation), -1);
  rb_define_method(SwigClassBand.klass, "set_color_interpretation", VALUEFUNC(_wrap_Band_set_color_interpretation), -1);
  rb_define_method(SwigClassBand.klass, "set_raster_color_interpretation", VALUEFUNC(_wrap_Band_set_raster_color_interpretation), -1);
  rb_define_method(SwigClassBand.klass, "get_no_data_value", VALUEFUNC(_wrap_Band_get_no_data_value), -1);
  rb_define_method(SwigClassBand.klass, "set_no_data_value", VALUEFUNC(_wrap_Band_set_no_data_value), -1);
  rb_define_method(SwigClassBand.klass, "get_unit_type", VALUEFUNC(_wrap_Band_get_unit_type), -1);
  rb_define_method(SwigClassBand.klass, "set_unit_type", VALUEFUNC(_wrap_Band_set_unit_type), -1);
  rb_define_method(SwigClassBand.klass, "get_raster_category_names", VALUEFUNC(_wrap_Band_get_raster_category_names), -1);
  rb_define_method(SwigClassBand.klass, "set_raster_category_names", VALUEFUNC(_wrap_Band_set_raster_category_names), -1);
  rb_define_method(SwigClassBand.klass, "get_minimum", VALUEFUNC(_wrap_Band_get_minimum), -1);
  rb_define_method(SwigClassBand.klass, "get_maximum", VALUEFUNC(_wrap_Band_get_maximum), -1);
  rb_define_method(SwigClassBand.klass, "get_offset", VALUEFUNC(_wrap_Band_get_offset), -1);
  rb_define_method(SwigClassBand.klass, "get_scale", VALUEFUNC(_wrap_Band_get_scale), -1);
  rb_define_method(SwigClassBand.klass, "set_offset", VALUEFUNC(_wrap_Band_set_offset), -1);
  rb_define_method(SwigClassBand.klass, "set_scale", VALUEFUNC(_wrap_Band_set_scale), -1);
  rb_define_method(SwigClassBand.klass, "get_statistics", VALUEFUNC(_wrap_Band_get_statistics), -1);
  rb_define_method(SwigClassBand.klass, "compute_statistics", VALUEFUNC(_wrap_Band_compute_statistics), -1);
  rb_define_method(SwigClassBand.klass, "set_statistics", VALUEFUNC(_wrap_Band_set_statistics), -1);
  rb_define_method(SwigClassBand.klass, "get_overview_count", VALUEFUNC(_wrap_Band_get_overview_count), -1);
  rb_define_method(SwigClassBand.klass, "get_overview", VALUEFUNC(_wrap_Band_get_overview), -1);
  rb_define_method(SwigClassBand.klass, "checksum", VALUEFUNC(_wrap_Band_checksum), -1);
  rb_define_method(SwigClassBand.klass, "compute_raster_min_max", VALUEFUNC(_wrap_Band_compute_raster_min_max), -1);
  rb_define_method(SwigClassBand.klass, "compute_band_stats", VALUEFUNC(_wrap_Band_compute_band_stats), -1);
  rb_define_method(SwigClassBand.klass, "fill", VALUEFUNC(_wrap_Band_fill), -1);
  rb_define_method(SwigClassBand.klass, "read_raster", VALUEFUNC(_wrap_Band_read_raster), -1);
  rb_define_method(SwigClassBand.klass, "write_raster", VALUEFUNC(_wrap_Band_write_raster), -1);
  rb_define_method(SwigClassBand.klass, "flush_cache", VALUEFUNC(_wrap_Band_flush_cache), -1);
  rb_define_method(SwigClassBand.klass, "get_raster_color_table", VALUEFUNC(_wrap_Band_get_raster_color_table), -1);
  rb_define_method(SwigClassBand.klass, "get_color_table", VALUEFUNC(_wrap_Band_get_color_table), -1);
  rb_define_method(SwigClassBand.klass, "set_raster_color_table", VALUEFUNC(_wrap_Band_set_raster_color_table), -1);
  rb_define_method(SwigClassBand.klass, "set_color_table", VALUEFUNC(_wrap_Band_set_color_table), -1);
  rb_define_method(SwigClassBand.klass, "get_default_rat", VALUEFUNC(_wrap_Band_get_default_rat), -1);
  rb_define_method(SwigClassBand.klass, "set_default_rat", VALUEFUNC(_wrap_Band_set_default_rat), -1);
  rb_define_method(SwigClassBand.klass, "get_mask_band", VALUEFUNC(_wrap_Band_get_mask_band), -1);
  rb_define_method(SwigClassBand.klass, "get_mask_flags", VALUEFUNC(_wrap_Band_get_mask_flags), -1);
  rb_define_method(SwigClassBand.klass, "create_mask_band", VALUEFUNC(_wrap_Band_create_mask_band), -1);
  rb_define_method(SwigClassBand.klass, "get_histogram", VALUEFUNC(_wrap_Band_get_histogram), -1);
  rb_define_method(SwigClassBand.klass, "get_default_histogram", VALUEFUNC(_wrap_Band_get_default_histogram), -1);
  rb_define_method(SwigClassBand.klass, "set_default_histogram", VALUEFUNC(_wrap_Band_set_default_histogram), -1);
  rb_define_method(SwigClassBand.klass, "has_arbitrary_overviews", VALUEFUNC(_wrap_Band_has_arbitrary_overviews), -1);
  SwigClassBand.mark = 0;
  SwigClassBand.trackObjects = 0;
  
  SwigClassColorTable.klass = rb_define_class_under(mGdal, "ColorTable", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GDALColorTableShadow, (void *) &SwigClassColorTable);
  rb_define_alloc_func(SwigClassColorTable.klass, _wrap_ColorTable_allocate);
  rb_define_method(SwigClassColorTable.klass, "initialize", VALUEFUNC(_wrap_new_ColorTable), -1);
  rb_define_method(SwigClassColorTable.klass, "clone", VALUEFUNC(_wrap_ColorTable_clone), -1);
  rb_define_method(SwigClassColorTable.klass, "get_palette_interpretation", VALUEFUNC(_wrap_ColorTable_get_palette_interpretation), -1);
  rb_define_method(SwigClassColorTable.klass, "get_count", VALUEFUNC(_wrap_ColorTable_get_count), -1);
  rb_define_method(SwigClassColorTable.klass, "get_color_entry", VALUEFUNC(_wrap_ColorTable_get_color_entry), -1);
  rb_define_method(SwigClassColorTable.klass, "get_color_entry_as_rgb", VALUEFUNC(_wrap_ColorTable_get_color_entry_as_rgb), -1);
  rb_define_method(SwigClassColorTable.klass, "set_color_entry", VALUEFUNC(_wrap_ColorTable_set_color_entry), -1);
  rb_define_method(SwigClassColorTable.klass, "create_color_ramp", VALUEFUNC(_wrap_ColorTable_create_color_ramp), -1);
  SwigClassColorTable.mark = 0;
  SwigClassColorTable.destroy = (void (*)(void *)) free_GDALColorTableShadow;
  SwigClassColorTable.trackObjects = 0;
  
  SwigClassRasterAttributeTable.klass = rb_define_class_under(mGdal, "RasterAttributeTable", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GDALRasterAttributeTableShadow, (void *) &SwigClassRasterAttributeTable);
  rb_define_alloc_func(SwigClassRasterAttributeTable.klass, _wrap_RasterAttributeTable_allocate);
  rb_define_method(SwigClassRasterAttributeTable.klass, "initialize", VALUEFUNC(_wrap_new_RasterAttributeTable), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "clone", VALUEFUNC(_wrap_RasterAttributeTable_clone), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_column_count", VALUEFUNC(_wrap_RasterAttributeTable_get_column_count), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_name_of_col", VALUEFUNC(_wrap_RasterAttributeTable_get_name_of_col), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_usage_of_col", VALUEFUNC(_wrap_RasterAttributeTable_get_usage_of_col), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_type_of_col", VALUEFUNC(_wrap_RasterAttributeTable_get_type_of_col), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_col_of_usage", VALUEFUNC(_wrap_RasterAttributeTable_get_col_of_usage), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_row_count", VALUEFUNC(_wrap_RasterAttributeTable_get_row_count), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_value_as_string", VALUEFUNC(_wrap_RasterAttributeTable_get_value_as_string), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_value_as_int", VALUEFUNC(_wrap_RasterAttributeTable_get_value_as_int), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_value_as_double", VALUEFUNC(_wrap_RasterAttributeTable_get_value_as_double), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "set_value_as_string", VALUEFUNC(_wrap_RasterAttributeTable_set_value_as_string), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "set_value_as_int", VALUEFUNC(_wrap_RasterAttributeTable_set_value_as_int), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "set_value_as_double", VALUEFUNC(_wrap_RasterAttributeTable_set_value_as_double), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "set_row_count", VALUEFUNC(_wrap_RasterAttributeTable_set_row_count), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "create_column", VALUEFUNC(_wrap_RasterAttributeTable_create_column), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_linear_binning", VALUEFUNC(_wrap_RasterAttributeTable_get_linear_binning), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "set_linear_binning", VALUEFUNC(_wrap_RasterAttributeTable_set_linear_binning), -1);
  rb_define_method(SwigClassRasterAttributeTable.klass, "get_row_of_value", VALUEFUNC(_wrap_RasterAttributeTable_get_row_of_value), -1);
  SwigClassRasterAttributeTable.mark = 0;
  SwigClassRasterAttributeTable.destroy = (void (*)(void *)) free_GDALRasterAttributeTableShadow;
  SwigClassRasterAttributeTable.trackObjects = 0;
  rb_define_module_function(mGdal, "TermProgress_nocb", VALUEFUNC(_wrap_TermProgress_nocb), -1);
  rb_define_const(mGdal, "TermProgress", SWIG_NewFunctionPtrObj((void *)(int (*)(double,char const *,void *))(GDALTermProgress), SWIGTYPE_p_f_double_p_q_const__char_p_void__int));
  rb_define_module_function(mGdal, "compute_median_cut_pct", VALUEFUNC(_wrap_compute_median_cut_pct), -1);
  rb_define_module_function(mGdal, "dither_rgb_2pct", VALUEFUNC(_wrap_dither_rgb_2pct), -1);
  rb_define_module_function(mGdal, "reproject_image", VALUEFUNC(_wrap_reproject_image), -1);
  rb_define_module_function(mGdal, "compute_proximity", VALUEFUNC(_wrap_compute_proximity), -1);
  rb_define_module_function(mGdal, "rasterize_layer", VALUEFUNC(_wrap_rasterize_layer), -1);
  rb_define_module_function(mGdal, "polygonize", VALUEFUNC(_wrap_polygonize), -1);
  rb_define_module_function(mGdal, "fill_nodata", VALUEFUNC(_wrap_fill_nodata), -1);
  rb_define_module_function(mGdal, "sieve_filter", VALUEFUNC(_wrap_sieve_filter), -1);
  rb_define_module_function(mGdal, "regenerate_overviews", VALUEFUNC(_wrap_regenerate_overviews), -1);
  rb_define_module_function(mGdal, "regenerate_overview", VALUEFUNC(_wrap_regenerate_overview), -1);
  rb_define_module_function(mGdal, "contour_generate", VALUEFUNC(_wrap_contour_generate), -1);
  rb_define_module_function(mGdal, "auto_create_warped_vrt", VALUEFUNC(_wrap_auto_create_warped_vrt), -1);
  
  SwigClassTransformer.klass = rb_define_class_under(mGdal, "Transformer", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GDALTransformerInfoShadow, (void *) &SwigClassTransformer);
  rb_define_alloc_func(SwigClassTransformer.klass, _wrap_Transformer_allocate);
  rb_define_method(SwigClassTransformer.klass, "initialize", VALUEFUNC(_wrap_new_Transformer), -1);
  rb_define_method(SwigClassTransformer.klass, "transform_point", VALUEFUNC(_wrap_Transformer_transform_point), -1);
  rb_define_method(SwigClassTransformer.klass, "transform_points", VALUEFUNC(_wrap_Transformer_transform_points), -1);
  SwigClassTransformer.mark = 0;
  SwigClassTransformer.destroy = (void (*)(void *)) free_GDALTransformerInfoShadow;
  SwigClassTransformer.trackObjects = 0;
  rb_define_module_function(mGdal, "gdalapply_geo_transform", VALUEFUNC(_wrap_gdalapply_geo_transform), -1);
  rb_define_module_function(mGdal, "gdalinv_geo_transform", VALUEFUNC(_wrap_gdalinv_geo_transform), -1);
  rb_define_module_function(mGdal, "gdalversion_info", VALUEFUNC(_wrap_gdalversion_info), -1);
  rb_define_module_function(mGdal, "all_register", VALUEFUNC(_wrap_all_register), -1);
  rb_define_module_function(mGdal, "gdaldestroy_driver_manager", VALUEFUNC(_wrap_gdaldestroy_driver_manager), -1);
  rb_define_module_function(mGdal, "get_cache_max", VALUEFUNC(_wrap_get_cache_max), -1);
  rb_define_module_function(mGdal, "get_cache_used", VALUEFUNC(_wrap_get_cache_used), -1);
  rb_define_module_function(mGdal, "set_cache_max", VALUEFUNC(_wrap_set_cache_max), -1);
  rb_define_module_function(mGdal, "get_data_type_size", VALUEFUNC(_wrap_get_data_type_size), -1);
  rb_define_module_function(mGdal, "data_type_is_complex", VALUEFUNC(_wrap_data_type_is_complex), -1);
  rb_define_module_function(mGdal, "get_data_type_name", VALUEFUNC(_wrap_get_data_type_name), -1);
  rb_define_module_function(mGdal, "get_data_type_by_name", VALUEFUNC(_wrap_get_data_type_by_name), -1);
  rb_define_module_function(mGdal, "get_color_interpretation_name", VALUEFUNC(_wrap_get_color_interpretation_name), -1);
  rb_define_module_function(mGdal, "get_palette_interpretation_name", VALUEFUNC(_wrap_get_palette_interpretation_name), -1);
  rb_define_module_function(mGdal, "dec_to_dms", VALUEFUNC(_wrap_dec_to_dms), -1);
  rb_define_module_function(mGdal, "packed_dms_to_dec", VALUEFUNC(_wrap_packed_dms_to_dec), -1);
  rb_define_module_function(mGdal, "dec_to_packed_dms", VALUEFUNC(_wrap_dec_to_packed_dms), -1);
  rb_define_module_function(mGdal, "parse_xml_string", VALUEFUNC(_wrap_parse_xml_string), -1);
  rb_define_module_function(mGdal, "serialize_xml_tree", VALUEFUNC(_wrap_serialize_xml_tree), -1);
  rb_define_module_function(mGdal, "get_driver_count", VALUEFUNC(_wrap_get_driver_count), -1);
  rb_define_module_function(mGdal, "get_driver_by_name", VALUEFUNC(_wrap_get_driver_by_name), -1);
  rb_define_module_function(mGdal, "get_driver", VALUEFUNC(_wrap_get_driver), -1);
  rb_define_module_function(mGdal, "open", VALUEFUNC(_wrap_open), -1);
  rb_define_module_function(mGdal, "open_shared", VALUEFUNC(_wrap_open_shared), -1);
  rb_define_module_function(mGdal, "identify_driver", VALUEFUNC(_wrap_identify_driver), -1);
  rb_define_module_function(mGdal, "general_cmd_line_processor", VALUEFUNC(_wrap_general_cmd_line_processor), -1);
}

