{-# LANGUAGE EmptyDataDecls, ExistentialQuantification, FlexibleContexts, FlexibleInstances, ForeignFunctionInterface, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies, TypeSynonymInstances #-} module HROOT.Tree.TBranch.Interface where import Data.Word import Data.Int import Foreign.C import Foreign.Ptr import FFICXX.Runtime.Cast import HROOT.Tree.TBranch.RawType import HROOT.Core.TNamed.Interface import HROOT.Core.TAttFill.Interface class (ITNamed a, ITAttFill a) => ITBranch a where upcastTBranch :: forall a . (FPtr a, ITBranch a) => a -> TBranch upcastTBranch :: forall a. (FPtr a, ITBranch a) => a -> TBranch upcastTBranch a h = let fh :: Ptr (Raw a) fh = a -> Ptr (Raw a) forall a. FPtr a => a -> Ptr (Raw a) get_fptr a h Ptr RawTBranch fh2 :: Ptr RawTBranch = Ptr (Raw a) -> Ptr RawTBranch forall a b. Ptr a -> Ptr b castPtr Ptr (Raw a) fh in Ptr (Raw TBranch) -> TBranch forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj Ptr (Raw TBranch) Ptr RawTBranch fh2 downcastTBranch :: forall a . (FPtr a, ITBranch a) => TBranch -> a downcastTBranch :: forall a. (FPtr a, ITBranch a) => TBranch -> a downcastTBranch TBranch h = let fh :: Ptr (Raw TBranch) fh = TBranch -> Ptr (Raw TBranch) forall a. FPtr a => a -> Ptr (Raw a) get_fptr TBranch h fh2 :: Ptr (Raw a) fh2 = Ptr RawTBranch -> Ptr (Raw a) forall a b. Ptr a -> Ptr b castPtr Ptr (Raw TBranch) Ptr RawTBranch fh in Ptr (Raw a) -> a forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj Ptr (Raw a) fh2