{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, 
             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}

-- module HROOT.Class.Interface where

module HROOT.IO.TDirectoryFile.Interface where


import Data.Word
import Foreign.C
import Foreign.Ptr
import Foreign.ForeignPtr
import FFICXX.Runtime.Cast

import HROOT.IO.TDirectoryFile.RawType

import HROOT.Core.TDirectory.Interface
---- ============ ----



class (ITDirectory a) => ITDirectoryFile a where

instance Existable TDirectoryFile where
  data Exist TDirectoryFile = forall a. (FPtr a, ITDirectoryFile a) => ETDirectoryFile a

upcastTDirectoryFile :: (FPtr a, ITDirectoryFile a) => a -> TDirectoryFile
upcastTDirectoryFile h = let fh = get_fptr h
                             fh2 :: ForeignPtr RawTDirectoryFile = castForeignPtr fh
                         in cast_fptr_to_obj fh2

downcastTDirectoryFile :: (FPtr a, ITDirectoryFile a) => TDirectoryFile -> a 
downcastTDirectoryFile h = let fh = get_fptr h
                               fh2 = castForeignPtr fh
                           in cast_fptr_to_obj fh2