-- | FFI module for reparenting nodes
module GEGL.FFI.Reparent
  ( c_gegl_node_add_child
  , c_gegl_node_remove_child
  , c_gegl_node_get_parent
  )
where

import Foreign

-- | Interface to the @gegl_node_add_child@ function in C.
foreign import ccall unsafe "gegl.h gegl_node_add_child"
  c_gegl_node_add_child
    :: Ptr ()    -- ^ Graph node
    -> Ptr ()    -- ^ Child node
    -> IO (Ptr ()) -- ^ The child

-- | Interface to the @gegl_node_remove_child@ function in C.
foreign import ccall unsafe "gegl.h gegl_node_remove_child"
  c_gegl_node_remove_child
    :: Ptr ()    -- ^ Graph node
    -> Ptr ()    -- ^ Child node
    -> IO (Ptr ()) -- ^ The child

-- | Interface to the @gegl_node_get_parent@ function in C.
foreign import ccall unsafe "gegl.h gegl_node_get_parent"
  c_gegl_node_get_parent
    :: Ptr ()    -- ^ A node
    -> IO (Ptr ()) -- ^ The parent of the node or NULL