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

-- module HROOT.Class.Interface where

module HROOT.Core.TArrayF.Interface where


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

import HROOT.Core.TArrayF.RawType

import HROOT.Core.TArray.Interface
---- ============ ----



class (ITArray a) => ITArrayF a where

instance Existable TArrayF where
  data Exist TArrayF = forall a. (FPtr a, ITArrayF a) => ETArrayF a

upcastTArrayF :: (FPtr a, ITArrayF a) => a -> TArrayF
upcastTArrayF h = let fh = get_fptr h
                      fh2 :: ForeignPtr RawTArrayF = castForeignPtr fh
                  in cast_fptr_to_obj fh2

downcastTArrayF :: (FPtr a, ITArrayF a) => TArrayF -> a 
downcastTArrayF h = let fh = get_fptr h
                        fh2 = castForeignPtr fh
                    in cast_fptr_to_obj fh2