ActionContext serves as a kind of shared memory context, or "blackboard", for Actions that work together to complete a task. ActionContext works as a typed name/value pair, with only one value allowed per name. More...
Public Member Functions | |
void | AddDependency (string itemName, string dependsOnItemName) |
Adds a dependency between itemName and dependsOnItemName. Whenever "dependsOnItemName" changes in the ActionContext, itemName will be removed. | |
void | RemoveDependency (string itemName, string dependsOnItemName) |
Removes a dependeny previously added between itemName and dependsOnItemName. | |
void | ClearDependencies () |
Remove all tracked dependencies. | |
virtual T | GetContextItem< T > (string itemName) |
GetContextItem retrieves a value from the ActionContext based on its key itemName. | |
void | AddContextItem< T > (string itemName, T value, bool replaceIfExists) |
AddContextItem adds the value to the context associated with the key itemName. If a key/value pair with key itemName already exists in the ActionContext, it is replaced with the new value/Type only if replaceIfExists is true. If there are any other context items dependent on itemName, they are removed from the ActionContext. | |
void | SetContextItem< T > (string itemName, T value) |
SetContextItem adds the value to the context associated with the key itemName. If a key/value pair with key itemName already exists in the ActionContext, it is replaced with the new value/Type. If there are any other context items dependent on itemName, they are removed from the ActionContext. | |
void | AddContextItem< T > (string itemName, T value) |
AddContextItem adds the value to the context associated with the key itemName. If a key/value pair with key itemName already exists in the ActionContext, it is replaced with the new value/Type. If there are any other context items dependent on itemName, they are removed from the ActionContext. | |
void | RemoveContextItem (string itemName) |
Remove an item from the ActionContext. If there are any other context items dependent on itemName, they are removed from the ActionContext. | |
virtual bool | ContextItemExists (string itemName) |
Check to see if any item exists with the given itemName. | |
void | Assign (string toItemName, string fromItemName) |
Assign will retrieve the value of fromItemName and assign it to toItemNAme If fromItemName is not in the context, this is a noop. | |
void | Clear () |
Clear will reset the ActionContext to an empty state, with no current key/value pairs. Dependencies are retained. |
ActionContext serves as a kind of shared memory context, or "blackboard", for Actions that work together to complete a task. ActionContext works as a typed name/value pair, with only one value allowed per name.
ActionContexts may define dependencies betwen variables, which cause dependent variables to be removed from the context whenever its corresponding variable changes.
void RAIN.Action.ActionContext.AddContextItem< T > | ( | string | itemName, |
T | value, | ||
bool | replaceIfExists | ||
) |
AddContextItem adds the value to the context associated with the key itemName. If a key/value pair with key itemName already exists in the ActionContext, it is replaced with the new value/Type only if replaceIfExists is true. If there are any other context items dependent on itemName, they are removed from the ActionContext.
T | The type of the value being added |
itemName | The key to associate with the value |
value | The value to store |
replaceIfExists | if false, only add if the value doesn't already exists |
void RAIN.Action.ActionContext.AddContextItem< T > | ( | string | itemName, |
T | value | ||
) |
AddContextItem adds the value to the context associated with the key itemName. If a key/value pair with key itemName already exists in the ActionContext, it is replaced with the new value/Type. If there are any other context items dependent on itemName, they are removed from the ActionContext.
T | The type of the value being added |
itemName | The key to associate with the value |
value | The value to store |
void RAIN.Action.ActionContext.AddDependency | ( | string | itemName, |
string | dependsOnItemName | ||
) |
Adds a dependency between itemName and dependsOnItemName. Whenever "dependsOnItemName" changes in the ActionContext, itemName will be removed.
itemName | The key of the key value pair to remove on a dependency change |
dependsOnItemName | The key of the key value pair variable to watch for changes |
void RAIN.Action.ActionContext.Assign | ( | string | toItemName, |
string | fromItemName | ||
) |
Assign will retrieve the value of fromItemName and assign it to toItemNAme If fromItemName is not in the context, this is a noop.
toItemName | item to assign to |
fromItemName | item to retrieve value from |
void RAIN.Action.ActionContext.Clear | ( | ) |
Clear will reset the ActionContext to an empty state, with no current key/value pairs. Dependencies are retained.
Remove all tracked dependencies.
virtual bool RAIN.Action.ActionContext.ContextItemExists | ( | string | itemName | ) | [virtual] |
Check to see if any item exists with the given itemName.
itemName | The key to search for |
Reimplemented in RAIN.Action.NestedActionContext.
virtual T RAIN.Action.ActionContext.GetContextItem< T > | ( | string | itemName | ) | [virtual] |
GetContextItem retrieves a value from the ActionContext based on its key itemName.
T | The Type of the item to retrieve |
itemName | The Name of the item to retrieve |
Reimplemented in RAIN.Action.NestedActionContext.
void RAIN.Action.ActionContext.RemoveContextItem | ( | string | itemName | ) |
Remove an item from the ActionContext. If there are any other context items dependent on itemName, they are removed from the ActionContext.
itemName | The name of the item to remove |
void RAIN.Action.ActionContext.RemoveDependency | ( | string | itemName, |
string | dependsOnItemName | ||
) |
Removes a dependeny previously added between itemName and dependsOnItemName.
itemName | the itemName to match |
dependsOnItemName | the dependsOnItemName to match |
void RAIN.Action.ActionContext.SetContextItem< T > | ( | string | itemName, |
T | value | ||
) |
SetContextItem adds the value to the context associated with the key itemName. If a key/value pair with key itemName already exists in the ActionContext, it is replaced with the new value/Type. If there are any other context items dependent on itemName, they are removed from the ActionContext.
T | The type of the value being added |
itemName | The key to associate with the value |
value | The value to store |