{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, 
             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}

-- module HROOT.Class.Interface where

module HROOT.Class.TAxis.Interface where


import Data.Word
import Foreign.ForeignPtr
import HROOT.TypeCast

import HROOT.Class.TAxis.RawType

import HROOT.Class.TNamed.Interface
import HROOT.Class.TAttAxis.Interface


class (ITNamed a,ITAttAxis a) => ITAxis a where

    findBinTAxis :: a -> Double -> IO Int 

    findFixBinTAxis :: a -> Double -> IO Int 

    getBinCenterTAxis :: a -> Int -> IO Double 

    getBinCenterLog :: a -> Int -> IO Double 

    getBinUpEdge :: a -> Int -> IO Double 

    setTimeDisplay :: a -> Int -> IO () 

    setTimeFormat :: a -> String -> IO () 

    setTimeOffset :: a -> Double -> String -> IO () 

instance Existable TAxis where
  data Exist TAxis = forall a. (FPtr a, ITAxis a) => ETAxis a

upcastTAxis :: (FPtr a, ITAxis a) => a -> TAxis
upcastTAxis h = let fh = get_fptr h
                    fh2 :: ForeignPtr RawTAxis = castForeignPtr fh
                in cast_fptr_to_obj fh2