package org.omg.CosTransactions;

import org.omg.CORBA.Any;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.ORB;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.ObjectImpl;

/**
 * TransIdentityHelper Class generated by the Idl2Java Compiler 3.1 of Jonathan
 */



public class TransIdentityHelper {
	static ORB _orb = ORB.init();
	static TypeCode _type;
	public static String _id = "IDL:omg.org/CosTransactions/TransIdentity:1.0";
	public static String id() {
		return _id;
	}

	public static void insert(Any a,org.omg.CosTransactions.TransIdentity t) {
		a.type(_type);
		write(a.create_output_stream(),t);
	}

	public static org.omg.CosTransactions.TransIdentity extract(Any a) {
		return read(a.create_input_stream());
	}

	static {
		_type = _orb.create_recursive_tc(_id);
		int _nbMemb = 3;
		StructMember[] members = new StructMember[_nbMemb];
		members[0] = new StructMember();
		members[0].name = "coord";
		members[0].type = org.omg.CosTransactions.CoordinatorHelper.type();
		members[1] = new StructMember();
		members[1].name = "term";
		members[1].type = org.omg.CosTransactions.TerminatorHelper.type();
		members[2] = new StructMember();
		members[2].name = "otid";
		members[2].type = org.omg.CosTransactions.otid_tHelper.type();
		_type = _orb.create_struct_tc(_id,"TransIdentity",members);
	}
	public static TransIdentity read(InputStream istream) {
		org.omg.CosTransactions.TransIdentity _result = new org.omg.CosTransactions.TransIdentity();
		_result.coord =  org.omg.CosTransactions.CoordinatorHelper.narrow(istream.read_Object());
		_result.term =  org.omg.CosTransactions.TerminatorHelper.narrow(istream.read_Object());
		_result.otid =  org.omg.CosTransactions.otid_tHelper.read(istream);
		return _result;
	}

	public static void write(OutputStream ostream, TransIdentity value) {
		ostream.write_Object(value.coord);
		ostream.write_Object(value.term);
		org.omg.CosTransactions.otid_tHelper.write(ostream,value.otid);
	}

	public static TypeCode type() {
		return _type;
	}

}
