packages feed

HROOT-hist-0.9: src/HROOT/Hist/TGraph/Cast.hs

{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
  #-}
module HROOT.Hist.TGraph.Cast where
import Foreign.Ptr
import FFICXX.Runtime.Cast
import System.IO.Unsafe
import HROOT.Hist.TGraph.RawType
import HROOT.Hist.TGraph.Interface

instance (ITGraph a, FPtr a) => Castable a (Ptr RawTGraph) where
        cast x f = f (castPtr (get_fptr x))
        uncast x f = f (cast_fptr_to_obj (castPtr x))

instance Castable TGraph (Ptr RawTGraph) where
        cast x f = f (castPtr (get_fptr x))
        uncast x f = f (cast_fptr_to_obj (castPtr x))