get rid of PipelineBase and PipelineImpl again
This commit is contained in:
parent
8eacc8cada
commit
d515500996
5 changed files with 26 additions and 45 deletions
|
@ -1665,7 +1665,7 @@ private:
|
||||||
KJ_MAP(n, nestedTypeDecls) { return kj::mv(n); },
|
KJ_MAP(n, nestedTypeDecls) { return kj::mv(n); },
|
||||||
|
|
||||||
//spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.RemotePromise<Reader", readerTypeParams, "> {\n",
|
//spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.RemotePromise<Reader", readerTypeParams, "> {\n",
|
||||||
spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.PipelineBase {\n",
|
spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.Pipeline {\n",
|
||||||
//spaces(indent), " private final org.capnproto.PipelineImpl typeless;\n",
|
//spaces(indent), " private final org.capnproto.PipelineImpl typeless;\n",
|
||||||
//spaces(indent), " org.capnproto.AnyPointer.Pipeline getTypeless();\n",
|
//spaces(indent), " org.capnproto.AnyPointer.Pipeline getTypeless();\n",
|
||||||
//spaces(indent), " public Pipeline(",
|
//spaces(indent), " public Pipeline(",
|
||||||
|
|
|
@ -35,9 +35,6 @@ public final class AnyPointer {
|
||||||
result.clear();
|
result.clear();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public Pipeline newPipeline(PipelineImpl typeless) {
|
|
||||||
return new AnyPointer.Pipeline(typeless.hook, typeless.ops);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static final Factory factory = new Factory();
|
public static final Factory factory = new Factory();
|
||||||
|
|
||||||
|
@ -145,20 +142,41 @@ public final class AnyPointer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Pipeline extends PipelineImpl implements PipelineBase {
|
public static class Pipeline implements org.capnproto.Pipeline {
|
||||||
|
|
||||||
|
protected final PipelineHook hook;
|
||||||
|
protected final PipelineOp[] ops;
|
||||||
|
|
||||||
public Pipeline(PipelineHook hook) {
|
public Pipeline(PipelineHook hook) {
|
||||||
this(hook, new PipelineOp[0]);
|
this(hook, new PipelineOp[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline(PipelineHook hook, PipelineOp[] ops) {
|
Pipeline(PipelineHook hook, PipelineOp[] ops) {
|
||||||
super(hook, ops);
|
this.hook = hook;
|
||||||
|
this.ops = ops;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pipeline typelessPipeline() {
|
public Pipeline typelessPipeline() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pipeline noop() {
|
||||||
|
return new Pipeline(this.hook, this.ops.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientHook asCap() {
|
||||||
|
return this.hook.getPipelinedCap(ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pipeline getPointerField(short pointerIndex) {
|
||||||
|
var newOps = new PipelineOp[this.ops.length + 1];
|
||||||
|
for (int ii = 0; ii < this.ops.length; ++ii) {
|
||||||
|
newOps[ii] = this.ops[ii];
|
||||||
|
}
|
||||||
|
newOps[this.ops.length] = PipelineOp.PointerField(pointerIndex);
|
||||||
|
return new Pipeline(this.hook, newOps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Request
|
public static final class Request
|
||||||
|
@ -186,7 +204,7 @@ public final class AnyPointer {
|
||||||
public RequestHook getHook() {
|
public RequestHook getHook() {
|
||||||
return this.requestHook;
|
return this.requestHook;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FromPointerBuilder<Builder> getParamsFactory() {
|
public FromPointerBuilder<Builder> getParamsFactory() {
|
||||||
return AnyPointer.factory;
|
return AnyPointer.factory;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package org.capnproto;
|
package org.capnproto;
|
||||||
|
|
||||||
public interface PipelineBase {
|
public interface Pipeline {
|
||||||
AnyPointer.Pipeline typelessPipeline();
|
AnyPointer.Pipeline typelessPipeline();
|
||||||
}
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
package org.capnproto;
|
|
||||||
|
|
||||||
public interface PipelineFactory<Pipeline> {
|
|
||||||
Pipeline newPipeline(RemotePromise<AnyPointer.Reader> promise, PipelineImpl typeless);
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package org.capnproto;
|
|
||||||
|
|
||||||
public class PipelineImpl {
|
|
||||||
protected final PipelineHook hook;
|
|
||||||
protected final PipelineOp[] ops;
|
|
||||||
|
|
||||||
public PipelineImpl(PipelineHook hook) {
|
|
||||||
this(hook, new PipelineOp[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PipelineImpl(PipelineHook hook, PipelineOp[] ops) {
|
|
||||||
this.hook = hook;
|
|
||||||
this.ops = ops;
|
|
||||||
}
|
|
||||||
|
|
||||||
PipelineImpl noop() {
|
|
||||||
return new PipelineImpl(this.hook, this.ops.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientHook asCap() {
|
|
||||||
return this.hook.getPipelinedCap(ops);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnyPointer.Pipeline getPointerField(short pointerIndex) {
|
|
||||||
var newOps = new PipelineOp[this.ops.length+1];
|
|
||||||
for (int ii = 0; ii < this.ops.length; ++ii) {
|
|
||||||
newOps[ii] = this.ops[ii];
|
|
||||||
}
|
|
||||||
newOps[this.ops.length] = PipelineOp.PointerField(pointerIndex);
|
|
||||||
return new AnyPointer.Pipeline(this.hook, newOps);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue