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

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

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