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

-- module HROOT.Class.Interface where

module HROOT.Hist.THStack.Interface where


import Data.Word
import Foreign.C
import Foreign.Ptr
import Foreign.ForeignPtr
import FFICXX.Runtime.Cast

import HROOT.Hist.THStack.RawType

import HROOT.Core.TNamed.Interface
---- ============ ----



class (ITNamed a) => ITHStack a where

instance Existable THStack where
  data Exist THStack = forall a. (FPtr a, ITHStack a) => ETHStack a

upcastTHStack :: (FPtr a, ITHStack a) => a -> THStack
upcastTHStack h = let fh = get_fptr h
                      fh2 :: ForeignPtr RawTHStack = castForeignPtr fh
                  in cast_fptr_to_obj fh2

downcastTHStack :: (FPtr a, ITHStack a) => THStack -> a 
downcastTHStack h = let fh = get_fptr h
                        fh2 = castForeignPtr fh
                    in cast_fptr_to_obj fh2