Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
3 |
|
---|
4 | namespace 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.