packages feed

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

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

class ITShape a => ITTUBE a

upcastTTUBE :: forall a . (FPtr a, ITTUBE a) => a -> TTUBE
upcastTTUBE h
  = let fh = get_fptr h
        fh2 :: Ptr RawTTUBE = castPtr fh
      in cast_fptr_to_obj fh2

downcastTTUBE :: forall a . (FPtr a, ITTUBE a) => TTUBE -> a
downcastTTUBE h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2