packages feed

HROOT-core-0.10.0.1: src/HROOT/Core/TGlobal/Interface.hs

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

class (ITDictionary a) => ITGlobal a where

upcastTGlobal :: forall a . (FPtr a, ITGlobal a) => a -> TGlobal
upcastTGlobal h
  = let fh = get_fptr h
        fh2 :: Ptr RawTGlobal = castPtr fh
      in cast_fptr_to_obj fh2

downcastTGlobal :: forall a . (FPtr a, ITGlobal a) => TGlobal -> a
downcastTGlobal h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2