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;

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



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

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

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

	static {
		_type = _orb.create_interface_tc(_id,"RecoveryCoordinator");
	}

	public static RecoveryCoordinator read(InputStream istream) {
		return narrow(istream.read_Object());
	}

	public static void write(OutputStream ostream, RecoveryCoordinator value) {
		ostream.write_Object(value);
	}

	public static RecoveryCoordinator narrow(org.omg.CORBA.Object obj) {
		if (obj == null || obj instanceof RecoveryCoordinator) {
			return (RecoveryCoordinator) obj;
		} else {
			if (obj._is_a(_id)) {
				Delegate d = ((ObjectImpl) obj)._get_delegate();
				ObjectImpl o = new org.omg.CosTransactions._RecoveryCoordinatorStub();
				o._set_delegate(d);
				return (RecoveryCoordinator) o;
			} else {
				throw new org.omg.CORBA.BAD_PARAM();
			}
		}
	}
	public static TypeCode type() {
		return _type;
	}

}
