Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Core/PrimitiveSerializerBase.cs @ 2160

Last change on this file since 2160 was 1853, checked in by epitzer, 15 years ago

Fix EmptyStorableClass attributes. (#603)

File size: 1.0 KB
Line 
1using System;
2using System.Text;
3using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
4
5namespace HeuristicLab.Persistence.Interfaces {
6
7  [EmptyStorableClass]
8  public abstract class PrimitiveSerializerBase<Source, SerialData> :
9      IPrimitiveSerializer<Source, SerialData>
10      where SerialData : ISerialData {
11
12    public abstract SerialData Format(Source o);
13
14    public abstract Source Parse(SerialData t);
15
16    public Type SerialDataType { get { return typeof(SerialData); } }
17
18    public Type SourceType { get { return typeof(Source); } }
19
20    ISerialData IPrimitiveSerializer.Format(object o) {
21      return Format((Source)o);
22    }
23
24    object IPrimitiveSerializer.Parse(ISerialData o) {
25      return Parse((SerialData)o);
26    }
27
28    public override string ToString() {
29      return new StringBuilder()
30        .Append(this.GetType().Name)
31        .Append('(')
32        .Append(SourceType.Name)
33        .Append("->")
34        .Append(SerialDataType.Name)
35        .ToString();
36    }
37
38  }
39
40}
Note: See TracBrowser for help on using the repository browser.