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

-- module HROOT.Class.Interface where

module HROOT.Graf.TCrown.Interface where


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

import HROOT.Graf.TCrown.RawType

import HROOT.Graf.TEllipse.Interface
---- ============ ----



class (ITEllipse a) => ITCrown a where

instance Existable TCrown where
  data Exist TCrown = forall a. (FPtr a, ITCrown a) => ETCrown a

upcastTCrown :: (FPtr a, ITCrown a) => a -> TCrown
upcastTCrown h = let fh = get_fptr h
                     fh2 :: ForeignPtr RawTCrown = castForeignPtr fh
                 in cast_fptr_to_obj fh2

downcastTCrown :: (FPtr a, ITCrown a) => TCrown -> a 
downcastTCrown h = let fh = get_fptr h
                       fh2 = castForeignPtr fh
                   in cast_fptr_to_obj fh2