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

-- module HROOT.Class.Interface where

module HROOT.Hist.TH1S.Interface where


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

import HROOT.Hist.TH1S.RawType

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



class (ITH1 a,ITArrayS a) => ITH1S a where

instance Existable TH1S where
  data Exist TH1S = forall a. (FPtr a, ITH1S a) => ETH1S a

upcastTH1S :: (FPtr a, ITH1S a) => a -> TH1S
upcastTH1S h = let fh = get_fptr h
                   fh2 :: ForeignPtr RawTH1S = castForeignPtr fh
               in cast_fptr_to_obj fh2

downcastTH1S :: (FPtr a, ITH1S a) => TH1S -> a 
downcastTH1S h = let fh = get_fptr h
                     fh2 = castForeignPtr fh
                 in cast_fptr_to_obj fh2