{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gst.Structs.TimedValue
(
TimedValue(..) ,
newZeroTimedValue ,
noTimedValue ,
#if defined(ENABLE_OVERLOADING)
ResolveTimedValueMethod ,
#endif
getTimedValueTimestamp ,
setTimedValueTimestamp ,
#if defined(ENABLE_OVERLOADING)
timedValue_timestamp ,
#endif
getTimedValueValue ,
setTimedValueValue ,
#if defined(ENABLE_OVERLOADING)
timedValue_value ,
#endif
) 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.GI.Base.Signals as B.Signals
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
newtype TimedValue = TimedValue (ManagedPtr TimedValue)
deriving (TimedValue -> TimedValue -> Bool
(TimedValue -> TimedValue -> Bool)
-> (TimedValue -> TimedValue -> Bool) -> Eq TimedValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimedValue -> TimedValue -> Bool
$c/= :: TimedValue -> TimedValue -> Bool
== :: TimedValue -> TimedValue -> Bool
$c== :: TimedValue -> TimedValue -> Bool
Eq)
instance WrappedPtr TimedValue where
wrappedPtrCalloc :: IO (Ptr TimedValue)
wrappedPtrCalloc = Int -> IO (Ptr TimedValue)
forall a. Int -> IO (Ptr a)
callocBytes 16
wrappedPtrCopy :: TimedValue -> IO TimedValue
wrappedPtrCopy = \p :: TimedValue
p -> TimedValue -> (Ptr TimedValue -> IO TimedValue) -> IO TimedValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TimedValue
p (Int -> Ptr TimedValue -> IO (Ptr TimedValue)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 16 (Ptr TimedValue -> IO (Ptr TimedValue))
-> (Ptr TimedValue -> IO TimedValue)
-> Ptr TimedValue
-> IO TimedValue
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr TimedValue -> TimedValue)
-> Ptr TimedValue -> IO TimedValue
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TimedValue -> TimedValue
TimedValue)
wrappedPtrFree :: Maybe (GDestroyNotify TimedValue)
wrappedPtrFree = GDestroyNotify TimedValue -> Maybe (GDestroyNotify TimedValue)
forall a. a -> Maybe a
Just GDestroyNotify TimedValue
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroTimedValue :: MonadIO m => m TimedValue
newZeroTimedValue :: m TimedValue
newZeroTimedValue = IO TimedValue -> m TimedValue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TimedValue -> m TimedValue) -> IO TimedValue -> m TimedValue
forall a b. (a -> b) -> a -> b
$ IO (Ptr TimedValue)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr TimedValue)
-> (Ptr TimedValue -> IO TimedValue) -> IO TimedValue
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr TimedValue -> TimedValue)
-> Ptr TimedValue -> IO TimedValue
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TimedValue -> TimedValue
TimedValue
instance tag ~ 'AttrSet => Constructible TimedValue tag where
new :: (ManagedPtr TimedValue -> TimedValue)
-> [AttrOp TimedValue tag] -> m TimedValue
new _ attrs :: [AttrOp TimedValue tag]
attrs = do
TimedValue
o <- m TimedValue
forall (m :: * -> *). MonadIO m => m TimedValue
newZeroTimedValue
TimedValue -> [AttrOp TimedValue 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set TimedValue
o [AttrOp TimedValue tag]
[AttrOp TimedValue 'AttrSet]
attrs
TimedValue -> m TimedValue
forall (m :: * -> *) a. Monad m => a -> m a
return TimedValue
o
noTimedValue :: Maybe TimedValue
noTimedValue :: Maybe TimedValue
noTimedValue = Maybe TimedValue
forall a. Maybe a
Nothing
getTimedValueTimestamp :: MonadIO m => TimedValue -> m Word64
getTimedValueTimestamp :: TimedValue -> m Word64
getTimedValueTimestamp s :: TimedValue
s = IO Word64 -> m Word64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ TimedValue -> (Ptr TimedValue -> IO Word64) -> IO Word64
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TimedValue
s ((Ptr TimedValue -> IO Word64) -> IO Word64)
-> (Ptr TimedValue -> IO Word64) -> IO Word64
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TimedValue
ptr -> do
Word64
val <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek (Ptr TimedValue
ptr Ptr TimedValue -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO Word64
Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
val
setTimedValueTimestamp :: MonadIO m => TimedValue -> Word64 -> m ()
setTimedValueTimestamp :: TimedValue -> Word64 -> m ()
setTimedValueTimestamp s :: TimedValue
s val :: Word64
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TimedValue -> (Ptr TimedValue -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TimedValue
s ((Ptr TimedValue -> IO ()) -> IO ())
-> (Ptr TimedValue -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TimedValue
ptr -> do
Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TimedValue
ptr Ptr TimedValue -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Word64
val :: Word64)
#if defined(ENABLE_OVERLOADING)
data TimedValueTimestampFieldInfo
instance AttrInfo TimedValueTimestampFieldInfo where
type AttrBaseTypeConstraint TimedValueTimestampFieldInfo = (~) TimedValue
type AttrAllowedOps TimedValueTimestampFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TimedValueTimestampFieldInfo = (~) Word64
type AttrTransferTypeConstraint TimedValueTimestampFieldInfo = (~)Word64
type AttrTransferType TimedValueTimestampFieldInfo = Word64
type AttrGetType TimedValueTimestampFieldInfo = Word64
type AttrLabel TimedValueTimestampFieldInfo = "timestamp"
type AttrOrigin TimedValueTimestampFieldInfo = TimedValue
attrGet = getTimedValueTimestamp
attrSet = setTimedValueTimestamp
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
timedValue_timestamp :: AttrLabelProxy "timestamp"
timedValue_timestamp = AttrLabelProxy
#endif
getTimedValueValue :: MonadIO m => TimedValue -> m Double
getTimedValueValue :: TimedValue -> m Double
getTimedValueValue s :: TimedValue
s = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ TimedValue -> (Ptr TimedValue -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TimedValue
s ((Ptr TimedValue -> IO Double) -> IO Double)
-> (Ptr TimedValue -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TimedValue
ptr -> do
CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr TimedValue
ptr Ptr TimedValue -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) :: IO CDouble
let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'
setTimedValueValue :: MonadIO m => TimedValue -> Double -> m ()
setTimedValueValue :: TimedValue -> Double -> m ()
setTimedValueValue s :: TimedValue
s val :: Double
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TimedValue -> (Ptr TimedValue -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TimedValue
s ((Ptr TimedValue -> IO ()) -> IO ())
-> (Ptr TimedValue -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TimedValue
ptr -> do
let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TimedValue
ptr Ptr TimedValue -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (CDouble
val' :: CDouble)
#if defined(ENABLE_OVERLOADING)
data TimedValueValueFieldInfo
instance AttrInfo TimedValueValueFieldInfo where
type AttrBaseTypeConstraint TimedValueValueFieldInfo = (~) TimedValue
type AttrAllowedOps TimedValueValueFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TimedValueValueFieldInfo = (~) Double
type AttrTransferTypeConstraint TimedValueValueFieldInfo = (~)Double
type AttrTransferType TimedValueValueFieldInfo = Double
type AttrGetType TimedValueValueFieldInfo = Double
type AttrLabel TimedValueValueFieldInfo = "value"
type AttrOrigin TimedValueValueFieldInfo = TimedValue
attrGet = getTimedValueValue
attrSet = setTimedValueValue
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
timedValue_value :: AttrLabelProxy "value"
timedValue_value = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TimedValue
type instance O.AttributeList TimedValue = TimedValueAttributeList
type TimedValueAttributeList = ('[ '("timestamp", TimedValueTimestampFieldInfo), '("value", TimedValueValueFieldInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveTimedValueMethod (t :: Symbol) (o :: *) :: * where
ResolveTimedValueMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTimedValueMethod t TimedValue, O.MethodInfo info TimedValue p) => OL.IsLabel t (TimedValue -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif