HROOT-core-0.8: src/HROOT/Core/TArrayS/Interface.hs
{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses,
FlexibleInstances, TypeSynonymInstances,
EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
-- module HROOT.Class.Interface where
module HROOT.Core.TArrayS.Interface where
import Data.Word
import Foreign.C
import Foreign.Ptr
import Foreign.ForeignPtr
import FFICXX.Runtime.Cast
import HROOT.Core.TArrayS.RawType
import HROOT.Core.TArray.Interface
---- ============ ----
class (ITArray a) => ITArrayS a where
instance Existable TArrayS where
data Exist TArrayS = forall a. (FPtr a, ITArrayS a) => ETArrayS a
upcastTArrayS :: (FPtr a, ITArrayS a) => a -> TArrayS
upcastTArrayS h = let fh = get_fptr h
fh2 :: ForeignPtr RawTArrayS = castForeignPtr fh
in cast_fptr_to_obj fh2
downcastTArrayS :: (FPtr a, ITArrayS a) => TArrayS -> a
downcastTArrayS h = let fh = get_fptr h
fh2 = castForeignPtr fh
in cast_fptr_to_obj fh2