packages feed

HROOT-core-0.10.0.1: src/HROOT/Core/TArray/Interface.hs

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

class (IDeletable a) => ITArray a where
        getAt :: () => a -> CInt -> IO CDouble
        
        setArray :: () => a -> CInt -> IO ()
        
        setAt :: () => a -> CDouble -> CInt -> IO ()

upcastTArray :: forall a . (FPtr a, ITArray a) => a -> TArray
upcastTArray h
  = let fh = get_fptr h
        fh2 :: Ptr RawTArray = castPtr fh
      in cast_fptr_to_obj fh2

downcastTArray :: forall a . (FPtr a, ITArray a) => TArray -> a
downcastTArray h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2