Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

Commit 1507e56c authored by Jean Meurice's avatar Jean Meurice
Browse files

SimplePacketType & PortInformation fixes

parent 44c1b74e
Pipeline #381485 passed with stage
in 49 seconds
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<groupId>montisim</groupId> <groupId>montisim</groupId>
<artifactId>commons</artifactId> <artifactId>commons</artifactId>
<version>2.0.12</version> <version>2.0.13</version>
<properties> <properties>
......
package de.rwth.montisim.commons.dynamicinterface; package de.rwth.montisim.commons.dynamicinterface;
import java.util.HashSet; import java.util.Vector;
import java.util.Set;
public class PortInformation { public class PortInformation {
public static enum PortDirection { public static enum PortDirection {
...@@ -20,7 +19,7 @@ public class PortInformation { ...@@ -20,7 +19,7 @@ public class PortInformation {
public DataType data_type; public DataType data_type;
public boolean allows_multiple_inputs = true; public boolean allows_multiple_inputs = true;
public boolean optional = false; public boolean optional = false;
public final Set<String> tags = new HashSet<>(); // Tags for routing. Example: 'network' tag -> gets collected by the Gateway component public Vector<String> tags = new Vector<>(); // Tags for routing. Example: 'network' tag -> gets collected by the Gateway component
protected PortInformation() {} protected PortInformation() {}
......
...@@ -17,8 +17,8 @@ public class ProgramInterface { ...@@ -17,8 +17,8 @@ public class ProgramInterface {
String res = "ProgramInterface of "+name+ " (v" + version+"):\n"; String res = "ProgramInterface of "+name+ " (v" + version+"):\n";
for (PortInformation p : ports) { for (PortInformation p : ports) {
res += '\t'; res += '\t';
if (p.direction == PortDirection.INPUT) res += (p.port_type == PortType.SOCKET) ? "sock_in" : "I "; if (p.direction == PortDirection.INPUT) res += (p.port_type == PortType.SOCKET) ? "sock_in " : "I ";
else res += (p.port_type == PortType.SOCKET) ? "sock_out" : "O "; else res += (p.port_type == PortType.SOCKET) ? "sock_out " : "O ";
res += p.name + ": "+p.data_type.toString()+"\n"; res += p.name + ": "+p.data_type.toString()+"\n";
} }
return res; return res;
......
...@@ -87,19 +87,22 @@ public class SimplePacketType extends DataType { ...@@ -87,19 +87,22 @@ public class SimplePacketType extends DataType {
public void toBinary(DataOutputStream os, Object o) throws IOException { public void toBinary(DataOutputStream os, Object o) throws IOException {
Object packet[] = (Object[]) o; Object packet[] = (Object[]) o;
String addr = (String)packet[0]; String addr = (String)packet[0];
os.writeShort(addr.length());
os.write(addr.getBytes()); os.write(addr.getBytes());
os.writeByte(0); // Termination char
payloadType.toBinary(os, packet[1]); payloadType.toBinary(os, packet[1]);
} }
@Override @Override
public Object fromBinary(DataInputStream is) throws IOException { public Object fromBinary(DataInputStream is) throws IOException {
Object res[] = new Object[2]; Object res[] = new Object[2];
short addrSize = is.readShort(); StringBuilder sb = new StringBuilder();
//res[0] = new String(is.readNBytes(addrSize)); byte c;
byte bytes[] = new byte[addrSize]; do {
for (int i = 0; i < addrSize; ++i) bytes[i] = is.readByte(); c = is.readByte();
res[0] = new String(bytes); if (c == 0) break;
sb.append((char)c);
} while (true);
res[0] = sb.toString();
res[1] = payloadType.fromBinary(is); res[1] = payloadType.fromBinary(is);
return res; return res;
} }
...@@ -113,6 +116,11 @@ public class SimplePacketType extends DataType { ...@@ -113,6 +116,11 @@ public class SimplePacketType extends DataType {
return res; return res;
} }
@Override
public String toString() {
return "SimplePacket(" + payloadType + ")";
}
@Override @Override
public Class<?> getArrayType() { public Class<?> getArrayType() {
return Object[].class; return Object[].class;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment