{-# OPTIONS_GHC -Wall #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-# Language ForeignFunctionInterface #-} {-# Language FlexibleInstances #-} {-# Language MultiParamTypeClasses #-} module Casadi.Core.Classes.ExternalFunction ( ExternalFunction, ExternalFunctionClass(..), externalFunction__0, externalFunction__1, ) 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.Core.Classes.PrintableObject 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 instance Show ExternalFunction where show = unsafePerformIO . printableObject_getDescription -- direct wrapper foreign import ccall unsafe "casadi__ExternalFunction__CONSTRUCTOR__0" c_casadi__ExternalFunction__CONSTRUCTOR__0 :: Ptr (Ptr StdString) -> Ptr StdString -> IO (Ptr ExternalFunction') casadi__ExternalFunction__CONSTRUCTOR__0 :: String -> IO ExternalFunction casadi__ExternalFunction__CONSTRUCTOR__0 x0 = withMarshal x0 $ \x0' -> do errStrPtrP <- new nullPtr ret <- c_casadi__ExternalFunction__CONSTRUCTOR__0 errStrPtrP x0' errStrPtr <- peek errStrPtrP free errStrPtrP if errStrPtr == nullPtr then wrapReturn ret else wrapReturn errStrPtr >>= (error . formatException) -- classy wrapper externalFunction__0 :: String -> IO ExternalFunction externalFunction__0 = casadi__ExternalFunction__CONSTRUCTOR__0 -- direct wrapper foreign import ccall unsafe "casadi__ExternalFunction__CONSTRUCTOR__1" c_casadi__ExternalFunction__CONSTRUCTOR__1 :: Ptr (Ptr StdString) -> IO (Ptr ExternalFunction') casadi__ExternalFunction__CONSTRUCTOR__1 :: IO ExternalFunction casadi__ExternalFunction__CONSTRUCTOR__1 = do errStrPtrP <- new nullPtr ret <- c_casadi__ExternalFunction__CONSTRUCTOR__1 errStrPtrP errStrPtr <- peek errStrPtrP free errStrPtrP if errStrPtr == nullPtr then wrapReturn ret else wrapReturn errStrPtr >>= (error . formatException) -- classy wrapper externalFunction__1 :: IO ExternalFunction externalFunction__1 = casadi__ExternalFunction__CONSTRUCTOR__1