Class TaskParallelTransformationContext
- Namespace
- NMF.Transformations.Parallel.Tasks
- Assembly
- NMF.Transformations.Parallel.dll
Denotes a parallel transformation context using the TPL
public class TaskParallelTransformationContext : ITransformationEngineContext, ITransformationContext
- Inheritance
-
TaskParallelTransformationContext
- Implements
- Inherited Members
- Extension Methods
Constructors
TaskParallelTransformationContext(Transformation)
Creates a new transformation context for the given transformation
public TaskParallelTransformationContext(Transformation transformation)
Parameters
transformation
TransformationThe transformation, a context should be generated for
Properties
Bag
Gets a Bag, where dynamic data can be added
public dynamic Bag { get; }
Property Value
- dynamic
Remarks
The value of this property is an ExpandoObject, so that the bag can be easily extended with new properties
Computations
Gets all computations (for custom trace purposes)
public IEnumerable<Computation> Computations { get; }
Property Value
Data
Gets a data dictionary, where data set during the transformation can be added
public IDictionary<object, object> Data { get; }
Property Value
Input
Gets the input of the transformation context
public object[] Input { get; set; }
Property Value
- object[]
Remarks
If the transformation has multiple inputs, this returns the first input
Inputs
Gets a collection of inputs
public IList<object[]> Inputs { get; }
Property Value
Output
Gets the output of the transformation context
public object Output { get; }
Property Value
Remarks
If the transformation has multiple outputs, this property returns the first output
Outputs
Gets a collection of outputs
public IList<object> Outputs { get; }
Property Value
Trace
Gets the object responsible for trace operations for this transformation context
public ITransformationTrace Trace { get; }
Property Value
Transformation
Gets the parent transformation, that the context is based upon
public Transformation Transformation { get; }
Property Value
Methods
AddTraceEntry(Computation)
Creates a trace entry for the given computation object
protected virtual void AddTraceEntry(Computation computation)
Parameters
computation
ComputationThe computation that needs to be added to the trace
Remarks
Override for custom trace entries. A null-check for the argument is not required.
CallTransformation(GeneralTransformationRule, object[], IEnumerable)
Calls the given transformation with the specified input
public Computation CallTransformation(GeneralTransformationRule transformationRule, object[] input, IEnumerable context)
Parameters
transformationRule
GeneralTransformationRuleThe rule that should be applied
input
object[]The input for the transformation rule
context
IEnumerableThe callers context
Returns
- Computation
The computation that handles this request
ExecutePending()
Calls the transformation context to finish any things yet undone
public void ExecutePending()
ExecutePendingComputations()
Executes all computations registered,but not already handled
public void ExecutePendingComputations()
GetRule(Type[], Type)
Gets any rules that apply the given signature
public GeneralTransformationRule GetRule(Type[] input, Type output)
Parameters
Returns
- GeneralTransformationRule
A random rule that has the given signature
GetRules(Type[], Type)
Gets all rules that apply the given signature
public IEnumerable<GeneralTransformationRule> GetRules(Type[] input, Type output)
Parameters
Returns
- IEnumerable<GeneralTransformationRule>
A collection with all the rules that have the given signature
OnComputationCompleted(ComputationEventArgs)
Fires the ComputationCompleted event with the given event data
protected virtual void OnComputationCompleted(ComputationEventArgs e)
Parameters
e
ComputationEventArgsThe event data
Events
ComputationCompleted
Gets fired when a computation completes
public event EventHandler<ComputationEventArgs> ComputationCompleted