3 /* ********************************************************* *
5 * Will be Generated by IDL *
7 * ********************************************************* */
9 import org.ocera.orte.*;
10 import org.ocera.orte.types.*;
12 public class HelloMsg extends org.ocera.orte.types.MessageData
14 private int counter = 0;
15 public int count_read = 0; // pro testovaci ucely!!
17 /* ************************************** *
19 * ************************************** */
24 /* ************************************** */
28 public HelloMsg(DomainApp domainApp, String newTopic)
32 // typeName registration
38 this.setTopic(newTopic); // set the topic of a publication
39 // register new data typeName
40 b = domainApp.regNewDataType(this.getType(),getMaxDataLength(),this.buffer);
43 System.out.println(":j!: cannot register data type!");
50 //System.out.println(":j: instance of HelloMsg created..");
55 * Serializetaion method. Put all of data fields and write them into a buffer.
56 * @return True - if write successful, False - write failed (IndexOutOfBoundsException or ReadOnlyBufferException).
58 /* TODO osetrit vyjimky - mozna pak bude vracet typ boolean
59 * IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit
60 * ReadOnlyBufferException - If this buffer is read-only
64 /* TODO - control setting fields !!*/
68 buffer.rewind(); // set offset to 0
69 buffer.putInt(this.num1);
70 buffer.putInt(this.num2);
74 * Serializetaion method. Put all of data fields and write them into a buffer.
75 * @return True - if write successful, False - write failed (IndexOutOfBoundsException or ReadOnlyBufferException).
77 /* TODO 'BufferUnderflowException' - osetrit vyjimky - mozna pak bude vracet typ boolean
82 buffer.rewind(); // set offset to 0
83 this.num1 = buffer.getInt();
84 this.num2 = buffer.getInt();
88 * Return maximum buffer's length according to its data fields.
89 * @return Length of buffer.
91 public int getMaxDataLength()
94 len += ORTEConstant.INT_FIELD_SIZE;
95 len += ORTEConstant.INT_FIELD_SIZE;
99 public String toString()
101 String data = new String();
103 data += (" num1 = " + num1);
104 data += (" num2 = " + num2);