Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Core/FormatBase.cs @ 3010

Last change on this file since 3010 was 3004, checked in by epitzer, 15 years ago

add complete persistence API docs (#548)

File size: 1.2 KB
Line 
1using System;
2using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
3
4namespace HeuristicLab.Persistence.Interfaces {
5
6  /// <summary>
7  /// Common base class for defining a new serialization format.
8  /// </summary> 
9  [StorableClass(StorableClassType.Empty)]
10  public abstract class FormatBase<SerialDataFormat> : IFormat<SerialDataFormat> where SerialDataFormat : ISerialData {
11   
12    public abstract string Name { get; }
13
14   
15    /// <summary>
16    /// Datatype that describes the atoms used for serialization serialization.
17    /// </summary>
18    public Type SerialDataType { get { return typeof(SerialDataFormat); } }
19
20    /// <summary>
21    /// Compares formats by name.
22    /// </summary>   
23    public bool Equals(FormatBase<SerialDataFormat> f) {
24      if (f == null)
25        return false;
26      return f.Name == this.Name;
27    }
28
29    /// <summary>
30    /// Compares foramts by name.
31    /// </summary>
32    public override bool Equals(object obj) {
33      FormatBase<SerialDataFormat> f = obj as FormatBase<SerialDataFormat>;
34      return Equals(f);
35    }
36
37    public override int GetHashCode() {
38      return Name.GetHashCode();
39    }
40
41  }
42
43}
Note: See TracBrowser for help on using the repository browser.