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

-- module HROOT.Class.Interface where

module HROOT.Core.TCollection.Interface where


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

import HROOT.Core.TCollection.RawType

import HROOT.Core.TObject.Interface
---- ============ ----



class (ITObject a) => ITCollection a where

instance Existable TCollection where
  data Exist TCollection = forall a. (FPtr a, ITCollection a) => ETCollection a

upcastTCollection :: (FPtr a, ITCollection a) => a -> TCollection
upcastTCollection h = let fh = get_fptr h
                          fh2 :: ForeignPtr RawTCollection = castForeignPtr fh
                      in cast_fptr_to_obj fh2

downcastTCollection :: (FPtr a, ITCollection a) => TCollection -> a 
downcastTCollection h = let fh = get_fptr h
                            fh2 = castForeignPtr fh
                        in cast_fptr_to_obj fh2