packages feed

HROOT-io-0.10.0.1: src/HROOT/IO/TMemFile/Interface.hs

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

class (ITFile a) => ITMemFile a where

upcastTMemFile :: forall a . (FPtr a, ITMemFile a) => a -> TMemFile
upcastTMemFile h
  = let fh = get_fptr h
        fh2 :: Ptr RawTMemFile = castPtr fh
      in cast_fptr_to_obj fh2

downcastTMemFile ::
                 forall a . (FPtr a, ITMemFile a) => TMemFile -> a
downcastTMemFile h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2