Ejemplo n.º 1
0
            static ProtoTool()
            {
                Cache <bool, ProtoBool> .ByteSize     = (bool value) => ProtoTool.BoolByteSize(value);
                Cache <int, ProtoInt32> .ByteSize     = (int value) => ProtoTool.Int32ByteSize(value);
                Cache <int, ProtoSInt32> .ByteSize    = (int value) => ProtoTool.SInt32ByteSize(value);
                Cache <uint, ProtoUInt32> .ByteSize   = (uint value) => ProtoTool.UInt32ByteSize(value);
                Cache <long, ProtoInt64> .ByteSize    = (long value) => ProtoTool.Int64ByteSize(value);
                Cache <long, ProtoSInt64> .ByteSize   = (long value) => ProtoTool.SInt64ByteSize(value);
                Cache <ulong, ProtoUInt64> .ByteSize  = (ulong value) => ProtoTool.UInt64ByteSize(value);
                Cache <float, ProtoFloat> .ByteSize   = (float value) => ProtoTool.FloatByteSize(value);
                Cache <double, ProtoDouble> .ByteSize = (double value) => ProtoTool.DoubleByteSize(value);
                Cache <string, ProtoString> .ByteSize = (string value) => ProtoTool.StringByteSize(value);

                Cache <bool, ProtoBool> .Code     = (bool value, Stream buf) => ProtoTool.BoolCode(value, buf);
                Cache <int, ProtoInt32> .Code     = (int value, Stream buf) => ProtoTool.Int32Code(value, buf);
                Cache <int, ProtoSInt32> .Code    = (int value, Stream buf) => ProtoTool.SInt32Code(value, buf);
                Cache <uint, ProtoUInt32> .Code   = (uint value, Stream buf) => ProtoTool.UInt32Code(value, buf);
                Cache <long, ProtoInt64> .Code    = (long value, Stream buf) => ProtoTool.Int64Code(value, buf);
                Cache <long, ProtoSInt64> .Code   = (long value, Stream buf) => ProtoTool.SInt64Code(value, buf);
                Cache <ulong, ProtoUInt64> .Code  = (ulong value, Stream buf) => ProtoTool.UInt64Code(value, buf);
                Cache <float, ProtoFloat> .Code   = (float value, Stream buf) => ProtoTool.FloatCode(value, buf);
                Cache <double, ProtoDouble> .Code = (double value, Stream buf) => ProtoTool.DoubleCode(value, buf);
                Cache <string, ProtoString> .Code = (string value, Stream buf) => ProtoTool.StringCode(value, buf);

                Cache <bool, ProtoBool> .Decode     = (ref bool value, Stream buf) => ProtoTool.BoolDecode(ref value, buf);
                Cache <int, ProtoInt32> .Decode     = (ref int value, Stream buf) => ProtoTool.Int32Decode(ref value, buf);
                Cache <int, ProtoSInt32> .Decode    = (ref int value, Stream buf) => ProtoTool.SInt32Decode(ref value, buf);
                Cache <uint, ProtoUInt32> .Decode   = (ref uint value, Stream buf) => ProtoTool.UInt32Decode(ref value, buf);
                Cache <long, ProtoInt64> .Decode    = (ref long value, Stream buf) => ProtoTool.Int64Decode(ref value, buf);
                Cache <long, ProtoSInt64> .Decode   = (ref long value, Stream buf) => ProtoTool.SInt64Decode(ref value, buf);
                Cache <ulong, ProtoUInt64> .Decode  = (ref ulong value, Stream buf) => ProtoTool.UInt64Decode(ref value, buf);
                Cache <float, ProtoFloat> .Decode   = (ref float value, Stream buf) => ProtoTool.FloatDecode(ref value, buf);
                Cache <double, ProtoDouble> .Decode = (ref double value, Stream buf) => ProtoTool.DoubleDecode(ref value, buf);
                Cache <string, ProtoString> .Decode = (ref string value, Stream buf) => ProtoTool.StringDecode(ref value, buf);
            }