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

instance (IOGRCurve a, FPtr a) => Castable (a) (Ptr RawOGRCurve)
         where
        cast :: forall r. a -> (Ptr RawOGRCurve -> IO r) -> IO r
cast a
x Ptr RawOGRCurve -> IO r
f = Ptr RawOGRCurve -> IO r
f (Ptr (Raw a) -> Ptr RawOGRCurve
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 RawOGRCurve -> (a -> IO r) -> IO r
uncast Ptr RawOGRCurve
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 RawOGRCurve -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr RawOGRCurve
x))

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