[1454] | 1 | using System;
|
---|
| 2 |
|
---|
| 3 | namespace HeuristicLab.Persistence.Interfaces {
|
---|
| 4 |
|
---|
[1564] | 5 | /// <summary>
|
---|
[1823] | 6 | /// Marker interface primitive serializers. Transform data of type SourceType
|
---|
| 7 | /// into the serialization format SerialDataType. Derive from PrimitiveSerializerBase instead
|
---|
[1564] | 8 | /// of implementing this interface.
|
---|
| 9 | /// </summary>
|
---|
[1823] | 10 | public interface IPrimitiveSerializer {
|
---|
[3016] | 11 |
|
---|
| 12 | /// <summary>
|
---|
| 13 | /// Gets the type of the serial data.
|
---|
| 14 | /// </summary>
|
---|
| 15 | /// <value>The type of the serial data.</value>
|
---|
[1564] | 16 | Type SerialDataType { get; }
|
---|
[3016] | 17 |
|
---|
| 18 | /// <summary>
|
---|
| 19 | /// Gets the source type.
|
---|
| 20 | /// </summary>
|
---|
| 21 | /// <value>The type of the source.</value>
|
---|
[1564] | 22 | Type SourceType { get; }
|
---|
[3016] | 23 |
|
---|
| 24 | /// <summary>
|
---|
| 25 | /// Creates a serialized representation of the provided object.
|
---|
| 26 | /// </summary>
|
---|
| 27 | /// <param name="o">The object.</param>
|
---|
| 28 | /// <returns>A serialized version of the object.</returns>
|
---|
[1564] | 29 | ISerialData Format(object o);
|
---|
[3016] | 30 |
|
---|
| 31 |
|
---|
| 32 | /// <summary>
|
---|
| 33 | /// Creates a fresh object instance using the serializes data..
|
---|
| 34 | /// </summary>
|
---|
| 35 | /// <param name="data">The data.</param>
|
---|
| 36 | /// <returns>A fresh object instance.</returns>
|
---|
| 37 | object Parse(ISerialData data);
|
---|
[1454] | 38 | }
|
---|
| 39 |
|
---|
[1564] | 40 | /// <summary>
|
---|
[1823] | 41 | /// Marker interface primitive serializers. Transform data of type SourceType
|
---|
| 42 | /// into the serialization format SerialDataType. Derive from PrimitiveSerializerBase instead
|
---|
[1564] | 43 | /// of implementing this interface.
|
---|
[1823] | 44 | /// </summary>
|
---|
[3016] | 45 | /// <typeparam name="Source">The source type.</typeparam>
|
---|
| 46 | /// <typeparam name="SerialData">The serialized data type.</typeparam>
|
---|
[1823] | 47 | public interface IPrimitiveSerializer<Source, SerialData> : IPrimitiveSerializer where SerialData : ISerialData {
|
---|
[3016] | 48 |
|
---|
| 49 | /// <summary>
|
---|
| 50 | /// Creates a serialized version of the provided object.
|
---|
| 51 | /// </summary>
|
---|
| 52 | /// <param name="o">The object.</param>
|
---|
| 53 | /// <returns>A serialized version of the object.</returns>
|
---|
[1564] | 54 | SerialData Format(Source o);
|
---|
[3016] | 55 |
|
---|
| 56 |
|
---|
| 57 | /// <summary>
|
---|
| 58 | /// Creates a fresh object instance from the serialized data
|
---|
| 59 | /// </summary>
|
---|
| 60 | /// <param name="data">The data.</param>
|
---|
| 61 | /// <returns>A fresh object instance.</returns>
|
---|
| 62 | Source Parse(SerialData data);
|
---|
[1566] | 63 | }
|
---|
| 64 |
|
---|
[1454] | 65 | } |
---|