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

-- module HROOT.Class.Interface where

module HROOT.Hist.TH1C.Interface where


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

import HROOT.Hist.TH1C.RawType

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



class (ITH1 a,ITArrayC a) => ITH1C a where

instance Existable TH1C where
  data Exist TH1C = forall a. (FPtr a, ITH1C a) => ETH1C a

upcastTH1C :: (FPtr a, ITH1C a) => a -> TH1C
upcastTH1C h = let fh = get_fptr h
                   fh2 :: ForeignPtr RawTH1C = castForeignPtr fh
               in cast_fptr_to_obj fh2

downcastTH1C :: (FPtr a, ITH1C a) => TH1C -> a 
downcastTH1C h = let fh = get_fptr h
                     fh2 = castForeignPtr fh
                 in cast_fptr_to_obj fh2