{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

'GI.GstBase.Objects.DataQueue.DataQueue' is an object that handles threadsafe queueing of objects. It
also provides size-related functionality. This object should be used for
any 'GI.Gst.Objects.Element.Element' that wishes to provide some sort of queueing functionality.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GstBase.Objects.DataQueue
    (

-- * Exported types
    DataQueue(..)                           ,
    IsDataQueue                             ,
    toDataQueue                             ,
    noDataQueue                             ,


 -- * Properties
-- ** currentLevelBytes #attr:currentLevelBytes#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DataQueueCurrentLevelBytesPropertyInfo  ,
#endif
#if ENABLE_OVERLOADING
    dataQueueCurrentLevelBytes              ,
#endif
    getDataQueueCurrentLevelBytes           ,


-- ** currentLevelTime #attr:currentLevelTime#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DataQueueCurrentLevelTimePropertyInfo   ,
#endif
#if ENABLE_OVERLOADING
    dataQueueCurrentLevelTime               ,
#endif
    getDataQueueCurrentLevelTime            ,


-- ** currentLevelVisible #attr:currentLevelVisible#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DataQueueCurrentLevelVisiblePropertyInfo,
#endif
#if ENABLE_OVERLOADING
    dataQueueCurrentLevelVisible            ,
#endif
    getDataQueueCurrentLevelVisible         ,




    ) 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.ManagedPtr as B.ManagedPtr
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.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 GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype DataQueue = DataQueue (ManagedPtr DataQueue)
foreign import ccall "gst_data_queue_get_type"
    c_gst_data_queue_get_type :: IO GType

instance GObject DataQueue where
    gobjectType = c_gst_data_queue_get_type


-- | Type class for types which can be safely cast to `DataQueue`, for instance with `toDataQueue`.
class (GObject o, O.IsDescendantOf DataQueue o) => IsDataQueue o
instance (GObject o, O.IsDescendantOf DataQueue o) => IsDataQueue o

instance O.HasParentTypes DataQueue
type instance O.ParentTypes DataQueue = '[GObject.Object.Object]

-- | Cast to `DataQueue`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDataQueue :: (MonadIO m, IsDataQueue o) => o -> m DataQueue
toDataQueue = liftIO . unsafeCastTo DataQueue

-- | A convenience alias for `Nothing` :: `Maybe` `DataQueue`.
noDataQueue :: Maybe DataQueue
noDataQueue = Nothing

#if ENABLE_OVERLOADING
type family ResolveDataQueueMethod (t :: Symbol) (o :: *) :: * where
    ResolveDataQueueMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDataQueueMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDataQueueMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDataQueueMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDataQueueMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDataQueueMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDataQueueMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDataQueueMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDataQueueMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDataQueueMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDataQueueMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDataQueueMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDataQueueMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDataQueueMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDataQueueMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDataQueueMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDataQueueMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDataQueueMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDataQueueMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDataQueueMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDataQueueMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDataQueueMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDataQueueMethod t DataQueue, O.MethodInfo info DataQueue p) => OL.IsLabel t (DataQueue -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- VVV Prop "current-level-bytes"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@current-level-bytes@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dataQueue #currentLevelBytes
@
-}
getDataQueueCurrentLevelBytes :: (MonadIO m, IsDataQueue o) => o -> m Word32
getDataQueueCurrentLevelBytes obj = liftIO $ B.Properties.getObjectPropertyUInt32 obj "current-level-bytes"

#if ENABLE_OVERLOADING
data DataQueueCurrentLevelBytesPropertyInfo
instance AttrInfo DataQueueCurrentLevelBytesPropertyInfo where
    type AttrAllowedOps DataQueueCurrentLevelBytesPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DataQueueCurrentLevelBytesPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DataQueueCurrentLevelBytesPropertyInfo = IsDataQueue
    type AttrGetType DataQueueCurrentLevelBytesPropertyInfo = Word32
    type AttrLabel DataQueueCurrentLevelBytesPropertyInfo = "current-level-bytes"
    type AttrOrigin DataQueueCurrentLevelBytesPropertyInfo = DataQueue
    attrGet _ = getDataQueueCurrentLevelBytes
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "current-level-time"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@current-level-time@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dataQueue #currentLevelTime
@
-}
getDataQueueCurrentLevelTime :: (MonadIO m, IsDataQueue o) => o -> m Word64
getDataQueueCurrentLevelTime obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "current-level-time"

#if ENABLE_OVERLOADING
data DataQueueCurrentLevelTimePropertyInfo
instance AttrInfo DataQueueCurrentLevelTimePropertyInfo where
    type AttrAllowedOps DataQueueCurrentLevelTimePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DataQueueCurrentLevelTimePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DataQueueCurrentLevelTimePropertyInfo = IsDataQueue
    type AttrGetType DataQueueCurrentLevelTimePropertyInfo = Word64
    type AttrLabel DataQueueCurrentLevelTimePropertyInfo = "current-level-time"
    type AttrOrigin DataQueueCurrentLevelTimePropertyInfo = DataQueue
    attrGet _ = getDataQueueCurrentLevelTime
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "current-level-visible"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@current-level-visible@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dataQueue #currentLevelVisible
@
-}
getDataQueueCurrentLevelVisible :: (MonadIO m, IsDataQueue o) => o -> m Word32
getDataQueueCurrentLevelVisible obj = liftIO $ B.Properties.getObjectPropertyUInt32 obj "current-level-visible"

#if ENABLE_OVERLOADING
data DataQueueCurrentLevelVisiblePropertyInfo
instance AttrInfo DataQueueCurrentLevelVisiblePropertyInfo where
    type AttrAllowedOps DataQueueCurrentLevelVisiblePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DataQueueCurrentLevelVisiblePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DataQueueCurrentLevelVisiblePropertyInfo = IsDataQueue
    type AttrGetType DataQueueCurrentLevelVisiblePropertyInfo = Word32
    type AttrLabel DataQueueCurrentLevelVisiblePropertyInfo = "current-level-visible"
    type AttrOrigin DataQueueCurrentLevelVisiblePropertyInfo = DataQueue
    attrGet _ = getDataQueueCurrentLevelVisible
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList DataQueue
type instance O.AttributeList DataQueue = DataQueueAttributeList
type DataQueueAttributeList = ('[ '("currentLevelBytes", DataQueueCurrentLevelBytesPropertyInfo), '("currentLevelTime", DataQueueCurrentLevelTimePropertyInfo), '("currentLevelVisible", DataQueueCurrentLevelVisiblePropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
dataQueueCurrentLevelBytes :: AttrLabelProxy "currentLevelBytes"
dataQueueCurrentLevelBytes = AttrLabelProxy

dataQueueCurrentLevelTime :: AttrLabelProxy "currentLevelTime"
dataQueueCurrentLevelTime = AttrLabelProxy

dataQueueCurrentLevelVisible :: AttrLabelProxy "currentLevelVisible"
dataQueueCurrentLevelVisible = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList DataQueue = DataQueueSignalList
type DataQueueSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif