{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, 
             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}

-- module HROOT.Class.Interface where

module HROOT.Class.TBranch.Interface where


import Data.Word
import Foreign.ForeignPtr
import HROOT.TypeCast

import HROOT.Class.TBranch.RawType

import HROOT.Class.TNamed.Interface
import HROOT.Class.TAttFill.Interface


class (ITNamed a,ITAttFill a) => ITBranch a where

instance Existable TBranch where
  data Exist TBranch = forall a. (FPtr a, ITBranch a) => ETBranch a

upcastTBranch :: (FPtr a, ITBranch a) => a -> TBranch
upcastTBranch h = let fh = get_fptr h
                      fh2 :: ForeignPtr RawTBranch = castForeignPtr fh
                  in cast_fptr_to_obj fh2