{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
  TypeSynonymInstances #-}
module GDAL.OGRLayer.Interface where
import Data.Word
import Data.Int
import Foreign.C
import Foreign.Ptr
import FFICXX.Runtime.Cast
import GDAL.OGRLayer.RawType
import GDAL.OGRFeature.RawType
import GDAL.OGRFeatureDefn.RawType
import GDAL.GDALMajorObject.Interface

class (IGDALMajorObject a) => IOGRLayer a where
        getFeature :: () => a -> CInt -> IO OGRFeature
        
        getFeatureCount :: () => a -> CInt -> IO CInt
        
        getLayerDefn :: () => a -> IO OGRFeatureDefn
        
        getNextFeature :: () => a -> IO OGRFeature
        
        resetReading :: () => a -> IO ()

upcastOGRLayer :: forall a . (FPtr a, IOGRLayer a) => a -> OGRLayer
upcastOGRLayer :: forall a. (FPtr a, IOGRLayer a) => a -> OGRLayer
upcastOGRLayer 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 RawOGRLayer
fh2 :: Ptr RawOGRLayer = Ptr (Raw a) -> Ptr RawOGRLayer
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw a)
fh
      in Ptr (Raw OGRLayer) -> OGRLayer
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw OGRLayer)
Ptr RawOGRLayer
fh2

downcastOGRLayer ::
                 forall a . (FPtr a, IOGRLayer a) => OGRLayer -> a
downcastOGRLayer :: forall a. (FPtr a, IOGRLayer a) => OGRLayer -> a
downcastOGRLayer OGRLayer
h
  = let fh :: Ptr (Raw OGRLayer)
fh = OGRLayer -> Ptr (Raw OGRLayer)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr OGRLayer
h
        fh2 :: Ptr (Raw a)
fh2 = Ptr RawOGRLayer -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw OGRLayer)
Ptr RawOGRLayer
fh
      in Ptr (Raw a) -> a
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw a)
fh2