packages feed

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

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

class ITShape a => ITPCON a

upcastTPCON :: forall a . (FPtr a, ITPCON a) => a -> TPCON
upcastTPCON h
  = let fh = get_fptr h
        fh2 :: Ptr RawTPCON = castPtr fh
      in cast_fptr_to_obj fh2

downcastTPCON :: forall a . (FPtr a, ITPCON a) => TPCON -> a
downcastTPCON h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2