| 1 | // tlb2java |
| 2 | package com.moesol.tests.disp.com_server; |
| 3 | |
| 4 | /** |
| 5 | * * <code>IDL: [ helpstring(""), ]<br/> |
| 6 | * struct/union</code> |
| 7 | */ |
| 8 | public class TEST_STRUCT extends com.moesol.bindings.NativeStructure { |
| 9 | public static final Class TYPELIB = TYPELIB_E149EE62_34AE_4D0A_B9E2_3ACA3FAD59F8.class; |
| 10 | public static final com.moesol.bindings.platform_sdk.component_services.GUID UUID = new com.moesol.bindings.platform_sdk.component_services.GUID( |
| 11 | 0x6b2f4b51, (short)0x18d0, (short)0x449d, |
| 12 | new byte[] { |
| 13 | (byte)0xa7, (byte)0x60, |
| 14 | (byte)0xb5, (byte)0x52, (byte)0x97, (byte)0x51, (byte)0x80, (byte)0xee |
| 15 | } ); |
| 16 | |
| 17 | /** |
| 18 | * Create a new instance. |
| 19 | */ |
| 20 | public TEST_STRUCT() { |
| 21 | super(new byte[sizeof()]); |
| 22 | } |
| 23 | /** |
| 24 | * Create a new instance on a byte buffer. |
| 25 | */ |
| 26 | public TEST_STRUCT(java.nio.ByteBuffer bb) { |
| 27 | super(bb); |
| 28 | // set limit based on the dynamic size in byte in bb. |
| 29 | bb.limit(getDynamicSize()); |
| 30 | } |
| 31 | public static int sizeof() { |
| 32 | return 28; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Represent a native array of these structures |
| 37 | */ |
| 38 | public static class Array extends com.moesol.bindings.NativeArrayOfStructs { |
| 39 | public Array(java.nio.ByteBuffer bb) { |
| 40 | super(bb); |
| 41 | } |
| 42 | public TEST_STRUCT get(int index) { |
| 43 | return new TEST_STRUCT(getElementSlice(index, TEST_STRUCT.sizeof())); |
| 44 | } |
| 45 | public void put(int index, TEST_STRUCT value) { |
| 46 | get(index).putStruct(0, TEST_STRUCT.sizeof(), value); |
| 47 | } |
| 48 | public int length() { |
| 49 | return _getByteBuffer().limit() / TEST_STRUCT.sizeof(); |
| 50 | } |
| 51 | public int getDynamicSize() { |
| 52 | return _getByteBuffer().limit(); |
| 53 | } |
| 54 | public String toString() { |
| 55 | StringBuffer sb = new StringBuffer(); |
| 56 | for (int i = 0; i < length(); i++) { |
| 57 | sb.append(get(i)); |
| 58 | } |
| 59 | return sb.toString(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | |
| 64 | |
| 65 | public static final int OFFSET_m_int_member = 0; |
| 66 | /** |
| 67 | * |
| 68 | * @param v new m_int_member value |
| 69 | */ |
| 70 | public void set_m_int_member(int v) { |
| 71 | putInt(0, v); |
| 72 | } |
| 73 | /** |
| 74 | * |
| 75 | * @return m_int_member value |
| 76 | */ |
| 77 | public int get_m_int_member() { |
| 78 | return getInt(0); |
| 79 | } |
| 80 | |
| 81 | public static final int OFFSET_m_BYTE_member = 4; |
| 82 | /** |
| 83 | * |
| 84 | * @param v new m_BYTE_member value |
| 85 | */ |
| 86 | public void set_m_BYTE_member(short v) { |
| 87 | putUnsignedByte(4, v); |
| 88 | } |
| 89 | /** |
| 90 | * |
| 91 | * @return m_BYTE_member value |
| 92 | */ |
| 93 | public short get_m_BYTE_member() { |
| 94 | return getUnsignedByte(4); |
| 95 | } |
| 96 | |
| 97 | public static final int OFFSET_m_string_member = 5; |
| 98 | /** |
| 99 | * |
| 100 | * @param v new m_string_member value |
| 101 | */ |
| 102 | public void set_m_string_member(byte[] /*c-style array*/ v) { |
| 103 | putByteArray(5, 20, v); |
| 104 | } |
| 105 | /** |
| 106 | * |
| 107 | * @return m_string_member value |
| 108 | */ |
| 109 | public byte[] /*c-style array*/ get_m_string_member() { |
| 110 | return getByteArray(5, 20); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Get dynamic size in bytes. |
| 115 | * If this structure contains a variable size array, |
| 116 | * return the number of bytes needed to hold the fixed |
| 117 | * part and the variable sized array based on the [length_is()] |
| 118 | * attribute. Note that the sizeof method on returns the |
| 119 | * size of the fixed part plus the size of one array entry. |
| 120 | * |
| 121 | * @return dynamic size in bytes. |
| 122 | */ |
| 123 | public int getDynamicSize() { |
| 124 | return sizeof(); |
| 125 | } |
| 126 | |
| 127 | public String toString() { |
| 128 | StringBuffer sb = new StringBuffer(); |
| 129 | sb.append("\nTEST_STRUCT("); |
| 130 | sb.append("m_int_member("); |
| 131 | sb.append(get_m_int_member()); |
| 132 | sb.append(")"); |
| 133 | |
| 134 | sb.append("m_BYTE_member("); |
| 135 | sb.append(get_m_BYTE_member()); |
| 136 | sb.append(")"); |
| 137 | |
| 138 | sb.append("m_string_member("); |
| 139 | sb.append(get_m_string_member()); |
| 140 | sb.append(")"); |
| 141 | |
| 142 | sb.append(')'); |
| 143 | return sb.toString(); |
| 144 | } |
| 145 | } |