Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PausableBasicAlgorithm/HeuristicLab.Persistence/3.3/Interfaces/IPrimitiveSerializer.cs @ 14529

Last change on this file since 14529 was 12012, checked in by ascheibe, 10 years ago

#2212 merged r12008, r12009, r12010 back into trunk

File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
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
21
22using System;
23
24namespace HeuristicLab.Persistence.Interfaces {
25
26  /// <summary>
27  /// Marker interface primitive serializers. Transform data of type SourceType
28  /// into the serialization format SerialDataType. Derive from PrimitiveSerializerBase instead
29  /// of implementing this interface.
30  /// </summary>
31  public interface IPrimitiveSerializer {
32
33    /// <summary>
34    /// Gets the type of the serial data.
35    /// </summary>
36    /// <value>The type of the serial data.</value>
37    Type SerialDataType { get; }
38
39    /// <summary>
40    /// Gets the source type.
41    /// </summary>
42    /// <value>The type of the source.</value>
43    Type SourceType { get; }
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>
50    ISerialData Format(object o);
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);
59  }
60
61  /// <summary>
62  /// Marker interface primitive serializers. Transform data of type SourceType
63  /// into the serialization format SerialDataType. Derive from PrimitiveSerializerBase instead
64  /// of implementing this interface.
65  /// </summary>
66  /// <typeparam name="Source">The source type.</typeparam>
67  /// <typeparam name="SerialData">The serialized data type.</typeparam>
68  public interface IPrimitiveSerializer<Source, SerialData> : IPrimitiveSerializer where SerialData : ISerialData {
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>
75    SerialData Format(Source o);
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);
84  }
85
86}
Note: See TracBrowser for help on using the repository browser.