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

-- module HROOT.Class.Interface where

module HROOT.Hist.TH2C.Interface where


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

import HROOT.Hist.TH2C.RawType

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



class (ITH2 a,ITArrayC a) => ITH2C a where

instance Existable TH2C where
  data Exist TH2C = forall a. (FPtr a, ITH2C a) => ETH2C a

upcastTH2C :: (FPtr a, ITH2C a) => a -> TH2C
upcastTH2C h = let fh = get_fptr h
                   fh2 :: ForeignPtr RawTH2C = castForeignPtr fh
               in cast_fptr_to_obj fh2

downcastTH2C :: (FPtr a, ITH2C a) => TH2C -> a 
downcastTH2C h = let fh = get_fptr h
                     fh2 = castForeignPtr fh
                 in cast_fptr_to_obj fh2