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

-- module HROOT.Class.Interface where

module HROOT.Hist.TH1F.Interface where


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

import HROOT.Hist.TH1F.RawType

import HROOT.Hist.TH1.Interface
import HROOT.Core.TArrayF.Interface
---- ============ ----



class (ITH1 a,ITArrayF a) => ITH1F a where

instance Existable TH1F where
  data Exist TH1F = forall a. (FPtr a, ITH1F a) => ETH1F a

upcastTH1F :: (FPtr a, ITH1F a) => a -> TH1F
upcastTH1F h = let fh = get_fptr h
                   fh2 :: ForeignPtr RawTH1F = castForeignPtr fh
               in cast_fptr_to_obj fh2

downcastTH1F :: (FPtr a, ITH1F a) => TH1F -> a 
downcastTH1F h = let fh = get_fptr h
                     fh2 = castForeignPtr fh
                 in cast_fptr_to_obj fh2