in src/Types/Encoder.cs [95:328]
internal static void Initialize()
{
knownDescribed = new Map();
#if !NETMF
knownDescribedByCode = new Dictionary<ulong, CreateDescribed>();
#endif
serializers = new Serializer[]
{
// 0: null
new Serializer()
{
Type = null,
Encoder = delegate(ByteBuffer b, object o, bool s) { AmqpBitConverter.WriteUByte(b, FormatCode.Null); },
Decoder = delegate(ByteBuffer b, byte c) { return null; }
},
// 1: boolean
new Serializer()
{
Type = typeof(bool),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteBoolean(b, (bool)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadBoolean(b, c); }
},
// 2: ubyte
new Serializer()
{
Type = typeof(byte),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteUByte(b, (byte)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadUByte(b, c); }
},
// 3: ushort
new Serializer()
{
Type = typeof(ushort),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteUShort(b, (ushort)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadUShort(b, c); }
},
// 4: uint
new Serializer()
{
Type = typeof(uint),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteUInt(b, (uint)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadUInt(b, c); }
},
// 5: ulong
new Serializer()
{
Type = typeof(ulong),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteULong(b, (ulong)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadULong(b, c); }
},
// 6: byte
new Serializer()
{
Type = typeof(sbyte),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteByte(b, (sbyte)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadByte(b, c); }
},
// 7: short
new Serializer()
{
Type = typeof(short),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteShort(b, (short)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadShort(b, c); }
},
// 8: int
new Serializer()
{
Type = typeof(int),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteInt(b, (int)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadInt(b, c); }
},
// 9: long
new Serializer()
{
Type = typeof(long),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteLong(b, (long)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadLong(b, c); }
},
// 10: float
new Serializer()
{
Type = typeof(float),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteFloat(b, (float)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadFloat(b, c); }
},
// 11: double
new Serializer()
{
Type = typeof(double),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteDouble(b, (double)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadDouble(b, c); }
},
// 12: char
new Serializer()
{
Type = typeof(char),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteChar(b, (char)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadChar(b, c); }
},
// 13: timestamp
new Serializer()
{
Type = typeof(DateTime),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteTimestamp(b, (DateTime)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadTimestamp(b, c); }
},
// 14: uuid
new Serializer()
{
Type = typeof(Guid),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteUuid(b, (Guid)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadUuid(b, c); }
},
// 15: binary
new Serializer()
{
Type = typeof(byte[]),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteBinary(b, (byte[])o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadBinary(b, c); }
},
// 16: string
new Serializer()
{
Type = typeof(string),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteString(b, (string)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadString(b, c); }
},
// 17: symbol
new Serializer()
{
Type = typeof(Symbol),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteSymbol(b, (Symbol)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadSymbol(b, c); }
},
// 18: list
new Serializer()
{
Type = typeof(List),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteList(b, (IList)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadList(b, c); }
},
// 19: map
new Serializer()
{
Type = typeof(Map),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteMap(b, (Map)o, s); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadMap(b, c); }
},
// 20: array
new Serializer()
{
Type = typeof(Array),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteArray(b, (Array)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadArray(b, c); }
},
// 21: decimal
new Serializer()
{
Type = typeof(Decimal),
Encoder = delegate(ByteBuffer b, object o, bool s) { WriteDecimal(b, (Decimal)o); },
Decoder = delegate(ByteBuffer b, byte c) { return ReadDecimal(b, c); }
},
// 22: invalid
null
};
codecByType = new Map()
{
{ typeof(bool), serializers[1] },
{ typeof(byte), serializers[2] },
{ typeof(ushort), serializers[3] },
{ typeof(uint), serializers[4] },
{ typeof(ulong), serializers[5] },
{ typeof(sbyte), serializers[6] },
{ typeof(short), serializers[7] },
{ typeof(int), serializers[8] },
{ typeof(long), serializers[9] },
{ typeof(float), serializers[10] },
{ typeof(double), serializers[11] },
{ typeof(char), serializers[12] },
{ typeof(DateTime), serializers[13] },
{ typeof(Guid), serializers[14] },
{ typeof(byte[]), serializers[15] },
{ typeof(string), serializers[16] },
{ typeof(Symbol), serializers[17] },
{ typeof(List), serializers[18] },
{ typeof(Map), serializers[19] },
#if !NETMF_LITE
{ typeof(Fields), serializers[19] },
#endif
{ typeof(Decimal), serializers[21] },
};
byte nil = (byte)(serializers.Length - 1);
codecIndexTable = new byte[][]
{
// 0x40:null, 0x41:boolean.true, 0x42:boolean.false, 0x43:uint0, 0x44:ulong0, 0x45:list0
new byte[] { 0, 1, 1, 4, 5, 18 },
// 0x50:ubyte, 0x51:byte, 0x52:small.uint, 0x53:small.ulong, 0x54:small.int, 0x55:small.long, 0x56:boolean
new byte[] { 2, 6, 4, 5, 8, 9, 1 },
// 0x60:ushort, 0x61:short
new byte[] { 3, 7 },
// 0x70:uint, 0x71:int, 0x72:float, 0x73:char, 0x74:decimal32
new byte[] { 4, 8, 10, 12, 21 },
// 0x80:ulong, 0x81:long, 0x82:double, 0x83:timestamp, 0x84:decimal64
new byte[] { 5, 9, 11, 13, 21 },
// 0x94:decimal128, 0x98:uuid
new byte[] { nil, nil, nil, nil, 21, nil, nil, nil, 14 },
// 0xa0:bin8, 0xa1:str8, 0xa3:sym8
new byte[] { 15, 16, 21, 17 },
// 0xb0:bin32, 0xb1:str32, 0xb3:sym32
new byte[] { 15, 16, nil, 17 },
// 0xc0:list8, 0xc1:map8
new byte[] { 18, 19 },
// 0xd0:list32, 0xd1:map32
new byte[] { 18, 19 },
// 0xe0:array8
new byte[] { 20 },
// 0xf0:array32
new byte[] { 20 }
};
}