/*
 * Automatically generated by jrpcgen 1.1.6 on 21.02.24 22:11
 * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
 * See http://remotetea.sourceforge.net for details
 */
package tests.org.acplt.oncrpc.jrpcgen;
import org.acplt.oncrpc.*;
import java.io.IOException;

import org.acplt.oncrpc.HasEncoding;

/** TODO */
public enum ENUMFOO implements HasEncoding<ENUMFOO> {
    /** TODO */
    FOO(0),
    /** TODO */
    BAR(0+1),
    /** TODO */
    BAZ_1(demo.C_B),
    /** TODO */
    BAZ_2(demo.C_B+1),
    /** TODO */
    BAZ_3(ENUMBAZ.E_BAZ.getEncoding());

    private final int encoding;

    private ENUMFOO(int encoding) {
        this.encoding = encoding;
    }

    public int getEncoding() {
        return encoding;
    }

    public HasEncoding<ENUMFOO>[] getValues() {
        return values();
    }

    public static void xdrEncodeFixedVector(XdrEncodingStream xdr, ENUMFOO[] vector, int size)
           throws OncRpcException, IOException {
        if (vector.length != size) {
            throw new IllegalArgumentException("array size does not match protocol specification");
        }

        for (int index = 0; index < size; index++) {
            xdr.xdrEncodeInt(vector[index].getEncoding());
        }
    }

    public static ENUMFOO[] xdrDecodeFixedVector(XdrDecodingStream xdr, int size)
           throws OncRpcException, IOException {
        ENUMFOO[] vector = new ENUMFOO[size];

        for (int index = 0; index < size; index++) {
            vector[index] = XdrEnum.create(ENUMFOO.FOO, xdr);
        }

        return vector;
    }

    public static void xdrEncodeDynamicVector(XdrEncodingStream xdr, ENUMFOO[] vector)
           throws OncRpcException, IOException {
        xdr.xdrEncodeInt(vector.length);
        xdrEncodeFixedVector(xdr, vector, vector.length);
    }

    public static ENUMFOO[] xdrDecodeDynamicVector(XdrDecodingStream xdr)
           throws OncRpcException, IOException {
        return xdrDecodeFixedVector(xdr, xdr.xdrDecodeInt());
    }

}
// End of ENUMFOO.java
