{-# LANGUAGE EmptyDataDecls, FlexibleInstances, MultiParamTypeClasses, TypeFamilies #-} module STD.VectorIterator.Template where import Foreign.C.Types import Foreign.Ptr import FFICXX.Runtime.Cast data RawVectorIterator tp1 newtype VectorIterator tp1 = VectorIterator (Ptr (RawVectorIterator tp1)) class () => IVectorIterator tp1 where deRef :: VectorIterator tp1 -> IO tp1 increment :: VectorIterator tp1 -> IO (VectorIterator tp1) instance () => FPtr (VectorIterator tp1) where type Raw (VectorIterator tp1) = RawVectorIterator tp1 get_fptr :: VectorIterator tp1 -> Ptr (Raw (VectorIterator tp1)) get_fptr (VectorIterator Ptr (RawVectorIterator tp1) ptr) = Ptr (RawVectorIterator tp1) ptr cast_fptr_to_obj :: Ptr (Raw (VectorIterator tp1)) -> VectorIterator tp1 cast_fptr_to_obj = forall tp1. Ptr (RawVectorIterator tp1) -> VectorIterator tp1 VectorIterator instance () => Castable (VectorIterator tp1) (Ptr (RawVectorIterator tp1)) where cast :: forall r. VectorIterator tp1 -> (Ptr (RawVectorIterator tp1) -> IO r) -> IO r cast VectorIterator tp1 x Ptr (RawVectorIterator tp1) -> IO r f = Ptr (RawVectorIterator tp1) -> IO r f (forall a b. Ptr a -> Ptr b castPtr (forall a. FPtr a => a -> Ptr (Raw a) get_fptr VectorIterator tp1 x)) uncast :: forall r. Ptr (RawVectorIterator tp1) -> (VectorIterator tp1 -> IO r) -> IO r uncast Ptr (RawVectorIterator tp1) x VectorIterator tp1 -> IO r f = VectorIterator tp1 -> IO r f (forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj (forall a b. Ptr a -> Ptr b castPtr Ptr (RawVectorIterator tp1) x))