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

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

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