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

-- module HROOT.Class.Interface where

module HROOT.Class.TTree.Interface where


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

import HROOT.Class.TTree.RawType

import HROOT.Class.TNamed.Interface
import HROOT.Class.TAttLine.Interface
import HROOT.Class.TAttFill.Interface
import HROOT.Class.TAttMarker.Interface


class (ITNamed a,ITAttLine a,ITAttFill a,ITAttMarker a) => ITTree a where

instance Existable TTree where
  data Exist TTree = forall a. (FPtr a, ITTree a) => ETTree a

upcastTTree :: (FPtr a, ITTree a) => a -> TTree
upcastTTree h = let fh = get_fptr h
                    fh2 :: ForeignPtr RawTTree = castForeignPtr fh
                in cast_fptr_to_obj fh2