packages feed

HROOT-io-0.9: src/HROOT/IO/TFile/Interface.hs

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

class ITDirectoryFile a => ITFile a

upcastTFile :: forall a . (FPtr a, ITFile a) => a -> TFile
upcastTFile h
  = let fh = get_fptr h
        fh2 :: Ptr RawTFile = castPtr fh
      in cast_fptr_to_obj fh2

downcastTFile :: forall a . (FPtr a, ITFile a) => TFile -> a
downcastTFile h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2