1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2018 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 |
|
---|
22 | using System.Collections.Generic;
|
---|
23 |
|
---|
24 | namespace HeuristicLab.Persistence.Core {
|
---|
25 |
|
---|
26 | /// <summary>
|
---|
27 | /// Association of id, type name and serializer
|
---|
28 | /// </summary>
|
---|
29 | public class TypeMapping {
|
---|
30 |
|
---|
31 | /// <summary>
|
---|
32 | /// The type's id.
|
---|
33 | /// </summary>
|
---|
34 | public readonly int Id;
|
---|
35 |
|
---|
36 | /// <summary>
|
---|
37 | /// The type's full name.
|
---|
38 | /// </summary>
|
---|
39 | public readonly string TypeName;
|
---|
40 |
|
---|
41 |
|
---|
42 | /// <summary>
|
---|
43 | /// The full name of the serializes used to serialize the
|
---|
44 | /// <see cref="TypeName"/>.
|
---|
45 | /// </summary>
|
---|
46 | public readonly string Serializer;
|
---|
47 |
|
---|
48 | /// <summary>
|
---|
49 | /// Initializes a new instance of the <see cref="TypeMapping"/> class.
|
---|
50 | /// </summary>
|
---|
51 | /// <param name="id">The type's id.</param>
|
---|
52 | /// <param name="typeName">The type's full name.</param>
|
---|
53 | /// <param name="serializer">The full name of the serializer use to
|
---|
54 | /// serialize this type.</param>
|
---|
55 | public TypeMapping(int id, string typeName, string serializer) {
|
---|
56 | Id = id;
|
---|
57 | TypeName = typeName;
|
---|
58 | Serializer = serializer;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /// <summary>
|
---|
62 | /// Creates a dictionary that conatins all properties
|
---|
63 | /// and values of this instance.
|
---|
64 | /// </summary>
|
---|
65 | /// <returns>A dictionary containing all properties
|
---|
66 | /// and values of this instance.</returns>
|
---|
67 | public Dictionary<string, string> GetDict() {
|
---|
68 | return new Dictionary<string, string> {
|
---|
69 | {"id", Id.ToString()},
|
---|
70 | {"typeName", TypeName},
|
---|
71 | {"serializer", Serializer}};
|
---|
72 | }
|
---|
73 |
|
---|
74 | }
|
---|
75 |
|
---|
76 | } |
---|