packages feed

HROOT-core-0.10.0.1: src/HROOT/Core/TQObject/Interface.hs

{-# 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 h
  = let fh = get_fptr h
        fh2 :: Ptr RawTQObject = castPtr fh
      in cast_fptr_to_obj fh2

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