packages feed

HROOT-hist-0.9: src/HROOT/Hist/TH1K/Interface.hs

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

class (ITH1 a, ITArrayF a) => ITH1K a

upcastTH1K :: forall a . (FPtr a, ITH1K a) => a -> TH1K
upcastTH1K h
  = let fh = get_fptr h
        fh2 :: Ptr RawTH1K = castPtr fh
      in cast_fptr_to_obj fh2

downcastTH1K :: forall a . (FPtr a, ITH1K a) => TH1K -> a
downcastTH1K h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2