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

module HROOT.Hist.TH1S.Implementation where


import FFICXX.Runtime.Cast

import HROOT.Hist.TH1S.RawType
import HROOT.Hist.TH1S.FFI
import HROOT.Hist.TH1S.Interface
import HROOT.Hist.TH1S.Cast
import HROOT.Core.TDirectory.RawType
import HROOT.Core.TDirectory.Cast
import HROOT.Core.TDirectory.Interface
import HROOT.Hist.TF1.RawType
import HROOT.Hist.TF1.Cast
import HROOT.Hist.TF1.Interface
import HROOT.Core.TArrayD.RawType
import HROOT.Core.TArrayD.Cast
import HROOT.Core.TArrayD.Interface
import HROOT.Hist.TAxis.RawType
import HROOT.Hist.TAxis.Cast
import HROOT.Hist.TAxis.Interface
import HROOT.Core.TClass.RawType
import HROOT.Core.TClass.Cast
import HROOT.Core.TClass.Interface
import HROOT.Hist.TH1.RawType
import HROOT.Hist.TH1.Cast
import HROOT.Hist.TH1.Interface
import HROOT.Core.TArrayS.RawType
import HROOT.Core.TArrayS.Cast
import HROOT.Core.TArrayS.Interface
import HROOT.Core.TObject.RawType
import HROOT.Core.TObject.Cast
import HROOT.Core.TObject.Interface
import HROOT.Core.TAttLine.RawType
import HROOT.Core.TAttLine.Cast
import HROOT.Core.TAttLine.Interface
import HROOT.Core.TAttFill.RawType
import HROOT.Core.TAttFill.Cast
import HROOT.Core.TAttFill.Interface
import HROOT.Core.TAttMarker.RawType
import HROOT.Core.TAttMarker.Cast
import HROOT.Core.TAttMarker.Interface
import HROOT.Core.Deletable.RawType
import HROOT.Core.Deletable.Cast
import HROOT.Core.Deletable.Interface
import HROOT.Core.TArray.RawType
import HROOT.Core.TArray.Cast
import HROOT.Core.TArray.Interface

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

import System.IO.Unsafe


instance ITH1S TH1S where
instance ITH1 TH1S where
  add = xform2 c_th1s_add
  addBinContent = xform2 c_th1s_addbincontent
  chi2Test = xform3 c_th1s_chi2test
  computeIntegral = xform0 c_th1s_computeintegral
  directoryAutoAdd = xform1 c_th1s_directoryautoadd
  divide = xform5 c_th1s_divide
  drawCopyTH1 = xform1 c_th1s_drawcopyth1
  drawNormalized = xform2 c_th1s_drawnormalized
  drawPanelTH1 = xform0 c_th1s_drawpanelth1
  bufferEmpty = xform1 c_th1s_bufferempty
  evalF = xform2 c_th1s_evalf
  fFT = xform2 c_th1s_fft
  fill1 = xform1 c_th1s_fill1
  fill1w = xform2 c_th1s_fill1w
  fillN1 = xform4 c_th1s_filln1
  fillRandom = xform2 c_th1s_fillrandom
  findBin = xform3 c_th1s_findbin
  findFixBin = xform3 c_th1s_findfixbin
  findFirstBinAbove = xform2 c_th1s_findfirstbinabove
  findLastBinAbove = xform2 c_th1s_findlastbinabove
  fitPanelTH1 = xform0 c_th1s_fitpanelth1
  getNdivisionA = xform1 c_th1s_getndivisiona
  getAxisColorA = xform1 c_th1s_getaxiscolora
  getLabelColorA = xform1 c_th1s_getlabelcolora
  getLabelFontA = xform1 c_th1s_getlabelfonta
  getLabelOffsetA = xform1 c_th1s_getlabeloffseta
  getLabelSizeA = xform1 c_th1s_getlabelsizea
  getTitleFontA = xform1 c_th1s_gettitlefonta
  getTitleOffsetA = xform1 c_th1s_gettitleoffseta
  getTitleSizeA = xform1 c_th1s_gettitlesizea
  getTickLengthA = xform1 c_th1s_getticklengtha
  getBarOffset = xform0 c_th1s_getbaroffset
  getBarWidth = xform0 c_th1s_getbarwidth
  getContour = xform1 c_th1s_getcontour
  getContourLevel = xform1 c_th1s_getcontourlevel
  getContourLevelPad = xform1 c_th1s_getcontourlevelpad
  getBin = xform3 c_th1s_getbin
  getBinCenter = xform1 c_th1s_getbincenter
  getBinContent1 = xform1 c_th1s_getbincontent1
  getBinContent2 = xform2 c_th1s_getbincontent2
  getBinContent3 = xform3 c_th1s_getbincontent3
  getBinError1 = xform1 c_th1s_getbinerror1
  getBinError2 = xform2 c_th1s_getbinerror2
  getBinError3 = xform3 c_th1s_getbinerror3
  getBinLowEdge = xform1 c_th1s_getbinlowedge
  getBinWidth = xform1 c_th1s_getbinwidth
  getCellContent = xform2 c_th1s_getcellcontent
  getCellError = xform2 c_th1s_getcellerror
  getEntries = xform0 c_th1s_getentries
  getEffectiveEntries = xform0 c_th1s_geteffectiveentries
  getFunction = xform1 c_th1s_getfunction
  getDimension = xform0 c_th1s_getdimension
  getKurtosis = xform1 c_th1s_getkurtosis
  getLowEdge = xform1 c_th1s_getlowedge
  getMaximumTH1 = xform1 c_th1s_getmaximumth1
  getMaximumBin = xform0 c_th1s_getmaximumbin
  getMaximumStored = xform0 c_th1s_getmaximumstored
  getMinimumTH1 = xform1 c_th1s_getminimumth1
  getMinimumBin = xform0 c_th1s_getminimumbin
  getMinimumStored = xform0 c_th1s_getminimumstored
  getMean = xform1 c_th1s_getmean
  getMeanError = xform1 c_th1s_getmeanerror
  getNbinsX = xform0 c_th1s_getnbinsx
  getNbinsY = xform0 c_th1s_getnbinsy
  getNbinsZ = xform0 c_th1s_getnbinsz
  getQuantilesTH1 = xform3 c_th1s_getquantilesth1
  getRandom = xform0 c_th1s_getrandom
  getStats = xform1 c_th1s_getstats
  getSumOfWeights = xform0 c_th1s_getsumofweights
  getSumw2 = xform0 c_th1s_getsumw2
  getSumw2N = xform0 c_th1s_getsumw2n
  getRMS = xform1 c_th1s_getrms
  getRMSError = xform1 c_th1s_getrmserror
  getSkewness = xform1 c_th1s_getskewness
  integral1 = xform3 c_th1s_integral1
  interpolate1 = xform1 c_th1s_interpolate1
  interpolate2 = xform2 c_th1s_interpolate2
  interpolate3 = xform3 c_th1s_interpolate3
  kolmogorovTest = xform2 c_th1s_kolmogorovtest
  labelsDeflate = xform1 c_th1s_labelsdeflate
  labelsInflate = xform1 c_th1s_labelsinflate
  labelsOption = xform2 c_th1s_labelsoption
  multiflyF = xform2 c_th1s_multiflyf
  multiply = xform5 c_th1s_multiply
  putStats = xform1 c_th1s_putstats
  rebin = xform3 c_th1s_rebin
  rebinAxis = xform2 c_th1s_rebinaxis
  rebuild = xform1 c_th1s_rebuild
  recursiveRemove = xform1 c_th1s_recursiveremove
  reset = xform1 c_th1s_reset
  resetStats = xform0 c_th1s_resetstats
  scale = xform2 c_th1s_scale
  setAxisColorA = xform2 c_th1s_setaxiscolora
  setAxisRange = xform3 c_th1s_setaxisrange
  setBarOffset = xform1 c_th1s_setbaroffset
  setBarWidth = xform1 c_th1s_setbarwidth
  setBinContent1 = xform2 c_th1s_setbincontent1
  setBinContent2 = xform3 c_th1s_setbincontent2
  setBinContent3 = xform4 c_th1s_setbincontent3
  setBinError1 = xform2 c_th1s_setbinerror1
  setBinError2 = xform3 c_th1s_setbinerror2
  setBinError3 = xform4 c_th1s_setbinerror3
  setBins1 = xform2 c_th1s_setbins1
  setBins2 = xform4 c_th1s_setbins2
  setBins3 = xform6 c_th1s_setbins3
  setBinsLength = xform1 c_th1s_setbinslength
  setBuffer = xform2 c_th1s_setbuffer
  setCellContent = xform3 c_th1s_setcellcontent
  setContent = xform1 c_th1s_setcontent
  setContour = xform2 c_th1s_setcontour
  setContourLevel = xform2 c_th1s_setcontourlevel
  setDirectory = xform1 c_th1s_setdirectory
  setEntries = xform1 c_th1s_setentries
  setError = xform1 c_th1s_seterror
  setLabelColorA = xform2 c_th1s_setlabelcolora
  setLabelSizeA = xform2 c_th1s_setlabelsizea
  setLabelFontA = xform2 c_th1s_setlabelfonta
  setLabelOffsetA = xform2 c_th1s_setlabeloffseta
  setMaximum = xform1 c_th1s_setmaximum
  setMinimum = xform1 c_th1s_setminimum
  setNormFactor = xform1 c_th1s_setnormfactor
  setStats = xform1 c_th1s_setstats
  setOption = xform1 c_th1s_setoption
  setXTitle = xform1 c_th1s_setxtitle
  setYTitle = xform1 c_th1s_setytitle
  setZTitle = xform1 c_th1s_setztitle
  showBackground = xform2 c_th1s_showbackground
  showPeaks = xform3 c_th1s_showpeaks
  smooth = xform2 c_th1s_smooth
  sumw2 = xform0 c_th1s_sumw2
instance ITArrayS TH1S where
instance ITObject TH1S where
  draw = xform1 c_th1s_draw
  findObject = xform1 c_th1s_findobject
  getName = xform0 c_th1s_getname
  isA = xform0 c_th1s_isa
  paint = xform1 c_th1s_paint
  printObj = xform1 c_th1s_printobj
  saveAs = xform2 c_th1s_saveas
  write = xform3 c_th1s_write
instance ITAttLine TH1S where
  getLineColor = xform0 c_th1s_getlinecolor
  getLineStyle = xform0 c_th1s_getlinestyle
  getLineWidth = xform0 c_th1s_getlinewidth
  resetAttLine = xform1 c_th1s_resetattline
  setLineAttributes = xform0 c_th1s_setlineattributes
  setLineColor = xform1 c_th1s_setlinecolor
  setLineStyle = xform1 c_th1s_setlinestyle
  setLineWidth = xform1 c_th1s_setlinewidth
instance ITAttFill TH1S where
  setFillColor = xform1 c_th1s_setfillcolor
  setFillStyle = xform1 c_th1s_setfillstyle
instance ITAttMarker TH1S where
  getMarkerColor = xform0 c_th1s_getmarkercolor
  getMarkerStyle = xform0 c_th1s_getmarkerstyle
  getMarkerSize = xform0 c_th1s_getmarkersize
  resetAttMarker = xform1 c_th1s_resetattmarker
  setMarkerAttributes = xform0 c_th1s_setmarkerattributes
  setMarkerColor = xform1 c_th1s_setmarkercolor
  setMarkerStyle = xform1 c_th1s_setmarkerstyle
  setMarkerSize = xform1 c_th1s_setmarkersize
instance IDeletable TH1S where
  delete = xform0 c_th1s_delete
instance ITArray TH1S where

instance ITH1S (Exist TH1S) where

instance ITH1 (Exist TH1S) where
  add (ETH1S x) = add x
  addBinContent (ETH1S x) = addBinContent x
  chi2Test (ETH1S x) = chi2Test x
  computeIntegral (ETH1S x) = computeIntegral x
  directoryAutoAdd (ETH1S x) = directoryAutoAdd x
  divide (ETH1S x) = divide x
  drawCopyTH1 (ETH1S x) a1 = return . ETH1S =<< drawCopyTH1 x a1
  drawNormalized (ETH1S x) = drawNormalized x
  drawPanelTH1 (ETH1S x) = drawPanelTH1 x
  bufferEmpty (ETH1S x) = bufferEmpty x
  evalF (ETH1S x) = evalF x
  fFT (ETH1S x) = fFT x
  fill1 (ETH1S x) = fill1 x
  fill1w (ETH1S x) = fill1w x
  fillN1 (ETH1S x) = fillN1 x
  fillRandom (ETH1S x) = fillRandom x
  findBin (ETH1S x) = findBin x
  findFixBin (ETH1S x) = findFixBin x
  findFirstBinAbove (ETH1S x) = findFirstBinAbove x
  findLastBinAbove (ETH1S x) = findLastBinAbove x
  fitPanelTH1 (ETH1S x) = fitPanelTH1 x
  getNdivisionA (ETH1S x) = getNdivisionA x
  getAxisColorA (ETH1S x) = getAxisColorA x
  getLabelColorA (ETH1S x) = getLabelColorA x
  getLabelFontA (ETH1S x) = getLabelFontA x
  getLabelOffsetA (ETH1S x) = getLabelOffsetA x
  getLabelSizeA (ETH1S x) = getLabelSizeA x
  getTitleFontA (ETH1S x) = getTitleFontA x
  getTitleOffsetA (ETH1S x) = getTitleOffsetA x
  getTitleSizeA (ETH1S x) = getTitleSizeA x
  getTickLengthA (ETH1S x) = getTickLengthA x
  getBarOffset (ETH1S x) = getBarOffset x
  getBarWidth (ETH1S x) = getBarWidth x
  getContour (ETH1S x) = getContour x
  getContourLevel (ETH1S x) = getContourLevel x
  getContourLevelPad (ETH1S x) = getContourLevelPad x
  getBin (ETH1S x) = getBin x
  getBinCenter (ETH1S x) = getBinCenter x
  getBinContent1 (ETH1S x) = getBinContent1 x
  getBinContent2 (ETH1S x) = getBinContent2 x
  getBinContent3 (ETH1S x) = getBinContent3 x
  getBinError1 (ETH1S x) = getBinError1 x
  getBinError2 (ETH1S x) = getBinError2 x
  getBinError3 (ETH1S x) = getBinError3 x
  getBinLowEdge (ETH1S x) = getBinLowEdge x
  getBinWidth (ETH1S x) = getBinWidth x
  getCellContent (ETH1S x) = getCellContent x
  getCellError (ETH1S x) = getCellError x
  getEntries (ETH1S x) = getEntries x
  getEffectiveEntries (ETH1S x) = getEffectiveEntries x
  getFunction (ETH1S x) = getFunction x
  getDimension (ETH1S x) = getDimension x
  getKurtosis (ETH1S x) = getKurtosis x
  getLowEdge (ETH1S x) = getLowEdge x
  getMaximumTH1 (ETH1S x) = getMaximumTH1 x
  getMaximumBin (ETH1S x) = getMaximumBin x
  getMaximumStored (ETH1S x) = getMaximumStored x
  getMinimumTH1 (ETH1S x) = getMinimumTH1 x
  getMinimumBin (ETH1S x) = getMinimumBin x
  getMinimumStored (ETH1S x) = getMinimumStored x
  getMean (ETH1S x) = getMean x
  getMeanError (ETH1S x) = getMeanError x
  getNbinsX (ETH1S x) = getNbinsX x
  getNbinsY (ETH1S x) = getNbinsY x
  getNbinsZ (ETH1S x) = getNbinsZ x
  getQuantilesTH1 (ETH1S x) = getQuantilesTH1 x
  getRandom (ETH1S x) = getRandom x
  getStats (ETH1S x) = getStats x
  getSumOfWeights (ETH1S x) = getSumOfWeights x
  getSumw2 (ETH1S x) = getSumw2 x
  getSumw2N (ETH1S x) = getSumw2N x
  getRMS (ETH1S x) = getRMS x
  getRMSError (ETH1S x) = getRMSError x
  getSkewness (ETH1S x) = getSkewness x
  integral1 (ETH1S x) = integral1 x
  interpolate1 (ETH1S x) = interpolate1 x
  interpolate2 (ETH1S x) = interpolate2 x
  interpolate3 (ETH1S x) = interpolate3 x
  kolmogorovTest (ETH1S x) = kolmogorovTest x
  labelsDeflate (ETH1S x) = labelsDeflate x
  labelsInflate (ETH1S x) = labelsInflate x
  labelsOption (ETH1S x) = labelsOption x
  multiflyF (ETH1S x) = multiflyF x
  multiply (ETH1S x) = multiply x
  putStats (ETH1S x) = putStats x
  rebin (ETH1S x) = rebin x
  rebinAxis (ETH1S x) = rebinAxis x
  rebuild (ETH1S x) = rebuild x
  recursiveRemove (ETH1S x) = recursiveRemove x
  reset (ETH1S x) = reset x
  resetStats (ETH1S x) = resetStats x
  scale (ETH1S x) = scale x
  setAxisColorA (ETH1S x) = setAxisColorA x
  setAxisRange (ETH1S x) = setAxisRange x
  setBarOffset (ETH1S x) = setBarOffset x
  setBarWidth (ETH1S x) = setBarWidth x
  setBinContent1 (ETH1S x) = setBinContent1 x
  setBinContent2 (ETH1S x) = setBinContent2 x
  setBinContent3 (ETH1S x) = setBinContent3 x
  setBinError1 (ETH1S x) = setBinError1 x
  setBinError2 (ETH1S x) = setBinError2 x
  setBinError3 (ETH1S x) = setBinError3 x
  setBins1 (ETH1S x) = setBins1 x
  setBins2 (ETH1S x) = setBins2 x
  setBins3 (ETH1S x) = setBins3 x
  setBinsLength (ETH1S x) = setBinsLength x
  setBuffer (ETH1S x) = setBuffer x
  setCellContent (ETH1S x) = setCellContent x
  setContent (ETH1S x) = setContent x
  setContour (ETH1S x) = setContour x
  setContourLevel (ETH1S x) = setContourLevel x
  setDirectory (ETH1S x) = setDirectory x
  setEntries (ETH1S x) = setEntries x
  setError (ETH1S x) = setError x
  setLabelColorA (ETH1S x) = setLabelColorA x
  setLabelSizeA (ETH1S x) = setLabelSizeA x
  setLabelFontA (ETH1S x) = setLabelFontA x
  setLabelOffsetA (ETH1S x) = setLabelOffsetA x
  setMaximum (ETH1S x) = setMaximum x
  setMinimum (ETH1S x) = setMinimum x
  setNormFactor (ETH1S x) = setNormFactor x
  setStats (ETH1S x) = setStats x
  setOption (ETH1S x) = setOption x
  setXTitle (ETH1S x) = setXTitle x
  setYTitle (ETH1S x) = setYTitle x
  setZTitle (ETH1S x) = setZTitle x
  showBackground (ETH1S x) = showBackground x
  showPeaks (ETH1S x) = showPeaks x
  smooth (ETH1S x) = smooth x
  sumw2 (ETH1S x) = sumw2 x
instance ITArrayS (Exist TH1S) where

instance ITObject (Exist TH1S) where
  draw (ETH1S x) = draw x
  findObject (ETH1S x) = findObject x
  getName (ETH1S x) = getName x
  isA (ETH1S x) = isA x
  paint (ETH1S x) = paint x
  printObj (ETH1S x) = printObj x
  saveAs (ETH1S x) = saveAs x
  write (ETH1S x) = write x
instance ITAttLine (Exist TH1S) where
  getLineColor (ETH1S x) = getLineColor x
  getLineStyle (ETH1S x) = getLineStyle x
  getLineWidth (ETH1S x) = getLineWidth x
  resetAttLine (ETH1S x) = resetAttLine x
  setLineAttributes (ETH1S x) = setLineAttributes x
  setLineColor (ETH1S x) = setLineColor x
  setLineStyle (ETH1S x) = setLineStyle x
  setLineWidth (ETH1S x) = setLineWidth x
instance ITAttFill (Exist TH1S) where
  setFillColor (ETH1S x) = setFillColor x
  setFillStyle (ETH1S x) = setFillStyle x
instance ITAttMarker (Exist TH1S) where
  getMarkerColor (ETH1S x) = getMarkerColor x
  getMarkerStyle (ETH1S x) = getMarkerStyle x
  getMarkerSize (ETH1S x) = getMarkerSize x
  resetAttMarker (ETH1S x) = resetAttMarker x
  setMarkerAttributes (ETH1S x) = setMarkerAttributes x
  setMarkerColor (ETH1S x) = setMarkerColor x
  setMarkerStyle (ETH1S x) = setMarkerStyle x
  setMarkerSize (ETH1S x) = setMarkerSize x
instance IDeletable (Exist TH1S) where
  delete (ETH1S x) = delete x
instance ITArray (Exist TH1S) where








instance FPtr (Exist TH1S) where
  type Raw (Exist TH1S) = RawTH1S
  get_fptr (ETH1S obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETH1S (cast_fptr_to_obj (fptr :: ForeignPtr RawTH1S) :: TH1S)