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

class (ITNamed a) => ITSystem a where
        processEvents :: () => a -> IO CBool

upcastTSystem :: forall a . (FPtr a, ITSystem a) => a -> TSystem
upcastTSystem :: forall a. (FPtr a, ITSystem a) => a -> TSystem
upcastTSystem 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 RawTSystem
fh2 :: Ptr RawTSystem = Ptr (Raw a) -> Ptr RawTSystem
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw a)
fh
      in Ptr (Raw TSystem) -> TSystem
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw TSystem)
Ptr RawTSystem
fh2

downcastTSystem :: forall a . (FPtr a, ITSystem a) => TSystem -> a
downcastTSystem :: forall a. (FPtr a, ITSystem a) => TSystem -> a
downcastTSystem TSystem
h
  = let fh :: Ptr (Raw TSystem)
fh = TSystem -> Ptr (Raw TSystem)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr TSystem
h
        fh2 :: Ptr (Raw a)
fh2 = Ptr RawTSystem -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw TSystem)
Ptr RawTSystem
fh
      in Ptr (Raw a) -> a
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw a)
fh2