Diffusion .NET Client Library  6.1.5
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta > Interface Template Reference

The optional extension provided by IDataType implementations that support incremental changes to values. More...

Inheritance diagram for PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >:
PushTechnology.ClientInterface.Data.IDeltaType

Public Member Functions

void WriteDelta (TDelta delta, Stream outputStream)
 Serializes a delta to binary. More...
 
IBytes ToBytes (TDelta delta)
 Returns the serialized form of the given delta as IBytes. More...
 
new TDelta ReadDelta (byte[] input, int offset, int length)
 Parse a delta from binary segment. More...
 
new TDelta ReadDelta (byte[] input)
 Parse a delta from binary. More...
 
new TDelta ReadDelta (IBytes input)
 Creates a delta from IBytes. More...
 
TDelta Diff (TValue oldValue, TValue newValue)
 Creates a delta from two values. More...
 
TValue Apply (TValue oldValue, TDelta delta)
 Applies a delta to a value. More...
 
bool IsValueCheaper (TValue value, TDelta delta)
 Calculates if value is cheaper than delta . The result is typically determined by the length of the serialized form but can also consider the complexity of the delta. More...
 
- Public Member Functions inherited from PushTechnology.ClientInterface.Data.IDeltaType
void WriteDelta (object delta, Stream outputStream)
 Serializes a delta to binary. More...
 
IBytes ToBytes (object delta)
 Returns the serialized form of the given delta as IBytes. More...
 
object Diff (object oldValue, object newValue)
 Creates a delta from two values. More...
 
object Apply (object oldValue, object delta)
 Applies a delta to a value. More...
 
bool IsValueCheaper (object value, object delta)
 Calculates if value is cheaper than delta . The result is typically determined by the length of the serialized form but can also consider the complexity of the delta. More...
 

Properties

new TDelta NoChange [get]
 Returns a constant that indicates no changes between values. More...
 
- Properties inherited from PushTechnology.ClientInterface.Data.IDeltaType
string Name [get]
 Returns the external identifier for this delta type. More...
 
object NoChange [get]
 Returns a constant that indicates no changes between values. More...
 

Detailed Description

The optional extension provided by IDataType implementations that support incremental changes to values.

This is a generic version of the IDeltaType interface that provides overloads for all object methods. It instead provides typed arguments and return values based on the given value and delta type.

For more information about the delta type interface, see

See Also
IDeltaType

.

Since 5.8

Member Function Documentation

TValue PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.Apply ( TValue  oldValue,
TDelta  delta 
)

Applies a delta to a value.

Parameters
oldValueThe old value.
deltaThe delta to apply to the old value.
Returns
The new value. The old value will be returned if the delta had no effect.
TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.Diff ( TValue  oldValue,
TValue  newValue 
)

Creates a delta from two values.

If there are many differences between oldValue and newValue, the result might require more bytes to transmit than the new value, or be computationally expensive to apply. In this case, it is better to discard oldValue and publish newValue in its place. This can be checked using IsValueCheaper(TValue,TDelta).

The implementation can return the special constant NoChange to indicate the oldValue and newValue are equivalent and there is no change to publish.

Parameters
oldValueThe old value.
newValueThe new value.
Returns
The delta representing the difference between oldValue and newValue.
bool PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.IsValueCheaper ( TValue  value,
TDelta  delta 
)

Calculates if value is cheaper than delta . The result is typically determined by the length of the serialized form but can also consider the complexity of the delta.

Parameters
valueThe value.
deltaThe delta.
Returns
True if value is considered cheaper than delta . Otherwise false.
new TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ReadDelta ( byte[]  input,
int  offset,
int  length 
)

Parse a delta from binary segment.

Parameters
inputThe binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified.
offsetThe starting index of the segment.
lengthThe length of the segment.
Returns
The delta.

Implements PushTechnology.ClientInterface.Data.IDeltaType.

new TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ReadDelta ( byte[]  input)

Parse a delta from binary.

This is equivalent to ReadDelta(input,0,input.Length).

Parameters
inputThe binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified.
Returns
The delta.

Implements PushTechnology.ClientInterface.Data.IDeltaType.

new TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ReadDelta ( IBytes  input)

Creates a delta from IBytes.

This is equivalent to calling ReadDelta(byte[]) with the result of IBytes.ToByteArray as argument.

Since 6.0.

Parameters
inputThe binary data.
Returns
The delta object.

Implements PushTechnology.ClientInterface.Data.IDeltaType.

IBytes PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ToBytes ( TDelta  delta)

Returns the serialized form of the given delta as IBytes.

Since 6.0.

Parameters
deltaThe delta object.
Returns
The delta as IBytes.
void PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.WriteDelta ( TDelta  delta,
Stream  outputStream 
)

Serializes a delta to binary.

Parameters
deltaThe delta.
outputStreamThe output stream.

Property Documentation

new TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.NoChange
get

Returns a constant that indicates no changes between values.

This constant is returned by Diff(TValue,TValue) to indicate oldValue and newValue are equivalent. The result is guaranteed to be equal only to itself.


The documentation for this interface was generated from the following file: