{-# 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 h
  = let fh = get_fptr h
        fh2 :: Ptr RawTBranch = castPtr fh
      in cast_fptr_to_obj fh2

downcastTBranch :: forall a . (FPtr a, ITBranch a) => TBranch -> a
downcastTBranch h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2