HTGS
v2.0
The Hybrid Task Graph Scheduler
|
Class to hold one/two dimensional state information. More...
#include <htgs/api/IRule.hpp>
Public Member Functions | |
StateContainer (size_t height, size_t width, T emptyData) | |
Constructs a state container with a width and height, and what it considers to be empty data. More... | |
~StateContainer () | |
Destructor. | |
void | set (size_t row, size_t col, T &value) const |
Sets a value (by reference) at a row column. More... | |
void | assign (size_t row, size_t col, T value) const |
Sets a value at a row column (uses assignment operator) More... | |
void | set (size_t index, T &value) const |
Sets a value (by reference) at an index. More... | |
void | assign (size_t index, T value) const |
Sets a value at an index (uses assignment operator) More... | |
T & | get (size_t row, size_t col) const |
Gets a value from a row column. More... | |
T & | get (size_t index) const |
Gets a value from an index. More... | |
void | remove (size_t row, size_t col) |
Removes the data from the specified row and column. More... | |
void | remove (size_t index) |
Removes the data from the specified index. More... | |
bool | has (size_t row, size_t col) const |
Checks whether the specified row column has data. More... | |
bool | has (size_t index) const |
Checks whether the specified index has data. More... | |
void | printState () |
Prints the state of the state container. More... | |
void | printContents () |
Prints the contents of the state container. More... | |
Private Member Functions | |
size_t | computeIndex (size_t row, size_t col) const |
Computes the one dimensional index from two dimension. More... | |
Private Attributes | |
T * | data |
The pointer to data for the StateContainer. | |
size_t | width |
The width of the StateContainer. | |
size_t | height |
The height of the StateContainer. | |
T | emptyData |
The data value that represents no data. | |
Class to hold one/two dimensional state information.
This class provides a quick method for identifiying state information for data that is passed to an IRule.
There are four helper functions to aid in creating a StateContainer within an IRule.
The StateContainer provides three core functions for handling state.
get - Retrieves a state value from a given index that may have been stored in the past set - Sets a state value at an index has - Checks whether a state value has been set at an index
Using these functions, the IRule can quickly determine when data dependencies are satisfied and get the data needed for passing to the next ITask.
T | the type of data for the state container |
|
inline |
Constructs a state container with a width and height, and what it considers to be empty data.
The empty data is used to initialize the array of data
height | the height of the state container |
width | the width of the state container |
emptyData | the data value that represents there is no data |
|
inline |
Sets a value at a row column (uses assignment operator)
row | the row |
col | the column |
value | the value |
|
inline |
Sets a value at an index (uses assignment operator)
index | the index |
value | the value |
|
inlineprivate |
Computes the one dimensional index from two dimension.
row | the row |
col | the column |
|
inline |
Gets a value from a row column.
row | the row |
col | the column |
|
inline |
Gets a value from an index.
index | the index |
|
inline |
Checks whether the specified row column has data.
row | the row |
col | the column |
TRUE | if there is data at the specified row column |
FALSE | if the data at the row column is 'emptyData' |
|
inline |
Checks whether the specified index has data.
index | the index |
TRUE | if there is data at the specified row column |
FALSE | if the data at the row column is 'emptyData' |
|
inline |
Prints the contents of the state container.
Iterates over all elements and prints the contents within.
|
inline |
Prints the state of the state container.
Iterates over all elements and prints a 1 if data is not equal to the empty data, otherwise it prints 0.
|
inline |
Removes the data from the specified row and column.
row | the row to remove data from |
col | the column to remove data from |
|
inline |
Removes the data from the specified index.
index | the index to remove data from |
|
inline |
Sets a value (by reference) at a row column.
row | the row |
col | the column |
value | the value |
|
inline |
Sets a value (by reference) at an index.
index | the index |
value | the value |