MediaSessionProgressInterface Class Reference

#include <mediasession_progress.h>

Inheritance diagram for MediaSessionProgressInterface:

Detailed Description

This class simplifies the progress tracking of operations. Once created a operation can simply put the current progress into the object by calling SetProgressAndCheckBreak(). On the other end the ObservableProgressNotification can be hooked up to get notifications (e.g. for the ui).

Public Member Functions

MAXON_METHOD Result< void > InitProgress (const TimeValue &delayFirstProgress, const TimeValue &minProgressUpdate)
 
MAXON_METHOD Result< IntAddProgressJob (const Float jobWeight, const String &jobName)
 
MAXON_METHOD Result< void > SetProgressAndCheckBreak (Int jobIndex, Float percent)
 
 MAXON_OBSERVABLE (void, ObservableProgressNotification,(const MediaSessionProgressRef &progress, Float percent, const TimeValue &duration, const TimeValue &expectedTotalTime), ObservableCombinerRunAllComponent)
 

Private Member Functions

 MAXON_INTERFACE (MediaSessionProgressInterface, MAXON_REFERENCE_NORMAL, "net.maxon.image.interface.mediasessionprogress")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( MediaSessionProgressInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.image.interface.mediasessionprogress"   
)
private

◆ InitProgress()

MAXON_METHOD Result<void> InitProgress ( const TimeValue delayFirstProgress,
const TimeValue minProgressUpdate 
)
Parameters
[in]delayFirstProgressTime to delay the first progress notification.
[in]minProgressUpdateMinimum time difference to call the progress callback.

◆ AddProgressJob()

MAXON_METHOD Result<Int> AddProgressJob ( const Float  jobWeight,
const String jobName 
)
Parameters
[in]jobWeightAdd the weight for this job. All the weights are summed up and is taken into account for the overall percentage.
Returns
Index of the job.

◆ SetProgressAndCheckBreak()

MAXON_METHOD Result<void> SetProgressAndCheckBreak ( Int  jobIndex,
Float  percent 
)

Sets the progress of the current operation.

Parameters
[in]jobIndexJob index returned by AddProgressJob or -1 if no jobs are added
[in]percentPercentage between 0.0 and 1.0 of the done work.

◆ MAXON_OBSERVABLE()

MAXON_OBSERVABLE ( void  ,
ObservableProgressNotification  ,
(const MediaSessionProgressRef &progress, Float percent, const TimeValue &duration, const TimeValue &expectedTotalTime)  ,
ObservableCombinerRunAllComponent   
)

Observable will be called as soon as the progress changes.

Parameters
[in]progressReference to this object.
[in]percentPercentage between 0.0 and 1.0 of the done work.
[in]durationDuration of the current operation.
[in]expectedTotalTimeExpected total time of the current operation. TIMEVALUE_INFINITE will be set for infinite time.
[in]userDataUser data passed from the caller.