Beispiel #1
0
 public insanity_thing(global::ThriftTest.Insanity data) : base(5)
 {
     this._data = data;
 }
Beispiel #2
0
        public static async Task <SomeUnion> ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                SomeUnion retval;
                await iprot.ReadStructBeginAsync(cancellationToken);

                TField field = await iprot.ReadFieldBeginAsync(cancellationToken);

                if (field.Type == TType.Stop)
                {
                    await iprot.ReadFieldEndAsync(cancellationToken);

                    retval = new ___undefined();
                }
                else
                {
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Map)
                        {
                            Dictionary <global::ThriftTest.Numberz, long> temp;
                            {
                                TMap _map59 = await iprot.ReadMapBeginAsync(cancellationToken);

                                temp = new Dictionary <global::ThriftTest.Numberz, long>(_map59.Count);
                                for (int _i60 = 0; _i60 < _map59.Count; ++_i60)
                                {
                                    global::ThriftTest.Numberz _key61;
                                    long _val62;
                                    _key61 = (global::ThriftTest.Numberz) await iprot.ReadI32Async(cancellationToken);

                                    _val62 = await iprot.ReadI64Async(cancellationToken);

                                    temp[_key61] = _val62;
                                }
                                await iprot.ReadMapEndAsync(cancellationToken);
                            }
                            retval = new map_thing(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            string temp;
                            temp = await iprot.ReadStringAsync(cancellationToken);

                            retval = new string_thing(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I32)
                        {
                            int temp;
                            temp = await iprot.ReadI32Async(cancellationToken);

                            retval = new i32_thing(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            global::ThriftTest.Xtruct3 temp;
                            temp = new global::ThriftTest.Xtruct3();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new xtruct_thing(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            global::ThriftTest.Insanity temp;
                            temp = new global::ThriftTest.Insanity();
                            await temp.ReadAsync(iprot, cancellationToken);

                            retval = new insanity_thing(temp);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            retval = new ___undefined();
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        retval = new ___undefined();
                        break;
                    }
                    await iprot.ReadFieldEndAsync(cancellationToken);

                    if ((await iprot.ReadFieldBeginAsync(cancellationToken)).Type != TType.Stop)
                    {
                        throw new TProtocolException(TProtocolException.INVALID_DATA);
                    }
                }
                await iprot.ReadStructEndAsync(cancellationToken);

                return(retval);
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Beispiel #3
0
        public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_list_field = false;
                TField field;
                await iprot.ReadStructBeginAsync(cancellationToken);

                while (true)
                {
                    field = await iprot.ReadFieldBeginAsync(cancellationToken);

                    if (field.Type == TType.Stop)
                    {
                        break;
                    }

                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            String_field = await iprot.ReadStringAsync(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Set)
                        {
                            {
                                TSet _set22 = await iprot.ReadSetBeginAsync(cancellationToken);

                                Set_field = new THashSet <global::ThriftTest.Insanity>(_set22.Count);
                                for (int _i23 = 0; _i23 < _set22.Count; ++_i23)
                                {
                                    global::ThriftTest.Insanity _elem24;
                                    _elem24 = new global::ThriftTest.Insanity();
                                    await _elem24.ReadAsync(iprot, cancellationToken);

                                    Set_field.Add(_elem24);
                                }
                                await iprot.ReadSetEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.List)
                        {
                            {
                                TList _list25 = await iprot.ReadListBeginAsync(cancellationToken);

                                List_field = new List <Dictionary <THashSet <int>, Dictionary <int, THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > > > >(_list25.Count);
                                for (int _i26 = 0; _i26 < _list25.Count; ++_i26)
                                {
                                    Dictionary <THashSet <int>, Dictionary <int, THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > > > _elem27;
                                    {
                                        TMap _map28 = await iprot.ReadMapBeginAsync(cancellationToken);

                                        _elem27 = new Dictionary <THashSet <int>, Dictionary <int, THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > > >(_map28.Count);
                                        for (int _i29 = 0; _i29 < _map28.Count; ++_i29)
                                        {
                                            THashSet <int> _key30;
                                            Dictionary <int, THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > > _val31;
                                            {
                                                TSet _set32 = await iprot.ReadSetBeginAsync(cancellationToken);

                                                _key30 = new THashSet <int>(_set32.Count);
                                                for (int _i33 = 0; _i33 < _set32.Count; ++_i33)
                                                {
                                                    int _elem34;
                                                    _elem34 = await iprot.ReadI32Async(cancellationToken);

                                                    _key30.Add(_elem34);
                                                }
                                                await iprot.ReadSetEndAsync(cancellationToken);
                                            }
                                            {
                                                TMap _map35 = await iprot.ReadMapBeginAsync(cancellationToken);

                                                _val31 = new Dictionary <int, THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > >(_map35.Count);
                                                for (int _i36 = 0; _i36 < _map35.Count; ++_i36)
                                                {
                                                    int _key37;
                                                    THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > _val38;
                                                    _key37 = await iprot.ReadI32Async(cancellationToken);

                                                    {
                                                        TSet _set39 = await iprot.ReadSetBeginAsync(cancellationToken);

                                                        _val38 = new THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > >(_set39.Count);
                                                        for (int _i40 = 0; _i40 < _set39.Count; ++_i40)
                                                        {
                                                            List <Dictionary <global::ThriftTest.Insanity, string> > _elem41;
                                                            {
                                                                TList _list42 = await iprot.ReadListBeginAsync(cancellationToken);

                                                                _elem41 = new List <Dictionary <global::ThriftTest.Insanity, string> >(_list42.Count);
                                                                for (int _i43 = 0; _i43 < _list42.Count; ++_i43)
                                                                {
                                                                    Dictionary <global::ThriftTest.Insanity, string> _elem44;
                                                                    {
                                                                        TMap _map45 = await iprot.ReadMapBeginAsync(cancellationToken);

                                                                        _elem44 = new Dictionary <global::ThriftTest.Insanity, string>(_map45.Count);
                                                                        for (int _i46 = 0; _i46 < _map45.Count; ++_i46)
                                                                        {
                                                                            global::ThriftTest.Insanity _key47;
                                                                            string _val48;
                                                                            _key47 = new global::ThriftTest.Insanity();
                                                                            await _key47.ReadAsync(iprot, cancellationToken);

                                                                            _val48 = await iprot.ReadStringAsync(cancellationToken);

                                                                            _elem44[_key47] = _val48;
                                                                        }
                                                                        await iprot.ReadMapEndAsync(cancellationToken);
                                                                    }
                                                                    _elem41.Add(_elem44);
                                                                }
                                                                await iprot.ReadListEndAsync(cancellationToken);
                                                            }
                                                            _val38.Add(_elem41);
                                                        }
                                                        await iprot.ReadSetEndAsync(cancellationToken);
                                                    }
                                                    _val31[_key37] = _val38;
                                                }
                                                await iprot.ReadMapEndAsync(cancellationToken);
                                            }
                                            _elem27[_key30] = _val31;
                                        }
                                        await iprot.ReadMapEndAsync(cancellationToken);
                                    }
                                    List_field.Add(_elem27);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                            isset_list_field = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.String)
                        {
                            Binary_field = await iprot.ReadBinaryAsync(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        break;
                    }

                    await iprot.ReadFieldEndAsync(cancellationToken);
                }

                await iprot.ReadStructEndAsync(cancellationToken);

                if (!isset_list_field)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }