public void Read (TProtocol iprot)
 {
   bool isset_uuidFicha = false;
   bool isset_headerTransport = 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.String) {
           UuidFicha = iprot.ReadString();
           isset_uuidFicha = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           HeaderTransport = new br.gov.saude.esus.cds.transport.generated.thrift.common.VariasLotacoesHeaderThrift();
           HeaderTransport.Read(iprot);
           isset_headerTransport = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.List) {
           {
             AtendimentosOdontologicos = new List<FichaAtendimentoOdontologicoChildThrift>();
             TList _list24 = iprot.ReadListBegin();
             for( int _i25 = 0; _i25 < _list24.Count; ++_i25)
             {
               FichaAtendimentoOdontologicoChildThrift _elem26;
               _elem26 = new FichaAtendimentoOdontologicoChildThrift();
               _elem26.Read(iprot);
               AtendimentosOdontologicos.Add(_elem26);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.I32) {
           TpCdsOrigem = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_uuidFicha)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_headerTransport)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
        public void Read(TProtocol iprot)
        {
            bool   isset_uuidFicha       = false;
            bool   isset_headerTransport = 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.String)
                    {
                        UuidFicha       = iprot.ReadString();
                        isset_uuidFicha = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        HeaderTransport = new br.gov.saude.esus.cds.transport.generated.thrift.common.VariasLotacoesHeaderThrift();
                        HeaderTransport.Read(iprot);
                        isset_headerTransport = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.List)
                    {
                        {
                            AtendimentosOdontologicos = new List <FichaAtendimentoOdontologicoChildThrift>();
                            TList _list24 = iprot.ReadListBegin();
                            for (int _i25 = 0; _i25 < _list24.Count; ++_i25)
                            {
                                FichaAtendimentoOdontologicoChildThrift _elem26;
                                _elem26 = new FichaAtendimentoOdontologicoChildThrift();
                                _elem26.Read(iprot);
                                AtendimentosOdontologicos.Add(_elem26);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        TpCdsOrigem = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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