packages feed

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

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

class ITVirtualPad a => ITPad a

upcastTPad :: forall a . (FPtr a, ITPad a) => a -> TPad
upcastTPad h
  = let fh = get_fptr h
        fh2 :: Ptr RawTPad = castPtr fh
      in cast_fptr_to_obj fh2

downcastTPad :: forall a . (FPtr a, ITPad a) => TPad -> a
downcastTPad h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2