The 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...
The 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
bool PushTechnology.ClientInterface.Data.IDataType.CanReadAs |
( |
Type |
resultType | ) |
|
Checks whether this data type is compatible with the given resultType .
This means that any valid binary representation of this data type can be read as a instance of the given resultType .
Since 6.0
- Parameters
-
resultType | The type to check for compatibility. |
- Returns
- True if the data type is compatible with the given resultType . Otherwise false.
- Exceptions
-
ArgumentNullException | The given resultType is null . |
IDeltaType PushTechnology.ClientInterface.Data.IDataType.DeltaType |
( |
string |
typeName | ) |
|
Returns a IDeltaType by name.
- Parameters
-
- Returns
- The delta type.
- Exceptions
-
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.
- Parameters
-
valueDeltaType | The delta value type. |
- Returns
- The delta type.
- Exceptions
-
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.ReadAs |
( |
Type |
resultType, |
|
|
byte[] |
input, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
Creates a value of a compatible type from a binary data segment.
Since 6.0.
- Parameters
-
resultType | The type of the result. |
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. |
- Returns
- The value object.
- Exceptions
-
ArgumentNullException | The given resultType is null . |
ArgumentException | Failed to read input as the given resultType type. |
InvalidOperationException | The given resultType is incompatible with input data. |
object PushTechnology.ClientInterface.Data.IDataType.ReadAs |
( |
Type |
resultType, |
|
|
byte[] |
input |
|
) |
| |
Creates a value of a compatible type from a binary data segment.
This is equivalent to calling
ReadAs(type, input, 0, input.Length)
.
Since 6.0.
- Parameters
-
resultType | The type of the result. |
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
- Returns
- The value object.
- Exceptions
-
ArgumentNullException | The given resultType is null . |
ArgumentException | Failed to read input as the given resultType type. |
InvalidOperationException | The given resultType is incompatible with input data. |
object PushTechnology.ClientInterface.Data.IDataType.ReadAs |
( |
Type |
resultType, |
|
|
IBytes |
bytes |
|
) |
| |
Creates a value of a compatible type from binary.
This is equivalent to calling
ReadAs(type, input.ToByteArray())
.
Since 6.0.
- Parameters
-
resultType | The type of the result. |
bytes | The binary data. |
- Returns
- The value object.
- Exceptions
-
ArgumentNullException | The given resultType is null . |
ArgumentException | Failed to read bytes as the given resultType type. |
InvalidDataException | The given resultType is incompatible with bytes data. |
object PushTechnology.ClientInterface.Data.IDataType.ReadValue |
( |
byte[] |
input, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
Parses a value from a binary data segment.
- Parameters
-
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. |
- Returns
- The value object.
Implemented in PushTechnology.ClientInterface.Data.IDataType< TValue >.
object PushTechnology.ClientInterface.Data.IDataType.ReadValue |
( |
byte[] |
input | ) |
|
object PushTechnology.ClientInterface.Data.IDataType.ReadValue |
( |
IBytes |
bytes | ) |
|
IBytes PushTechnology.ClientInterface.Data.IDataType.ToBytes |
( |
object |
value | ) |
|
Returns the serialized form of the given value as IBytes.
Since 6.0
- Parameters
-
value | The value to serialize. |
- Returns
- The IBytes representing the serialized form of the given value .
- Exceptions
-
ArgumentException | Failed to read value as the given result type. |
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.
- Parameters
-
value | The value object to check for validity. |
- Exceptions
-
InvalidDataException | The given value is invalid. |
void PushTechnology.ClientInterface.Data.IDataType.WriteValue |
( |
object |
value, |
|
|
Stream |
outputStream |
|
) |
| |
Serializes a value to binary.
- Parameters
-
value | The value object. |
outputStream | The output stream. |
- Exceptions
-
ArgumentException | The given value is invalid for this data type. |
string PushTechnology.ClientInterface.Data.IDataType.TypeName |
|
get |
Returns the external type identifier.
The documentation for this interface was generated from the following file: