packages feed

casadi-bindings-core-2.4.1.0: Casadi/Core/Classes/Map.hs

{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# Language ForeignFunctionInterface #-}
{-# Language FlexibleInstances #-}
{-# Language MultiParamTypeClasses #-}

module Casadi.Core.Classes.Map
       (
         Map,
         MapClass(..),
         map__0,
         map__1,
         map__2,
       ) where


import Prelude hiding ( Functor )

import Data.Vector ( Vector )
import qualified Data.Map as M
import Foreign.C.Types
import Foreign.Marshal ( new, free )
import Foreign.Storable ( peek )
import Foreign.Ptr ( Ptr, nullPtr )
import Foreign.ForeignPtr ( newForeignPtr )
import System.IO.Unsafe ( unsafePerformIO ) -- for show instances

import Casadi.Internal.FormatException ( formatException )
import Casadi.Internal.MarshalTypes ( StdVec, StdString, StdMap, StdPair ) -- StdPair StdOstream'
import Casadi.Internal.Marshal ( Marshal(..), withMarshal )
import Casadi.Internal.WrapReturn ( WrapReturn(..) )
import Casadi.Core.Data
import Casadi.Core.Enums
-- direct wrapper
foreign import ccall unsafe "casadi__Map__CONSTRUCTOR__0" c_casadi__Map__CONSTRUCTOR__0
  :: Ptr (Ptr StdString) -> Ptr StdString -> Ptr Function' -> CInt -> Ptr (StdVec CInt) -> Ptr (StdVec CInt) -> IO (Ptr Map')
casadi__Map__CONSTRUCTOR__0
  :: String -> Function -> Int -> Vector Bool -> Vector Bool -> IO Map
casadi__Map__CONSTRUCTOR__0 x0 x1 x2 x3 x4 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  withMarshal x2 $ \x2' ->
  withMarshal x3 $ \x3' ->
  withMarshal x4 $ \x4' ->
  do
    errStrPtrP <- new nullPtr
    ret <- c_casadi__Map__CONSTRUCTOR__0 errStrPtrP x0' x1' x2' x3' x4'
    errStrPtr <- peek errStrPtrP
    free errStrPtrP
    if errStrPtr == nullPtr then wrapReturn ret else wrapReturn errStrPtr >>= (error . formatException)


-- classy wrapper
map__0 :: String -> Function -> Int -> Vector Bool -> Vector Bool -> IO Map
map__0 = casadi__Map__CONSTRUCTOR__0


-- direct wrapper
foreign import ccall unsafe "casadi__Map__CONSTRUCTOR__1" c_casadi__Map__CONSTRUCTOR__1
  :: Ptr (Ptr StdString) -> Ptr StdString -> Ptr Function' -> CInt -> Ptr (StdVec CInt) -> Ptr (StdVec CInt) -> Ptr (StdMap StdString (Ptr GenericType')) -> IO (Ptr Map')
casadi__Map__CONSTRUCTOR__1
  :: String -> Function -> Int -> Vector Bool -> Vector Bool -> M.Map String GenericType -> IO Map
casadi__Map__CONSTRUCTOR__1 x0 x1 x2 x3 x4 x5 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  withMarshal x2 $ \x2' ->
  withMarshal x3 $ \x3' ->
  withMarshal x4 $ \x4' ->
  withMarshal x5 $ \x5' ->
  do
    errStrPtrP <- new nullPtr
    ret <- c_casadi__Map__CONSTRUCTOR__1 errStrPtrP x0' x1' x2' x3' x4' x5'
    errStrPtr <- peek errStrPtrP
    free errStrPtrP
    if errStrPtr == nullPtr then wrapReturn ret else wrapReturn errStrPtr >>= (error . formatException)


-- classy wrapper
map__1 :: String -> Function -> Int -> Vector Bool -> Vector Bool -> M.Map String GenericType -> IO Map
map__1 = casadi__Map__CONSTRUCTOR__1


-- direct wrapper
foreign import ccall unsafe "casadi__Map__CONSTRUCTOR__2" c_casadi__Map__CONSTRUCTOR__2
  :: Ptr (Ptr StdString) -> IO (Ptr Map')
casadi__Map__CONSTRUCTOR__2
  :: IO Map
casadi__Map__CONSTRUCTOR__2  =

  do
    errStrPtrP <- new nullPtr
    ret <- c_casadi__Map__CONSTRUCTOR__2 errStrPtrP 
    errStrPtr <- peek errStrPtrP
    free errStrPtrP
    if errStrPtr == nullPtr then wrapReturn ret else wrapReturn errStrPtr >>= (error . formatException)


-- classy wrapper
map__2 :: IO Map
map__2 = casadi__Map__CONSTRUCTOR__2