[3742] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[14185] | 3 | * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[3742] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
[1454] | 21 |
|
---|
[3742] | 22 | using System;
|
---|
| 23 |
|
---|
[1454] | 24 | namespace HeuristicLab.Persistence.Interfaces {
|
---|
| 25 |
|
---|
[1564] | 26 | /// <summary>
|
---|
[1823] | 27 | /// Marker interface primitive serializers. Transform data of type SourceType
|
---|
| 28 | /// into the serialization format SerialDataType. Derive from PrimitiveSerializerBase instead
|
---|
[1564] | 29 | /// of implementing this interface.
|
---|
| 30 | /// </summary>
|
---|
[1823] | 31 | public interface IPrimitiveSerializer {
|
---|
[3016] | 32 |
|
---|
| 33 | /// <summary>
|
---|
| 34 | /// Gets the type of the serial data.
|
---|
| 35 | /// </summary>
|
---|
| 36 | /// <value>The type of the serial data.</value>
|
---|
[1564] | 37 | Type SerialDataType { get; }
|
---|
[3016] | 38 |
|
---|
| 39 | /// <summary>
|
---|
| 40 | /// Gets the source type.
|
---|
| 41 | /// </summary>
|
---|
| 42 | /// <value>The type of the source.</value>
|
---|
[1564] | 43 | Type SourceType { get; }
|
---|
[3016] | 44 |
|
---|
| 45 | /// <summary>
|
---|
| 46 | /// Creates a serialized representation of the provided object.
|
---|
| 47 | /// </summary>
|
---|
| 48 | /// <param name="o">The object.</param>
|
---|
| 49 | /// <returns>A serialized version of the object.</returns>
|
---|
[1564] | 50 | ISerialData Format(object o);
|
---|
[3016] | 51 |
|
---|
| 52 |
|
---|
| 53 | /// <summary>
|
---|
| 54 | /// Creates a fresh object instance using the serializes data..
|
---|
| 55 | /// </summary>
|
---|
| 56 | /// <param name="data">The data.</param>
|
---|
| 57 | /// <returns>A fresh object instance.</returns>
|
---|
| 58 | object Parse(ISerialData data);
|
---|
[1454] | 59 | }
|
---|
| 60 |
|
---|
[1564] | 61 | /// <summary>
|
---|
[1823] | 62 | /// Marker interface primitive serializers. Transform data of type SourceType
|
---|
| 63 | /// into the serialization format SerialDataType. Derive from PrimitiveSerializerBase instead
|
---|
[1564] | 64 | /// of implementing this interface.
|
---|
[1823] | 65 | /// </summary>
|
---|
[3016] | 66 | /// <typeparam name="Source">The source type.</typeparam>
|
---|
| 67 | /// <typeparam name="SerialData">The serialized data type.</typeparam>
|
---|
[1823] | 68 | public interface IPrimitiveSerializer<Source, SerialData> : IPrimitiveSerializer where SerialData : ISerialData {
|
---|
[3016] | 69 |
|
---|
| 70 | /// <summary>
|
---|
| 71 | /// Creates a serialized version of the provided object.
|
---|
| 72 | /// </summary>
|
---|
| 73 | /// <param name="o">The object.</param>
|
---|
| 74 | /// <returns>A serialized version of the object.</returns>
|
---|
[1564] | 75 | SerialData Format(Source o);
|
---|
[3016] | 76 |
|
---|
| 77 |
|
---|
| 78 | /// <summary>
|
---|
| 79 | /// Creates a fresh object instance from the serialized data
|
---|
| 80 | /// </summary>
|
---|
| 81 | /// <param name="data">The data.</param>
|
---|
| 82 | /// <returns>A fresh object instance.</returns>
|
---|
| 83 | Source Parse(SerialData data);
|
---|
[1566] | 84 | }
|
---|
| 85 |
|
---|
[1454] | 86 | } |
---|