HROOT-core-0.8: src/HROOT/Core/TClass/Interface.hs
{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses,
FlexibleInstances, TypeSynonymInstances,
EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
-- module HROOT.Class.Interface where
module HROOT.Core.TClass.Interface where
import Data.Word
import Foreign.C
import Foreign.Ptr
import Foreign.ForeignPtr
import FFICXX.Runtime.Cast
import HROOT.Core.TClass.RawType
import HROOT.Core.TDictionary.Interface
---- ============ ----
class (ITDictionary a) => ITClass a where
instance Existable TClass where
data Exist TClass = forall a. (FPtr a, ITClass a) => ETClass a
upcastTClass :: (FPtr a, ITClass a) => a -> TClass
upcastTClass h = let fh = get_fptr h
fh2 :: ForeignPtr RawTClass = castForeignPtr fh
in cast_fptr_to_obj fh2
downcastTClass :: (FPtr a, ITClass a) => TClass -> a
downcastTClass h = let fh = get_fptr h
fh2 = castForeignPtr fh
in cast_fptr_to_obj fh2