packages feed

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

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

class (ITNamed a, ITAttAxis a) => ITAxis a where
        findBinTAxis :: a -> CDouble -> IO CInt
        
        findFixBinTAxis :: a -> CDouble -> IO CInt
        
        getBinCenterTAxis :: a -> CInt -> IO CDouble
        
        getBinCenterLog :: a -> CInt -> IO CDouble
        
        getBinUpEdge :: a -> CInt -> IO CDouble
        
        setTimeDisplay :: a -> CInt -> IO ()
        
        setTimeFormat :: Castable c0 CString => a -> c0 -> IO ()
        
        setTimeOffset :: Castable c0 CString => a -> CDouble -> c0 -> IO ()

upcastTAxis :: forall a . (FPtr a, ITAxis a) => a -> TAxis
upcastTAxis h
  = let fh = get_fptr h
        fh2 :: Ptr RawTAxis = castPtr fh
      in cast_fptr_to_obj fh2

downcastTAxis :: forall a . (FPtr a, ITAxis a) => TAxis -> a
downcastTAxis h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2