{-# LINE 1 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
{-# LANGUAGE CPP #-}

module Database.EJDB2.Bindings.Types.EJDBExec where


import           Prelude           hiding ( log )

import           Foreign
import           Foreign.C.String
import           Foreign.C.Types

import           Database.EJDB2.Bindings.Types.EJDB
import           Database.EJDB2.Bindings.JQL
import           Database.EJDB2.Bindings.Types.EJDBDoc
import           Database.EJDB2.Result



type EJDBExecVisitor = Ptr EJDBExec -> Ptr EJDBDoc -> Ptr CIntMax -> IO RC
type EJDB_EXEC_VISITOR = FunPtr EJDBExecVisitor

type IWXSTR = Ptr ()
type IWPOOL = Ptr ()

data EJDBExec = EJDBExec { db :: !EJDB
                         , q :: !JQL
                         , visitor :: !EJDB_EXEC_VISITOR
                         , opaque :: !(Ptr ())
                         , skip :: !CIntMax
                         , limit :: !CIntMax
                         , cnt :: !CIntMax
                         , log :: !IWXSTR
                         , pool :: !IWPOOL }

minimal :: EJDB -> JQL -> EJDB_EXEC_VISITOR -> EJDBExec
minimal db q visitor = EJDBExec { db = db
                                , q = q
                                , visitor = visitor
                                , opaque = nullPtr
                                , skip = 0
                                , limit = 0
                                , cnt = 0
                                , log = nullPtr
                                , pool = nullPtr }

zero :: EJDBExec
zero = EJDBExec { db = nullPtr
                , q = nullPtr
                , visitor = nullFunPtr
                , opaque = nullPtr
                , skip = 0
                , limit = 0
                , cnt = 0
                , log = nullPtr
                , pool = nullPtr }

instance Storable EJDBExec where
        sizeOf _ = (72)
{-# LINE 59 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
        alignment _ = 8
{-# LINE 60 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
        peek ptr = do
           db <- (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 62 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           q <- (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 63 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           visitor <- (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 64 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           opaque <- (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 65 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           skip <- (\hsc_ptr -> peekByteOff hsc_ptr 32) ptr
{-# LINE 66 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           limit <- (\hsc_ptr -> peekByteOff hsc_ptr 40) ptr
{-# LINE 67 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           cnt <- (\hsc_ptr -> peekByteOff hsc_ptr 48) ptr
{-# LINE 68 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           log <- (\hsc_ptr -> peekByteOff hsc_ptr 56) ptr
{-# LINE 69 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           pool <- (\hsc_ptr -> peekByteOff hsc_ptr 64) ptr
{-# LINE 70 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           return $ EJDBExec db q visitor opaque skip limit cnt log pool
        poke ptr (EJDBExec db q visitor opaque skip limit cnt log pool) = do
           (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr db
{-# LINE 73 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr q
{-# LINE 74 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr visitor
{-# LINE 75 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 24) ptr opaque
{-# LINE 76 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 32) ptr skip
{-# LINE 77 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 40) ptr limit
{-# LINE 78 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 48) ptr cnt
{-# LINE 79 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 56) ptr log
{-# LINE 80 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}
           (\hsc_ptr -> pokeByteOff hsc_ptr 64) ptr pool
{-# LINE 81 "src/Database/EJDB2/Bindings/Types/EJDBExec.hsc" #-}