001: package org.cougaar.qos.ResourceStatus;
002:
003: /**
004: * org/cougaar/qos/ResourceStatus/data_valueHelper.java .
005: * Generated by the IDL-to-Java compiler (portable), version "3.2"
006: * from qrs.idl
007: * Tuesday, August 7, 2007 11:57:30 AM EDT
008: */
009:
010: abstract public class data_valueHelper {
011: private static String _id = "IDL:org/cougaar/qos/ResourceStatus/data_value/data_value:1.0";
012:
013: public static void insert(org.omg.CORBA.Any a,
014: org.cougaar.qos.ResourceStatus.data_value that) {
015: org.omg.CORBA.portable.OutputStream out = a
016: .create_output_stream();
017: a.type(type());
018: write(out, that);
019: a.read_value(out.create_input_stream(), type());
020: }
021:
022: public static org.cougaar.qos.ResourceStatus.data_value extract(
023: org.omg.CORBA.Any a) {
024: return read(a.create_input_stream());
025: }
026:
027: private static org.omg.CORBA.TypeCode __typeCode = null;
028:
029: synchronized public static org.omg.CORBA.TypeCode type() {
030: if (__typeCode == null) {
031: org.omg.CORBA.TypeCode _disTypeCode0;
032: _disTypeCode0 = org.cougaar.qos.ResourceStatus.data_typesHelper
033: .type();
034: org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember[3];
035: org.omg.CORBA.TypeCode _tcOf_members0;
036: org.omg.CORBA.Any _anyOf_members0;
037:
038: // Branch for d_value (case label number_data)
039: _anyOf_members0 = org.omg.CORBA.ORB.init().create_any();
040: org.cougaar.qos.ResourceStatus.data_typesHelper
041: .insert(
042: _anyOf_members0,
043: org.cougaar.qos.ResourceStatus.data_types.number_data);
044: _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(
045: org.omg.CORBA.TCKind.tk_double);
046: _members0[0] = new org.omg.CORBA.UnionMember("d_value",
047: _anyOf_members0, _tcOf_members0, null);
048:
049: // Branch for s_value (case label string_data)
050: _anyOf_members0 = org.omg.CORBA.ORB.init().create_any();
051: org.cougaar.qos.ResourceStatus.data_typesHelper
052: .insert(
053: _anyOf_members0,
054: org.cougaar.qos.ResourceStatus.data_types.string_data);
055: _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(
056: 0);
057: _members0[1] = new org.omg.CORBA.UnionMember("s_value",
058: _anyOf_members0, _tcOf_members0, null);
059:
060: // Branch for b_value (case label boolean_data)
061: _anyOf_members0 = org.omg.CORBA.ORB.init().create_any();
062: org.cougaar.qos.ResourceStatus.data_typesHelper
063: .insert(
064: _anyOf_members0,
065: org.cougaar.qos.ResourceStatus.data_types.boolean_data);
066: _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(
067: org.omg.CORBA.TCKind.tk_boolean);
068: _members0[2] = new org.omg.CORBA.UnionMember("b_value",
069: _anyOf_members0, _tcOf_members0, null);
070: __typeCode = org.omg.CORBA.ORB.init().create_union_tc(
071: org.cougaar.qos.ResourceStatus.data_valueHelper
072: .id(), "data_value", _disTypeCode0,
073: _members0);
074: }
075: return __typeCode;
076: }
077:
078: public static String id() {
079: return _id;
080: }
081:
082: public static org.cougaar.qos.ResourceStatus.data_value read(
083: org.omg.CORBA.portable.InputStream istream) {
084: org.cougaar.qos.ResourceStatus.data_value value = new org.cougaar.qos.ResourceStatus.data_value();
085: org.cougaar.qos.ResourceStatus.data_types _dis0 = null;
086: _dis0 = org.cougaar.qos.ResourceStatus.data_typesHelper
087: .read(istream);
088: switch (_dis0.value()) {
089: case org.cougaar.qos.ResourceStatus.data_types._number_data:
090: double _d_value = (double) 0;
091: _d_value = istream.read_double();
092: value.d_value(_d_value);
093: break;
094: case org.cougaar.qos.ResourceStatus.data_types._string_data:
095: String _s_value = null;
096: _s_value = istream.read_string();
097: value.s_value(_s_value);
098: break;
099: case org.cougaar.qos.ResourceStatus.data_types._boolean_data:
100: boolean _b_value = false;
101: _b_value = istream.read_boolean();
102: value.b_value(_b_value);
103: break;
104: }
105: return value;
106: }
107:
108: public static void write(
109: org.omg.CORBA.portable.OutputStream ostream,
110: org.cougaar.qos.ResourceStatus.data_value value) {
111: org.cougaar.qos.ResourceStatus.data_typesHelper.write(ostream,
112: value.discriminator());
113: switch (value.discriminator().value()) {
114: case org.cougaar.qos.ResourceStatus.data_types._number_data:
115: ostream.write_double(value.d_value());
116: break;
117: case org.cougaar.qos.ResourceStatus.data_types._string_data:
118: ostream.write_string(value.s_value());
119: break;
120: case org.cougaar.qos.ResourceStatus.data_types._boolean_data:
121: ostream.write_boolean(value.b_value());
122: break;
123: }
124: }
125:
126: }
|