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

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

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