From 08351607dda4b0b40abd944b3d0844d51775fc0a Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Thu, 15 May 2008 17:52:22 +0000 Subject: QPID-1062: phase 1 of improvements to 0-10 encode/decode; this inlines the read/write method of structs into generated code resulting in roughly a 2x improvement git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@656760 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpidity/transport/Struct.java | 74 +--------------------- 1 file changed, 2 insertions(+), 72 deletions(-) (limited to 'java/common/src') diff --git a/java/common/src/main/java/org/apache/qpidity/transport/Struct.java b/java/common/src/main/java/org/apache/qpidity/transport/Struct.java index f901f9e840..9146f41535 100644 --- a/java/common/src/main/java/org/apache/qpidity/transport/Struct.java +++ b/java/common/src/main/java/org/apache/qpidity/transport/Struct.java @@ -108,79 +108,9 @@ public abstract class Struct implements Encodable return getFlagCount() - getFields().size(); } - public final void read(Decoder dec) - { - List> fields = getFields(); - - assert fields.size() <= getFlagCount(); - - if (packed()) - { - for (Field f : fields) - { - if (isBit(f)) - { - f.has(this, true); - f.read(dec, this); - } - else - { - f.has(this, dec.readBit()); - } - } - - for (int i = 0; i < getReservedFlagCount(); i++) - { - if (dec.readBit()) - { - throw new IllegalStateException("reserved flag true"); - } - } - } - - for (Field f : fields) - { - if (encoded(f)) - { - f.read(dec, this); - } - } - } - - public final void write(Encoder enc) - { - List> fields = getFields(); + public abstract void read(Decoder dec); - assert fields.size() <= getFlagCount(); - - if (packed()) - { - for (Field f : fields) - { - if (isBit(f)) - { - f.write(enc, this); - } - else - { - enc.writeBit(f.has(this)); - } - } - - for (int i = 0; i < getReservedFlagCount(); i++) - { - enc.writeBit(false); - } - } - - for (Field f : fields) - { - if (encoded(f)) - { - f.write(enc, this); - } - } - } + public abstract void write(Encoder enc); public String toString() { -- cgit v1.2.1