Class CompositeParameterDataAccess
A composite parameter data access object.
Inheritance
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public class CompositeParameterDataAccess : Object, ICompositeParameterDataAccess, IDisposable
Constructors
CompositeParameterDataAccess(ICompositeSession, IReadOnlyList<ICompositeSessionInfo>, String, ICompositePdaExecutionService)
Initializes a new instance of the CompositeParameterDataAccess class.
Declaration
public CompositeParameterDataAccess(ICompositeSession parent, IReadOnlyList<ICompositeSessionInfo> sessions, string parameterIdentifier, ICompositePdaExecutionService executionService)
Parameters
Type | Name | Description |
---|---|---|
ICompositeSession | parent | The parent. |
System.Collections.Generic.IReadOnlyList<ICompositeSessionInfo> | sessions | The sessions. |
System.String | parameterIdentifier | The parameter identifier. |
ICompositePdaExecutionService | executionService | The execution service. |
Fields
DefaultSampleTime
The default sample time
Declaration
protected const int DefaultSampleTime = 10000000
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
CurrentDistance
Get the current distance
Declaration
public Nullable<double> CurrentDistance { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> |
CurrentTime
Gets the current position.
Declaration
public Nullable<long> CurrentTime { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int64> | The current timestamp for the PDA. |
Owner
Gets the key of the composite session that owns this PDA.
Declaration
public CompositeSessionKey Owner { get; }
Property Value
Type | Description |
---|---|
CompositeSessionKey | The key of the owning composite session. |
ParameterIdentifier
Gets the parameter identifier.
Declaration
public string ParameterIdentifier { get; }
Property Value
Type | Description |
---|---|
System.String | The parameter identifier. |
ParentCompositeSession
Gets the parent composite session.
Declaration
public ICompositeSession ParentCompositeSession { get; }
Property Value
Type | Description |
---|---|
ICompositeSession | The parent composite session. |
PdaCurrentPosition
Gets the current position for the PDA (supersedes CurrentPosition).
Declaration
public PdaCurrentPosition PdaCurrentPosition { get; }
Property Value
Type | Description |
---|---|
PdaCurrentPosition | The current position of the PDA. |
SampleTime
Gets or sets the sample time (in nanoseconds) for the data. This value will only affect requests to get data (using the GetNextData method) and will not affect calls to get samples (using the GetNextSamples/GetPreviousSamples methods).
Declaration
public long SampleTime { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Remarks
This time is the interval between data samples. For example: 1,000,000 ns = 1000Hz 10,000,000 ns = 100Hz 100,000,000 ns = 10Hz 1,000,000,000 ns = 1Hz If this value is not set then the default sample time is 100Hz (10,000,000 ns).
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Finalize()
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
Declaration
protected override void Finalize()
GetAbsoluteSamples(Int32, Int64, Int64)
Get Absolute Samples (no default offset applied).
Declaration
public ParameterValues GetAbsoluteSamples(int maximumNumberOfSamples, long startTimeStamp, long endTimeStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maximumNumberOfSamples | |
System.Int64 | startTimeStamp | |
System.Int64 | endTimeStamp |
Returns
Type | Description |
---|---|
ParameterValues |
GetAbsoluteSamples(Int32, Int64, Int64, ref Double[], ref DataStatusType[], ref Int64[])
Get Absolute Samples (no default offset applied).
Declaration
public int GetAbsoluteSamples(int maximumNumberOfSamples, long startTimeStamp, long endTimeStamp, ref double[] data, ref DataStatusType[] status, ref long[] time)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maximumNumberOfSamples | |
System.Int64 | startTimeStamp | |
System.Int64 | endTimeStamp | |
System.Double[] | data | |
DataStatusType[] | status | |
System.Int64[] | time |
Returns
Type | Description |
---|---|
System.Int32 |
GetDataStatistics(Int64, Int64, Boolean, StatisticOption)
Returns the maximum, minimum and mean values for a range of data. Optionally returns the position and status of the values.
Declaration
public CompositeStatistics[] GetDataStatistics(long startTimeStamp, long duration, bool weightStatistics, StatisticOption statisticOption)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | startTimeStamp | Start time of data range in nanoseconds. |
System.Int64 | duration | Length of data range in nanoseconds. |
System.Boolean | weightStatistics | Weight statistics flag. |
StatisticOption | statisticOption | The statistic to be retrieved |
Returns
Type | Description |
---|---|
CompositeStatistics[] |
Remarks
If data is requested data is either before or after samples are available then a zero numberOfSamples will be returned.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if the |
GetEndTime()
Returns the end time of the parameters data.
Declaration
public Dictionary<SessionKey, Nullable<long>> GetEndTime()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Nullable<System.Int64>> | The end time. |
GetLapStatistics(Lap, Boolean, StatisticOption)
Gets the lap statistics for the passed lap parameter. The calculated statistics will be cached for improved performance.
Declaration
public CompositeStatistics[] GetLapStatistics(Lap lap, bool weightStatistics, StatisticOption statisticOption)
Parameters
Type | Name | Description |
---|---|---|
Lap | lap | The lap to get statistics for. |
System.Boolean | weightStatistics | Weight statistics flag. |
StatisticOption | statisticOption | The statistic to be retrieved |
Returns
Type | Description |
---|---|
CompositeStatistics[] |
GetMaximumFrequency()
Returns maximum frequencies for session keys.
Declaration
public Dictionary<SessionKey, double> GetMaximumFrequency()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Double> | A dictionary where keys are session keys and values are doubles representing maximum frequencies. |
Remarks
If zero, then the frequency could not be determined.
GetMaximumSampleRate()
Get Maximum Sample Rate
Declaration
public Dictionary<SessionKey, Nullable<long>> GetMaximumSampleRate()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Nullable<System.Int64>> |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException |
GetMinimumFrequency()
Returns minimum frequencies for session keys.
Declaration
public Dictionary<SessionKey, double> GetMinimumFrequency()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Double> | A dictionary where keys are session keys and values are doubles representing minimum frequencies. |
Remarks
If zero, then the frequency could not be determined.
GetNextData(Int32, SampleModeType, Boolean, ref Double[], ref DataStatusType[])
Gets the next sampled data values and DataStatusType based on the number of samples requested.
Declaration
public void GetNextData(int numberOfSamples, SampleModeType sampleMode, bool interpolate, ref double[] data, ref DataStatusType[] status)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
SampleModeType | sampleMode | The SampleModeType. |
System.Boolean | interpolate | If set to |
System.Double[] | data | Sampled data. |
DataStatusType[] | status | DataStatusType of the sampled data |
Remarks
On completion of this call, the CurrentTime will be set to the end of the returned data
GetNextData(Int32, Boolean, ref MinimumMaximumMeanDouble[], ref DataStatusType[])
Returns the next sampled data values and DataStatusType based on the number of samples requested using the min/max/mean sampler.
Declaration
public void GetNextData(int numberOfSamples, bool interpolate, ref MinimumMaximumMeanDouble[] data, ref DataStatusType[] status)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
System.Boolean | interpolate | If set to |
MinimumMaximumMeanDouble[] | data | The minimum/maximum/mean values. |
DataStatusType[] | status | DataStatusType of the sampled data. |
Remarks
Does not use linear interpolation between samples. On completion of this call, the CurrentTime will be set to the end of the returned data
GetNextData(Int32, Boolean, ref Double[], ref Double[], ref DataStatusType[])
Returns the next sampled data values and DataStatusType based on the number of samples requested using min/max sampler.
Declaration
public void GetNextData(int numberOfSamples, bool interpolate, ref double[] minimumValues, ref double[] maximumValues, ref DataStatusType[] status)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
System.Boolean | interpolate | If set to |
System.Double[] | minimumValues | The minimum values. |
System.Double[] | maximumValues | The maximum values. |
DataStatusType[] | status | DataStatusType of the sampled data. |
Remarks
On completion of this call, the CurrentTime will be set to the end of the returned data
GetNextData(Int32, ref Double[], ref DataStatusType[])
Returns the next sampled data values and DataStatusType based on the number of samples requested.
Declaration
public void GetNextData(int numberOfSamples, ref double[] data, ref DataStatusType[] status)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
System.Double[] | data | Sampled data. |
DataStatusType[] | status | DataStatusType of the sampled data. |
Remarks
Uses SampleModeType.Mean and does not interpolate between samples. On completion of this call, the CurrentTime will be set to the end of the returned data.
GetNextData(Int64[])
Returns sampled data for each of the specified timestamps passed in.
Declaration
public ParameterValues GetNextData(long[] sampleTimestamps)
Parameters
Type | Name | Description |
---|---|---|
System.Int64[] | sampleTimestamps | The sample timestamps to retrieve data for. |
Returns
Type | Description |
---|---|
ParameterValues |
Remarks
Uses SampleModeType.Mean and does not use linear interpolation between samples.
GetNextData(Int64[], SampleModeType, Boolean)
Returns sampled data for each of the specified timestamps passed in.
Declaration
public ParameterValues GetNextData(long[] sampleTimestamps, SampleModeType sampleMode, bool interpolate)
Parameters
Type | Name | Description |
---|---|---|
System.Int64[] | sampleTimestamps | The sample timestamps to retrieve data for. |
SampleModeType | sampleMode | The SampleModeType. |
System.Boolean | interpolate | If set to |
Returns
Type | Description |
---|---|
ParameterValues |
GetNextData(Int64[], SampleModeType, Boolean, ref Double[], ref DataStatusType[])
Returns sampled data for each of the specified timestamps passed in.
Declaration
public void GetNextData(long[] sampleTimestamps, SampleModeType sampleMode, bool interpolate, ref double[] data, ref DataStatusType[] status)
Parameters
Type | Name | Description |
---|---|---|
System.Int64[] | sampleTimestamps | The sample timestamps to retrieve data for. |
SampleModeType | sampleMode | The SampleModeType. |
System.Boolean | interpolate | If set to |
System.Double[] | data | Sampled data. |
DataStatusType[] | status | DataStatusType of the sampled data. |
GetNextData(Int64[], Boolean)
Returns sampled data for each of the timestamps passed in, using min/max sampler.
Declaration
public ParameterValues GetNextData(long[] timestamps, bool interpolate)
Parameters
Type | Name | Description |
---|---|---|
System.Int64[] | timestamps | The sample timestamps. |
System.Boolean | interpolate | If set to |
Returns
Type | Description |
---|---|
ParameterValues |
Remarks
Does not use linear interpolation between samples.
GetNextData(Int64[], Boolean, ref Double[], ref Double[], ref DataStatusType[])
Returns sampled data for each of the timestamps passed in, using min/max sampler.
Declaration
public void GetNextData(long[] timestamps, bool interpolate, ref double[] minimumValues, ref double[] maximumValues, ref DataStatusType[] status)
Parameters
Type | Name | Description |
---|---|---|
System.Int64[] | timestamps | The sample timestamps. |
System.Boolean | interpolate | If set to |
System.Double[] | minimumValues | The minimum values. |
System.Double[] | maximumValues | The maximum values. |
DataStatusType[] | status | DataStatusType of the sampled data. |
Remarks
Does not use linear interpolation between samples.
GetNextData(Int64[], ref Double[], ref DataStatusType[])
Returns sampled data for each of the specified timestamps passed in.
Declaration
public void GetNextData(long[] sampleTimestamps, ref double[] data, ref DataStatusType[] status)
Parameters
Type | Name | Description |
---|---|---|
System.Int64[] | sampleTimestamps | The sample timestamps to retrieve data for. |
System.Double[] | data | Sampled data. |
DataStatusType[] | status | DataStatusType of the sampled data. |
Remarks
Uses SampleModeType.Mean and does not use linear interpolation between samples.
GetNextSamples(Int32)
Returns the next raw data samples, their DataStatusType and time based on the number of samples requested.
Declaration
public ParameterValues GetNextSamples(int numberOfSamples)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
Returns
Type | Description |
---|---|
ParameterValues | The number of samples available. |
Remarks
On completion of this call, the CurrentTime will be set to the end of the returned data
GetNextSamples(Int32, ref Double[], ref DataStatusType[], ref Int64[])
Returns the next raw data samples, their DataStatusType and time based on the number of samples requested.
Declaration
public int GetNextSamples(int numberOfSamples, ref double[] data, ref DataStatusType[] status, ref long[] time)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
System.Double[] | data | Raw data values. |
DataStatusType[] | status | DataStatusType of the raw data values. |
System.Int64[] | time | Timestamps of the raw data values. |
Returns
Type | Description |
---|---|
System.Int32 | The number of samples available. |
Remarks
On completion of this call, the CurrentTime will be set to the end of the returned data
GetNextSamples(Int64)
Returns the next raw data samples, their DataStatusType and timestamps between the current time and the endTime provided.
Declaration
public ParameterValues GetNextSamples(long endTime)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | endTime | The end time. |
Returns
Type | Description |
---|---|
ParameterValues | The number of samples available. |
GetNextSamples(Int64, ref Double[], ref DataStatusType[], ref Int64[])
Returns the next raw data samples, their DataStatusType and timestamps between the current time and the endTime provided.
Declaration
public int GetNextSamples(long endTime, ref double[] data, ref DataStatusType[] status, ref long[] timestamps)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | endTime | The end time. |
System.Double[] | data | Raw data values. |
DataStatusType[] | status | DataStatusType of the raw data values |
System.Int64[] | timestamps | Timestamps of the raw data values. |
Returns
Type | Description |
---|---|
System.Int32 | The number of samples available. |
GetPreviousSamples(Int32)
Returns the next raw data samples, their DataStatusType and time based on the number of samples requested.
Declaration
public ParameterValues GetPreviousSamples(int numberOfSamples)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
Returns
Type | Description |
---|---|
ParameterValues | The number of samples available. |
Remarks
On completion of this call, the CurrentTime will be set to the end of the returned data
GetPreviousSamples(Int32, ref Double[], ref DataStatusType[], ref Int64[])
Returns the previous raw data samples, their DataStatusType and time based on the number of samples requested.
Declaration
public int GetPreviousSamples(int numberOfSamples, ref double[] data, ref DataStatusType[] status, ref long[] time)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numberOfSamples | Number of samples to retrieve. |
System.Double[] | data | Raw data values. |
DataStatusType[] | status | DataStatusType of the raw data values. |
System.Int64[] | time | Timestamps of the raw data values. |
Returns
Type | Description |
---|---|
System.Int32 | The number of samples available. |
GetPreviousSamples(Int64)
Returns the previous raw data samples, their DataStatusType and timestamp, starting at
endTime
and ending at the CurrentTime.
Declaration
public ParameterValues GetPreviousSamples(long endTime)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | endTime | The end time. |
Returns
Type | Description |
---|---|
ParameterValues | Number of samples available |
GetPreviousSamples(Int64, ref Double[], ref DataStatusType[], ref Int64[])
Returns the previous raw data samples, their DataStatusType and timestamp, starting at
endTime
and ending at the CurrentTime.
Declaration
public int GetPreviousSamples(long endTime, ref double[] data, ref DataStatusType[] status, ref long[] timestamps)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | endTime | The end time. |
System.Double[] | data | Raw data values. |
DataStatusType[] | status | DataStatusType of the raw data values. |
System.Int64[] | timestamps | Timestamps of the data. |
Returns
Type | Description |
---|---|
System.Int32 | Number of samples available |
GetSamples(Int32, Int64, Int64)
Returns a number of raw data samples between a start and end sample time, along with their DataStatusType and timestamps.
Declaration
public ParameterValues GetSamples(int maximumNumberOfSamples, long startTimeStamp, long endTimeStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maximumNumberOfSamples | Maximum number of samples to return. |
System.Int64 | startTimeStamp | Start time stamp of the data. |
System.Int64 | endTimeStamp | Close time stamp of the data. |
Returns
Type | Description |
---|---|
ParameterValues | The number of samples available. |
Remarks
If the number of samples requested is greater than the total samples then only the samples available are returned.
The method will move to the next sample if the startTimeStamp does not fall exactly on the timestamp of a sample.
GetSamples(Int32, Int64, Int64, ref Double[], ref DataStatusType[], ref Int64[])
Returns a number of raw data samples between a start and end sample time, along with their DataStatusType and timestamps.
Declaration
public int GetSamples(int maximumNumberOfSamples, long startTimeStamp, long endTimeStamp, ref double[] data, ref DataStatusType[] status, ref long[] time)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maximumNumberOfSamples | Maximum number of samples to return. |
System.Int64 | startTimeStamp | Start time stamp of the data. |
System.Int64 | endTimeStamp | Close time stamp of the data. |
System.Double[] | data | Raw data values. |
DataStatusType[] | status | DataStatusType of the raw data values. |
System.Int64[] | time | Timestamps of the data. |
Returns
Type | Description |
---|---|
System.Int32 | The number of samples available. |
Remarks
If the number of samples requested is greater than the total samples then only the samples available are returned.
The method will move to the next sample if the startTimeStamp does not fall exactly on the timestamp of a sample.
GetSamplesCount(Int64, Int64)
Returns the numbers of samples between a specified start and end time.
Declaration
public Dictionary<SessionKey, Nullable<long>> GetSamplesCount(long startTimeStamp, long endTimeStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | startTimeStamp | Start time stamp of the data. |
System.Int64 | endTimeStamp | End time stamp of the data. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Nullable<System.Int64>> | Number of samples between the start and end time, or zero if not samples found. |
GetSamplesCountEstimate(Int64, Int64)
Returns the theoretical sample count between a specified start and end time based on the highest frequency channel for this PDA's Parameter. If the return value is zero means that was impossible to calculate the sample count, or this PDA is created on a SlowRow parameter
Declaration
public Dictionary<SessionKey, Nullable<long>> GetSamplesCountEstimate(long startTimeStamp, long endTimeStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | startTimeStamp | Start time stamp of the data. |
System.Int64 | endTimeStamp | End time stamp of the data. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Nullable<System.Int64>> | Theoretical sample count between the start and end time, or zero if it was impossible to calculate, or this PDA is created on a SlowRow parameter. |
GetStartTime()
Returns the start time for the parameters data.
Declaration
public Dictionary<SessionKey, Nullable<long>> GetStartTime()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Nullable<System.Int64>> | The start time. |
GetTimeRange()
Gets the time range for the PDA.
Declaration
public Dictionary<SessionKey, Nullable<TimeRange>> GetTimeRange()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SessionKey, System.Nullable<TimeRange>> | Returns time range or null if there is no data. |
GetUnderlyingPda(SessionKey)
Get the underlying PDA for session key.
Declaration
public IParameterDataAccess GetUnderlyingPda(SessionKey sessionKey)
Parameters
Type | Name | Description |
---|---|---|
SessionKey | sessionKey | Session key. |
Returns
Type | Description |
---|---|
IParameterDataAccess | Underlying PDA or null if not found. |
GoTo(Double)
Positions the ParameterDataAccess object to a specific position (i.e. when using other than time axis) within the parameter's data.
Declaration
public void GoTo(double position)
Parameters
Type | Name | Description |
---|---|---|
System.Double | position | Required position. |
GoTo(Int64)
Positions the ParameterDataAccess object to a specific time within the parameter's data.
Declaration
public void GoTo(long time)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | time | Required time location in nano-seconds. |
SetMapper(String)
Sets the mapper to be used for GetNextData calls. The mapper is identified by its name. The API includes default mappers for time (which is the default for a PDA) and distance. These are named "time" and "distance" respectively. The API caller may specify another mapping name for a custom mapper that has been registered with the API (see MapperService). If a mapper is set which is not registered then an invalid argument exception will be thrown.
Declaration
public void SetMapper(string mapperName)
Parameters
Type | Name | Description |
---|---|---|
System.String | mapperName | The name of the mapper. |
SetSampleIncrement(Double)
Sets the current sample increment for the PDA, when the X Axis is not Time
Declaration
public void SetSampleIncrement(double increment)
Parameters
Type | Name | Description |
---|---|---|
System.Double | increment | The required sample increment. |
SetSampleIncrement(Int64)
Sets the current sample increment for the PDA, in nanoseconds (supersedes SampleTime). This value will only affect requests to get data (using the GetNextData method ) and will not affect calls to get samples (using the GetSamples/GetNextSamples/GetPreviousSamples methods).
Declaration
public void SetSampleIncrement(long increment)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | increment | The required sample increment |
Remarks
This time is the interval between data samples. For example: 1,000,000 ns = 1000Hz 10,000,000 ns = 100Hz 100,000,000 ns = 10Hz 1,000,000,000 ns = 1Hz If this value is not set then the default sample time is 100Hz (10,000,000 ns).
Events
Invalidated
Occurs when [invalidated].
Declaration
public event EventHandler Invalidated
Event Type
Type | Description |
---|---|
System.EventHandler |
UnderlyingDataSourceChanged
Occurs when [underlying data source changed]. This event will be raised if the source data context of one of the underlying PDAs of this composite PDA change - any previously-requested data is invalid.
Declaration
public event EventHandler UnderlyingDataSourceChanged
Event Type
Type | Description |
---|---|
System.EventHandler |