{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
  TypeSynonymInstances #-}
module HROOT.Core.TColor.Interface where
import Data.Word
import Data.Int
import Foreign.C
import Foreign.Ptr
import FFICXX.Runtime.Cast
import HROOT.Core.TColor.RawType
import HROOT.Core.TNamed.Interface

class (ITNamed a) => ITColor a where

upcastTColor :: forall a . (FPtr a, ITColor a) => a -> TColor
upcastTColor :: forall a. (FPtr a, ITColor a) => a -> TColor
upcastTColor a
h
  = let fh :: Ptr (Raw a)
fh = a -> Ptr (Raw a)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr a
h
        Ptr RawTColor
fh2 :: Ptr RawTColor = Ptr (Raw a) -> Ptr RawTColor
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw a)
fh
      in Ptr (Raw TColor) -> TColor
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw TColor)
Ptr RawTColor
fh2

downcastTColor :: forall a . (FPtr a, ITColor a) => TColor -> a
downcastTColor :: forall a. (FPtr a, ITColor a) => TColor -> a
downcastTColor TColor
h
  = let fh :: Ptr (Raw TColor)
fh = TColor -> Ptr (Raw TColor)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr TColor
h
        fh2 :: Ptr (Raw a)
fh2 = Ptr RawTColor -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw TColor)
Ptr RawTColor
fh
      in Ptr (Raw a) -> a
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw a)
fh2