Todd Wang | e5d67b4 | 2014-05-27 10:48:07 -0700 | [diff] [blame] | 1 | // This file was auto-generated by the veyron vdl tool. |
Tilak Sharma | 43395f3 | 2014-05-27 11:33:38 -0700 | [diff] [blame] | 2 | // Source: test_base.vdl |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 3 | |
| 4 | package test_base |
| 5 | |
| 6 | import ( |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 7 | // The non-user imports are prefixed with "__" to prevent collisions. |
| 8 | __io "io" |
Jiri Simsa | 764efb7 | 2014-12-25 20:57:03 -0800 | [diff] [blame] | 9 | __veyron2 "v.io/core/veyron2" |
| 10 | __context "v.io/core/veyron2/context" |
| 11 | __ipc "v.io/core/veyron2/ipc" |
| 12 | __vdl "v.io/core/veyron2/vdl" |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 13 | ) |
| 14 | |
| 15 | type Struct struct { |
| 16 | X int32 |
| 17 | Y int32 |
| 18 | } |
| 19 | |
Todd Wang | 34ed4c6 | 2014-11-26 15:15:52 -0800 | [diff] [blame] | 20 | func (Struct) __VDLReflect(struct { |
Jiri Simsa | 764efb7 | 2014-12-25 20:57:03 -0800 | [diff] [blame] | 21 | Name string "v.io/core/veyron/tools/vrpc/test_base.Struct" |
Todd Wang | 34ed4c6 | 2014-11-26 15:15:52 -0800 | [diff] [blame] | 22 | }) { |
| 23 | } |
| 24 | |
| 25 | func init() { |
| 26 | __vdl.Register(Struct{}) |
| 27 | } |
| 28 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 29 | // TypeTesterClientMethods is the client interface |
| 30 | // containing TypeTester methods. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 31 | // |
| 32 | // TypeTester methods are listed in alphabetical order, to make it easier to |
| 33 | // test Signature output, which sorts methods alphabetically. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 34 | type TypeTesterClientMethods interface { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 35 | // Methods to test support for primitive types. |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 36 | EchoBool(ctx *__context.T, I1 bool, opts ...__ipc.CallOpt) (O1 bool, err error) |
| 37 | EchoFloat32(ctx *__context.T, I1 float32, opts ...__ipc.CallOpt) (O1 float32, err error) |
| 38 | EchoFloat64(ctx *__context.T, I1 float64, opts ...__ipc.CallOpt) (O1 float64, err error) |
| 39 | EchoInt32(ctx *__context.T, I1 int32, opts ...__ipc.CallOpt) (O1 int32, err error) |
| 40 | EchoInt64(ctx *__context.T, I1 int64, opts ...__ipc.CallOpt) (O1 int64, err error) |
| 41 | EchoString(ctx *__context.T, I1 string, opts ...__ipc.CallOpt) (O1 string, err error) |
| 42 | EchoByte(ctx *__context.T, I1 byte, opts ...__ipc.CallOpt) (O1 byte, err error) |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 43 | EchoUint32(ctx *__context.T, I1 uint32, opts ...__ipc.CallOpt) (O1 uint32, err error) |
| 44 | EchoUint64(ctx *__context.T, I1 uint64, opts ...__ipc.CallOpt) (O1 uint64, err error) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 45 | // Methods to test support for composite types. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 46 | XEchoArray(ctx *__context.T, I1 [2]int32, opts ...__ipc.CallOpt) (O1 [2]int32, err error) |
| 47 | XEchoMap(ctx *__context.T, I1 map[int32]string, opts ...__ipc.CallOpt) (O1 map[int32]string, err error) |
| 48 | XEchoSet(ctx *__context.T, I1 map[int32]struct{}, opts ...__ipc.CallOpt) (O1 map[int32]struct{}, err error) |
| 49 | XEchoSlice(ctx *__context.T, I1 []int32, opts ...__ipc.CallOpt) (O1 []int32, err error) |
| 50 | XEchoStruct(ctx *__context.T, I1 Struct, opts ...__ipc.CallOpt) (O1 Struct, err error) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 51 | // Methods to test support for different number of arguments. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 52 | YMultiArg(ctx *__context.T, I1 int32, I2 int32, opts ...__ipc.CallOpt) (O1 int32, O2 int32, err error) |
| 53 | YNoArgs(*__context.T, ...__ipc.CallOpt) error |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 54 | // Methods to test support for streaming. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 55 | ZStream(ctx *__context.T, NumStreamItems int32, StreamItem bool, opts ...__ipc.CallOpt) (TypeTesterZStreamCall, error) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 56 | } |
| 57 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 58 | // TypeTesterClientStub adds universal methods to TypeTesterClientMethods. |
| 59 | type TypeTesterClientStub interface { |
| 60 | TypeTesterClientMethods |
| 61 | __ipc.UniversalServiceMethods |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 62 | } |
| 63 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 64 | // TypeTesterClient returns a client stub for TypeTester. |
| 65 | func TypeTesterClient(name string, opts ...__ipc.BindOpt) TypeTesterClientStub { |
| 66 | var client __ipc.Client |
| 67 | for _, opt := range opts { |
| 68 | if clientOpt, ok := opt.(__ipc.Client); ok { |
| 69 | client = clientOpt |
| 70 | } |
| 71 | } |
| 72 | return implTypeTesterClientStub{name, client} |
| 73 | } |
| 74 | |
| 75 | type implTypeTesterClientStub struct { |
| 76 | name string |
| 77 | client __ipc.Client |
| 78 | } |
| 79 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 80 | func (c implTypeTesterClientStub) c(ctx *__context.T) __ipc.Client { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 81 | if c.client != nil { |
| 82 | return c.client |
| 83 | } |
Suharsh Sivakumar | be80c1b | 2015-01-07 18:51:16 -0800 | [diff] [blame] | 84 | return __veyron2.GetClient(ctx) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 85 | } |
| 86 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 87 | func (c implTypeTesterClientStub) EchoBool(ctx *__context.T, i0 bool, opts ...__ipc.CallOpt) (o0 bool, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 88 | var call __ipc.Call |
| 89 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoBool", []interface{}{i0}, opts...); err != nil { |
| 90 | return |
| 91 | } |
| 92 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 93 | err = ierr |
| 94 | } |
| 95 | return |
| 96 | } |
| 97 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 98 | func (c implTypeTesterClientStub) EchoFloat32(ctx *__context.T, i0 float32, opts ...__ipc.CallOpt) (o0 float32, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 99 | var call __ipc.Call |
| 100 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoFloat32", []interface{}{i0}, opts...); err != nil { |
| 101 | return |
| 102 | } |
| 103 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 104 | err = ierr |
| 105 | } |
| 106 | return |
| 107 | } |
| 108 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 109 | func (c implTypeTesterClientStub) EchoFloat64(ctx *__context.T, i0 float64, opts ...__ipc.CallOpt) (o0 float64, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 110 | var call __ipc.Call |
| 111 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoFloat64", []interface{}{i0}, opts...); err != nil { |
| 112 | return |
| 113 | } |
| 114 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 115 | err = ierr |
| 116 | } |
| 117 | return |
| 118 | } |
| 119 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 120 | func (c implTypeTesterClientStub) EchoInt32(ctx *__context.T, i0 int32, opts ...__ipc.CallOpt) (o0 int32, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 121 | var call __ipc.Call |
| 122 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoInt32", []interface{}{i0}, opts...); err != nil { |
| 123 | return |
| 124 | } |
| 125 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 126 | err = ierr |
| 127 | } |
| 128 | return |
| 129 | } |
| 130 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 131 | func (c implTypeTesterClientStub) EchoInt64(ctx *__context.T, i0 int64, opts ...__ipc.CallOpt) (o0 int64, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 132 | var call __ipc.Call |
| 133 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoInt64", []interface{}{i0}, opts...); err != nil { |
| 134 | return |
| 135 | } |
| 136 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 137 | err = ierr |
| 138 | } |
| 139 | return |
| 140 | } |
| 141 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 142 | func (c implTypeTesterClientStub) EchoString(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (o0 string, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 143 | var call __ipc.Call |
| 144 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoString", []interface{}{i0}, opts...); err != nil { |
| 145 | return |
| 146 | } |
| 147 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 148 | err = ierr |
| 149 | } |
| 150 | return |
| 151 | } |
| 152 | |
Matt Rosencrantz | 4f8ac60 | 2014-12-29 14:42:48 -0800 | [diff] [blame] | 153 | func (c implTypeTesterClientStub) EchoByte(ctx *__context.T, i0 byte, opts ...__ipc.CallOpt) (o0 byte, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 154 | var call __ipc.Call |
| 155 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoByte", []interface{}{i0}, opts...); err != nil { |
| 156 | return |
| 157 | } |
| 158 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 159 | err = ierr |
| 160 | } |
| 161 | return |
| 162 | } |
| 163 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 164 | func (c implTypeTesterClientStub) EchoUint32(ctx *__context.T, i0 uint32, opts ...__ipc.CallOpt) (o0 uint32, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 165 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 166 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoUint32", []interface{}{i0}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 167 | return |
| 168 | } |
| 169 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 170 | err = ierr |
| 171 | } |
| 172 | return |
| 173 | } |
| 174 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 175 | func (c implTypeTesterClientStub) EchoUint64(ctx *__context.T, i0 uint64, opts ...__ipc.CallOpt) (o0 uint64, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 176 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 177 | if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoUint64", []interface{}{i0}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 178 | return |
| 179 | } |
| 180 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 181 | err = ierr |
| 182 | } |
| 183 | return |
| 184 | } |
| 185 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 186 | func (c implTypeTesterClientStub) XEchoArray(ctx *__context.T, i0 [2]int32, opts ...__ipc.CallOpt) (o0 [2]int32, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 187 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 188 | if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoArray", []interface{}{i0}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 189 | return |
| 190 | } |
| 191 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 192 | err = ierr |
| 193 | } |
| 194 | return |
| 195 | } |
| 196 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 197 | func (c implTypeTesterClientStub) XEchoMap(ctx *__context.T, i0 map[int32]string, opts ...__ipc.CallOpt) (o0 map[int32]string, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 198 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 199 | if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoMap", []interface{}{i0}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 200 | return |
| 201 | } |
| 202 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 203 | err = ierr |
| 204 | } |
| 205 | return |
| 206 | } |
| 207 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 208 | func (c implTypeTesterClientStub) XEchoSet(ctx *__context.T, i0 map[int32]struct{}, opts ...__ipc.CallOpt) (o0 map[int32]struct{}, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 209 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 210 | if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoSet", []interface{}{i0}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 211 | return |
| 212 | } |
| 213 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 214 | err = ierr |
| 215 | } |
| 216 | return |
| 217 | } |
| 218 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 219 | func (c implTypeTesterClientStub) XEchoSlice(ctx *__context.T, i0 []int32, opts ...__ipc.CallOpt) (o0 []int32, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 220 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 221 | if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoSlice", []interface{}{i0}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 222 | return |
| 223 | } |
| 224 | if ierr := call.Finish(&o0, &err); ierr != nil { |
| 225 | err = ierr |
| 226 | } |
| 227 | return |
| 228 | } |
| 229 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 230 | func (c implTypeTesterClientStub) XEchoStruct(ctx *__context.T, i0 Struct, opts ...__ipc.CallOpt) (o0 Struct, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 231 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 232 | if call, err = c.c(ctx).StartCall(ctx, c.name, "XEchoStruct", []interface{}{i0}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 233 | return |
| 234 | } |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 235 | if ierr := call.Finish(&o0, &err); ierr != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 236 | err = ierr |
| 237 | } |
| 238 | return |
| 239 | } |
| 240 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 241 | func (c implTypeTesterClientStub) YMultiArg(ctx *__context.T, i0 int32, i1 int32, opts ...__ipc.CallOpt) (o0 int32, o1 int32, err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 242 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 243 | if call, err = c.c(ctx).StartCall(ctx, c.name, "YMultiArg", []interface{}{i0, i1}, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 244 | return |
| 245 | } |
| 246 | if ierr := call.Finish(&o0, &o1, &err); ierr != nil { |
| 247 | err = ierr |
| 248 | } |
| 249 | return |
| 250 | } |
| 251 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 252 | func (c implTypeTesterClientStub) YNoArgs(ctx *__context.T, opts ...__ipc.CallOpt) (err error) { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 253 | var call __ipc.Call |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 254 | if call, err = c.c(ctx).StartCall(ctx, c.name, "YNoArgs", nil, opts...); err != nil { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 255 | return |
| 256 | } |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 257 | if ierr := call.Finish(&err); ierr != nil { |
| 258 | err = ierr |
| 259 | } |
| 260 | return |
| 261 | } |
| 262 | |
| 263 | func (c implTypeTesterClientStub) ZStream(ctx *__context.T, i0 int32, i1 bool, opts ...__ipc.CallOpt) (ocall TypeTesterZStreamCall, err error) { |
| 264 | var call __ipc.Call |
| 265 | if call, err = c.c(ctx).StartCall(ctx, c.name, "ZStream", []interface{}{i0, i1}, opts...); err != nil { |
| 266 | return |
| 267 | } |
| 268 | ocall = &implTypeTesterZStreamCall{Call: call} |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 269 | return |
| 270 | } |
| 271 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 272 | // TypeTesterZStreamClientStream is the client stream for TypeTester.ZStream. |
| 273 | type TypeTesterZStreamClientStream interface { |
| 274 | // RecvStream returns the receiver side of the TypeTester.ZStream client stream. |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 275 | RecvStream() interface { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 276 | // Advance stages an item so that it may be retrieved via Value. Returns |
| 277 | // true iff there is an item to retrieve. Advance must be called before |
| 278 | // Value is called. May block if an item is not available. |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 279 | Advance() bool |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 280 | // Value returns the item that was staged by Advance. May panic if Advance |
| 281 | // returned false or was not called. Never blocks. |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 282 | Value() bool |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 283 | // Err returns any error encountered by Advance. Never blocks. |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 284 | Err() error |
| 285 | } |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 286 | } |
Shyam Jayaraman | c4aed6e | 2014-07-22 14:25:06 -0700 | [diff] [blame] | 287 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 288 | // TypeTesterZStreamCall represents the call returned from TypeTester.ZStream. |
| 289 | type TypeTesterZStreamCall interface { |
| 290 | TypeTesterZStreamClientStream |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 291 | // Finish blocks until the server is done, and returns the positional return |
| 292 | // values for call. |
Shyam Jayaraman | c4aed6e | 2014-07-22 14:25:06 -0700 | [diff] [blame] | 293 | // |
Matt Rosencrantz | 9346b41 | 2014-12-18 15:59:19 -0800 | [diff] [blame] | 294 | // Finish returns immediately if the call has been canceled; depending on the |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 295 | // timing the output could either be an error signaling cancelation, or the |
| 296 | // valid positional return values from the server. |
Shyam Jayaraman | c4aed6e | 2014-07-22 14:25:06 -0700 | [diff] [blame] | 297 | // |
Matt Rosencrantz | 9346b41 | 2014-12-18 15:59:19 -0800 | [diff] [blame] | 298 | // Calling Finish is mandatory for releasing stream resources, unless the call |
| 299 | // has been canceled or any of the other methods return an error. Finish should |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 300 | // be called at most once. |
| 301 | Finish() error |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 302 | } |
| 303 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 304 | type implTypeTesterZStreamCall struct { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 305 | __ipc.Call |
| 306 | valRecv bool |
| 307 | errRecv error |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 308 | } |
| 309 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 310 | func (c *implTypeTesterZStreamCall) RecvStream() interface { |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 311 | Advance() bool |
| 312 | Value() bool |
| 313 | Err() error |
| 314 | } { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 315 | return implTypeTesterZStreamCallRecv{c} |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 316 | } |
| 317 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 318 | type implTypeTesterZStreamCallRecv struct { |
| 319 | c *implTypeTesterZStreamCall |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 320 | } |
| 321 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 322 | func (c implTypeTesterZStreamCallRecv) Advance() bool { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 323 | c.c.errRecv = c.c.Recv(&c.c.valRecv) |
| 324 | return c.c.errRecv == nil |
| 325 | } |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 326 | func (c implTypeTesterZStreamCallRecv) Value() bool { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 327 | return c.c.valRecv |
| 328 | } |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 329 | func (c implTypeTesterZStreamCallRecv) Err() error { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 330 | if c.c.errRecv == __io.EOF { |
| 331 | return nil |
| 332 | } |
| 333 | return c.c.errRecv |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 334 | } |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 335 | func (c *implTypeTesterZStreamCall) Finish() (err error) { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 336 | if ierr := c.Call.Finish(&err); ierr != nil { |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 337 | err = ierr |
| 338 | } |
| 339 | return |
| 340 | } |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 341 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 342 | // TypeTesterServerMethods is the interface a server writer |
| 343 | // implements for TypeTester. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 344 | // |
| 345 | // TypeTester methods are listed in alphabetical order, to make it easier to |
| 346 | // test Signature output, which sorts methods alphabetically. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 347 | type TypeTesterServerMethods interface { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 348 | // Methods to test support for primitive types. |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 349 | EchoBool(ctx __ipc.ServerContext, I1 bool) (O1 bool, err error) |
| 350 | EchoFloat32(ctx __ipc.ServerContext, I1 float32) (O1 float32, err error) |
| 351 | EchoFloat64(ctx __ipc.ServerContext, I1 float64) (O1 float64, err error) |
| 352 | EchoInt32(ctx __ipc.ServerContext, I1 int32) (O1 int32, err error) |
| 353 | EchoInt64(ctx __ipc.ServerContext, I1 int64) (O1 int64, err error) |
| 354 | EchoString(ctx __ipc.ServerContext, I1 string) (O1 string, err error) |
| 355 | EchoByte(ctx __ipc.ServerContext, I1 byte) (O1 byte, err error) |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 356 | EchoUint32(ctx __ipc.ServerContext, I1 uint32) (O1 uint32, err error) |
| 357 | EchoUint64(ctx __ipc.ServerContext, I1 uint64) (O1 uint64, err error) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 358 | // Methods to test support for composite types. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 359 | XEchoArray(ctx __ipc.ServerContext, I1 [2]int32) (O1 [2]int32, err error) |
| 360 | XEchoMap(ctx __ipc.ServerContext, I1 map[int32]string) (O1 map[int32]string, err error) |
| 361 | XEchoSet(ctx __ipc.ServerContext, I1 map[int32]struct{}) (O1 map[int32]struct{}, err error) |
| 362 | XEchoSlice(ctx __ipc.ServerContext, I1 []int32) (O1 []int32, err error) |
| 363 | XEchoStruct(ctx __ipc.ServerContext, I1 Struct) (O1 Struct, err error) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 364 | // Methods to test support for different number of arguments. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 365 | YMultiArg(ctx __ipc.ServerContext, I1 int32, I2 int32) (O1 int32, O2 int32, err error) |
| 366 | YNoArgs(__ipc.ServerContext) error |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 367 | // Methods to test support for streaming. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 368 | ZStream(ctx TypeTesterZStreamContext, NumStreamItems int32, StreamItem bool) error |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 369 | } |
| 370 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 371 | // TypeTesterServerStubMethods is the server interface containing |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 372 | // TypeTester methods, as expected by ipc.Server. |
| 373 | // The only difference between this interface and TypeTesterServerMethods |
| 374 | // is the streaming methods. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 375 | type TypeTesterServerStubMethods interface { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 376 | // Methods to test support for primitive types. |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 377 | EchoBool(ctx __ipc.ServerContext, I1 bool) (O1 bool, err error) |
| 378 | EchoFloat32(ctx __ipc.ServerContext, I1 float32) (O1 float32, err error) |
| 379 | EchoFloat64(ctx __ipc.ServerContext, I1 float64) (O1 float64, err error) |
| 380 | EchoInt32(ctx __ipc.ServerContext, I1 int32) (O1 int32, err error) |
| 381 | EchoInt64(ctx __ipc.ServerContext, I1 int64) (O1 int64, err error) |
| 382 | EchoString(ctx __ipc.ServerContext, I1 string) (O1 string, err error) |
| 383 | EchoByte(ctx __ipc.ServerContext, I1 byte) (O1 byte, err error) |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 384 | EchoUint32(ctx __ipc.ServerContext, I1 uint32) (O1 uint32, err error) |
| 385 | EchoUint64(ctx __ipc.ServerContext, I1 uint64) (O1 uint64, err error) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 386 | // Methods to test support for composite types. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 387 | XEchoArray(ctx __ipc.ServerContext, I1 [2]int32) (O1 [2]int32, err error) |
| 388 | XEchoMap(ctx __ipc.ServerContext, I1 map[int32]string) (O1 map[int32]string, err error) |
| 389 | XEchoSet(ctx __ipc.ServerContext, I1 map[int32]struct{}) (O1 map[int32]struct{}, err error) |
| 390 | XEchoSlice(ctx __ipc.ServerContext, I1 []int32) (O1 []int32, err error) |
| 391 | XEchoStruct(ctx __ipc.ServerContext, I1 Struct) (O1 Struct, err error) |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 392 | // Methods to test support for different number of arguments. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 393 | YMultiArg(ctx __ipc.ServerContext, I1 int32, I2 int32) (O1 int32, O2 int32, err error) |
| 394 | YNoArgs(__ipc.ServerContext) error |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 395 | // Methods to test support for streaming. |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 396 | ZStream(ctx *TypeTesterZStreamContextStub, NumStreamItems int32, StreamItem bool) error |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 397 | } |
| 398 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 399 | // TypeTesterServerStub adds universal methods to TypeTesterServerStubMethods. |
| 400 | type TypeTesterServerStub interface { |
| 401 | TypeTesterServerStubMethods |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 402 | // Describe the TypeTester interfaces. |
| 403 | Describe__() []__ipc.InterfaceDesc |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | // TypeTesterServer returns a server stub for TypeTester. |
| 407 | // It converts an implementation of TypeTesterServerMethods into |
| 408 | // an object that may be used by ipc.Server. |
| 409 | func TypeTesterServer(impl TypeTesterServerMethods) TypeTesterServerStub { |
| 410 | stub := implTypeTesterServerStub{ |
| 411 | impl: impl, |
Shyam Jayaraman | 97b9dca | 2014-07-31 13:30:46 -0700 | [diff] [blame] | 412 | } |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 413 | // Initialize GlobState; always check the stub itself first, to handle the |
| 414 | // case where the user has the Glob method defined in their VDL source. |
| 415 | if gs := __ipc.NewGlobState(stub); gs != nil { |
| 416 | stub.gs = gs |
| 417 | } else if gs := __ipc.NewGlobState(impl); gs != nil { |
| 418 | stub.gs = gs |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 419 | } |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 420 | return stub |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 421 | } |
| 422 | |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 423 | type implTypeTesterServerStub struct { |
| 424 | impl TypeTesterServerMethods |
| 425 | gs *__ipc.GlobState |
Matt Rosencrantz | bf85d54 | 2014-08-22 13:31:14 -0700 | [diff] [blame] | 426 | } |
| 427 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 428 | func (s implTypeTesterServerStub) EchoBool(ctx __ipc.ServerContext, i0 bool) (bool, error) { |
| 429 | return s.impl.EchoBool(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 430 | } |
| 431 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 432 | func (s implTypeTesterServerStub) EchoFloat32(ctx __ipc.ServerContext, i0 float32) (float32, error) { |
| 433 | return s.impl.EchoFloat32(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 434 | } |
| 435 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 436 | func (s implTypeTesterServerStub) EchoFloat64(ctx __ipc.ServerContext, i0 float64) (float64, error) { |
| 437 | return s.impl.EchoFloat64(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 438 | } |
| 439 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 440 | func (s implTypeTesterServerStub) EchoInt32(ctx __ipc.ServerContext, i0 int32) (int32, error) { |
| 441 | return s.impl.EchoInt32(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 442 | } |
| 443 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 444 | func (s implTypeTesterServerStub) EchoInt64(ctx __ipc.ServerContext, i0 int64) (int64, error) { |
| 445 | return s.impl.EchoInt64(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 446 | } |
| 447 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 448 | func (s implTypeTesterServerStub) EchoString(ctx __ipc.ServerContext, i0 string) (string, error) { |
| 449 | return s.impl.EchoString(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 450 | } |
| 451 | |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 452 | func (s implTypeTesterServerStub) EchoByte(ctx __ipc.ServerContext, i0 byte) (byte, error) { |
| 453 | return s.impl.EchoByte(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 456 | func (s implTypeTesterServerStub) EchoUint32(ctx __ipc.ServerContext, i0 uint32) (uint32, error) { |
| 457 | return s.impl.EchoUint32(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 458 | } |
| 459 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 460 | func (s implTypeTesterServerStub) EchoUint64(ctx __ipc.ServerContext, i0 uint64) (uint64, error) { |
| 461 | return s.impl.EchoUint64(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 462 | } |
| 463 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 464 | func (s implTypeTesterServerStub) XEchoArray(ctx __ipc.ServerContext, i0 [2]int32) ([2]int32, error) { |
| 465 | return s.impl.XEchoArray(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 468 | func (s implTypeTesterServerStub) XEchoMap(ctx __ipc.ServerContext, i0 map[int32]string) (map[int32]string, error) { |
| 469 | return s.impl.XEchoMap(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 470 | } |
| 471 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 472 | func (s implTypeTesterServerStub) XEchoSet(ctx __ipc.ServerContext, i0 map[int32]struct{}) (map[int32]struct{}, error) { |
| 473 | return s.impl.XEchoSet(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 474 | } |
| 475 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 476 | func (s implTypeTesterServerStub) XEchoSlice(ctx __ipc.ServerContext, i0 []int32) ([]int32, error) { |
| 477 | return s.impl.XEchoSlice(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 480 | func (s implTypeTesterServerStub) XEchoStruct(ctx __ipc.ServerContext, i0 Struct) (Struct, error) { |
| 481 | return s.impl.XEchoStruct(ctx, i0) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 482 | } |
| 483 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 484 | func (s implTypeTesterServerStub) YMultiArg(ctx __ipc.ServerContext, i0 int32, i1 int32) (int32, int32, error) { |
| 485 | return s.impl.YMultiArg(ctx, i0, i1) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 488 | func (s implTypeTesterServerStub) YNoArgs(ctx __ipc.ServerContext) error { |
| 489 | return s.impl.YNoArgs(ctx) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 490 | } |
| 491 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 492 | func (s implTypeTesterServerStub) ZStream(ctx *TypeTesterZStreamContextStub, i0 int32, i1 bool) error { |
| 493 | return s.impl.ZStream(ctx, i0, i1) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 494 | } |
| 495 | |
Robin Thellend | 39ac323 | 2014-12-02 09:50:41 -0800 | [diff] [blame] | 496 | func (s implTypeTesterServerStub) Globber() *__ipc.GlobState { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 497 | return s.gs |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 498 | } |
| 499 | |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 500 | func (s implTypeTesterServerStub) Describe__() []__ipc.InterfaceDesc { |
| 501 | return []__ipc.InterfaceDesc{TypeTesterDesc} |
| 502 | } |
| 503 | |
| 504 | // TypeTesterDesc describes the TypeTester interface. |
| 505 | var TypeTesterDesc __ipc.InterfaceDesc = descTypeTester |
| 506 | |
| 507 | // descTypeTester hides the desc to keep godoc clean. |
| 508 | var descTypeTester = __ipc.InterfaceDesc{ |
| 509 | Name: "TypeTester", |
Jiri Simsa | 764efb7 | 2014-12-25 20:57:03 -0800 | [diff] [blame] | 510 | PkgPath: "v.io/core/veyron/tools/vrpc/test_base", |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 511 | Doc: "// TypeTester methods are listed in alphabetical order, to make it easier to\n// test Signature output, which sorts methods alphabetically.", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 512 | Methods: []__ipc.MethodDesc{ |
| 513 | { |
| 514 | Name: "EchoBool", |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 515 | Doc: "// Methods to test support for primitive types.", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 516 | InArgs: []__ipc.ArgDesc{ |
| 517 | {"I1", ``}, // bool |
| 518 | }, |
| 519 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 520 | {"O1", ``}, // bool |
| 521 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 522 | }, |
| 523 | }, |
| 524 | { |
| 525 | Name: "EchoFloat32", |
| 526 | InArgs: []__ipc.ArgDesc{ |
| 527 | {"I1", ``}, // float32 |
| 528 | }, |
| 529 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 530 | {"O1", ``}, // float32 |
| 531 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 532 | }, |
| 533 | }, |
| 534 | { |
| 535 | Name: "EchoFloat64", |
| 536 | InArgs: []__ipc.ArgDesc{ |
| 537 | {"I1", ``}, // float64 |
| 538 | }, |
| 539 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 540 | {"O1", ``}, // float64 |
| 541 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 542 | }, |
| 543 | }, |
| 544 | { |
| 545 | Name: "EchoInt32", |
| 546 | InArgs: []__ipc.ArgDesc{ |
| 547 | {"I1", ``}, // int32 |
| 548 | }, |
| 549 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 550 | {"O1", ``}, // int32 |
| 551 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 552 | }, |
| 553 | }, |
| 554 | { |
| 555 | Name: "EchoInt64", |
| 556 | InArgs: []__ipc.ArgDesc{ |
| 557 | {"I1", ``}, // int64 |
| 558 | }, |
| 559 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 560 | {"O1", ``}, // int64 |
| 561 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 562 | }, |
| 563 | }, |
| 564 | { |
| 565 | Name: "EchoString", |
| 566 | InArgs: []__ipc.ArgDesc{ |
| 567 | {"I1", ``}, // string |
| 568 | }, |
| 569 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 570 | {"O1", ``}, // string |
| 571 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 572 | }, |
| 573 | }, |
| 574 | { |
| 575 | Name: "EchoByte", |
| 576 | InArgs: []__ipc.ArgDesc{ |
| 577 | {"I1", ``}, // byte |
| 578 | }, |
| 579 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 580 | {"O1", ``}, // byte |
| 581 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 582 | }, |
| 583 | }, |
| 584 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 585 | Name: "EchoUint32", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 586 | InArgs: []__ipc.ArgDesc{ |
| 587 | {"I1", ``}, // uint32 |
| 588 | }, |
| 589 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 590 | {"O1", ``}, // uint32 |
| 591 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 592 | }, |
| 593 | }, |
| 594 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 595 | Name: "EchoUint64", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 596 | InArgs: []__ipc.ArgDesc{ |
| 597 | {"I1", ``}, // uint64 |
| 598 | }, |
| 599 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 600 | {"O1", ``}, // uint64 |
| 601 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 602 | }, |
| 603 | }, |
| 604 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 605 | Name: "XEchoArray", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 606 | Doc: "// Methods to test support for composite types.", |
| 607 | InArgs: []__ipc.ArgDesc{ |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 608 | {"I1", ``}, // [2]int32 |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 609 | }, |
| 610 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 611 | {"O1", ``}, // [2]int32 |
| 612 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 613 | }, |
| 614 | }, |
| 615 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 616 | Name: "XEchoMap", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 617 | InArgs: []__ipc.ArgDesc{ |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 618 | {"I1", ``}, // map[int32]string |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 619 | }, |
| 620 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 621 | {"O1", ``}, // map[int32]string |
| 622 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 623 | }, |
| 624 | }, |
| 625 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 626 | Name: "XEchoSet", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 627 | InArgs: []__ipc.ArgDesc{ |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 628 | {"I1", ``}, // map[int32]struct{} |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 629 | }, |
| 630 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 631 | {"O1", ``}, // map[int32]struct{} |
| 632 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 633 | }, |
| 634 | }, |
| 635 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 636 | Name: "XEchoSlice", |
| 637 | InArgs: []__ipc.ArgDesc{ |
| 638 | {"I1", ``}, // []int32 |
| 639 | }, |
| 640 | OutArgs: []__ipc.ArgDesc{ |
| 641 | {"O1", ``}, // []int32 |
| 642 | {"err", ``}, // error |
| 643 | }, |
| 644 | }, |
| 645 | { |
| 646 | Name: "XEchoStruct", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 647 | InArgs: []__ipc.ArgDesc{ |
| 648 | {"I1", ``}, // Struct |
| 649 | }, |
| 650 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 651 | {"O1", ``}, // Struct |
| 652 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 653 | }, |
| 654 | }, |
| 655 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 656 | Name: "YMultiArg", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 657 | Doc: "// Methods to test support for different number of arguments.", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 658 | InArgs: []__ipc.ArgDesc{ |
| 659 | {"I1", ``}, // int32 |
| 660 | {"I2", ``}, // int32 |
| 661 | }, |
| 662 | OutArgs: []__ipc.ArgDesc{ |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 663 | {"O1", ``}, // int32 |
| 664 | {"O2", ``}, // int32 |
| 665 | {"err", ``}, // error |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 666 | }, |
| 667 | }, |
| 668 | { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 669 | Name: "YNoArgs", |
| 670 | OutArgs: []__ipc.ArgDesc{ |
| 671 | {"", ``}, // error |
| 672 | }, |
| 673 | }, |
| 674 | { |
| 675 | Name: "ZStream", |
Todd Wang | 5739dda | 2014-11-16 22:44:02 -0800 | [diff] [blame] | 676 | Doc: "// Methods to test support for streaming.", |
| 677 | InArgs: []__ipc.ArgDesc{ |
| 678 | {"NumStreamItems", ``}, // int32 |
| 679 | {"StreamItem", ``}, // bool |
| 680 | }, |
| 681 | OutArgs: []__ipc.ArgDesc{ |
| 682 | {"", ``}, // error |
| 683 | }, |
| 684 | }, |
| 685 | }, |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 686 | } |
| 687 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 688 | // TypeTesterZStreamServerStream is the server stream for TypeTester.ZStream. |
| 689 | type TypeTesterZStreamServerStream interface { |
| 690 | // SendStream returns the send side of the TypeTester.ZStream server stream. |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 691 | SendStream() interface { |
| 692 | // Send places the item onto the output stream. Returns errors encountered |
| 693 | // while sending. Blocks if there is no buffer space; will unblock when |
| 694 | // buffer space is available. |
| 695 | Send(item bool) error |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 696 | } |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 697 | } |
| 698 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 699 | // TypeTesterZStreamContext represents the context passed to TypeTester.ZStream. |
| 700 | type TypeTesterZStreamContext interface { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 701 | __ipc.ServerContext |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 702 | TypeTesterZStreamServerStream |
Robin Thellend | 94bc464 | 2014-11-05 18:05:08 -0800 | [diff] [blame] | 703 | } |
| 704 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 705 | // TypeTesterZStreamContextStub is a wrapper that converts ipc.ServerCall into |
| 706 | // a typesafe stub that implements TypeTesterZStreamContext. |
| 707 | type TypeTesterZStreamContextStub struct { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 708 | __ipc.ServerCall |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 709 | } |
| 710 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 711 | // Init initializes TypeTesterZStreamContextStub from ipc.ServerCall. |
| 712 | func (s *TypeTesterZStreamContextStub) Init(call __ipc.ServerCall) { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 713 | s.ServerCall = call |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 714 | } |
| 715 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 716 | // SendStream returns the send side of the TypeTester.ZStream server stream. |
| 717 | func (s *TypeTesterZStreamContextStub) SendStream() interface { |
Todd Wang | 702385a | 2014-11-07 01:54:08 -0800 | [diff] [blame] | 718 | Send(item bool) error |
| 719 | } { |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 720 | return implTypeTesterZStreamContextSend{s} |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 721 | } |
| 722 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 723 | type implTypeTesterZStreamContextSend struct { |
| 724 | s *TypeTesterZStreamContextStub |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 725 | } |
| 726 | |
Todd Wang | 06eeab0 | 2015-01-20 11:34:14 -0800 | [diff] [blame] | 727 | func (s implTypeTesterZStreamContextSend) Send(item bool) error { |
Todd Wang | 1fe7cdd | 2014-11-12 12:51:49 -0800 | [diff] [blame] | 728 | return s.s.Send(item) |
Jiri Simsa | 5293dcb | 2014-05-10 09:56:38 -0700 | [diff] [blame] | 729 | } |