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

-- module HROOT.Class.Interface where

module HROOT.Hist.TH2F.Interface where


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

import HROOT.Hist.TH2F.RawType

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



class (ITH2 a,ITArrayF a) => ITH2F a where

instance Existable TH2F where
  data Exist TH2F = forall a. (FPtr a, ITH2F a) => ETH2F a

upcastTH2F :: (FPtr a, ITH2F a) => a -> TH2F
upcastTH2F h = let fh = get_fptr h
                   fh2 :: ForeignPtr RawTH2F = castForeignPtr fh
               in cast_fptr_to_obj fh2

downcastTH2F :: (FPtr a, ITH2F a) => TH2F -> a 
downcastTH2F h = let fh = get_fptr h
                     fh2 = castForeignPtr fh
                 in cast_fptr_to_obj fh2