{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gst.Structs.AtomicQueue
(
AtomicQueue(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveAtomicQueueMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
AtomicQueueLengthMethodInfo ,
#endif
atomicQueueLength ,
atomicQueueNew ,
#if defined(ENABLE_OVERLOADING)
AtomicQueuePeekMethodInfo ,
#endif
atomicQueuePeek ,
#if defined(ENABLE_OVERLOADING)
AtomicQueuePopMethodInfo ,
#endif
atomicQueuePop ,
#if defined(ENABLE_OVERLOADING)
AtomicQueuePushMethodInfo ,
#endif
atomicQueuePush ,
#if defined(ENABLE_OVERLOADING)
AtomicQueueRefMethodInfo ,
#endif
atomicQueueRef ,
#if defined(ENABLE_OVERLOADING)
AtomicQueueUnrefMethodInfo ,
#endif
atomicQueueUnref ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
newtype AtomicQueue = AtomicQueue (SP.ManagedPtr AtomicQueue)
deriving (AtomicQueue -> AtomicQueue -> Bool
(AtomicQueue -> AtomicQueue -> Bool)
-> (AtomicQueue -> AtomicQueue -> Bool) -> Eq AtomicQueue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AtomicQueue -> AtomicQueue -> Bool
$c/= :: AtomicQueue -> AtomicQueue -> Bool
== :: AtomicQueue -> AtomicQueue -> Bool
$c== :: AtomicQueue -> AtomicQueue -> Bool
Eq)
instance SP.ManagedPtrNewtype AtomicQueue where
toManagedPtr :: AtomicQueue -> ManagedPtr AtomicQueue
toManagedPtr (AtomicQueue ManagedPtr AtomicQueue
p) = ManagedPtr AtomicQueue
p
foreign import ccall "gst_atomic_queue_get_type" c_gst_atomic_queue_get_type ::
IO GType
type instance O.ParentTypes AtomicQueue = '[]
instance O.HasParentTypes AtomicQueue
instance B.Types.TypedObject AtomicQueue where
glibType :: IO GType
glibType = IO GType
c_gst_atomic_queue_get_type
instance B.Types.GBoxed AtomicQueue
instance B.GValue.IsGValue (Maybe AtomicQueue) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gst_atomic_queue_get_type
gvalueSet_ :: Ptr GValue -> Maybe AtomicQueue -> IO ()
gvalueSet_ Ptr GValue
gv Maybe AtomicQueue
P.Nothing = Ptr GValue -> Ptr AtomicQueue -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr AtomicQueue
forall a. Ptr a
FP.nullPtr :: FP.Ptr AtomicQueue)
gvalueSet_ Ptr GValue
gv (P.Just AtomicQueue
obj) = AtomicQueue -> (Ptr AtomicQueue -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AtomicQueue
obj (Ptr GValue -> Ptr AtomicQueue -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe AtomicQueue)
gvalueGet_ Ptr GValue
gv = do
Ptr AtomicQueue
ptr <- Ptr GValue -> IO (Ptr AtomicQueue)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr AtomicQueue)
if Ptr AtomicQueue
ptr Ptr AtomicQueue -> Ptr AtomicQueue -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr AtomicQueue
forall a. Ptr a
FP.nullPtr
then AtomicQueue -> Maybe AtomicQueue
forall a. a -> Maybe a
P.Just (AtomicQueue -> Maybe AtomicQueue)
-> IO AtomicQueue -> IO (Maybe AtomicQueue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr AtomicQueue -> AtomicQueue)
-> Ptr AtomicQueue -> IO AtomicQueue
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr AtomicQueue -> AtomicQueue
AtomicQueue Ptr AtomicQueue
ptr
else Maybe AtomicQueue -> IO (Maybe AtomicQueue)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe AtomicQueue
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList AtomicQueue
type instance O.AttributeList AtomicQueue = AtomicQueueAttributeList
type AtomicQueueAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "gst_atomic_queue_new" gst_atomic_queue_new ::
Word32 ->
IO (Ptr AtomicQueue)
atomicQueueNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> m AtomicQueue
atomicQueueNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> m AtomicQueue
atomicQueueNew Word32
initialSize = IO AtomicQueue -> m AtomicQueue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AtomicQueue -> m AtomicQueue)
-> IO AtomicQueue -> m AtomicQueue
forall a b. (a -> b) -> a -> b
$ do
Ptr AtomicQueue
result <- Word32 -> IO (Ptr AtomicQueue)
gst_atomic_queue_new Word32
initialSize
Text -> Ptr AtomicQueue -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"atomicQueueNew" Ptr AtomicQueue
result
AtomicQueue
result' <- ((ManagedPtr AtomicQueue -> AtomicQueue)
-> Ptr AtomicQueue -> IO AtomicQueue
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr AtomicQueue -> AtomicQueue
AtomicQueue) Ptr AtomicQueue
result
AtomicQueue -> IO AtomicQueue
forall (m :: * -> *) a. Monad m => a -> m a
return AtomicQueue
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gst_atomic_queue_length" gst_atomic_queue_length ::
Ptr AtomicQueue ->
IO Word32
atomicQueueLength ::
(B.CallStack.HasCallStack, MonadIO m) =>
AtomicQueue
-> m Word32
atomicQueueLength :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AtomicQueue -> m Word32
atomicQueueLength AtomicQueue
queue = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr AtomicQueue
queue' <- AtomicQueue -> IO (Ptr AtomicQueue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AtomicQueue
queue
Word32
result <- Ptr AtomicQueue -> IO Word32
gst_atomic_queue_length Ptr AtomicQueue
queue'
AtomicQueue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AtomicQueue
queue
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AtomicQueueLengthMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.OverloadedMethod AtomicQueueLengthMethodInfo AtomicQueue signature where
overloadedMethod = atomicQueueLength
instance O.OverloadedMethodInfo AtomicQueueLengthMethodInfo AtomicQueue where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gst.Structs.AtomicQueue.atomicQueueLength",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Structs-AtomicQueue.html#v:atomicQueueLength"
}
#endif
foreign import ccall "gst_atomic_queue_peek" gst_atomic_queue_peek ::
Ptr AtomicQueue ->
IO (Ptr ())
atomicQueuePeek ::
(B.CallStack.HasCallStack, MonadIO m) =>
AtomicQueue
-> m (Ptr ())
atomicQueuePeek :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AtomicQueue -> m (Ptr ())
atomicQueuePeek AtomicQueue
queue = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
Ptr AtomicQueue
queue' <- AtomicQueue -> IO (Ptr AtomicQueue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AtomicQueue
queue
Ptr ()
result <- Ptr AtomicQueue -> IO (Ptr ())
gst_atomic_queue_peek Ptr AtomicQueue
queue'
AtomicQueue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AtomicQueue
queue
Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result
#if defined(ENABLE_OVERLOADING)
data AtomicQueuePeekMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m) => O.OverloadedMethod AtomicQueuePeekMethodInfo AtomicQueue signature where
overloadedMethod = atomicQueuePeek
instance O.OverloadedMethodInfo AtomicQueuePeekMethodInfo AtomicQueue where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gst.Structs.AtomicQueue.atomicQueuePeek",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Structs-AtomicQueue.html#v:atomicQueuePeek"
}
#endif
foreign import ccall "gst_atomic_queue_pop" gst_atomic_queue_pop ::
Ptr AtomicQueue ->
IO (Ptr ())
atomicQueuePop ::
(B.CallStack.HasCallStack, MonadIO m) =>
AtomicQueue
-> m (Ptr ())
atomicQueuePop :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AtomicQueue -> m (Ptr ())
atomicQueuePop AtomicQueue
queue = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
Ptr AtomicQueue
queue' <- AtomicQueue -> IO (Ptr AtomicQueue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AtomicQueue
queue
Ptr ()
result <- Ptr AtomicQueue -> IO (Ptr ())
gst_atomic_queue_pop Ptr AtomicQueue
queue'
AtomicQueue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AtomicQueue
queue
Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result
#if defined(ENABLE_OVERLOADING)
data AtomicQueuePopMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m) => O.OverloadedMethod AtomicQueuePopMethodInfo AtomicQueue signature where
overloadedMethod = atomicQueuePop
instance O.OverloadedMethodInfo AtomicQueuePopMethodInfo AtomicQueue where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gst.Structs.AtomicQueue.atomicQueuePop",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Structs-AtomicQueue.html#v:atomicQueuePop"
}
#endif
foreign import ccall "gst_atomic_queue_push" gst_atomic_queue_push ::
Ptr AtomicQueue ->
Ptr () ->
IO ()
atomicQueuePush ::
(B.CallStack.HasCallStack, MonadIO m) =>
AtomicQueue
-> Ptr ()
-> m ()
atomicQueuePush :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AtomicQueue -> Ptr () -> m ()
atomicQueuePush AtomicQueue
queue Ptr ()
data_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr AtomicQueue
queue' <- AtomicQueue -> IO (Ptr AtomicQueue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AtomicQueue
queue
Ptr AtomicQueue -> Ptr () -> IO ()
gst_atomic_queue_push Ptr AtomicQueue
queue' Ptr ()
data_
AtomicQueue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AtomicQueue
queue
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data AtomicQueuePushMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m) => O.OverloadedMethod AtomicQueuePushMethodInfo AtomicQueue signature where
overloadedMethod = atomicQueuePush
instance O.OverloadedMethodInfo AtomicQueuePushMethodInfo AtomicQueue where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gst.Structs.AtomicQueue.atomicQueuePush",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Structs-AtomicQueue.html#v:atomicQueuePush"
}
#endif
foreign import ccall "gst_atomic_queue_ref" gst_atomic_queue_ref ::
Ptr AtomicQueue ->
IO ()
atomicQueueRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
AtomicQueue
-> m ()
atomicQueueRef :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AtomicQueue -> m ()
atomicQueueRef AtomicQueue
queue = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr AtomicQueue
queue' <- AtomicQueue -> IO (Ptr AtomicQueue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AtomicQueue
queue
Ptr AtomicQueue -> IO ()
gst_atomic_queue_ref Ptr AtomicQueue
queue'
AtomicQueue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AtomicQueue
queue
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data AtomicQueueRefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod AtomicQueueRefMethodInfo AtomicQueue signature where
overloadedMethod = atomicQueueRef
instance O.OverloadedMethodInfo AtomicQueueRefMethodInfo AtomicQueue where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gst.Structs.AtomicQueue.atomicQueueRef",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Structs-AtomicQueue.html#v:atomicQueueRef"
}
#endif
foreign import ccall "gst_atomic_queue_unref" gst_atomic_queue_unref ::
Ptr AtomicQueue ->
IO ()
atomicQueueUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
AtomicQueue
-> m ()
atomicQueueUnref :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AtomicQueue -> m ()
atomicQueueUnref AtomicQueue
queue = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr AtomicQueue
queue' <- AtomicQueue -> IO (Ptr AtomicQueue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AtomicQueue
queue
Ptr AtomicQueue -> IO ()
gst_atomic_queue_unref Ptr AtomicQueue
queue'
AtomicQueue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AtomicQueue
queue
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data AtomicQueueUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod AtomicQueueUnrefMethodInfo AtomicQueue signature where
overloadedMethod = atomicQueueUnref
instance O.OverloadedMethodInfo AtomicQueueUnrefMethodInfo AtomicQueue where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gst.Structs.AtomicQueue.atomicQueueUnref",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gst-1.0.24/docs/GI-Gst-Structs-AtomicQueue.html#v:atomicQueueUnref"
}
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveAtomicQueueMethod (t :: Symbol) (o :: *) :: * where
ResolveAtomicQueueMethod "length" o = AtomicQueueLengthMethodInfo
ResolveAtomicQueueMethod "peek" o = AtomicQueuePeekMethodInfo
ResolveAtomicQueueMethod "pop" o = AtomicQueuePopMethodInfo
ResolveAtomicQueueMethod "push" o = AtomicQueuePushMethodInfo
ResolveAtomicQueueMethod "ref" o = AtomicQueueRefMethodInfo
ResolveAtomicQueueMethod "unref" o = AtomicQueueUnrefMethodInfo
ResolveAtomicQueueMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAtomicQueueMethod t AtomicQueue, O.OverloadedMethod info AtomicQueue p) => OL.IsLabel t (AtomicQueue -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAtomicQueueMethod t AtomicQueue, O.OverloadedMethod info AtomicQueue p, R.HasField t AtomicQueue p) => R.HasField t AtomicQueue p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveAtomicQueueMethod t AtomicQueue, O.OverloadedMethodInfo info AtomicQueue) => OL.IsLabel t (O.MethodProxy info AtomicQueue) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif