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

class (IDeletable a) => ITQObject a where

upcastTQObject :: forall a . (FPtr a, ITQObject a) => a -> TQObject
upcastTQObject :: forall a. (FPtr a, ITQObject a) => a -> TQObject
upcastTQObject 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 RawTQObject
fh2 :: Ptr RawTQObject = Ptr (Raw a) -> Ptr RawTQObject
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw a)
fh
      in Ptr (Raw TQObject) -> TQObject
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw TQObject)
Ptr RawTQObject
fh2

downcastTQObject ::
                 forall a . (FPtr a, ITQObject a) => TQObject -> a
downcastTQObject :: forall a. (FPtr a, ITQObject a) => TQObject -> a
downcastTQObject TQObject
h
  = let fh :: Ptr (Raw TQObject)
fh = TQObject -> Ptr (Raw TQObject)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr TQObject
h
        fh2 :: Ptr (Raw a)
fh2 = Ptr RawTQObject -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw TQObject)
Ptr RawTQObject
fh
      in Ptr (Raw a) -> a
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw a)
fh2