Diffusion .NET API
5.9.24
|
Represents a data type that is specified for a particular value type. It provides methods to convert values to and from binary. Diffusion provides several IDataTypes implementations. More...
Public Member Functions | |
void | WriteValue (object value, Stream outputStream) |
Serializes a value to binary. More... | |
object | ReadValue (byte[] input, int offset, int length) |
Parses a value from a binary data segment. More... | |
object | ReadValue (byte[] input) |
Parses a value from a binary. More... | |
object | ReadValue (IBytes bytes) |
Parses a value from binary. More... | |
void | Validate (object value) |
Checks whether a value is valid. More... | |
IDeltaType | DeltaType (string typeName) |
Returns a IDeltaType by name. More... | |
IDeltaType | DeltaType (Type valueDeltaType) |
Returns a IDeltaType by type. More... | |
Properties | |
string | TypeName [get] |
Returns the external type identifier. More... | |
Represents a data type that is specified for a particular value type. It provides methods to convert values to and from binary. Diffusion provides several IDataTypes implementations.
Value types should provide a string representation and define reasonable equality.
A data type can optionally support incremental changes to values, represented by one or more types of delta. A delta is the difference between two values. For large or composite values that change in small steps, it is more efficient to transmit an initial value followed by a delta for each change than to transmit a complete value for each change. The data type provides an implementation of IDeltaType for each type of delta it supports via DeltaType(string) and DeltaType(Type).
Since 5.8
IDeltaType PushTechnology.ClientInterface.Data.IDataType.DeltaType | ( | string | typeName | ) |
Returns a IDeltaType by name.
typeName | The delta type name as returned by IDeltaType.Name. |
ArgumentException | This data type does not provide a IDeltaType with the given name. |
IDeltaType PushTechnology.ClientInterface.Data.IDataType.DeltaType | ( | Type | valueDeltaType | ) |
Returns a IDeltaType by type.
valueDeltaType | The delta value type. |
ArgumentException | This data type does not provide a IDeltaType for the given type or it provides more than one IDeltaType but none is preferred. |
object PushTechnology.ClientInterface.Data.IDataType.ReadValue | ( | byte[] | input, |
int | offset, | ||
int | length | ||
) |
Parses a value from a binary data segment.
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
offset | The starting index of the data segment. |
length | The length of the data segment. |
Implemented in PushTechnology.ClientInterface.Data.IDataType< TValue >.
object PushTechnology.ClientInterface.Data.IDataType.ReadValue | ( | byte[] | input | ) |
Parses a value from a binary.
This is equivalent to ReadValue(input,0,input.Length).
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
Implemented in PushTechnology.ClientInterface.Data.IDataType< TValue >.
object PushTechnology.ClientInterface.Data.IDataType.ReadValue | ( | IBytes | bytes | ) |
Parses a value from binary.
This is equivalent to ReadValue(bytes.ToByteArray()).
bytes | The binary data. |
Implemented in PushTechnology.ClientInterface.Data.IDataType< TValue >.
void PushTechnology.ClientInterface.Data.IDataType.Validate | ( | object | value | ) |
Checks whether a value is valid.
A DataType implementation is not required to check the binary data supplied to ReadValue(byte[],int,int). This method can be used the check the value at a later time.
value | The value object to check for validity. |
InvalidDataException | The given value is invalid. |
void PushTechnology.ClientInterface.Data.IDataType.WriteValue | ( | object | value, |
Stream | outputStream | ||
) |
Serializes a value to binary.
value | The value object. |
outputStream | The output stream. |
|
get |
Returns the external type identifier.