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

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

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