Пример #1
0
  /**
   * A hack to fix the problem with swapped ids in SRL in the mentor delivery 08032?
   *
   * @param typedCircularMessages
   */
  private void correctMessageIds(final Collection<TypedCircularMessage> typedCircularMessages) {
    for (TypedCircularMessage typedCircularMessage : typedCircularMessages) {
      Struct struct = typedCircularMessage.getStruct();

      /*
       * Detect id - name mismatch
       */
      if (struct.getId() == Message.UML_SEND.srlTypeId()) {
        if (struct.getName().equals("srl_UmlSignalReceive")) {
          struct.setId(Message.UML_RECEIVE.srlTypeId());
        }
      } else if (struct.getId() == Message.UML_RECEIVE.srlTypeId()) {
        if (struct.getName().equals("srl_UmlSignalSend")) {
          struct.setId(Message.UML_SEND.srlTypeId());
        }
      }
    }
  }
Пример #2
0
  private void getUserStructs() {
    for (Struct struct : userStructs) {
      List<FieldDescription> fieldDescs = new ArrayList<FieldDescription>();

      List<Field> fields = struct.getFields();
      for (Field field : fields) {
        Srl srlType = Srl.valueOf(field.getType().getId());
        switch (srlType) {
          case t_srl_I32:
            fieldDescs.add(new FieldDescription(field.getName(), FieldType.INT64));
            break;
          case t_srl_U32:
            fieldDescs.add(new FieldDescription(field.getName(), FieldType.INT64));
            break;
          default:
        }
      }
      client.typeDescRead(new TypeDescription(struct.getId(), struct.getName(), fieldDescs));
    }
  }