Utils.debugMsg("sendDataRequest()", this);
long timestamp;
int nodeId;
byte[] data;
BaseInterpreter interpreter;
// Length will be stored in an integer, just in case the two-byte
// length-field which is unsigned has a value that is too high and
// would be interpreted as negative in Java.
int length = 0;
byte tmpLength;
int startAddr = 1 + Const.SHARED_MEM_SEND_ADDRESS; // first byte is the signal, so +1
byte temp;
byte[] sendPkg;
interpreter = sim.getInterpreter();
nodeId = ((SimulatorThread) simMap.get(sim)).getNode().hashCode();
timestamp = sim.getClock().getCount();
/* if (Const.NODES_USE_BIG_ENDIAN) {
tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
length |= (tmpLength << 24);
tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
length |= (tmpLength << 16);
tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
length |= (tmpLength << 8);
tmpLength = interpreter.getDataByte(startAddr++); System.out.println("xx "+tmpLength);
length |= tmpLength;
} else {*/
tmpLength = interpreter.getDataByte(startAddr++);
length |= tmpLength;
tmpLength = interpreter.getDataByte(startAddr++);
length |= (tmpLength << 8);
tmpLength = interpreter.getDataByte(startAddr++);
length |= (tmpLength << 16);
tmpLength = interpreter.getDataByte(startAddr++);
length |= (tmpLength << 24);
// }
if (length == 0) return; // empty data, nothing to do
if ((1+2+length) > Const.SHARED_MEM_SEND_SIZE) { // 1+2 => signal + length-field
System.err.println("Node "+nodeId+" is trying to send to much data :" + (1+2+length));
System.exit(-1);
}
startAddr = 1 + Const.SHARED_MEM_SEND_ADDRESS;
// read the data from the node
data = new byte[length];
for (int i = 0; i < length; i++) {
data[i] = interpreter.getDataByte(startAddr+i);
}
/* Convert the data into a message
*/
PartsBuffer messageBuffer;