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

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

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