//
// Java generated by the OrbixWeb IDL compiler 
//

package shared.TreeUPackage;

import IE.Iona.OrbixWeb._OrbixWeb;


public class childrenHelper
{
    public static void insert (org.omg.CORBA.Any any, shared.TreeU[] value)
    {
        any.type(type());
        org.omg.CORBA.portable.OutputStream _stream = any.create_output_stream();
        write(_stream,value);
    }
    public static shared.TreeU[] extract (org.omg.CORBA.Any any)
    {
        if (!any.type().equal(type())) 
            throw new org.omg.CORBA.BAD_TYPECODE("Error inserting/extracting value from typecode.");
        else
            return read(any.create_input_stream()); 
    }
    private static org.omg.CORBA.TypeCode _type;
    public static org.omg.CORBA.TypeCode type()
    {
        if (_type == null) {
	    // --- org.omg.CORBA.TypeCode _tc = shared.TreeUHelper.type();
	    // --- _type =  org.omg.CORBA.ORB.init().create_sequence_tc(0, _tc);
	    _type = org.omg.CORBA.ORB.init().create_recursive_sequence_tc(0, -81); // +++
        }
        return _type;
    }
    public static org.omg.CORBA.ORB _orb () {
        return org.omg.CORBA.ORB.init(); 
    }
    public static String id () {
        return "";
    }
    public static shared.TreeU[] read (org.omg.CORBA.portable.InputStream _stream)
    {
        int _l = _OrbixWeb.MarshalBuffer(_stream).extract_array_header(childrenHelper.type());
        shared.TreeU value []= new shared.TreeU[_l];
        for (int _i0 = 0; _i0 < value.length; _i0++) {
            value[_i0] = shared.TreeUHelper.read (_stream);
        }
        return value;
    }
    public static void write (org.omg.CORBA.portable.OutputStream _stream, shared.TreeU[] value)
    {
        _OrbixWeb.MarshalBuffer(_stream).insert_array_header(childrenHelper.type(),value.length);

        for (int _i0 = 0; _i0 < value.length; _i0++) {
            shared.TreeUHelper.write (_stream, value[_i0]);
        }
    }
}
