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 | /// <summary>
|
---|
13 | /// Gets the format's name.
|
---|
14 | /// </summary>
|
---|
15 | /// <value>The format's name.</value>
|
---|
16 | public abstract string Name { get; }
|
---|
17 |
|
---|
18 | /// <summary>
|
---|
19 | /// Datatype that describes the atoms used for serialization serialization.
|
---|
20 | /// </summary>
|
---|
21 | public Type SerialDataType { get { return typeof(SerialDataFormat); } }
|
---|
22 |
|
---|
23 | /// <summary>
|
---|
24 | /// Compares formats by name.
|
---|
25 | /// </summary>
|
---|
26 | public bool Equals(FormatBase<SerialDataFormat> f) {
|
---|
27 | if (f == null)
|
---|
28 | return false;
|
---|
29 | return f.Name == this.Name;
|
---|
30 | }
|
---|
31 |
|
---|
32 | /// <summary>
|
---|
33 | /// Compares foramts by name.
|
---|
34 | /// </summary>
|
---|
35 | public override bool Equals(object obj) {
|
---|
36 | FormatBase<SerialDataFormat> f = obj as FormatBase<SerialDataFormat>;
|
---|
37 | return Equals(f);
|
---|
38 | }
|
---|
39 |
|
---|
40 | public override int GetHashCode() {
|
---|
41 | return Name.GetHashCode();
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
45 |
|
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.