DotMP
Public Member Functions | Package Functions | Private Attributes | List of all members
DotMP.DAG< T, U > Class Template Reference

DAG for maintaining task dependencies. More...

Inheritance diagram for DotMP.DAG< T, U >:
Inheritance graph
[legend]
Collaboration diagram for DotMP.DAG< T, U >:
Collaboration graph
[legend]

Public Member Functions

void Dispose ()
 Override to implement IDisposable, disposes of the read-write lock. More...
 

Package Functions

 DAG ()
 Default constructor. More...
 
void AddItem (T id, U item, T[] dependencies)
 Adds an item to the DAG. More...
 
bool GetNextItem (out U item, out T id, out int tasks_remaining)
 Gets the next item from the DAG. More...
 
void CompleteItem (T id)
 Mark an item as completed, in order to remove as a dependency. More...
 
bool TaskIsComplete (T id)
 Determines if a task has been completed. More...
 

Private Attributes

volatile int tasks_remaining
 Counter for remaining tasks in queue. More...
 
ConcurrentDictionary< T, U > associations
 Associations from T->U. More...
 
Dictionary< T, IntWrapperunmet_dependencies
 Counts the number of yet-unmet dependencies of a task. More...
 
Dictionary< T, List< T > > satisfies_dependency
 Keeps track of what task satisfies what dependencies. More...
 
ConcurrentBag< T > no_dependencies
 Bag of items with no dependencies. More...
 
volatile ReaderWriterLockSlim rw_lock
 RW lock for managing tasks. More...
 
ConcurrentDictionary< T, T > completed
 Keeps track of what items have been completed. More...
 

Detailed Description

DAG for maintaining task dependencies.

Type Constraints
T :struct 

Constructor & Destructor Documentation

◆ DAG()

DotMP.DAG< T, U >.DAG ( )
inlinepackage

Default constructor.

Member Function Documentation

◆ AddItem()

void DotMP.DAG< T, U >.AddItem ( id,
item,
T[]  dependencies 
)
inlinepackage

Adds an item to the DAG.

Parameters
idThe ID of the item to be added.
itemThe item to be added.
dependenciesA list of ID dependencies.

◆ CompleteItem()

void DotMP.DAG< T, U >.CompleteItem ( id)
inlinepackage

Mark an item as completed, in order to remove as a dependency.

Parameters
idThe ID of the item to be marked completed.

◆ Dispose()

void DotMP.DAG< T, U >.Dispose ( )
inline

Override to implement IDisposable, disposes of the read-write lock.

◆ GetNextItem()

bool DotMP.DAG< T, U >.GetNextItem ( out U  item,
out T  id,
out int  tasks_remaining 
)
inlinepackage

Gets the next item from the DAG.

Parameters
itemThe item returned from the DAG.
idThe ID of the item returned from the DAG.
tasks_remainingThe number of tasks remaining in the queue.
Returns
Whether or not there was an item to be returned.

◆ TaskIsComplete()

bool DotMP.DAG< T, U >.TaskIsComplete ( id)
inlinepackage

Determines if a task has been completed.

Parameters
idThe ID of the task to check completion.
Returns
Whether or not the task has been completed.

Member Data Documentation

◆ associations

ConcurrentDictionary<T, U> DotMP.DAG< T, U >.associations
private

Associations from T->U.

◆ completed

ConcurrentDictionary<T, T> DotMP.DAG< T, U >.completed
private

Keeps track of what items have been completed.

◆ no_dependencies

ConcurrentBag<T> DotMP.DAG< T, U >.no_dependencies
private

Bag of items with no dependencies.

◆ rw_lock

volatile ReaderWriterLockSlim DotMP.DAG< T, U >.rw_lock
private

RW lock for managing tasks.

◆ satisfies_dependency

Dictionary<T, List<T> > DotMP.DAG< T, U >.satisfies_dependency
private

Keeps track of what task satisfies what dependencies.

◆ tasks_remaining

volatile int DotMP.DAG< T, U >.tasks_remaining
private

Counter for remaining tasks in queue.

◆ unmet_dependencies

Dictionary<T, IntWrapper> DotMP.DAG< T, U >.unmet_dependencies
private

Counts the number of yet-unmet dependencies of a task.


The documentation for this class was generated from the following file: