logmsg.java

来自「nesC写的heed算法」· Java 代码 · 共 321 行

JAVA
321
字号
/** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This class implements a Java interface to the 'LogMsg' * message type. */package net.tinyos.tools;public class LogMsg extends net.tinyos.message.Message {    /** The default size of this message type in bytes. */    public static final int DEFAULT_MESSAGE_SIZE = 18;    /** The Active Message type associated with this message. */    public static final int AM_TYPE = 9;    /** Create a new LogMsg of size 18. */    public LogMsg() {        super(DEFAULT_MESSAGE_SIZE);        amTypeSet(AM_TYPE);    }    /** Create a new LogMsg of the given data_length. */    public LogMsg(int data_length) {        super(data_length);        amTypeSet(AM_TYPE);    }    /**     * Create a new LogMsg with the given data_length     * and base offset.     */    public LogMsg(int data_length, int base_offset) {        super(data_length, base_offset);        amTypeSet(AM_TYPE);    }    /**     * Create a new LogMsg using the given byte array     * as backing store.     */    public LogMsg(byte[] data) {        super(data);        amTypeSet(AM_TYPE);    }    /**     * Create a new LogMsg using the given byte array     * as backing store, with the given base offset.     */    public LogMsg(byte[] data, int base_offset) {        super(data, base_offset);        amTypeSet(AM_TYPE);    }    /**     * Create a new LogMsg using the given byte array     * as backing store, with the given base offset and data length.     */    public LogMsg(byte[] data, int base_offset, int data_length) {        super(data, base_offset, data_length);        amTypeSet(AM_TYPE);    }    /**     * Create a new LogMsg embedded in the given message     * at the given base offset.     */    public LogMsg(net.tinyos.message.Message msg, int base_offset) {        super(msg, base_offset, DEFAULT_MESSAGE_SIZE);        amTypeSet(AM_TYPE);    }    /**     * Create a new LogMsg embedded in the given message     * at the given base offset and length.     */    public LogMsg(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 <LogMsg> \n";      try {        s += "  [sourceaddr=0x"+Long.toHexString(get_sourceaddr())+"]\n";      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }      try {        s += "  [log=";        for (int i = 0; i < 16; i++) {          s += "0x"+Long.toHexString(getElement_log(i) & 0xff)+" ";        }        s += "]\n";      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }      return s;    }    // Message-type-specific access methods appear below.    /////////////////////////////////////////////////////////    // Accessor methods for field: sourceaddr    //   Field type: int, unsigned    //   Offset (bits): 0    //   Size (bits): 16    /////////////////////////////////////////////////////////    /**     * Return whether the field 'sourceaddr' is signed (false).     */    public static boolean isSigned_sourceaddr() {        return false;    }    /**     * Return whether the field 'sourceaddr' is an array (false).     */    public static boolean isArray_sourceaddr() {        return false;    }    /**     * Return the offset (in bytes) of the field 'sourceaddr'     */    public static int offset_sourceaddr() {        return (0 / 8);    }    /**     * Return the offset (in bits) of the field 'sourceaddr'     */    public static int offsetBits_sourceaddr() {        return 0;    }    /**     * Return the value (as a int) of the field 'sourceaddr'     */    public int get_sourceaddr() {        return (int)getUIntElement(offsetBits_sourceaddr(), 16);    }    /**     * Set the value of the field 'sourceaddr'     */    public void set_sourceaddr(int value) {        setUIntElement(offsetBits_sourceaddr(), 16, value);    }    /**     * Return the size, in bytes, of the field 'sourceaddr'     */    public static int size_sourceaddr() {        return (16 / 8);    }    /**     * Return the size, in bits, of the field 'sourceaddr'     */    public static int sizeBits_sourceaddr() {        return 16;    }    /////////////////////////////////////////////////////////    // Accessor methods for field: log    //   Field type: short[], unsigned    //   Offset (bits): 16    //   Size of each element (bits): 8    /////////////////////////////////////////////////////////    /**     * Return whether the field 'log' is signed (false).     */    public static boolean isSigned_log() {        return false;    }    /**     * Return whether the field 'log' is an array (true).     */    public static boolean isArray_log() {        return true;    }    /**     * Return the offset (in bytes) of the field 'log'     */    public static int offset_log(int index1) {        int offset = 16;        if (index1 < 0 || index1 >= 16) throw new ArrayIndexOutOfBoundsException();        offset += 0 + index1 * 8;        return (offset / 8);    }    /**     * Return the offset (in bits) of the field 'log'     */    public static int offsetBits_log(int index1) {        int offset = 16;        if (index1 < 0 || index1 >= 16) throw new ArrayIndexOutOfBoundsException();        offset += 0 + index1 * 8;        return offset;    }    /**     * Return the entire array 'log' as a short[]     */    public short[] get_log() {        short[] tmp = new short[16];        for (int index0 = 0; index0 < numElements_log(0); index0++) {            tmp[index0] = getElement_log(index0);        }        return tmp;    }    /**     * Set the contents of the array 'log' from the given short[]     */    public void set_log(short[] value) {        for (int index0 = 0; index0 < value.length; index0++) {            setElement_log(index0, value[index0]);        }    }    /**     * Return an element (as a short) of the array 'log'     */    public short getElement_log(int index1) {        return (short)getUIntElement(offsetBits_log(index1), 8);    }    /**     * Set an element of the array 'log'     */    public void setElement_log(int index1, short value) {        setUIntElement(offsetBits_log(index1), 8, value);    }    /**     * Return the total size, in bytes, of the array 'log'     */    public static int totalSize_log() {        return (128 / 8);    }    /**     * Return the total size, in bits, of the array 'log'     */    public static int totalSizeBits_log() {        return 128;    }    /**     * Return the size, in bytes, of each element of the array 'log'     */    public static int elementSize_log() {        return (8 / 8);    }    /**     * Return the size, in bits, of each element of the array 'log'     */    public static int elementSizeBits_log() {        return 8;    }    /**     * Return the number of dimensions in the array 'log'     */    public static int numDimensions_log() {        return 1;    }    /**     * Return the number of elements in the array 'log'     */    public static int numElements_log() {        return 16;    }    /**     * Return the number of elements in the array 'log'     * for the given dimension.     */    public static int numElements_log(int dimension) {      int array_dims[] = { 16,  };        if (dimension < 0 || dimension >= 1) throw new ArrayIndexOutOfBoundsException();        if (array_dims[dimension] == 0) throw new IllegalArgumentException("Array dimension "+dimension+" has unknown size");        return array_dims[dimension];    }    /**     * Fill in the array 'log' with a String     */    public void setString_log(String s) {          int len = s.length();         int i;         for (i = 0; i < len; i++) {             setElement_log(i, (short)s.charAt(i));         }         setElement_log(i, (short)0); //null terminate    }    /**     * Read the array 'log' as a String     */    public String getString_log() {          char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,16)];         int i;         for (i = 0; i < carr.length; i++) {             if ((char)getElement_log(i) == (char)0) break;             carr[i] = (char)getElement_log(i);         }         return new String(carr,0,i);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?