This repository was archived by the owner on Feb 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathBucketEntry.cs
48 lines (45 loc) · 1.7 KB
/
BucketEntry.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Automatically generated by xdrgen
// DO NOT EDIT or your changes may be overwritten
namespace Stellar.Generated
{
// === xdr source ============================================================
// union BucketEntry switch (BucketEntryType type)
// {
// case LIVEENTRY:
// LedgerEntry liveEntry;
//
// case DEADENTRY:
// LedgerKey deadEntry;
// };
// ===========================================================================
public class BucketEntry {
public BucketEntry () {}
public BucketEntryType Discriminant { get; set; } = new BucketEntryType();
public LedgerEntry LiveEntry { get; set; } = default(LedgerEntry);
public LedgerKey DeadEntry { get; set; } = default(LedgerKey);
public static void Encode(IByteWriter stream, BucketEntry encodedBucketEntry) {
XdrEncoding.EncodeInt32((int)encodedBucketEntry.Discriminant.InnerValue, stream);
switch (encodedBucketEntry.Discriminant.InnerValue) {
case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY:
LedgerEntry.Encode(stream, encodedBucketEntry.LiveEntry);
break;
case BucketEntryType.BucketEntryTypeEnum.DEADENTRY:
LedgerKey.Encode(stream, encodedBucketEntry.DeadEntry);
break;
}
}
public static BucketEntry Decode(IByteReader stream) {
BucketEntry decodedBucketEntry = new BucketEntry();
decodedBucketEntry.Discriminant = BucketEntryType.Decode(stream);
switch (decodedBucketEntry.Discriminant.InnerValue) {
case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY:
decodedBucketEntry.LiveEntry = LedgerEntry.Decode(stream);
break;
case BucketEntryType.BucketEntryTypeEnum.DEADENTRY:
decodedBucketEntry.DeadEntry = LedgerKey.Decode(stream);
break;
}
return decodedBucketEntry;
}
}
}