]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/thrift/lib/netstd/Thrift/Protocol/TProtocolDecorator.cs
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / netstd / Thrift / Protocol / TProtocolDecorator.cs
CommitLineData
f67539c2
TL
1// Licensed to the Apache Software Foundation(ASF) under one
2// or more contributor license agreements.See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18using System;
19using System.Threading;
20using System.Threading.Tasks;
21using Thrift.Protocol.Entities;
22
23namespace Thrift.Protocol
24{
25 // ReSharper disable once InconsistentNaming
26 /// <summary>
27 /// TProtocolDecorator forwards all requests to an enclosed TProtocol instance,
28 /// providing a way to author concise concrete decorator subclasses.While it has
29 /// no abstract methods, it is marked abstract as a reminder that by itself,
30 /// it does not modify the behaviour of the enclosed TProtocol.
31 /// </summary>
32 public abstract class TProtocolDecorator : TProtocol
33 {
34 private readonly TProtocol _wrappedProtocol;
35
36 protected TProtocolDecorator(TProtocol protocol)
37 : base(protocol.Transport)
38 {
39 _wrappedProtocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
40 }
41
42 public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken)
43 {
44 await _wrappedProtocol.WriteMessageBeginAsync(message, cancellationToken);
45 }
46
47 public override async Task WriteMessageEndAsync(CancellationToken cancellationToken)
48 {
49 await _wrappedProtocol.WriteMessageEndAsync(cancellationToken);
50 }
51
52 public override async Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
53 {
54 await _wrappedProtocol.WriteStructBeginAsync(@struct, cancellationToken);
55 }
56
57 public override async Task WriteStructEndAsync(CancellationToken cancellationToken)
58 {
59 await _wrappedProtocol.WriteStructEndAsync(cancellationToken);
60 }
61
62 public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken)
63 {
64 await _wrappedProtocol.WriteFieldBeginAsync(field, cancellationToken);
65 }
66
67 public override async Task WriteFieldEndAsync(CancellationToken cancellationToken)
68 {
69 await _wrappedProtocol.WriteFieldEndAsync(cancellationToken);
70 }
71
72 public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
73 {
74 await _wrappedProtocol.WriteFieldStopAsync(cancellationToken);
75 }
76
77 public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
78 {
79 await _wrappedProtocol.WriteMapBeginAsync(map, cancellationToken);
80 }
81
82 public override async Task WriteMapEndAsync(CancellationToken cancellationToken)
83 {
84 await _wrappedProtocol.WriteMapEndAsync(cancellationToken);
85 }
86
87 public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken)
88 {
89 await _wrappedProtocol.WriteListBeginAsync(list, cancellationToken);
90 }
91
92 public override async Task WriteListEndAsync(CancellationToken cancellationToken)
93 {
94 await _wrappedProtocol.WriteListEndAsync(cancellationToken);
95 }
96
97 public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
98 {
99 await _wrappedProtocol.WriteSetBeginAsync(set, cancellationToken);
100 }
101
102 public override async Task WriteSetEndAsync(CancellationToken cancellationToken)
103 {
104 await _wrappedProtocol.WriteSetEndAsync(cancellationToken);
105 }
106
107 public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken)
108 {
109 await _wrappedProtocol.WriteBoolAsync(b, cancellationToken);
110 }
111
112 public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken)
113 {
114 await _wrappedProtocol.WriteByteAsync(b, cancellationToken);
115 }
116
117 public override async Task WriteI16Async(short i16, CancellationToken cancellationToken)
118 {
119 await _wrappedProtocol.WriteI16Async(i16, cancellationToken);
120 }
121
122 public override async Task WriteI32Async(int i32, CancellationToken cancellationToken)
123 {
124 await _wrappedProtocol.WriteI32Async(i32, cancellationToken);
125 }
126
127 public override async Task WriteI64Async(long i64, CancellationToken cancellationToken)
128 {
129 await _wrappedProtocol.WriteI64Async(i64, cancellationToken);
130 }
131
132 public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken)
133 {
134 await _wrappedProtocol.WriteDoubleAsync(d, cancellationToken);
135 }
136
137 public override async Task WriteStringAsync(string s, CancellationToken cancellationToken)
138 {
139 await _wrappedProtocol.WriteStringAsync(s, cancellationToken);
140 }
141
142 public override async Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken)
143 {
144 await _wrappedProtocol.WriteBinaryAsync(bytes, cancellationToken);
145 }
146
147 public override async ValueTask<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
148 {
149 return await _wrappedProtocol.ReadMessageBeginAsync(cancellationToken);
150 }
151
152 public override async Task ReadMessageEndAsync(CancellationToken cancellationToken)
153 {
154 await _wrappedProtocol.ReadMessageEndAsync(cancellationToken);
155 }
156
157 public override async ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
158 {
159 return await _wrappedProtocol.ReadStructBeginAsync(cancellationToken);
160 }
161
162 public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
163 {
164 await _wrappedProtocol.ReadStructEndAsync(cancellationToken);
165 }
166
167 public override async ValueTask<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
168 {
169 return await _wrappedProtocol.ReadFieldBeginAsync(cancellationToken);
170 }
171
172 public override async Task ReadFieldEndAsync(CancellationToken cancellationToken)
173 {
174 await _wrappedProtocol.ReadFieldEndAsync(cancellationToken);
175 }
176
177 public override async ValueTask<TMap> ReadMapBeginAsync(CancellationToken cancellationToken)
178 {
179 return await _wrappedProtocol.ReadMapBeginAsync(cancellationToken);
180 }
181
182 public override async Task ReadMapEndAsync(CancellationToken cancellationToken)
183 {
184 await _wrappedProtocol.ReadMapEndAsync(cancellationToken);
185 }
186
187 public override async ValueTask<TList> ReadListBeginAsync(CancellationToken cancellationToken)
188 {
189 return await _wrappedProtocol.ReadListBeginAsync(cancellationToken);
190 }
191
192 public override async Task ReadListEndAsync(CancellationToken cancellationToken)
193 {
194 await _wrappedProtocol.ReadListEndAsync(cancellationToken);
195 }
196
197 public override async ValueTask<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
198 {
199 return await _wrappedProtocol.ReadSetBeginAsync(cancellationToken);
200 }
201
202 public override async Task ReadSetEndAsync(CancellationToken cancellationToken)
203 {
204 await _wrappedProtocol.ReadSetEndAsync(cancellationToken);
205 }
206
207 public override async ValueTask<bool> ReadBoolAsync(CancellationToken cancellationToken)
208 {
209 return await _wrappedProtocol.ReadBoolAsync(cancellationToken);
210 }
211
212 public override async ValueTask<sbyte> ReadByteAsync(CancellationToken cancellationToken)
213 {
214 return await _wrappedProtocol.ReadByteAsync(cancellationToken);
215 }
216
217 public override async ValueTask<short> ReadI16Async(CancellationToken cancellationToken)
218 {
219 return await _wrappedProtocol.ReadI16Async(cancellationToken);
220 }
221
222 public override async ValueTask<int> ReadI32Async(CancellationToken cancellationToken)
223 {
224 return await _wrappedProtocol.ReadI32Async(cancellationToken);
225 }
226
227 public override async ValueTask<long> ReadI64Async(CancellationToken cancellationToken)
228 {
229 return await _wrappedProtocol.ReadI64Async(cancellationToken);
230 }
231
232 public override async ValueTask<double> ReadDoubleAsync(CancellationToken cancellationToken)
233 {
234 return await _wrappedProtocol.ReadDoubleAsync(cancellationToken);
235 }
236
237 public override async ValueTask<string> ReadStringAsync(CancellationToken cancellationToken)
238 {
239 return await _wrappedProtocol.ReadStringAsync(cancellationToken);
240 }
241
242 public override async ValueTask<byte[]> ReadBinaryAsync(CancellationToken cancellationToken)
243 {
244 return await _wrappedProtocol.ReadBinaryAsync(cancellationToken);
245 }
246 }
247}