{-# LANGUAGE CApiFFI #-}
module OpenCascade.ShapeExtend.WireData
( WireData
, fromWireChainedAndManifold
, reverse
, wire
, wireAPIMake
) where

import Prelude hiding (reverse)
import OpenCascade.ShapeExtend.Types (WireData)
import OpenCascade.ShapeExtend.Internal.Destructors (deleteWireData)
import qualified OpenCascade.TopoDS as TopoDS
import OpenCascade.TopoDS.Internal.Destructors (deleteShape)
import OpenCascade.Internal.Bool (boolToCBool)
import OpenCascade.Inheritance (upcast)
import Foreign.Ptr (Ptr)
import Foreign.C (CBool (..))
import Data.Acquire (Acquire, mkAcquire)

foreign import capi unsafe "hs_ShapeExtend_WireData.h hs_new_ShapeExtend_WireData_fromWireChainedAndManifold" rawFromWireChainedAndManifold :: Ptr TopoDS.Wire -> CBool -> CBool -> IO (Ptr WireData)

fromWireChainedAndManifold :: Ptr TopoDS.Wire -> Bool -> Bool -> Acquire (Ptr WireData)
fromWireChainedAndManifold :: Ptr Wire -> Bool -> Bool -> Acquire (Ptr WireData)
fromWireChainedAndManifold Ptr Wire
theWire Bool
chained Bool
manifold = 
    IO (Ptr WireData)
-> (Ptr WireData -> IO ()) -> Acquire (Ptr WireData)
forall a. IO a -> (a -> IO ()) -> Acquire a
mkAcquire (Ptr Wire -> CBool -> CBool -> IO (Ptr WireData)
rawFromWireChainedAndManifold Ptr Wire
theWire (Bool -> CBool
boolToCBool Bool
chained) (Bool -> CBool
boolToCBool Bool
manifold)) (Ptr WireData -> IO ()
deleteWireData)

foreign import capi unsafe "hs_ShapeExtend_WireData.h hs_ShapeExtend_WireData_reverse" reverse :: Ptr WireData -> IO ()


foreign import capi unsafe "hs_ShapeExtend_WireData.h hs_ShapeExtend_WireData_wire" rawWire :: Ptr WireData -> IO (Ptr TopoDS.Wire)

wire :: Ptr WireData -> Acquire (Ptr TopoDS.Wire)
wire :: Ptr WireData -> Acquire (Ptr Wire)
wire Ptr WireData
wireData = IO (Ptr Wire) -> (Ptr Wire -> IO ()) -> Acquire (Ptr Wire)
forall a. IO a -> (a -> IO ()) -> Acquire a
mkAcquire (Ptr WireData -> IO (Ptr Wire)
rawWire Ptr WireData
wireData) (Ptr Shape -> IO ()
deleteShape (Ptr Shape -> IO ())
-> (Ptr Wire -> Ptr Shape) -> Ptr Wire -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Wire -> Ptr Shape
forall a b. SubTypeOf a b => Ptr b -> Ptr a
upcast)


foreign import capi unsafe "hs_ShapeExtend_WireData.h hs_ShapeExtend_WireData_wireAPIMake" rawWireAPIMake :: Ptr WireData -> IO (Ptr TopoDS.Wire)

wireAPIMake :: Ptr WireData -> Acquire (Ptr TopoDS.Wire)
wireAPIMake :: Ptr WireData -> Acquire (Ptr Wire)
wireAPIMake Ptr WireData
wireData = IO (Ptr Wire) -> (Ptr Wire -> IO ()) -> Acquire (Ptr Wire)
forall a. IO a -> (a -> IO ()) -> Acquire a
mkAcquire (Ptr WireData -> IO (Ptr Wire)
rawWireAPIMake Ptr WireData
wireData) (Ptr Shape -> IO ()
deleteShape (Ptr Shape -> IO ())
-> (Ptr Wire -> Ptr Shape) -> Ptr Wire -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Wire -> Ptr Shape
forall a b. SubTypeOf a b => Ptr b -> Ptr a
upcast)