{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, 
             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}

-- module HROOT.Class.Interface where

module HROOT.Core.TApplication.Interface where


import Data.Word
import Foreign.C
import Foreign.Ptr
import Foreign.ForeignPtr
import FFICXX.Runtime.Cast

import HROOT.Core.TApplication.RawType

import HROOT.Core.TObject.Interface
import HROOT.Core.TQObject.Interface
---- ============ ----



class (ITObject a,ITQObject a) => ITApplication a where

    run :: a -> CInt -> IO () 

instance Existable TApplication where
  data Exist TApplication = forall a. (FPtr a, ITApplication a) => ETApplication a

upcastTApplication :: (FPtr a, ITApplication a) => a -> TApplication
upcastTApplication h = let fh = get_fptr h
                           fh2 :: ForeignPtr RawTApplication = castForeignPtr fh
                       in cast_fptr_to_obj fh2

downcastTApplication :: (FPtr a, ITApplication a) => TApplication -> a 
downcastTApplication h = let fh = get_fptr h
                             fh2 = castForeignPtr fh
                         in cast_fptr_to_obj fh2