packages feed

HROOT-math-0.10.0.1: src/HROOT/Math/TRandom/Interface.hs

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

class (ITNamed a) => ITRandom a where
        getSeed :: () => a -> IO CInt
        
        gaus :: () => a -> CDouble -> CDouble -> IO CDouble
        
        setSeed :: () => a -> CInt -> IO ()
        
        uniform :: () => a -> CDouble -> CDouble -> IO CDouble

upcastTRandom :: forall a . (FPtr a, ITRandom a) => a -> TRandom
upcastTRandom h
  = let fh = get_fptr h
        fh2 :: Ptr RawTRandom = castPtr fh
      in cast_fptr_to_obj fh2

downcastTRandom :: forall a . (FPtr a, ITRandom a) => TRandom -> a
downcastTRandom h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2