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

-- module HROOT.Class.Interface where

module HROOT.Hist.TGraphErrors.Interface where


import Data.Word
import Foreign.C
import Foreign.Ptr
import Foreign.ForeignPtr
import FFICXX.Runtime.Cast

import HROOT.Hist.TGraphErrors.RawType

import HROOT.Hist.TGraph.Interface
---- ============ ----



class (ITGraph a) => ITGraphErrors a where

instance Existable TGraphErrors where
  data Exist TGraphErrors = forall a. (FPtr a, ITGraphErrors a) => ETGraphErrors a

upcastTGraphErrors :: (FPtr a, ITGraphErrors a) => a -> TGraphErrors
upcastTGraphErrors h = let fh = get_fptr h
                           fh2 :: ForeignPtr RawTGraphErrors = castForeignPtr fh
                       in cast_fptr_to_obj fh2

downcastTGraphErrors :: (FPtr a, ITGraphErrors a) => TGraphErrors -> a 
downcastTGraphErrors h = let fh = get_fptr h
                             fh2 = castForeignPtr fh
                         in cast_fptr_to_obj fh2