packages feed

HROOT-core-0.9: src/HROOT/Core/TArrayI/Interface.hs

{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
  TypeSynonymInstances #-}
module HROOT.Core.TArrayI.Interface where
import Data.Word
import Foreign.C
import Foreign.Ptr
import FFICXX.Runtime.Cast
import HROOT.Core.TArrayI.RawType
import HROOT.Core.TArray.Interface

class ITArray a => ITArrayI a

upcastTArrayI :: forall a . (FPtr a, ITArrayI a) => a -> TArrayI
upcastTArrayI h
  = let fh = get_fptr h
        fh2 :: Ptr RawTArrayI = castPtr fh
      in cast_fptr_to_obj fh2

downcastTArrayI :: forall a . (FPtr a, ITArrayI a) => TArrayI -> a
downcastTArrayI h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2