{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
  #-}
module GDAL.OGRCurvePolygon.Cast where
import Foreign.Ptr
import FFICXX.Runtime.Cast
import System.IO.Unsafe
import GDAL.OGRCurvePolygon.RawType
import GDAL.OGRCurvePolygon.Interface

instance (IOGRCurvePolygon a, FPtr a) =>
         Castable (a) (Ptr RawOGRCurvePolygon)
         where
        cast :: forall r. a -> (Ptr RawOGRCurvePolygon -> IO r) -> IO r
cast a
x Ptr RawOGRCurvePolygon -> IO r
f = Ptr RawOGRCurvePolygon -> IO r
f (Ptr (Raw a) -> Ptr RawOGRCurvePolygon
forall a b. Ptr a -> Ptr b
castPtr (a -> Ptr (Raw a)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr a
x))
        uncast :: forall r. Ptr RawOGRCurvePolygon -> (a -> IO r) -> IO r
uncast Ptr RawOGRCurvePolygon
x a -> IO r
f = a -> IO r
f (Ptr (Raw a) -> a
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj (Ptr RawOGRCurvePolygon -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr RawOGRCurvePolygon
x))

instance () => Castable (OGRCurvePolygon) (Ptr RawOGRCurvePolygon)
         where
        cast :: forall r.
OGRCurvePolygon -> (Ptr RawOGRCurvePolygon -> IO r) -> IO r
cast OGRCurvePolygon
x Ptr RawOGRCurvePolygon -> IO r
f = Ptr RawOGRCurvePolygon -> IO r
f (Ptr RawOGRCurvePolygon -> Ptr RawOGRCurvePolygon
forall a b. Ptr a -> Ptr b
castPtr (OGRCurvePolygon -> Ptr (Raw OGRCurvePolygon)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr OGRCurvePolygon
x))
        uncast :: forall r.
Ptr RawOGRCurvePolygon -> (OGRCurvePolygon -> IO r) -> IO r
uncast Ptr RawOGRCurvePolygon
x OGRCurvePolygon -> IO r
f = OGRCurvePolygon -> IO r
f (Ptr (Raw OGRCurvePolygon) -> OGRCurvePolygon
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj (Ptr RawOGRCurvePolygon -> Ptr RawOGRCurvePolygon
forall a b. Ptr a -> Ptr b
castPtr Ptr RawOGRCurvePolygon
x))