î
ªÍ X›  ã               @   sJ   d  d l  m Z d  d l m Z d  d l m Z Gd d „  d e ƒ Z d S)é    )Úc_void_p)ÚGDALException)Úsixc               @   sI   e  Z d  Z d Z d Z e Z d d „  Z d d „  Z e	 e e ƒ Z
 d S)ÚGDALBasez
    Base object for GDAL objects that has a pointer access property
    that controls access to the underlying C pointer.
    Nc             C   s*   |  j  r |  j  St d |  j j ƒ ‚ d  S)Nz GDAL %s pointer no longer valid.)Ú_ptrr   Ú	__class__Ú__name__)Úself© r
   úJ/home/ubuntu/projects/ifolica/build/django/django/contrib/gis/gdal/base.pyÚ_get_ptr   s    	zGDALBase._get_ptrc             C   sa   t  | t j ƒ r' |  j | ƒ |  _ n6 | d  k sE t  | |  j ƒ rQ | |  _ n t d ƒ ‚ d  S)NzIncompatible pointer type)Ú
isinstancer   Úinteger_typesÚptr_typer   Ú	TypeError)r	   Úptrr
   r
   r   Ú_set_ptr   s
    zGDALBase._set_ptr)r   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   Úpropertyr   r
   r
   r
   r   r      s   	
r   N)Úctypesr   Zdjango.contrib.gis.gdal.errorr   Zdjango.utilsr   Úobjectr   r
   r
   r
   r   Ú<module>   s   