51Degrees Pipeline .NET  4.1

51Degrees Pipeline for .NET

FiftyOne.Pipeline.Core.Data.FlowData Class Reference

Detailed Description

The FlowData class contains the data that is used within a pipeline.

The input data is referred to as 'evidence'. The output data is split into groups of related properties called 'aspects'.

Inheritance diagram for FiftyOne.Pipeline.Core.Data.FlowData:

[legend]

Collaboration diagram for FiftyOne.Pipeline.Core.Data.FlowData:

[legend]

Public Member Functions

void  AddError (Exception ex, IFlowElement flowElement)
Register an error that occurred while working with this instance. More...
void  AddError (Exception ex, IFlowElement flowElement, bool shouldThrow, bool shouldLog)
Register an error that occurred while working with this instance. More...
IEvidence  GetEvidence ()
Get the IEvidence object that contains the input data for this instance. More...
bool  TryGetEvidence< T > (string key, out T value)
Try to get the data value from evidence. More...
IList< string >  GetDataKeys ()
Get the string keys to the aspects that are contained within the output data. More...
IEnumerable< KeyValuePair< string, object > >  GetWhere (Func< IElementPropertyMetaData, bool > predicate)
Get all element data AspectPropertyValues that match the specified predicate More...
void  Process ()
Use the pipeline to process this FlowData instance and populate the aspect data values. More...
IFlowData  AddEvidence (string key, object value)
Add the specified evidence to the FlowData More...
IFlowData  AddEvidence (IDictionary< string, object > evidence)
Add the specified evidence to the FlowData More...
IElementData  Get (string elementDataKey)
Get the IElementData instance containing data populated by the specified element. More...
T  Get< T > (ITypedKey< T > key)
Get the IElementData instance containing data populated by the specified element. More...
bool  TryGetValue< T > (ITypedKey< T > key, out T value)
Check if the flow data contains an item with the specified key name and type. More...
T  Get< T > ()
Get the IElementData instance containing data of the specified type. More...
T  GetFromElement< T, TMeta > (IFlowElement< T, TMeta > flowElement)
Get the IElementData instance containing data populated by the specified element. More...
T  GetAs< T > (string propertyName)
Get the specified property as the specified type. More...
bool  GetAsBool (string propertyName)
Get the specified property as a boolean. More...
string  GetAsString (string propertyName)
Get the specified property as a string. More...
int  GetAsInt (string propertyName)
Get the specified property as a int. More...
long  GetAsLong (string propertyName)
Get the specified property as a long. More...
float  GetAsFloat (string propertyName)
Get the specified property as a float. More...
double  GetAsDouble (string propertyName)
Get the specified property as a double. More...
T  GetOrAdd< T > (string elementDataKey, Func< IPipeline, T > dataFactory)
Get or add the specified element data to the internal map. More...
T  GetOrAdd< T > (ITypedKey< T > key, Func< IPipeline, T > dataFactory)
Add the specified element data to the internal map. More...
IDictionary< string, object >  ElementDataAsDictionary ()
Get the element data for this instance as a dictionary. More...
IEnumerable< IElementData >  ElementDataAsEnumerable ()
Get the element data for this instance as an enumerable. More...
DataKey  GenerateKey (IEvidenceKeyFilter filter)
Generate a DataKey that contains the evidence data from this instance that matches the specified filter. More...

Properties

IList< IFlowError >  Errors [get]
The errors that have occurred during processing More...
IPipeline  Pipeline [get]
The pipeline that was used to create this FlowData instance More...
bool  Stop [get, set]
A boolean flag that can be used to stop further elements from executing. More...
IEvidenceKeyFilter  EvidenceKeyFilter [get]
Get a filter that will only include the evidence keys that can be used by the elements within the pipeline that created this flow element. More...

Properties inherited from FiftyOne.Pipeline.Core.Data.IFlowData

bool  Stop [get, set]
A boolean flag that can be used to stop further elements from executing. More...
IList< IFlowError >  Errors [get]
The errors that have occurred during processing More...
IPipeline  Pipeline [get]
The pipeline used to create this flow data. More...
IEvidenceKeyFilter  EvidenceKeyFilter [get]
Get a filter that will only include the evidence keys that can be used by the elements within the pipeline that created this flow element. More...

Member Function Documentation

◆ AddError() [1/2]

void FiftyOne.Pipeline.Core.Data.FlowData.AddError ( Exception   ex,
IFlowElement   flowElement  
)

Register an error that occurred while working with this instance.

Parameters
ex - The exception that occurred.
flowElement - The flow element that the exception occurred in.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ AddError() [2/2]

void FiftyOne.Pipeline.Core.Data.FlowData.AddError ( Exception   ex,
IFlowElement   flowElement,
bool   shouldThrow,
bool   shouldLog  
)

Register an error that occurred while working with this instance.

Parameters
ex - The exception that occurred.
flowElement - The flow element that the exception occurred in.
shouldThrow - Set whether the pipeline should throw the exception.
shouldLog - Set whether the pipeline should log the exception as an error.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ AddEvidence() [1/2]

IFlowData FiftyOne.Pipeline.Core.Data.FlowData.AddEvidence ( string   key,
object   value  
)

Add the specified evidence to the FlowData

Parameters
key - The evidence key
value - The evidence value
Exceptions
ArgumentNullException - Thrown if parameters are null

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ AddEvidence() [2/2]

IFlowData FiftyOne.Pipeline.Core.Data.FlowData.AddEvidence ( IDictionary< string, object >   evidence )

Add the specified evidence to the FlowData

Parameters
evidence - The evidence to add
Exceptions
ArgumentNullException - Thrown if evidence is null

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ ElementDataAsDictionary()

IDictionary<string, object> FiftyOne.Pipeline.Core.Data.FlowData.ElementDataAsDictionary ( )

Get the element data for this instance as a dictionary.

Returns
A dictionary containing the element data.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ ElementDataAsEnumerable()

IEnumerable<IElementData> FiftyOne.Pipeline.Core.Data.FlowData.ElementDataAsEnumerable ( )

Get the element data for this instance as an enumerable.

Returns
An enumerable containing the element data.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ Get()

IElementData FiftyOne.Pipeline.Core.Data.FlowData.Get ( string   elementDataKey )

Get the IElementData instance containing data populated by the specified element.

Parameters
elementDataKey - The name of the element to get data from.
Returns
An IElementData instance containing the data.
Exceptions
ArgumentNullException - Thrown if the supplied data key is null
PipelineException - Thrown if this FlowData instance has not been processed yet.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ Get< T >() [1/2]

Get the IElementData instance containing data populated by the specified element.

Template Parameters
T - The expected type of the data to be returned.
Parameters
key - An ITypedKey<T> indicating the element to get data from.
Returns
An instance of type T containing the data.
Exceptions
ArgumentNullException - Thrown if the supplied key is null
PipelineException - Thrown if this FlowData instance has not been processed yet.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

Type Constraints
T :IElementData 

◆ GetAs< T >()

T FiftyOne.Pipeline.Core.Data.FlowData.GetAs< T > ( string   propertyName )

Get the specified property as the specified type.

Template Parameters
T - The type to return the property value as
Parameters
propertyName - The name of the property to get
Returns
The property value
Exceptions
PipelineException - Thrown if this FlowData instance has not been processed yet.
PipelineDataException ( )

Get the IElementData instance containing data of the specified type.

If multiple instances of the type exist then an exception is thrown.

Template Parameters
T - The type of the data to look for and return.
Returns
The data instance.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

Type Constraints
T :IElementData 

◆ GetAs< T >()

T FiftyOne.Pipeline.Core.Data.FlowData.GetAs< T > ( string   propertyName )

Get the specified property as the specified type.

Template Parameters
T - The type to return the property value as
Parameters
propertyName - The name of the property to get
Returns
The property value
Exceptions
PipelineException - Thrown if this FlowData instance has not been processed yet.
PipelineDataException - Thrown if the requested property cannot be found or if multiple flow elements use the same property name.
InvalidCastException - Thrown if property value cannot be cast to the requested type.
KeyNotFoundException - Thrown if property value is expected to be present but was not found.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetAsBool()

bool FiftyOne.Pipeline.Core.Data.FlowData.GetAsBool ( string   propertyName )

Get the specified property as a boolean.

Parameters
propertyName - The name of the property to get
Returns
The property value

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetAsDouble()

double FiftyOne.Pipeline.Core.Data.FlowData.GetAsDouble ( string   propertyName )

Get the specified property as a double.

Parameters
propertyName - The name of the property to get
Returns
The property value

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetAsFloat()

float FiftyOne.Pipeline.Core.Data.FlowData.GetAsFloat ( string   propertyName )

Get the specified property as a float.

Parameters
propertyName - The name of the property to get
Returns
The property value

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetAsInt()

int FiftyOne.Pipeline.Core.Data.FlowData.GetAsInt ( string   propertyName )

Get the specified property as a int.

Parameters
propertyName - The name of the property to get
Returns
The property value

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetAsLong()

long FiftyOne.Pipeline.Core.Data.FlowData.GetAsLong ( string   propertyName )

Get the specified property as a long.

Parameters
propertyName - The name of the property to get
Returns
The property value

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetAsString()

string FiftyOne.Pipeline.Core.Data.FlowData.GetAsString ( string   propertyName )

Get the specified property as a string.

Parameters
propertyName - The name of the property to get
Returns
The property value

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetDataKeys()

IList<string> FiftyOne.Pipeline.Core.Data.FlowData.GetDataKeys ( )

Get the string keys to the aspects that are contained within the output data.

Returns

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ GetFromElement< T, TMeta >()

T FiftyOne.Pipeline.Core.Data.FlowData.GetFromElement< T, TMeta > ( IFlowElement< T, TMeta >   flowElement )

Get the IElementData instance containing data populated by the specified element.

Template Parameters
T - The expected type of the data to be returned.
Template Parameters
TMeta - The type of meta data that the flow element will supply about the properties it populates.
Parameters
flowElement - The IFlowElement<T, TMeta> that populated the desired data.
Returns
An instance of type T containing the data.
Exceptions
ArgumentNullException - Thrown if the supplied flow element is null
PipelineException - Thrown if this FlowData instance has not been processed yet.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

Type Constraints
T :IElementData 
TMeta :IElementPropertyMetaData 

◆ GetOrAdd< T >() [1/2]

T FiftyOne.Pipeline.Core.Data.FlowData.GetOrAdd< T > ( string   elementDataKey,
Func< IPipeline, T >   dataFactory  
)

Get or add the specified element data to the internal map.

Parameters
elementDataKey - The name of the element to store the data under.
dataFactory - The method to use to create a new data to store if one does not already exist.
Returns
Existing data matching the key, or newly added data.
Exceptions
ArgumentNullException - Thrown if the supplied data factory is null
InvalidCastException - Thrown if the IElementData retrieved for the supplied data key cannot be cast to the type T

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

Type Constraints
T :IElementData 

◆ GetOrAdd< T >() [2/2]

T FiftyOne.Pipeline.Core.Data.FlowData.GetOrAdd< T > ( ITypedKey< T >   key,
Func< IPipeline, T >   dataFactory  
)

Add the specified element data to the internal map.

Template Parameters
T - The type of the data being stored.
Parameters
key - The key to use when storing the data.
dataFactory - The method to use to create a new data to store if one does not already exist.
Returns
Existing data matching the key, or newly added data.
Exceptions
ArgumentNullException - Thrown if the supplied data factory is null

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

Type Constraints
T :IElementData 

◆ GetWhere()

IEnumerable<KeyValuePair<string, object> > FiftyOne.Pipeline.Core.Data.FlowData.GetWhere ( Func< IElementPropertyMetaData, bool >   predicate )

Get all element data AspectPropertyValues that match the specified predicate

Parameters
predicate - If a property passed to this function returns true then it will be included in the results
Returns
All the element data AspectPropertyValues that match the predicate

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ Process()

void FiftyOne.Pipeline.Core.Data.FlowData.Process ( )

Use the pipeline to process this FlowData instance and populate the aspect data values.

Exceptions
PipelineException - Thrown if this flow data object has already been processed.
ObjectDisposedException - Thrown if the Pipeline has already been disposed.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ TryGetEvidence< T >()

bool FiftyOne.Pipeline.Core.Data.FlowData.TryGetEvidence< T > ( string   key,
out T   value  
)

Try to get the data value from evidence.

Parameters
key - The evidence key.
value - The value from evidence.
Returns
True if a value for a given key is found or false if the key is not found or if the method cannot cast the value to the requested type.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

◆ TryGetValue< T >()

bool FiftyOne.Pipeline.Core.Data.FlowData.TryGetValue< T > ( ITypedKey< T >   key,
out T   value  
)

Check if the flow data contains an item with the specified key name and type.

If it does exist, retrieve it.

Parameters
key - The key to check for.
value - The value associated with the key.
Returns
True if an entry matching the key exists, false otherwise.

Implements FiftyOne.Pipeline.Core.Data.IFlowData.

Type Constraints
T :IElementData 

Property Documentation

◆ Errors

IList<IFlowError> FiftyOne.Pipeline.Core.Data.FlowData.Errors
get

The errors that have occurred during processing

◆ EvidenceKeyFilter

IEvidenceKeyFilter FiftyOne.Pipeline.Core.Data.FlowData.EvidenceKeyFilter
get

Get a filter that will only include the evidence keys that can be used by the elements within the pipeline that created this flow element.

◆ Pipeline

IPipeline FiftyOne.Pipeline.Core.Data.FlowData.Pipeline
get

The pipeline that was used to create this FlowData instance

◆ Stop

bool FiftyOne.Pipeline.Core.Data.FlowData.Stop
get set

A boolean flag that can be used to stop further elements from executing.