{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
  TypeSynonymInstances #-}
module HROOT.IO.TFile.Interface where
import Data.Word
import Data.Int
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 where

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

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