3
š(ƒh›  ã               @   s8   d dl mZ d dlmZ d dlmZ G dd„ deƒZdS )é    )Úc_void_p)ÚGDALException)Úsixc               @   s2   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 S td| jj ƒ‚d S )Nz GDAL %s pointer no longer valid.)Ú_ptrr   Ú	__class__Ú__name__)Úself© r
   ú@/tmp/pip-install-q3hcpn_q/Django/django/contrib/gis/gdal/base.pyÚ_get_ptr   s    zGDALBase._get_ptrc             C   sB   t |tjƒr| j|ƒ| _n$|d ks.t || jƒr6|| _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   