Ejemplo n.º 1
0
        public override void Setup()
        {
            simpleInput            = new Simple();
            simpleInput.Value      = simpleValue;
            simpleInput.ShortValue = 16;
            simpleInput.IntValue   = 17;
            simpleInput.LongValue  = 18;
            simpleOutput           = new Simple();

            complexInput             = new Complex();
            complexOutput            = new Complex();
            complexInput.SimpleValue = simpleInput;
            complexInput.ListValue   = new List <Simple> {
                simpleInput, simpleInput
            };

            if (full)
            {
                complexInput.SetValue = new THashSet <Simple>();
                complexInput.SetValue.Add(simpleInput);
                complexInput.SetValue.Add(simpleInput);

                complexInput.MapValue = new Dictionary <string, Simple>
                {
                    { "a", simpleInput },
                    { "b", simpleInput }
                };
            }

            trans = new TByteBuffer(1024);
            //  prot = new TBinaryProtocol(trans);
            prot = new TCompactProtocol(trans);

            trans.Clear();
            simpleInput.Write(prot);
        }
Ejemplo n.º 2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            SimpleValue = new Simple();
                            SimpleValue.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                ListValue = new List <Simple>();
                                TList _list12 = iprot.ReadListBegin();
                                for (int _i13 = 0; _i13 < _list12.Count; ++_i13)
                                {
                                    Simple _elem14;
                                    _elem14 = new Simple();
                                    _elem14.Read(iprot);
                                    ListValue.Add(_elem14);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Set)
                        {
                            {
                                SetValue = new THashSet <Simple>();
                                TSet _set15 = iprot.ReadSetBegin();
                                for (int _i16 = 0; _i16 < _set15.Count; ++_i16)
                                {
                                    Simple _elem17;
                                    _elem17 = new Simple();
                                    _elem17.Read(iprot);
                                    SetValue.Add(_elem17);
                                }
                                iprot.ReadSetEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Map)
                        {
                            {
                                MapValue = new Dictionary <string, Simple>();
                                TMap _map18 = iprot.ReadMapBegin();
                                for (int _i19 = 0; _i19 < _map18.Count; ++_i19)
                                {
                                    string _key20;
                                    Simple _val21;
                                    _key20 = iprot.ReadString();
                                    _val21 = new Simple();
                                    _val21.Read(iprot);
                                    MapValue[_key20] = _val21;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.List)
                        {
                            {
                                ListSetMap = new List <THashSet <Dictionary <string, List <Simple> > > >();
                                TList _list22 = iprot.ReadListBegin();
                                for (int _i23 = 0; _i23 < _list22.Count; ++_i23)
                                {
                                    THashSet <Dictionary <string, List <Simple> > > _elem24;
                                    {
                                        _elem24 = new THashSet <Dictionary <string, List <Simple> > >();
                                        TSet _set25 = iprot.ReadSetBegin();
                                        for (int _i26 = 0; _i26 < _set25.Count; ++_i26)
                                        {
                                            Dictionary <string, List <Simple> > _elem27;
                                            {
                                                _elem27 = new Dictionary <string, List <Simple> >();
                                                TMap _map28 = iprot.ReadMapBegin();
                                                for (int _i29 = 0; _i29 < _map28.Count; ++_i29)
                                                {
                                                    string        _key30;
                                                    List <Simple> _val31;
                                                    _key30 = iprot.ReadString();
                                                    {
                                                        _val31 = new List <Simple>();
                                                        TList _list32 = iprot.ReadListBegin();
                                                        for (int _i33 = 0; _i33 < _list32.Count; ++_i33)
                                                        {
                                                            Simple _elem34;
                                                            _elem34 = new Simple();
                                                            _elem34.Read(iprot);
                                                            _val31.Add(_elem34);
                                                        }
                                                        iprot.ReadListEnd();
                                                    }
                                                    _elem27[_key30] = _val31;
                                                }
                                                iprot.ReadMapEnd();
                                            }
                                            _elem24.Add(_elem27);
                                        }
                                        iprot.ReadSetEnd();
                                    }
                                    ListSetMap.Add(_elem24);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Map)
                        {
                            {
                                MapList = new Dictionary <string, List <Dictionary <string, Simple> > >();
                                TMap _map35 = iprot.ReadMapBegin();
                                for (int _i36 = 0; _i36 < _map35.Count; ++_i36)
                                {
                                    string _key37;
                                    List <Dictionary <string, Simple> > _val38;
                                    _key37 = iprot.ReadString();
                                    {
                                        _val38 = new List <Dictionary <string, Simple> >();
                                        TList _list39 = iprot.ReadListBegin();
                                        for (int _i40 = 0; _i40 < _list39.Count; ++_i40)
                                        {
                                            Dictionary <string, Simple> _elem41;
                                            {
                                                _elem41 = new Dictionary <string, Simple>();
                                                TMap _map42 = iprot.ReadMapBegin();
                                                for (int _i43 = 0; _i43 < _map42.Count; ++_i43)
                                                {
                                                    string _key44;
                                                    Simple _val45;
                                                    _key44 = iprot.ReadString();
                                                    _val45 = new Simple();
                                                    _val45.Read(iprot);
                                                    _elem41[_key44] = _val45;
                                                }
                                                iprot.ReadMapEnd();
                                            }
                                            _val38.Add(_elem41);
                                        }
                                        iprot.ReadListEnd();
                                    }
                                    MapList[_key37] = _val38;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.List)
                        {
                            {
                                ListOfList = new List <List <string> >();
                                TList _list46 = iprot.ReadListBegin();
                                for (int _i47 = 0; _i47 < _list46.Count; ++_i47)
                                {
                                    List <string> _elem48;
                                    {
                                        _elem48 = new List <string>();
                                        TList _list49 = iprot.ReadListBegin();
                                        for (int _i50 = 0; _i50 < _list49.Count; ++_i50)
                                        {
                                            string _elem51;
                                            _elem51 = iprot.ReadString();
                                            _elem48.Add(_elem51);
                                        }
                                        iprot.ReadListEnd();
                                    }
                                    ListOfList.Add(_elem48);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.List)
                        {
                            {
                                ListOfListOfList = new List <List <List <string> > >();
                                TList _list52 = iprot.ReadListBegin();
                                for (int _i53 = 0; _i53 < _list52.Count; ++_i53)
                                {
                                    List <List <string> > _elem54;
                                    {
                                        _elem54 = new List <List <string> >();
                                        TList _list55 = iprot.ReadListBegin();
                                        for (int _i56 = 0; _i56 < _list55.Count; ++_i56)
                                        {
                                            List <string> _elem57;
                                            {
                                                _elem57 = new List <string>();
                                                TList _list58 = iprot.ReadListBegin();
                                                for (int _i59 = 0; _i59 < _list58.Count; ++_i59)
                                                {
                                                    string _elem60;
                                                    _elem60 = iprot.ReadString();
                                                    _elem57.Add(_elem60);
                                                }
                                                iprot.ReadListEnd();
                                            }
                                            _elem54.Add(_elem57);
                                        }
                                        iprot.ReadListEnd();
                                    }
                                    ListOfListOfList.Add(_elem54);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }