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

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

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