sequence | A CORBA sequence is represented as a
J# array.
A J# helper class is generated to ease the conversion from Corba sequence into J# array or visa versa. |
// CORBA IDL |
module demo { module any { typedef sequence<string> MyStringSeq; } } |
// J# package demo.any; /** * Helper class for : MyStringSeq * * @author TomORB J# Native Compiler */ public class MyStringSeqHelper { /** * Insert MyStringSeq into an any * @param a an any * @param t MyStringSeq value */ public static void insert(org.omg.CORBA.Any a, java.lang.String[] t) { a.insert_Streamable(new demo.any.MyStringSeqHolder(t)); } /** * Extract MyStringSeq from an any * @param a an any * @return the extracted MyStringSeq value */ public static java.lang.String[] extract(org.omg.CORBA.Any a) { if (!a.type().equal(type())) throw new org.omg.CORBA.MARSHAL(); return read(a.create_input_stream()); } // // Internal TypeCode value // private static org.omg.CORBA.TypeCode _tc = null; /** * Return the MyStringSeq TypeCode * @return a TypeCode */ public static org.omg.CORBA.TypeCode type() { if (_tc == null) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); _tc = orb.create_alias_tc(id(),"MyStringSeq", orb.create_sequence_tc(0,orb.get_primitive_tc( org.omg.CORBA.TCKind.tk_string))); } return _tc; } /** * Return the MyStringSeq IDL ID * @return an ID */ public static java.lang.String id() { return _id; } private final static java.lang.String _id = "IDL:demo/any/MyStringSeq:1.0"; /** * Read MyStringSeq from a marshalled stream * @param istream the input stream * @return the readed MyStringSeq value */ public static java.lang.String[] read(org.omg.CORBA.portable.InputStream istream) { java.lang.String[] new_one; { int size1 = istream.read_ulong(); new_one = new java.lang.String[size1]; for (int i1=0; i1<new_one.length; i1++) { new_one[i1] = istream.read_string(); } } return new_one; } /** * Write MyStringSeq into a marshalled stream * @param ostream the output stream * @param value MyStringSeq value */ public static void write(org.omg.CORBA.portable.OutputStream ostream, java.lang.String[] value) { ostream.write_ulong(value.length); for (int i1=0; i1<value.length; i1++) { ostream.write_string(value[i1]); } } } package demo.any; /** * Holder class for : MyStringSeq * * @author TomORB J# Native Compiler */ final public class MyStringSeqHolder implements org.omg.CORBA.portable.Streamable { /** * Internal MyStringSeq value */ public java.lang.String[] value; /** * Default constructor */ public MyStringSeqHolder() { } /** * Constructor with value initialisation * @param initial the initial value */ public MyStringSeqHolder(java.lang.String[] initial) { value = initial; } /** * Read MyStringSeq from a marshalled stream * @param istream the input stream */ public void _read(org.omg.CORBA.portable.InputStream istream) { value = MyStringSeqHelper.read(istream); } /** * Write MyStringSeq into a marshalled stream * @param ostream the output stream */ public void _write(org.omg.CORBA.portable.OutputStream ostream) { MyStringSeqHelper.write(ostream,value); } /** * Return the MyStringSeq TypeCode * @return a TypeCode */ public org.omg.CORBA.TypeCode _type() { return MyStringSeqHelper.type(); } } |