6 * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
7 * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz)
8 * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
9 * @author dedication to Kj
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
25 package org.ocera.orte.types;
26 import java.nio.ByteBuffer;
27 import java.nio.ByteOrder;
29 public abstract class MessageData
33 protected ByteBuffer buffer;
40 this.buffer = ByteBuffer.allocateDirect(getMaxDataLength());
41 this.buffer.order(ByteOrder.nativeOrder());
42 //System.out.println(":j: instance MessageData created..");
45 public abstract void read();
46 public abstract void write();
49 * Get the Publication's Topic.
50 * @ return Publication's topic
52 public String getTopic()
58 * Set the Publication's Topic.
61 public void setTopic(String newTopic)
67 * Get default Type of Publication. Default type name is abbreviate from its class name.
68 * @ return default type of Publication
70 public String getType()
72 char extensionSeparator = '.';
74 String className = getClass().getName();
75 // find last separator
76 int dot = className.lastIndexOf(extensionSeparator);
77 return className.substring(dot + 1);
80 public abstract int getMaxDataLength();
82 public ByteBuffer getBuffer()