{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
             OverlappingInstances, IncoherentInstances #-}

module HROOT.Class.TGraphErrors.Implementation where


import HROOT.TypeCast

import HROOT.Class.TGraphErrors.RawType
import HROOT.Class.TGraphErrors.FFI
import HROOT.Class.TGraphErrors.Interface
import HROOT.Class.TGraphErrors.Cast
import HROOT.Class.TF1.RawType
import HROOT.Class.TF1.Cast
import HROOT.Class.TF1.Interface
import HROOT.Class.TH1F.RawType
import HROOT.Class.TH1F.Cast
import HROOT.Class.TH1F.Interface
import HROOT.Class.TList.RawType
import HROOT.Class.TList.Cast
import HROOT.Class.TList.Interface
import HROOT.Class.TAxis.RawType
import HROOT.Class.TAxis.Cast
import HROOT.Class.TAxis.Interface
import HROOT.Class.TClass.RawType
import HROOT.Class.TClass.Cast
import HROOT.Class.TClass.Interface
import HROOT.Class.TGraph.RawType
import HROOT.Class.TGraph.Cast
import HROOT.Class.TGraph.Interface
import HROOT.Class.TNamed.RawType
import HROOT.Class.TNamed.Cast
import HROOT.Class.TNamed.Interface
import HROOT.Class.TAttLine.RawType
import HROOT.Class.TAttLine.Cast
import HROOT.Class.TAttLine.Interface
import HROOT.Class.TAttFill.RawType
import HROOT.Class.TAttFill.Cast
import HROOT.Class.TAttFill.Interface
import HROOT.Class.TAttMarker.RawType
import HROOT.Class.TAttMarker.Cast
import HROOT.Class.TAttMarker.Interface
import HROOT.Class.TObject.RawType
import HROOT.Class.TObject.Cast
import HROOT.Class.TObject.Interface
import HROOT.Class.Deletable.RawType
import HROOT.Class.Deletable.Cast
import HROOT.Class.Deletable.Interface

import Data.Word
-- import Foreign.C            
-- import Foreign.Ptr
import Foreign.ForeignPtr

import System.IO.Unsafe


instance ITGraphErrors TGraphErrors where
instance ITGraph TGraphErrors where
  apply = xform1 c_tgrapherrors_apply
  chisquare = xform1 c_tgrapherrors_chisquare
  drawGraph = xform4 c_tgrapherrors_drawgraph
  drawPanelTGraph = xform0 c_tgrapherrors_drawpaneltgraph
  expand = xform2 c_tgrapherrors_expand
  fitPanelTGraph = xform0 c_tgrapherrors_fitpaneltgraph
  getCorrelationFactorTGraph = xform0 c_tgrapherrors_getcorrelationfactortgraph
  getCovarianceTGraph = xform0 c_tgrapherrors_getcovariancetgraph
  getMeanTGraph = xform1 c_tgrapherrors_getmeantgraph
  getRMSTGraph = xform1 c_tgrapherrors_getrmstgraph
  getErrorX = xform1 c_tgrapherrors_geterrorx
  getErrorY = xform1 c_tgrapherrors_geterrory
  getErrorXhigh = xform1 c_tgrapherrors_geterrorxhigh
  getErrorXlow = xform1 c_tgrapherrors_geterrorxlow
  getErrorYhigh = xform1 c_tgrapherrors_geterroryhigh
  getErrorYlow = xform1 c_tgrapherrors_geterrorylow
  initExpo = xform2 c_tgrapherrors_initexpo
  initGaus = xform2 c_tgrapherrors_initgaus
  initPolynom = xform2 c_tgrapherrors_initpolynom
  insertPoint = xform0 c_tgrapherrors_insertpoint
  integralTGraph = xform2 c_tgrapherrors_integraltgraph
  isEditable = xform0 c_tgrapherrors_iseditable
  isInsideTGraph = xform2 c_tgrapherrors_isinsidetgraph
  leastSquareFit = xform4 c_tgrapherrors_leastsquarefit
  paintStats = xform1 c_tgrapherrors_paintstats
  removePoint = xform1 c_tgrapherrors_removepoint
  setEditable = xform1 c_tgrapherrors_seteditable
  setHistogram = xform1 c_tgrapherrors_sethistogram
  setMaximumTGraph = xform1 c_tgrapherrors_setmaximumtgraph
  setMinimumTGraph = xform1 c_tgrapherrors_setminimumtgraph
  set = xform1 c_tgrapherrors_set
  setPoint = xform3 c_tgrapherrors_setpoint
instance ITNamed TGraphErrors where
  setName = xform1 c_tgrapherrors_setname
  setNameTitle = xform2 c_tgrapherrors_setnametitle
  setTitle = xform1 c_tgrapherrors_settitle
instance ITAttLine TGraphErrors where
  getLineColor = xform0 c_tgrapherrors_getlinecolor
  getLineStyle = xform0 c_tgrapherrors_getlinestyle
  getLineWidth = xform0 c_tgrapherrors_getlinewidth
  resetAttLine = xform1 c_tgrapherrors_resetattline
  setLineAttributes = xform0 c_tgrapherrors_setlineattributes
  setLineColor = xform1 c_tgrapherrors_setlinecolor
  setLineStyle = xform1 c_tgrapherrors_setlinestyle
  setLineWidth = xform1 c_tgrapherrors_setlinewidth
instance ITAttFill TGraphErrors where
  setFillColor = xform1 c_tgrapherrors_setfillcolor
  setFillStyle = xform1 c_tgrapherrors_setfillstyle
instance ITAttMarker TGraphErrors where
  getMarkerColor = xform0 c_tgrapherrors_getmarkercolor
  getMarkerStyle = xform0 c_tgrapherrors_getmarkerstyle
  getMarkerSize = xform0 c_tgrapherrors_getmarkersize
  resetAttMarker = xform1 c_tgrapherrors_resetattmarker
  setMarkerAttributes = xform0 c_tgrapherrors_setmarkerattributes
  setMarkerColor = xform1 c_tgrapherrors_setmarkercolor
  setMarkerStyle = xform1 c_tgrapherrors_setmarkerstyle
  setMarkerSize = xform1 c_tgrapherrors_setmarkersize
instance ITObject TGraphErrors where
  draw = xform1 c_tgrapherrors_draw
  findObject = xform1 c_tgrapherrors_findobject
  getName = xform0 c_tgrapherrors_getname
  isA = xform0 c_tgrapherrors_isa
  isFolder = xform0 c_tgrapherrors_isfolder
  isEqual = xform1 c_tgrapherrors_isequal
  isSortable = xform0 c_tgrapherrors_issortable
  paint = xform1 c_tgrapherrors_paint
  printObj = xform1 c_tgrapherrors_printobj
  recursiveRemove = xform1 c_tgrapherrors_recursiveremove
  saveAs = xform2 c_tgrapherrors_saveas
  useCurrentStyle = xform0 c_tgrapherrors_usecurrentstyle
  write = xform3 c_tgrapherrors_write
instance IDeletable TGraphErrors where
  delete = xform0 c_tgrapherrors_delete

instance ITGraphErrors (Exist TGraphErrors) where

instance ITGraph (Exist TGraphErrors) where
  apply (ETGraphErrors x) = apply x
  chisquare (ETGraphErrors x) = chisquare x
  drawGraph (ETGraphErrors x) = drawGraph x
  drawPanelTGraph (ETGraphErrors x) = drawPanelTGraph x
  expand (ETGraphErrors x) = expand x
  fitPanelTGraph (ETGraphErrors x) = fitPanelTGraph x
  getCorrelationFactorTGraph (ETGraphErrors x) = getCorrelationFactorTGraph x
  getCovarianceTGraph (ETGraphErrors x) = getCovarianceTGraph x
  getMeanTGraph (ETGraphErrors x) = getMeanTGraph x
  getRMSTGraph (ETGraphErrors x) = getRMSTGraph x
  getErrorX (ETGraphErrors x) = getErrorX x
  getErrorY (ETGraphErrors x) = getErrorY x
  getErrorXhigh (ETGraphErrors x) = getErrorXhigh x
  getErrorXlow (ETGraphErrors x) = getErrorXlow x
  getErrorYhigh (ETGraphErrors x) = getErrorYhigh x
  getErrorYlow (ETGraphErrors x) = getErrorYlow x
  initExpo (ETGraphErrors x) = initExpo x
  initGaus (ETGraphErrors x) = initGaus x
  initPolynom (ETGraphErrors x) = initPolynom x
  insertPoint (ETGraphErrors x) = insertPoint x
  integralTGraph (ETGraphErrors x) = integralTGraph x
  isEditable (ETGraphErrors x) = isEditable x
  isInsideTGraph (ETGraphErrors x) = isInsideTGraph x
  leastSquareFit (ETGraphErrors x) = leastSquareFit x
  paintStats (ETGraphErrors x) = paintStats x
  removePoint (ETGraphErrors x) = removePoint x
  setEditable (ETGraphErrors x) = setEditable x
  setHistogram (ETGraphErrors x) = setHistogram x
  setMaximumTGraph (ETGraphErrors x) = setMaximumTGraph x
  setMinimumTGraph (ETGraphErrors x) = setMinimumTGraph x
  set (ETGraphErrors x) = set x
  setPoint (ETGraphErrors x) = setPoint x
instance ITNamed (Exist TGraphErrors) where
  setName (ETGraphErrors x) = setName x
  setNameTitle (ETGraphErrors x) = setNameTitle x
  setTitle (ETGraphErrors x) = setTitle x
instance ITAttLine (Exist TGraphErrors) where
  getLineColor (ETGraphErrors x) = getLineColor x
  getLineStyle (ETGraphErrors x) = getLineStyle x
  getLineWidth (ETGraphErrors x) = getLineWidth x
  resetAttLine (ETGraphErrors x) = resetAttLine x
  setLineAttributes (ETGraphErrors x) = setLineAttributes x
  setLineColor (ETGraphErrors x) = setLineColor x
  setLineStyle (ETGraphErrors x) = setLineStyle x
  setLineWidth (ETGraphErrors x) = setLineWidth x
instance ITAttFill (Exist TGraphErrors) where
  setFillColor (ETGraphErrors x) = setFillColor x
  setFillStyle (ETGraphErrors x) = setFillStyle x
instance ITAttMarker (Exist TGraphErrors) where
  getMarkerColor (ETGraphErrors x) = getMarkerColor x
  getMarkerStyle (ETGraphErrors x) = getMarkerStyle x
  getMarkerSize (ETGraphErrors x) = getMarkerSize x
  resetAttMarker (ETGraphErrors x) = resetAttMarker x
  setMarkerAttributes (ETGraphErrors x) = setMarkerAttributes x
  setMarkerColor (ETGraphErrors x) = setMarkerColor x
  setMarkerStyle (ETGraphErrors x) = setMarkerStyle x
  setMarkerSize (ETGraphErrors x) = setMarkerSize x
instance ITObject (Exist TGraphErrors) where
  draw (ETGraphErrors x) = draw x
  findObject (ETGraphErrors x) = findObject x
  getName (ETGraphErrors x) = getName x
  isA (ETGraphErrors x) = isA x
  isFolder (ETGraphErrors x) = isFolder x
  isEqual (ETGraphErrors x) = isEqual x
  isSortable (ETGraphErrors x) = isSortable x
  paint (ETGraphErrors x) = paint x
  printObj (ETGraphErrors x) = printObj x
  recursiveRemove (ETGraphErrors x) = recursiveRemove x
  saveAs (ETGraphErrors x) = saveAs x
  useCurrentStyle (ETGraphErrors x) = useCurrentStyle x
  write (ETGraphErrors x) = write x
instance IDeletable (Exist TGraphErrors) where
  delete (ETGraphErrors x) = delete x


newTGraphErrors :: Int -> [Double] -> [Double] -> [Double] -> [Double] -> IO TGraphErrors
newTGraphErrors = xform4 c_tgrapherrors_newtgrapherrors





instance FPtr (Exist TGraphErrors) where
  type Raw (Exist TGraphErrors) = RawTGraphErrors
  get_fptr (ETGraphErrors obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETGraphErrors (cast_fptr_to_obj (fptr :: ForeignPtr RawTGraphErrors) :: TGraphErrors)