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