Abstract work processor – takes work units and turns them into WorkResult instances. More...
#include <mitsuba/core/sched.h>
Public Member Functions | |
virtual ref< WorkUnit > | createWorkUnit () const =0 |
Create a work unit of the proper type and size. More... | |
virtual ref< WorkResult > | createWorkResult () const =0 |
Create a work result of the proper type and size. More... | |
virtual ref< WorkProcessor > | clone () const =0 |
Create a copy of this work processor instance. More... | |
virtual void | prepare ()=0 |
Called once before processing starts. More... | |
virtual void | process (const WorkUnit *workUnit, WorkResult *workResult, const bool &stop)=0 |
Process a work unit and store the computed results. More... | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Public Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a serializable object. More... | |
virtual void | serialize (Stream *stream, InstanceManager *manager) const =0 |
Serialize this object to a stream. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
virtual std::string | toString () const |
Return a human-readable string representation of the object's contents. More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::SerializableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
virtual | ~WorkProcessor () |
Virtual destructor. More... | |
WorkProcessor () | |
Protected constructors. More... | |
WorkProcessor (Stream *stream, InstanceManager *manager) | |
SerializableObject * | getResource (const std::string &name) |
Look up a named resource, which has been bound to the associated parallel process. More... | |
Protected Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject () | |
Construct a serializable object. More... | |
virtual | ~SerializableObject () |
Virtual deconstructor. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Protected Attributes | |
std::map< std::string, SerializableObject * > | m_resources |
Friends | |
class | Scheduler |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Abstract work processor – takes work units and turns them into WorkResult instances.
When executing a parallel task using Mitsuba's scheduling system, the actual work is done in an implementation of this interface.
The class is serializable so that it can be sent over the network if required. It is possible to keep local state in WorkProcessor instances (e.g. scratch space for computations), though anything not returned in the form of a WorkResult will eventually be lost. Each Worker (both locally and remotely) has its own WorkProcessor, and therefore no form of locking is required within instances of this class.
|
inlineprotectedvirtual |
Virtual destructor.
|
inlineprotected |
Protected constructors.
|
inlineprotected |
|
pure virtual |
Create a copy of this work processor instance.
|
pure virtual |
Create a work result of the proper type and size.
Create a work unit of the proper type and size.
Implemented in mitsuba::ParticleTracer.
|
virtual |
Retrieve this object's class.
Reimplemented from mitsuba::SerializableObject.
Reimplemented in mitsuba::ParticleTracer.
|
protected |
Look up a named resource, which has been bound to the associated parallel process.
Throws an exception if the resource is not known / bound.
|
pure virtual |
Called once before processing starts.
This is useful for allocating scratch space or resolving references to resource objects. Lengthy computations should be performed in process() instead of here, since this this method will be called while the central scheduler lock is held. A thrown exception will lead to the termination of the parallel process.
Implemented in mitsuba::ParticleTracer.
|
pure virtual |
Process a work unit and store the computed results.
The active
parameter can be used to signal a premature stop of the execution flow. In this case, the work result is allowed to be undefined (it will simply be ignored). A thrown exception will lead to the termination of the parallel process.
Implemented in mitsuba::ParticleTracer.
|
friend |
|
protected |
|
static |