public org.omg.CORBA.StructDef create_struct(
     java.lang.String id,
     java.lang.String name,
     java.lang.String version,
     org.omg.CORBA.StructMember[] members) {
   org.omg.CORBA.Request _request = this._request("create_struct");
   _request.set_return_type(org.omg.CORBA.StructDefHelper.type());
   org.omg.CORBA.Any $id = _request.add_named_in_arg("id");
   $id.insert_string(id);
   org.omg.CORBA.Any $name = _request.add_named_in_arg("name");
   $name.insert_string(name);
   org.omg.CORBA.Any $version = _request.add_named_in_arg("version");
   $version.insert_string(version);
   org.omg.CORBA.Any $members = _request.add_named_in_arg("members");
   org.omg.CORBA.StructMemberSeqHelper.insert($members, members);
   _request.invoke();
   java.lang.Exception _exception = _request.env().exception();
   if (_exception != null) {
     if (_exception instanceof org.omg.CORBA.UnknownUserException) {
       org.omg.CORBA.UnknownUserException _userException =
           (org.omg.CORBA.UnknownUserException) _exception;
     }
     throw (org.omg.CORBA.SystemException) _exception;
   }
   ;
   org.omg.CORBA.StructDef _result;
   _result = org.omg.CORBA.StructDefHelper.extract(_request.return_value());
   return _result;
 }
示例#2
0
  /** print an IDL struct def */
  public void printStruct(org.omg.CORBA.TypeDescription t, int indentation) {
    org.omg.CORBA.StructDef s_def = org.omg.CORBA.StructDefHelper.narrow(ir.lookup_id(t.id));

    if (s_def != null) {
      org.omg.CORBA.StructMember[] members = s_def.members();
      org.omg.CORBA.Contained[] contents =
          s_def.contents(org.omg.CORBA.DefinitionKind.dk_all, false);

      indent(indentation);
      print("struct " + s_def.name() + " {" + "\n");
      indent(indentation + 3);

      for (int i = 0; i < members.length; i++) {
        print(TypeCode.idlTypeName(members[i].type) + " " + members[i].name + ";" + "\n");
      }

      for (int i = 0; i < contents.length; i++) {
        printContained(contents[i], indentation);
      }

      indent(indentation);
      print("};" + "\n\n");
    } else {
      logger.error("Error, could not find struct " + t.id + " in IR ");
    }
  }