Interface IEncoder<T>
Encoders are used by RapWriters and RapReaders for serializing and deserializing Recording data. Implement this interface to serialize custom data types.
Namespace: Recolude.Core.IO
Assembly: Recolude.Core.dll
Syntax
public interface IEncoder<out T>
where T : ICaptureCollection<ICapture>
Type Parameters
| Name | Description |
|---|---|
| T | The capture collection this encoder is meant to serialize/deserialize. |
Methods
Accepts(ICaptureCollection<ICapture>)
Evaluates whether or not the encoder can serialize the provided capture collection.
Declaration
bool Accepts(ICaptureCollection<ICapture> captureCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| ICaptureCollection<ICapture> | captureCollection | The collection to evaluate whether or not the encoder can handle it. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether or not the encoder can handle this specific collection type. |
Decode(String, Byte[], Byte[], Single[])
Produces a capture collection by deserializing the data provided.
Declaration
T Decode(string name, byte[] header, byte[] body, float[] times)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the capture stream to create. |
| System.Byte[] | header | Header data for all capture collections. |
| System.Byte[] | body | The data specific to the collection to deserialize. |
| System.Single[] | times | The time stamps for the captures in the collection. |
Returns
| Type | Description |
|---|---|
| T | The deserialized collection. |
Encode(ICaptureCollection<ICapture>[])
Encodes all collections provided.
Declaration
EncodedCollections Encode(ICaptureCollection<ICapture>[] captureCollections)
Parameters
| Type | Name | Description |
|---|---|---|
| ICaptureCollection<ICapture>[] | captureCollections | The collections to encode. |
Returns
| Type | Description |
|---|---|
| EncodedCollections | The encoded data. |
Signature()
When serializing a recording, this value get's written to denote what capture collections this encoder is designed to handle. The naming for a encoder's signature follows the scheme: [company name].[capture collection name]
For example: recolude.position recolude.enum recolude.euler recolude.event
Declaration
string Signature()
Returns
| Type | Description |
|---|---|
| System.String | The signature of the recording. |
Version()
When serializing a recording, this value gets written along with the encoder's signature. When the recording is being deserialized, the version found in the recording is compared against the encoder registered to the RapReader. If the version found in the recording is greater than the registered encoder, an exception will get thrown.
The value must be non-negative.
Declaration
int Version()
Returns
| Type | Description |
|---|---|
| System.Int32 | Version of encoder. |