コード例 #1
0
 public void Read (TProtocol iprot)
 {
   bool isset_spouts = false;
   bool isset_bolts = false;
   bool isset_state_spouts = false;
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Map) {
           {
             Spouts = new Dictionary<string, SpoutSpec>();
             TMap _map22 = iprot.ReadMapBegin();
             for( int _i23 = 0; _i23 < _map22.Count; ++_i23)
             {
               string _key24;
               SpoutSpec _val25;
               _key24 = iprot.ReadString();
               _val25 = new SpoutSpec();
               _val25.Read(iprot);
               Spouts[_key24] = _val25;
             }
             iprot.ReadMapEnd();
           }
           isset_spouts = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Map) {
           {
             Bolts = new Dictionary<string, Bolt>();
             TMap _map26 = iprot.ReadMapBegin();
             for( int _i27 = 0; _i27 < _map26.Count; ++_i27)
             {
               string _key28;
               Bolt _val29;
               _key28 = iprot.ReadString();
               _val29 = new Bolt();
               _val29.Read(iprot);
               Bolts[_key28] = _val29;
             }
             iprot.ReadMapEnd();
           }
           isset_bolts = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Map) {
           {
             State_spouts = new Dictionary<string, StateSpoutSpec>();
             TMap _map30 = iprot.ReadMapBegin();
             for( int _i31 = 0; _i31 < _map30.Count; ++_i31)
             {
               string _key32;
               StateSpoutSpec _val33;
               _key32 = iprot.ReadString();
               _val33 = new StateSpoutSpec();
               _val33.Read(iprot);
               State_spouts[_key32] = _val33;
             }
             iprot.ReadMapEnd();
           }
           isset_state_spouts = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_spouts)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_bolts)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_state_spouts)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
コード例 #2
0
    public void Read(TProtocol iprot)
    {
        bool   isset_spouts       = false;
        bool   isset_bolts        = false;
        bool   isset_state_spouts = false;
        TField field;

        iprot.ReadStructBegin();
        while (true)
        {
            field = iprot.ReadFieldBegin();
            if (field.Type == TType.Stop)
            {
                break;
            }
            switch (field.ID)
            {
            case 1:
                if (field.Type == TType.Map)
                {
                    {
                        Spouts = new Dictionary <string, SpoutSpec>();
                        TMap _map22 = iprot.ReadMapBegin();
                        for (int _i23 = 0; _i23 < _map22.Count; ++_i23)
                        {
                            string    _key24;
                            SpoutSpec _val25;
                            _key24 = iprot.ReadString();
                            _val25 = new SpoutSpec();
                            _val25.Read(iprot);
                            Spouts[_key24] = _val25;
                        }
                        iprot.ReadMapEnd();
                    }
                    isset_spouts = true;
                }
                else
                {
                    TProtocolUtil.Skip(iprot, field.Type);
                }
                break;

            case 2:
                if (field.Type == TType.Map)
                {
                    {
                        Bolts = new Dictionary <string, Bolt>();
                        TMap _map26 = iprot.ReadMapBegin();
                        for (int _i27 = 0; _i27 < _map26.Count; ++_i27)
                        {
                            string _key28;
                            Bolt   _val29;
                            _key28 = iprot.ReadString();
                            _val29 = new Bolt();
                            _val29.Read(iprot);
                            Bolts[_key28] = _val29;
                        }
                        iprot.ReadMapEnd();
                    }
                    isset_bolts = true;
                }
                else
                {
                    TProtocolUtil.Skip(iprot, field.Type);
                }
                break;

            case 3:
                if (field.Type == TType.Map)
                {
                    {
                        State_spouts = new Dictionary <string, StateSpoutSpec>();
                        TMap _map30 = iprot.ReadMapBegin();
                        for (int _i31 = 0; _i31 < _map30.Count; ++_i31)
                        {
                            string         _key32;
                            StateSpoutSpec _val33;
                            _key32 = iprot.ReadString();
                            _val33 = new StateSpoutSpec();
                            _val33.Read(iprot);
                            State_spouts[_key32] = _val33;
                        }
                        iprot.ReadMapEnd();
                    }
                    isset_state_spouts = true;
                }
                else
                {
                    TProtocolUtil.Skip(iprot, field.Type);
                }
                break;

            default:
                TProtocolUtil.Skip(iprot, field.Type);
                break;
            }
            iprot.ReadFieldEnd();
        }
        iprot.ReadStructEnd();
        if (!isset_spouts)
        {
            throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
        if (!isset_bolts)
        {
            throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
        if (!isset_state_spouts)
        {
            throw new TProtocolException(TProtocolException.INVALID_DATA);
        }
    }