/**
 * This class is automatically generated by mig. DO NOT EDIT THIS FILE.
 * This class implements a Java interface to the 'RAddr'
 * message type.
 */

public class RAddr extends net.tinyos.message.Message {

    /** The default size of this message type in bytes. */
    public static final int DEFAULT_MESSAGE_SIZE = 4;

    /** The Active Message type associated with this message. */
    public static final int AM_TYPE = 31;

    /** Create a new RAddr of size 4. */
    public RAddr() {
        super(DEFAULT_MESSAGE_SIZE);
        amTypeSet(AM_TYPE);
    }

    /** Create a new RAddr of the given data_length. */
    public RAddr(int data_length) {
        super(data_length);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new RAddr with the given data_length
     * and base offset.
     */
    public RAddr(int data_length, int base_offset) {
        super(data_length, base_offset);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new RAddr using the given byte array
     * as backing store.
     */
    public RAddr(byte[] data) {
        super(data);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new RAddr using the given byte array
     * as backing store, with the given base offset.
     */
    public RAddr(byte[] data, int base_offset) {
        super(data, base_offset);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new RAddr using the given byte array
     * as backing store, with the given base offset and data length.
     */
    public RAddr(byte[] data, int base_offset, int data_length) {
        super(data, base_offset, data_length);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new RAddr embedded in the given message
     * at the given base offset.
     */
    public RAddr(net.tinyos.message.Message msg, int base_offset) {
        super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new RAddr embedded in the given message
     * at the given base offset and length.
     */
    public RAddr(net.tinyos.message.Message msg, int base_offset, int data_length) {
        super(msg, base_offset, data_length);
        amTypeSet(AM_TYPE);
    }

    /**
    /* Return a String representation of this message. Includes the
     * message type name and the non-indexed field values.
     */
    public String toString() {
      String s = "Message <RAddr> \n";
      try {
        s += "  [pid=0x"+Long.toHexString(get_pid())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [devid=0x"+Long.toHexString(get_devid())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      return s;
    }

    // Message-type-specific access methods appear below.

    /////////////////////////////////////////////////////////
    // Accessor methods for field: pid
    //   Field type: int, unsigned
    //   Offset (bits): 0
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'pid' is signed (false).
     */
    public static boolean isSigned_pid() {
        return false;
    }

    /**
     * Return whether the field 'pid' is an array (false).
     */
    public static boolean isArray_pid() {
        return false;
    }

    /**
     * Return the offset (in bytes) of the field 'pid'
     */
    public static int offset_pid() {
        return (0 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'pid'
     */
    public static int offsetBits_pid() {
        return 0;
    }

    /**
     * Return the value (as a int) of the field 'pid'
     */
    public int get_pid() {
        return (int)getUIntBEElement(offsetBits_pid(), 16);
    }

    /**
     * Set the value of the field 'pid'
     */
    public void set_pid(int value) {
        setUIntBEElement(offsetBits_pid(), 16, value);
    }

    /**
     * Return the size, in bytes, of the field 'pid'
     */
    public static int size_pid() {
        return (16 / 8);
    }

    /**
     * Return the size, in bits, of the field 'pid'
     */
    public static int sizeBits_pid() {
        return 16;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: devid
    //   Field type: int, unsigned
    //   Offset (bits): 16
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'devid' is signed (false).
     */
    public static boolean isSigned_devid() {
        return false;
    }

    /**
     * Return whether the field 'devid' is an array (false).
     */
    public static boolean isArray_devid() {
        return false;
    }

    /**
     * Return the offset (in bytes) of the field 'devid'
     */
    public static int offset_devid() {
        return (16 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'devid'
     */
    public static int offsetBits_devid() {
        return 16;
    }

    /**
     * Return the value (as a int) of the field 'devid'
     */
    public int get_devid() {
        return (int)getUIntBEElement(offsetBits_devid(), 16);
    }

    /**
     * Set the value of the field 'devid'
     */
    public void set_devid(int value) {
        setUIntBEElement(offsetBits_devid(), 16, value);
    }

    /**
     * Return the size, in bytes, of the field 'devid'
     */
    public static int size_devid() {
        return (16 / 8);
    }

    /**
     * Return the size, in bits, of the field 'devid'
     */
    public static int sizeBits_devid() {
        return 16;
    }

}
