Class DirtySet<T>
Component class to maintain a 'dirty' set of entries of type T that will periodically process and clear. It will check whenever ticked, and whenever CleanTimer is ready, which must be initialized in the implementing class.
Inheritance
Namespace: Eco.Core.Utils
Assembly: Eco.Core.dll
Syntax
public class DirtySet<T> : Object where T : class
Type Parameters
Name | Description |
---|---|
T |
Constructors
DirtySet(Double)
Initialize with a value for how long to wait between cleanings.
Declaration
public DirtySet(double cleanTimer)
Parameters
Type | Name | Description |
---|---|---|
System.Double | cleanTimer |
Methods
Clear()
Clear dirty list without processing.
Declaration
public void Clear()
DirtiesReadyToProcess()
Returns a list of entries when they're ready to be processed, removing them from the list. Will only return when CleanTimer has expired, and CleanTimer continuously resets even when no entries are in the dirty list (this it to allow entries to 'queue up', so they can be processed in bulk, meant for systems where a flurry of changes will happen in quick succession, such that the processing shouldnt be done immediately after the first change).
Declaration
public IReadOnlySet<T> DirtiesReadyToProcess()
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlySet<T> |
MarkDirty(T)
Mark a an entry as dirty, to be processed at intervals in bulk.
Declaration
public void MarkDirty(T dirty)
Parameters
Type | Name | Description |
---|---|---|
T | dirty |
MarkDirty(IEnumerable<T>)
Mark a list of entires as dirty, to be processed at intervals in bulk.
Declaration
public void MarkDirty(IEnumerable<T> dirties)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | dirties |
UpdateNextTick()
Declaration
public void UpdateNextTick()