packages feed

HROOT-graf-0.9: src/HROOT/Graf/TCrown/Interface.hs

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

class ITEllipse a => ITCrown a

upcastTCrown :: forall a . (FPtr a, ITCrown a) => a -> TCrown
upcastTCrown h
  = let fh = get_fptr h
        fh2 :: Ptr RawTCrown = castPtr fh
      in cast_fptr_to_obj fh2

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