JobResultRef< Result< RESULTVALUETYPE > > Class Template Reference

#include <job.h>

Inheritance diagram for JobResultRef< Result< RESULTVALUETYPE > >:

Public Member Functions

 MAXON_DEFAULT_REFERENCE_CONSTRUCTORS (JobResultRef, JobRef)
 
Result< RESULTVALUETYPE > GetResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
Result< RESULTVALUETYPE > MoveResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT)
 
- Public Member Functions inherited from JobRef
 MAXON_DEFAULT_REFERENCE_CONSTRUCTORS (JobRef, Ptr)
 
MAXON_IMPLICIT JobRef (const Ptr &src)
 
MAXON_IMPLICIT JobRef (Ptr &&src)
 
Bool Wait (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
Result< void > GetResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
void Cancel ()
 
Bool IsCancelled () const
 
void CancelAndWait (WAITMODE mode=WAITMODE::DEFAULT)
 
JobRefEnqueue (JobQueueInterface *queue=JOBQUEUE_CURRENT)
 
Result< void > AddSubJob (JobInterface *subJob)
 
template<JOBCANCELLATION B = JOBCANCELLATION::ISOK, typename FN >
 DISABLE_IF_JOBREF (FN, Result< void >) AddSubJob(FN &&src)
 
template<typename GROUP >
Result< void > AddSubGroup (GROUP *subGroup)
 
JobGroupInterfaceGetJobGroup () const
 
ObservableFinishedBase< JobInterfaceObservableFinished ()
 
ObservableCancelledBase< JobInterfaceObservableCancelled ()
 
String ToString (const FormatStatement *formatStatement) const
 
- Public Member Functions inherited from BaseRef< T, HANDLER >
T * GetPointer ()
 
ConstReferencedTypeGetPointer () const
 
T * operator-> ()
 
ConstReferencedTypeoperator-> () const
 
T & operator* ()
 
ConstReferencedTypeoperator* () const
 
 operator T* ()
 
 operator ConstReferencedType * () const
 
 operator Bool () const
 
 operator Bool ()
 
ResultRef< typename std::remove_const< T >::type > MakeWritable (Bool resetOnError=true)
 
T & GetOrNull () const
 
 BaseRef ()
 
MAXON_IMPLICIT BaseRef (std::nullptr_t)=delete
 
MAXON_IMPLICIT BaseRef (T *o)
 
template<typename PTR >
 BaseRef (ForwardResultPtr< PTR > o)
 
 BaseRef (ResultPtr< T > o, Int)
 
 BaseRef (const BaseRef &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
MAXON_IMPLICIT BaseRef (const REF &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
MAXON_IMPLICIT BaseRef (REF &src)
 
BaseRefoperator= (T *src)
 
BaseRefoperator= (std::nullptr_t src)
 
BaseRefoperator= (const BaseRef &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
BaseRefoperator= (const REF &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
BaseRefoperator= (REF &src)
 
 BaseRef (BaseRef &&src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(const, REF) && !STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
MAXON_IMPLICIT BaseRef (REF &&src)
 
BaseRefoperator= (BaseRef &&src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(const, REF) && !STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
BaseRefoperator= (REF &&src)
 
 ~BaseRef ()
 
Bool operator== (const BaseRef &b) const
 
Bool operator!= (const BaseRef &b) const
 
Bool operator== (const T *b) const
 
Bool operator!= (const T *b) const
 
Bool operator== (typename std::remove_const< T >::type *b) const
 
Bool operator!= (typename std::remove_const< T >::type *b) const
 
Bool operator== (std::nullptr_t) const
 
Bool operator!= (std::nullptr_t) const
 
UInt GetHashCode () const
 
T * Disconnect ()
 
void PrivateSetTarget (ResultPtr< T > src)
 
void PrivateSetPointer (T *ptr)
 

Additional Inherited Members

- Public Types inherited from BaseRef< T, HANDLER >
using ReferencedType = T
 
using ConstReferencedType = typename ConstIf< T, Bool(HANDLER::KIND &VALUEKIND::DEEP_CONSTNESS)>::type
 
using DirectlyReferencedType = T
 
using SelfType = BaseRef< T, HANDLER >
 
template<typename D >
using IsGenericBaseOf = std::true_type
 
using Handler = HANDLER
 
using RefCompareType = RefCompare< MAXON_IS_COW_KIND(HANDLER::KIND), IsInterfaceType< T >::value >
 
- Static Public Member Functions inherited from JobRef
template<JOBCANCELLATION B = JOBCANCELLATION::AUTOMATIC, typename FN , typename... ARGS>
static auto Create (FN &&src, ARGS &&... args) -> ResultMemT< JobResultRef< decltype(src(std::forward< ARGS >(args)...))>>
 
template<JOBCANCELLATION B = JOBCANCELLATION::AUTOMATIC, typename FN >
static MAXON_WARN_UNUSED auto Enqueue (FN &&src, JobQueueInterface *queue=JOBQUEUE_CURRENT) -> ResultMemT< JobResultRef< decltype(src())>>
 
template<JOBCANCELLATION B = JOBCANCELLATION::AUTOMATIC, typename FN , typename... ARGS>
static MAXON_WARN_UNUSED auto Enqueue (FN &&src, JobQueueInterface *queue, ARGS &&... args) -> ResultMemT< JobResultRef< decltype(src(std::forward< ARGS >(args)...))>>
 
static Int GetCurrentWorkerThreadIndex ()
 
static Int GetCurrentThreadCount ()
 
static Bool IsCurrentJobCancelled (const JobInterface *optionalJob=nullptr)
 
static Bool IsCurrentJobCancelled (const JobRef &optionalJob)
 
static JobStatusInterfaceGetCurrentJob ()
 
static const JobRefNullValue ()
 
- Static Public Member Functions inherited from BaseRef< T, HANDLER >
static std::false_type GenericVarianceCheck (const void *)
 
template<typename... ARGS>
static MAXON_ATTRIBUTE_FORCE_INLINE ResultMemT< BaseRefCreate (ARGS &&... args)
 
static const BaseRefNullValue ()
 
- Static Public Attributes inherited from BaseRef< T, HANDLER >
static const Bool DIRECT_REF
 
- Protected Member Functions inherited from JobRef
JobInterfaceoperator-> () const
 
- Protected Attributes inherited from BaseRef< T, HANDLER >
T * _object
 

Member Function Documentation

◆ MAXON_DEFAULT_REFERENCE_CONSTRUCTORS()

MAXON_DEFAULT_REFERENCE_CONSTRUCTORS ( JobResultRef< Result< RESULTVALUETYPE > >  ,
JobRef   
)

◆ GetResult()

Result<RESULTVALUETYPE> GetResult ( TimeValue  timeout = TIMEVALUE_INFINITE,
WAITMODE  mode = WAITMODE::DEFAULT 
) const

Waits until this job has been executed and returns the result. THREADSAFE.

Parameters
[in]timeoutMaximum wait interval (or TIMEVALUE_INFINITE for no time-out).
[in]modeWAITMODE::DEFAULT by default. WAITMODE::RETURN_ON_CANCEL means that Wait() will return if the caller has been cancelled even if the condition has not been set yet.
Returns
Result value on success.

◆ MoveResult()

Result<RESULTVALUETYPE> MoveResult ( TimeValue  timeout = TIMEVALUE_INFINITE,
WAITMODE  mode = WAITMODE::DEFAULT 
)

Waits until this job has been executed and returns the result via std::move.

Note
You may only use MoveResult() if you can ensure that nobody else will ask for the result of the job. THREADSAFE.
Parameters
[in]timeoutMaximum wait interval (or TIMEVALUE_INFINITE for no time-out).
[in]modeWAITMODE::DEFAULT by default. WAITMODE::RETURN_ON_CANCEL means that Wait() will return if the caller has been cancelled even if the condition has not been set yet.
Returns
Result value on success.