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