Class ValueHistoryPinConfiguration
Specialized value history that stores compressed pin configuration data.
Each pin configuration is only stored once to save memory. The history itself simply stores identifiers instead of whole pin configurations.
Implements
Namespace: AS2.Sim
Assembly: .dll
Syntax
public class ValueHistoryPinConfiguration : ValueHistory<SysPinConfiguration>, IReplayHistory
Constructors
| Edit this page View SourceValueHistoryPinConfiguration(PinConfigurationHistorySaveData)
Same as ValueHistory(ValueHistorySaveData<T>) but specialized for pin configuration history data.
Declaration
public ValueHistoryPinConfiguration(PinConfigurationHistorySaveData data)
Parameters
Type | Name | Description |
---|---|---|
PinConfigurationHistorySaveData | data | The serializable history data from which to restore the ValueHistoryPinConfiguration instance. |
ValueHistoryPinConfiguration(SysPinConfiguration, int)
Declaration
public ValueHistoryPinConfiguration(SysPinConfiguration initialValue, int initialRound = 0)
Parameters
Type | Name | Description |
---|---|---|
SysPinConfiguration | initialValue | |
int | initialRound |
Fields
| Edit this page View Sourceconfigs
Contains all pin configurations we have seen so far. Pin configurations are only stored once to save memory.
Declaration
private List<PinConfigurationSaveData> configs
Field Value
Type | Description |
---|---|
List<PinConfigurationSaveData> |
idxHistory
Stores the actual history state and indices of pin configurations.
Declaration
private ValueHistory<int> idxHistory
Field Value
Type | Description |
---|---|
ValueHistory<int> |
Methods
| Edit this page View SourceContinueTracking()
Resets the marker to continue tracking the last recorded round.
Declaration
public override void ContinueTracking()
Overrides
| Edit this page View SourceCutOffAfterRound(int)
Deletes all records after the specified round, turning this round into the last round if it is earlier than the current last round.
Declaration
public override void CutOffAfterRound(int round)
Parameters
Type | Name | Description |
---|---|---|
int | round | The round after which all records should be removed. |
Overrides
| Edit this page View SourceCutOffAtMarker()
Deletes all records after the currently marked round. If the marked round is earlier than the current last round, the marked round becomes the new last round.
Declaration
public override void CutOffAtMarker()
Overrides
| Edit this page View SourceFindOrAddConfig(PinConfigurationSaveData)
Helper to find a given pin configuration in the list of encountered configurations or insert it and then return its index.
Declaration
private int FindOrAddConfig(PinConfigurationSaveData d)
Parameters
Type | Name | Description |
---|---|---|
PinConfigurationSaveData | d | The compressed version of the pin configuration to find or insert. |
Returns
Type | Description |
---|---|
int | The index of |
GeneratePCSaveData()
Generates value history save data specifically for serialized pin configuration data. Use this instead of GenerateSaveData().
Declaration
public PinConfigurationHistorySaveData GeneratePCSaveData()
Returns
Type | Description |
---|---|
PinConfigurationHistorySaveData | A serializable object storing history data from which pin configurations can be restored. |
GenerateSaveData()
Not supported.
Declaration
public override ValueHistorySaveData<SysPinConfiguration> GenerateSaveData()
Returns
Type | Description |
---|---|
ValueHistorySaveData<SysPinConfiguration> |
Overrides
| Edit this page View SourceGetFirstRecordedRound()
Returns the first round in which a value was recorded. This is the round in which the history of this variable begins; its value is undefined in all previous rounds.
See also GetLastRecordedRound().
Declaration
public override int GetFirstRecordedRound()
Returns
Type | Description |
---|---|
int | The first round with a recorded value. |
Overrides
| Edit this page View SourceGetLastRecordedRound()
Returns the last round in which a value was recorded. The history may only be updated for rounds greater than or equal to this round. Queries for rounds after this one will return the value that was recorded for this round.
See also GetFirstRecordedRound().
Declaration
public override int GetLastRecordedRound()
Returns
Type | Description |
---|---|
int | The last round with a recorded value. |
Overrides
| Edit this page View SourceGetMarkedRound()
Returns the round that is currently marked.
Declaration
public override int GetMarkedRound()
Returns
Type | Description |
---|---|
int | The currently marked round. |
Overrides
| Edit this page View SourceGetMarkedValue()
Not supported, use GetMarkedValue(Particle) instead.
A Particle is required to reconstruct a SysPinConfiguration from only its PinConfigurationSaveData.
Declaration
public override SysPinConfiguration GetMarkedValue()
Returns
Type | Description |
---|---|
SysPinConfiguration |
Overrides
| Edit this page View SourceGetMarkedValue(Particle)
Replaces GetMarkedValue().
A Particle is required to reconstruct a SysPinConfiguration from its PinConfigurationSaveData.
Declaration
public SysPinConfiguration GetMarkedValue(Particle p)
Parameters
Type | Name | Description |
---|---|---|
Particle | p | The particle used to reconstruct the pin configuration. Must be in a matching expansion state. |
Returns
Type | Description |
---|---|
SysPinConfiguration | A pin configuration reconstructed from the currently
marked configuration data using the particle |
GetValueInRound(int)
Not supported, use GetValueInRound(int, Particle) instead.
A Particle is required to reconstruct a SysPinConfiguration from only its PinConfigurationSaveData.
Declaration
public override SysPinConfiguration GetValueInRound(int round)
Parameters
Type | Name | Description |
---|---|---|
int | round |
Returns
Type | Description |
---|---|
SysPinConfiguration |
Overrides
| Edit this page View SourceGetValueInRound(int, Particle)
Replaces GetValueInRound(int).
A Particle is required to reconstruct a SysPinConfiguration from its PinConfigurationSaveData.
Declaration
public SysPinConfiguration GetValueInRound(int round, Particle p)
Parameters
Type | Name | Description |
---|---|---|
int | round | The round from which to get the pin configuration. |
Particle | p | The particle used to reconstruct the pin configuration. Must be in a matching expansion state. |
Returns
Type | Description |
---|---|
SysPinConfiguration | A pin configuration reconstructed from the configuration data
recorded for round |
IsTracking()
Checks whether the round marker is currently tracking the latest round.
Declaration
public override bool IsTracking()
Returns
Type | Description |
---|---|
bool |
|
Overrides
| Edit this page View SourceRecordValueAtMarker(SysPinConfiguration)
Like RecordValueInRound(T, int) but the recorded round is the round that is currently marked.
Declaration
public override void RecordValueAtMarker(SysPinConfiguration value)
Parameters
Type | Name | Description |
---|---|---|
SysPinConfiguration | value | The value to record in the currently marked round. |
Overrides
| Edit this page View SourceRecordValueInRound(SysPinConfiguration, int)
Adds a value for the specified round to the variable record.
The value is assumed to remain unchanged between the previously
last round and round
.
Declaration
public override void RecordValueInRound(SysPinConfiguration value, int round)
Parameters
Type | Name | Description |
---|---|---|
SysPinConfiguration | value | The value to be recorded. |
int | round | The round for which the value should be recorded. Must be greater than or equal to the last recorded round. |
Overrides
| Edit this page View SourceSetMarkerToRound(int)
Sets the marker to the specified round and stops it from tracking the latest round.
Declaration
public override void SetMarkerToRound(int round)
Parameters
Type | Name | Description |
---|---|---|
int | round | The round to which the marker should be set. Must not be smaller than the first recorded round. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
ShiftTimescale(int)
Shifts all records as well as the marker by the specified amount of rounds.
Declaration
public override void ShiftTimescale(int amount)
Parameters
Type | Name | Description |
---|---|---|
int | amount | The number of rounds to add to each entry. May be negative. |
Overrides
| Edit this page View SourceStepBack()
Moves the marker one round back and stops it from tracking the last round.
Must not be called when the marker is already at the first recorded round.
Declaration
public override void StepBack()
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when the marker is already at the first recorded round. |
StepForward()
Moves the marker one round forward and stops it from tracking the last round.
Declaration
public override void StepForward()
Overrides
Operators
| Edit this page View Sourceimplicit operator SysPinConfiguration(ValueHistoryPinConfiguration)
Implicit conversion that returns the currently marked value
Declaration
public static implicit operator SysPinConfiguration(ValueHistoryPinConfiguration history)
Parameters
Type | Name | Description |
---|---|---|
ValueHistoryPinConfiguration | history | The history whose marked value to return. |
Returns
Type | Description |
---|---|
SysPinConfiguration |