packages feed

HROOT-tree-0.9.0.1: src/HROOT/Tree/TChain/Interface.hs

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

class ITTree a => ITChain a where
        addChain :: (ITChain c0, FPtr c0) => a -> c0 -> IO CInt
        
        addChain1 :: Castable c0 CString => a -> c0 -> CLong -> IO CInt

upcastTChain :: forall a . (FPtr a, ITChain a) => a -> TChain
upcastTChain h
  = let fh = get_fptr h
        fh2 :: Ptr RawTChain = castPtr fh
      in cast_fptr_to_obj fh2

downcastTChain :: forall a . (FPtr a, ITChain a) => TChain -> a
downcastTChain h
  = let fh = get_fptr h
        fh2 = castPtr fh
      in cast_fptr_to_obj fh2