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

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

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