Interface of a WorkUnit. This represents on piece of work through time. More...
#include <workunit.h>
Public Member Functions | |
virtual | ~iWorkUnit () |
Virtual destructor. | |
virtual void | AddDependency (iWorkUnit *NewDependency)=0 |
Force this WorkUnit to Start after another has completed. More... | |
virtual void | ClearDependencies ()=0 |
Drop any information about what work units this one depends on. | |
virtual void | DoWork (DefaultThreadSpecificStorage::Type &CurrentThreadStorage)=0 |
WorkUnits Must implement these to do the work. | |
virtual iWorkUnit * | GetDependency (Whole Index) const =0 |
This is used to iterate of all the dependencies. More... | |
virtual Whole | GetDependencyCount () const =0 |
How many other WorkUnits does this one depend on? More... | |
virtual Whole | GetDependentCount (FrameScheduler &SchedulerToCount)=0 |
This returns the count workunits that depend on this work unit. More... | |
virtual Whole | GetImmediateDependencyCount () const =0 |
Get the amount of dependencies that directly count on this for access purposes. More... | |
virtual Whole | GetPerformance () const =0 |
Get the internal rolling average for querying. More... | |
virtual RunningState | GetRunningState () const =0 |
Retrieves the current RunningState of the thread. More... | |
virtual WorkUnitKey | GetSortingKey (FrameScheduler &SchedulerToCount)=0 |
Get the sorting metadata. More... | |
virtual bool | IsEveryDependencyComplete ()=0 |
Check if this WorkUnit could concievably run right now. More... | |
virtual void | operator() (DefaultThreadSpecificStorage::Type &CurrentThreadStorage)=0 |
This tracks work unit metadata, then calls DoWork. More... | |
virtual void | PrepareForNextFrame ()=0 |
This resets the running state and takes any further action required to use the WorkUnit again. | |
virtual void | RemoveDependency (iWorkUnit *RemoveDependency)=0 |
Remove a dependency. More... | |
virtual RunningState | TakeOwnerShip ()=0 |
Attempts to atomically start the work unit in the current thread. More... | |
Interface of a WorkUnit. This represents on piece of work through time.
This has no real substance, use the DefaultWorkUnit class is you want to inherit from something ready for easy integration. Implement this if you want to make heavy changes to the algorithm or maximize performance.
Definition at line 66 of file workunit.h.
|
pure virtual |
Force this WorkUnit to Start after another has completed.
NewDependency | The WorkUnit that must start after this one has completed. |
Implemented in Mezzanine::Threading::DefaultWorkUnit.
This is used to iterate of all the dependencies.
Index | The 0 based index of the dependency you are trying to retrieve. No ordering is guaranteed, just that counting from 0 to GetImmediateDependencyCount() with access each iWorkUnit once. |
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
How many other WorkUnits does this one depend on?
This is what the FrameScheduler uses to calculate the sorting order of WorkUnits. In the default implmentation it counts some units twice if they depend on this WorkUnit through Multiple dependency chains.
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
This returns the count workunits that depend on this work unit.
SchedulerToCount | The FrameScheduler has a cache of this data, it is impossible to calculate without the complete list of WorkUnits on it either. |
Because Dependents are not tracked this iterates over entry in the FrameScheduler it is passed.
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
Get the amount of dependencies that directly count on this for access purposes.
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
Get the internal rolling average for querying.
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
Retrieves the current RunningState of the thread.
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
Get the sorting metadata.
SchedulerToCount | This uses the metadata on the FrameScheduler to generate the Dependency listing required. |
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
Check if this WorkUnit could concievably run right now.
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
This tracks work unit metadata, then calls DoWork.
CurrentThreadStorage | The ThreadSpecificStorage that this WorkUnit will operate with when executing. |
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
Remove a dependency.
RemoveDependency | A pointer to the WorkUnit to remove as a dependency. |
Implemented in Mezzanine::Threading::DefaultWorkUnit.
|
pure virtual |
Attempts to atomically start the work unit in the current thread.
Implemented in Mezzanine::Threading::DefaultWorkUnit.