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

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

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