00001
00002
00003
00004
00005
00006
00007 #ifndef COH_DELEGATING_WRITE_BUFFER_HPP
00008 #define COH_DELEGATING_WRITE_BUFFER_HPP
00009
00010 #include "coherence/lang.ns"
00011
00012 #include "coherence/io/AbstractWriteBuffer.hpp"
00013 #include "coherence/io/WriteBuffer.hpp"
00014
00015 COH_OPEN_NAMESPACE2(coherence,io)
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 class COH_EXPORT DelegatingWriteBuffer
00031 : public cloneable_spec<DelegatingWriteBuffer,
00032 extends<AbstractWriteBuffer> >
00033 {
00034 friend class factory<DelegatingWriteBuffer>;
00035
00036
00037
00038 public:
00039 typedef this_spec::Handle Handle;
00040 typedef this_spec::View View;
00041 typedef this_spec::Holder Holder;
00042
00043
00044
00045
00046 protected:
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 DelegatingWriteBuffer(WriteBuffer::Handle hBuf, size32_t of,
00057 size32_t cb);
00058
00059
00060
00061
00062 DelegatingWriteBuffer(const DelegatingWriteBuffer& that);
00063
00064
00065
00066
00067 public:
00068
00069
00070
00071 virtual size32_t length() const;
00072
00073
00074
00075
00076 virtual size32_t getCapacity() const;
00077
00078
00079
00080
00081 virtual size32_t getMaximumCapacity() const;
00082
00083
00084
00085
00086 virtual void write(size32_t ofDest, octet_t b);
00087
00088
00089
00090
00091 virtual void write(size32_t ofDest, Array<octet_t>::View vabSrc,
00092 size32_t ofSrc, size32_t cbSrc);
00093
00094
00095
00096
00097 virtual void write(size32_t ofDest, ReadBuffer::View vBufSrc,
00098 size32_t ofSrc, size32_t cbSrc);
00099
00100
00101
00102
00103 using AbstractWriteBuffer::write;
00104
00105
00106
00107
00108 virtual void retain(size32_t of, size32_t cb);
00109
00110
00111
00112
00113 using AbstractWriteBuffer::retain;
00114
00115
00116
00117
00118 virtual void clear();
00119
00120
00121
00122
00123 virtual ReadBuffer::View getUnsafeReadBuffer() const;
00124
00125
00126
00127
00128 virtual Array<octet_t>::View toOctetArray() const;
00129
00130
00131
00132
00133 protected:
00134
00135
00136
00137 virtual BufferOutput::Handle instantiateBufferOutput();
00138
00139
00140
00141
00142
00143
00144
00145
00146 virtual void checkBounds(size32_t of, size32_t cb) const;
00147
00148
00149
00150
00151
00152
00153
00154 virtual void updateLength(size32_t cb);
00155
00156
00157
00158
00159 public:
00160
00161
00162
00163
00164
00165
00166
00167 class COH_EXPORT DelegatingBufferOutput
00168 : public class_spec<DelegatingBufferOutput,
00169 extends<AbstractBufferOutput> >
00170 {
00171 friend class factory<DelegatingBufferOutput>;
00172
00173
00174
00175 protected:
00176
00177
00178
00179
00180
00181
00182
00183 DelegatingBufferOutput(DelegatingWriteBuffer::Handle hBuf);
00184
00185
00186
00187 public:
00188
00189
00190
00191 using AbstractBufferOutput::write;
00192
00193
00194
00195
00196 virtual void write(octet_t b);
00197
00198
00199
00200
00201 virtual void write(Array<octet_t>::View vab, size32_t of,
00202 size32_t cb);
00203
00204
00205
00206
00207 virtual void writeBuffer(ReadBuffer::View vBuf);
00208
00209
00210
00211
00212 virtual void writeBuffer(ReadBuffer::View vBuf, size32_t of,
00213 size32_t cb);
00214
00215
00216
00217
00218 virtual void writeBoolean(bool f);
00219
00220
00221
00222
00223 virtual void writeChar16(wchar16_t ch);
00224
00225
00226
00227
00228 virtual void writeFloat32(float32_t fl);
00229
00230
00231
00232
00233 virtual void writeFloat64(float64_t dfl);
00234
00235
00236
00237 protected:
00238
00239
00240
00241
00242
00243 virtual void moveOffset(size32_t cb);
00244
00245
00246
00247 protected:
00248
00249
00250
00251 FinalHandle<BufferOutput> f_hOut;
00252 };
00253
00254
00255
00256
00257 protected:
00258
00259
00260
00261 FinalHandle<WriteBuffer> f_hBuf;
00262
00263
00264
00265
00266
00267 size32_t m_ofStart;
00268
00269
00270
00271
00272 size32_t m_cb;
00273
00274
00275
00276
00277 size32_t m_cbMax;
00278 };
00279
00280 COH_CLOSE_NAMESPACE2
00281
00282 #endif // COH_DELEGATING_WRITE_BUFFER_HPP