JobInterfaceTemplate< IMPLEMENTATION, RESULTVALUETYPE, USE_VIRTUAL_DESTRUCTOR > Class Template Reference

#include <job.h>

Inheritance diagram for JobInterfaceTemplate< IMPLEMENTATION, RESULTVALUETYPE, USE_VIRTUAL_DESTRUCTOR >:

Detailed Description

template<typename IMPLEMENTATION, typename RESULTVALUETYPE = void, Bool USE_VIRTUAL_DESTRUCTOR = false>
class maxon::JobInterfaceTemplate< IMPLEMENTATION, RESULTVALUETYPE, USE_VIRTUAL_DESTRUCTOR >

Template for jobs which inherit from JobInterface (and are not created using a lambda).

Template Parameters
IMPLEMENTATIONThe job implementation type (used to build the jump table).
RESULTVALUETYPEAn optional result value type to be used if the job returns more than just Result<void>.
USE_VIRTUAL_DESTRUCTORBy default ~IMPLEMENTATION() is called on destruction. Specify true if you require a virtual destructor.

The following snippet implements a job which returns an Int.

class MyJob : public JobInterfaceTemplate<MyJob, Int>
{
public:
Result<void> operator ()()
{
return SetResult(42);
}
};
ResultOk< void > SetResult()
Definition: job.h:1080

Static Public Member Functions

template<typename... ARGS>
static ResultMemT< JobResultRef< RESULTVALUETYPE > > Create (ARGS &&... args)
 
- Static Public Member Functions inherited from JobInterface
template<JOBCANCELLATION B = JOBCANCELLATION::AUTOMATIC, typename FN , typename... ARGS>
static ResultMemT< JobInterface * > Create (FN &&src, ARGS &&... args)
 
static Int GetCurrentWorkerThreadIndex ()
 
static Int GetCurrentThreadCount ()
 
static Bool IsCurrentJobCancelled (const JobInterface *optionalJob=nullptr)
 
static JobStatusInterfaceGetCurrentJob ()
 

Private Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (JobInterfaceTemplate)
 

Additional Inherited Members

- Public Member Functions inherited from JobInterface
JOBOPTIONFLAGS GetJobOptions () const
 
const CharGetName () const
 
 JobInterface (const JobInterfaceJumpTablePOD &jmpTable)
 
 ~JobInterface () override
 
 JobInterface (JobInterface &&src)
 
JobInterfaceoperator= (JobInterface &&src)
 
Bool Wait (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
Result< void > GetResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
Result< void > MoveResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT)
 
void Cancel ()
 
Bool IsCancelled () const
 
void CancelAndWait (WAITMODE mode=WAITMODE::DEFAULT)
 
JobInterfaceEnqueue (JobQueueInterface *queue=JOBQUEUE_CURRENT)
 
Result< void > AddSubJob (JobInterface *subJob)
 
template<typename JOB >
Result< void > AddSubJob (ResultMemT< JOB * > subJob)
 
template<typename JOBREF >
Result< void > AddSubJob (ResultMemT< JOBREF > &&subJob)
 
template<typename GROUP >
Result< void > AddSubGroup (GROUP *subGroup)
 
template<typename GROUP >
Result< void > AddSubGroup (ResultMemT< GROUP * > subGroup)
 
template<typename GROUP >
Result< void > AddSubGroup (ResultMemT< GROUP > subGroup)
 
JobGroupInterfaceGetJobGroup () const
 
ObservableFinishedBase< JobInterfaceObservableFinished ()
 
ObservableCancelledBase< JobInterfaceObservableCancelled ()
 
Result< void > Then (JobInterface *next, JobQueueInterface *queue=JOBQUEUE_CURRENT)
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
- Protected Types inherited from JobResultInterface< void >
using ValueType = void
 
- Protected Member Functions inherited from JobResultInterface< void >
ResultOk< void > SetResult ()
 
void GetResultValue ()
 
template<typename FN , typename... ARGS>
Result< void > Invoke (FN &&obj, ARGS &&... args)