module HROOT.Core.TArrayF.Cast where
import Foreign.Ptr
import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
import Foreign.ForeignPtr.Unsafe
import FFICXX.Runtime.Cast
import System.IO.Unsafe
import HROOT.Core.TArrayF.RawType
import HROOT.Core.TArrayF.Interface
instance (ITArrayF a, FPtr a) => Castable a (Ptr RawTArrayF) where
cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_
instance Castable TArrayF (Ptr RawTArrayF) where
cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_