packages feed

HROOT-core-0.9: src/HROOT/Core/TROOT/Interface.hs

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

class ITDirectory a => ITROOT a

upcastTROOT :: forall a . (FPtr a, ITROOT a) => a -> TROOT
upcastTROOT h
  = let fh = get_fptr h
        fh2 :: Ptr RawTROOT = castPtr fh
      in cast_fptr_to_obj fh2

downcastTROOT :: forall a . (FPtr a, ITROOT a) => TROOT -> a
downcastTROOT h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2