{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
  TypeSynonymInstances #-}
module HROOT.Hist.TAxis.Interface where
import Data.Word
import Data.Int
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
        
        setLimits :: () => a -> CDouble -> CDouble -> IO ()
        
        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 :: forall a. (FPtr a, ITAxis a) => a -> TAxis
upcastTAxis a
h
  = let fh :: Ptr (Raw a)
fh = a -> Ptr (Raw a)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr a
h
        Ptr RawTAxis
fh2 :: Ptr RawTAxis = Ptr (Raw a) -> Ptr RawTAxis
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw a)
fh
      in Ptr (Raw TAxis) -> TAxis
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw TAxis)
Ptr RawTAxis
fh2

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