source: branches/New Persistence Exploration/Persistence/Persistence/Tokens.cs @ 1355

Last change on this file since 1355 was 1355, checked in by epitzer, 12 years ago

Implement a type cache. (#506)

File size: 2.8 KB
Line 
1using System;
2namespace Persistence {
3
4  #region Serialization Tokens
5
6  public interface ISerializationToken {
7  }
8  public class BeginToken : ISerializationToken {   
9    public readonly string Name;
10    public readonly int? TypeId;
11    public readonly int? Id;
12    public BeginToken(string name, int? typeId, int? id) {
13      Name = name;
14      TypeId = typeId;
15      Id = id;
16    }
17  }
18  public class EndToken : ISerializationToken {
19    public readonly string Name;
20    public readonly int? TypeId;
21    public readonly int? Id;
22    public EndToken(string name, int? typeId, int? id) {
23      Name = name;
24      TypeId = typeId;
25      Id = id;
26    }
27  }
28  public class PrimitiveToken : ISerializationToken {
29    public readonly string Name;
30    public readonly int? TypeId;
31    public readonly int? Id;
32    public readonly object SerialData;
33    public PrimitiveToken(string name, int? typeId, object serialData, int? id) {
34      Name = name;
35      TypeId = typeId;
36      SerialData = serialData;     
37      Id = id;
38    }
39  }
40  public class ReferenceToken : ISerializationToken {
41    public readonly string Name;
42    public readonly int Id;
43    public ReferenceToken(string name, int id) {
44      Name = name;
45      Id = id;
46    }
47  }
48  public class NullReferenceToken : ISerializationToken {
49    public readonly string Name;
50    public NullReferenceToken(string name) {
51      Name = name;
52    }
53  }
54  #endregion
55
56  #region DeSerialization Tokens
57
58  public interface IParseToken { }
59
60  public class CompositeStart : IParseToken {
61    public readonly string Name;
62    public readonly string TypeId;
63    public readonly int? Id;
64    public CompositeStart(string name, string typeId, int? id) {
65      Name = name;
66      TypeId = typeId;
67      Id = id;
68    }
69  }
70  public class CompositeEnd : IParseToken {
71    public readonly string Name;
72    public readonly string TypeId;
73    public readonly int? Id;
74    public CompositeEnd(string name, string typeId, int? id) {
75      Name = name;
76      TypeId = typeId;
77      Id = id;
78    }
79  }
80  public class Primitive : IParseToken {
81    public readonly string Name;
82    public readonly string TypeId;
83    public readonly string SerializedValue;
84    public readonly int? Id;
85    public Primitive(string name, string typeId, string serilaizedValue, int? id) {
86      Name = name;
87      TypeId = typeId;
88      SerializedValue = serilaizedValue;
89      Id = id;
90    }
91  }
92  public class Reference : IParseToken {
93    public readonly string Name;
94    public readonly int Id;
95    public Reference(string name, int id) {
96      Name = name;
97      Id = id;
98    }
99  }
100  public class Null : IParseToken {
101    public readonly string Name;
102    public Null(string name) {
103      Name = name;
104    }
105  }
106  #endregion
107
108}
Note: See TracBrowser for help on using the repository browser.