IDL Complex Type | |
custom valuetype |
The CORBA custom valuetype (TBD) ..... It maps to J#'s class type. |
// CORBA IDL |
custom valuetype valueExample { private long number_state; public string name_state; void print(); }; |
e.g. valueExample valueExampleHelper |
// J# package demo.obv.custom; /** * Value Type definition : valueExample * * @author TomORB J# Native Compiler */ public abstract class valueExample implements org.omg.CORBA.portable.CustomValue { /** * Private member : number_state */ protected int number_state; /** * Public member : name_state */ public java.lang.String name_state; /** * Read accessor for number attribute * @return the attribute value */ public abstract int number(); /** * Operation print */ public abstract void print(); /** * Return the truncatable ids */ static final java.lang.String[] _ids_list = { "IDL:demo/obv/custom/valueExample:1.0" }; public java.lang.String[] _truncatable_ids() { return _ids_list; } } package demo.obv.custom; /** * Helper class for : valueExample * * @author TomORB J# Native Compiler */ public class valueExampleHelper { /** * Insert valueExample into an any * @param a an any * @param t valueExample value */ public static void insert(org.omg.CORBA.Any a, demo.obv.custom.valueExample t) { a.insert_Value(t, type()); } /** * Extract valueExample from an any * @param a an any * @return the extracted valueExample value */ public static demo.obv.custom.valueExample extract(org.omg.CORBA.Any a) { if (!a.type().equal(type())) throw new org.omg.CORBA.MARSHAL(); try { return (demo.obv.custom.valueExample)a.extract_Value(); } catch(final java.lang.ClassCastException e) { throw new org.omg.CORBA.MARSHAL(e.getMessage()); } } // // Internal TypeCode value // private static org.omg.CORBA.TypeCode _tc = null; private static boolean _working = false; /** * Return the valueExample TypeCode * @return a TypeCode */ public static org.omg.CORBA.TypeCode type() { if (_tc == null) { synchronized(org.omg.CORBA.TypeCode.class) { if (_tc != null) return _tc; if (_working) return org.omg.CORBA.ORB.init().create_recursive_tc(id()); _working = true; org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(); org.omg.CORBA.ValueMember []_members = new org.omg.CORBA.ValueMember[2]; _members[0] = new org.omg.CORBA.ValueMember(); _members[0].name = "number_state"; _members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long); _members[0].access = org.omg.CORBA.PRIVATE_MEMBER.value; _members[1] = new org.omg.CORBA.ValueMember(); _members[1].name = "name_state"; _members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string); _members[1].access = org.omg.CORBA.PUBLIC_MEMBER.value; org.omg.CORBA.TypeCode _concrete_tc = orb.get_primitive_tc( org.omg.CORBA.TCKind.tk_null); _tc = orb.create_value_tc(id(),"valueExample", org.omg.CORBA.VM_CUSTOM.value,_concrete_tc,_members); _working = false; } } return _tc; } /** * Return the valueExample IDL ID * @return an ID */ public static java.lang.String id() { return _id; } private final static java.lang.String _id = "IDL:demo/obv/custom/valueExample:1.0"; /** * Read valueExample from a marshalled stream * @param istream the input stream * @return the readed valueExample value */ public static demo.obv.custom.valueExample read( org.omg.CORBA.portable.InputStream istream) { return (demo.obv.custom.valueExample) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value(_id.toString()); } /** * Write valueExample into a marshalled stream * @param ostream the output stream * @param value valueExample value */ public static void write(org.omg.CORBA.portable.OutputStream ostream, demo.obv.custom.valueExample value) { ((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value(value, _id); } } package demo.obv.custom; /** * Holder class for : valueExample * * @author TomORB J# Native Compiler */ final public class valueExampleHolder implements org.omg.CORBA.portable.Streamable { /** * Internal valueExample value */ public demo.obv.custom.valueExample value; /** * Default constructor */ public valueExampleHolder() { } /** * Constructor with value initialisation * @param initial the initial value */ public valueExampleHolder(demo.obv.custom.valueExample initial) { value = initial; } /** * Read valueExample from a marshalled stream * @param istream the input stream */ public void _read(org.omg.CORBA.portable.InputStream istream) { value = valueExampleHelper.read(istream); } /** * Write valueExample into a marshalled stream * @param ostream the output stream */ public void _write(org.omg.CORBA.portable.OutputStream ostream) { valueExampleHelper.write(ostream,value); } /** * Return the valueExample TypeCode * @return a TypeCode */ public org.omg.CORBA.TypeCode _type() { return valueExampleHelper.type(); } } |