summaryrefslogtreecommitdiff
path: root/java/common/src
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-05-15 17:52:22 +0000
committerRafael H. Schloming <rhs@apache.org>2008-05-15 17:52:22 +0000
commit08351607dda4b0b40abd944b3d0844d51775fc0a (patch)
treeabf66a44146f69133ffd65ab180eaddac127dba0 /java/common/src
parent36a62d9a903fa9eb219f87067fe6e9a223c0230b (diff)
downloadqpid-python-08351607dda4b0b40abd944b3d0844d51775fc0a.tar.gz
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
Diffstat (limited to 'java/common/src')
-rw-r--r--java/common/src/main/java/org/apache/qpidity/transport/Struct.java74
1 files changed, 2 insertions, 72 deletions
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<Field<?,?>> 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<Field<?,?>> 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()
{