packages feed

casadi-bindings-core-2.2.0.0: Casadi/Core/Classes/CustomFunction.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.CustomFunction
       (
         CustomFunction,
         CustomFunctionClass(..),
         customFunction__0,
         customFunction__1,
         customFunction__2,
       ) where


import Prelude hiding ( Functor )

import Data.Vector ( Vector )
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.CToolsInstances ( )
import Casadi.Internal.FormatException ( formatException )
import Casadi.Internal.MarshalTypes ( StdVec, StdString) -- 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__CustomFunction__CONSTRUCTOR__0" c_casadi__CustomFunction__CONSTRUCTOR__0
  :: Ptr (Ptr StdString) -> Ptr CustomEvaluate' -> IO (Ptr CustomFunction')
casadi__CustomFunction__CONSTRUCTOR__0
  :: CustomEvaluate -> IO CustomFunction
casadi__CustomFunction__CONSTRUCTOR__0 x0 =
  withMarshal x0 $ \x0' ->
  do
    errStrPtrP <- new nullPtr
    ret <- c_casadi__CustomFunction__CONSTRUCTOR__0 errStrPtrP x0'
    errStrPtr <- peek errStrPtrP
    free errStrPtrP
    if errStrPtr == nullPtr then wrapReturn ret else wrapReturn errStrPtr >>= (error . formatException)


-- classy wrapper
customFunction__0 :: CustomEvaluate -> IO CustomFunction
customFunction__0 = casadi__CustomFunction__CONSTRUCTOR__0


-- direct wrapper
foreign import ccall unsafe "casadi__CustomFunction__CONSTRUCTOR__1" c_casadi__CustomFunction__CONSTRUCTOR__1
  :: Ptr (Ptr StdString) -> Ptr CustomEvaluate' -> Ptr (StdVec (Ptr Sparsity')) -> Ptr (StdVec (Ptr Sparsity')) -> IO (Ptr CustomFunction')
casadi__CustomFunction__CONSTRUCTOR__1
  :: CustomEvaluate -> Vector Sparsity -> Vector Sparsity -> IO CustomFunction
casadi__CustomFunction__CONSTRUCTOR__1 x0 x1 x2 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  withMarshal x2 $ \x2' ->
  do
    errStrPtrP <- new nullPtr
    ret <- c_casadi__CustomFunction__CONSTRUCTOR__1 errStrPtrP x0' x1' x2'
    errStrPtr <- peek errStrPtrP
    free errStrPtrP
    if errStrPtr == nullPtr then wrapReturn ret else wrapReturn errStrPtr >>= (error . formatException)


-- classy wrapper
customFunction__1 :: CustomEvaluate -> Vector Sparsity -> Vector Sparsity -> IO CustomFunction
customFunction__1 = casadi__CustomFunction__CONSTRUCTOR__1


-- direct wrapper
foreign import ccall unsafe "casadi__CustomFunction__CONSTRUCTOR__2" c_casadi__CustomFunction__CONSTRUCTOR__2
  :: Ptr (Ptr StdString) -> IO (Ptr CustomFunction')
casadi__CustomFunction__CONSTRUCTOR__2
  :: IO CustomFunction
casadi__CustomFunction__CONSTRUCTOR__2  =

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


-- classy wrapper
customFunction__2 :: IO CustomFunction
customFunction__2 = casadi__CustomFunction__CONSTRUCTOR__2