Esempio n. 1
0
        public static void Encode(ClientMessage clientMessage, Hazelcast.Core.MemberInfo memberInfo)
        {
            clientMessage.Add(BeginFrame.Copy());

            var initialFrame = new Frame(new byte[InitialFrameSize]);

            EncodeGuid(initialFrame.Content, UuidFieldOffset, memberInfo.Uuid);
            EncodeBool(initialFrame.Content, LiteMemberFieldOffset, memberInfo.IsLiteMember);
            clientMessage.Add(initialFrame);

            AddressCodec.Encode(clientMessage, memberInfo.Address);
            MapCodec.Encode(clientMessage, memberInfo.Attributes, StringCodec.Encode, StringCodec.Encode);
            MemberVersionCodec.Encode(clientMessage, memberInfo.Version);

            clientMessage.Add(EndFrame.Copy());
        }
        public static void Encode(ClientMessage clientMessage, Hazelcast.Data.MemberInfo memberInfo)
        {
            clientMessage.Append(Frame.CreateBeginStruct());

            var initialFrame = new Frame(new byte[InitialFrameSize]);

            initialFrame.Bytes.WriteGuidL(UuidFieldOffset, memberInfo.Uuid);
            initialFrame.Bytes.WriteBoolL(LiteMemberFieldOffset, memberInfo.IsLiteMember);
            clientMessage.Append(initialFrame);

            AddressCodec.Encode(clientMessage, memberInfo.Address);
            MapCodec.Encode(clientMessage, memberInfo.Attributes, StringCodec.Encode, StringCodec.Encode);
            MemberVersionCodec.Encode(clientMessage, memberInfo.Version);
            MapCodec.Encode(clientMessage, memberInfo.AddressMap, EndpointQualifierCodec.Encode, AddressCodec.Encode);

            clientMessage.Append(Frame.CreateEndStruct());
        }
        public void MapTest()
        {
            var oh = new MapCodec(data);

            oh.MapStart = 10;
            oh.MapStep  = 5;
            var test = new List <string> {
                "a", "c", "d", "f"
            };
            var expected = new TensorOld(new double[] { 10, 20, 25, 35 }, 4, 1);
            var encode   = oh.Encode(test);

            Assert.Equal(expected, encode);

            var decode = oh.Decode(encode);

            Assert.Equal(decode, test);
        }