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

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

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