00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_ABSTRACT_READ_BUFFER_HPP
00017 #define COH_ABSTRACT_READ_BUFFER_HPP
00018
00019 #include "coherence/lang.ns"
00020
00021 #include "coherence/io/ReadBuffer.hpp"
00022
00023
00024
00025 COH_OPEN_NAMESPACE2(coherence,util)
00026
00027 class Binary;
00028
00029 COH_CLOSE_NAMESPACE2
00030
00031 COH_OPEN_NAMESPACE2(coherence,io)
00032
00033
00034
00035
00036
00037
00038
00039 class COH_EXPORT AbstractReadBuffer
00040 : public abstract_spec<AbstractReadBuffer,
00041 extends<Object>,
00042 implements<ReadBuffer> >
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 typedef TypedHandle<const coherence::util::Binary> BinaryView;
00055
00056
00057
00058
00059 typedef TypedHandle<coherence::util::Binary> BinaryHandle;
00060
00061
00062
00063
00064 public:
00065
00066
00067
00068 virtual BufferInput::Handle getBufferInput() const;
00069
00070
00071
00072
00073 virtual ReadBuffer::View getReadBuffer(size32_t of, size32_t cb) const;
00074
00075
00076
00077
00078 virtual BinaryView toBinary() const;
00079
00080
00081
00082
00083 virtual BinaryView toBinary(size32_t of, size32_t cb) const;
00084
00085
00086
00087
00088 virtual Array<octet_t>::View toOctetArray() const;
00089
00090
00091
00092
00093 virtual Array<octet_t>::View toOctetArray(size32_t of, size32_t cb) const;
00094
00095
00096
00097
00098 public:
00099
00100
00101
00102 virtual bool equals(Object::View v) const;
00103
00104
00105
00106
00107 protected:
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 virtual ReadBuffer::View instantiateReadBuffer(size32_t of,
00119 size32_t cb) const = 0;
00120
00121
00122
00123
00124
00125
00126
00127 virtual BufferInput::Handle instantiateBufferInput() const;
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 virtual void checkBounds(size32_t of, size32_t cb) const;
00139
00140
00141
00142
00143 public:
00144
00145
00146
00147
00148
00149
00150 class COH_EXPORT AbstractBufferInput
00151 : public class_spec<AbstractBufferInput,
00152 extends<Object>,
00153 implements<BufferInput> >
00154 {
00155 friend class factory<AbstractBufferInput>;
00156
00157
00158
00159 protected:
00160
00161
00162
00163
00164
00165
00166 AbstractBufferInput(AbstractReadBuffer::View vBuf);
00167
00168
00169
00170
00171 public:
00172
00173
00174
00175 virtual ReadBuffer::View getBuffer() const;
00176
00177
00178
00179
00180 virtual size32_t getOffset() const;
00181
00182
00183
00184
00185 virtual void setOffset(size32_t of);
00186
00187
00188
00189
00190 virtual size32_t available() const;
00191
00192
00193
00194
00195 virtual void skip(size32_t cb);
00196
00197
00198
00199
00200 virtual octet_t read();
00201
00202
00203
00204
00205 virtual void read(Array<octet_t>::Handle hab);
00206
00207
00208
00209
00210 virtual void read(Array<octet_t>::Handle hab, size32_t of,
00211 size32_t cb);
00212
00213
00214
00215
00216 virtual ReadBuffer::View readBuffer(size32_t cb);
00217
00218
00219
00220
00221 virtual bool readBoolean();
00222
00223
00224
00225
00226 virtual char16_t readChar16();
00227
00228
00229
00230
00231 virtual String::View readString();
00232
00233
00234
00235
00236 virtual int16_t readInt16();
00237
00238
00239
00240
00241 virtual int32_t readInt32();
00242
00243
00244
00245
00246 virtual int64_t readInt64();
00247
00248
00249
00250
00251 virtual float32_t readFloat32();
00252
00253
00254
00255
00256 virtual float64_t readFloat64();
00257
00258
00259
00260 protected:
00261
00262
00263
00264
00265
00266 virtual void setOffsetInternal(size32_t of);
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283 virtual String::View readUTF(size32_t cb);
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 virtual String::View convertUTF(size32_t of, size32_t cb) const;
00297
00298
00299
00300 protected:
00301
00302
00303
00304 FinalView<AbstractReadBuffer> f_vBuf;
00305
00306
00307
00308
00309 size32_t m_of;
00310 };
00311
00312
00313
00314
00315 public:
00316
00317
00318
00319 static Array<octet_t>::Handle getEmptyOctetArray();
00320
00321
00322
00323
00324
00325
00326 static BinaryHandle getEmptyBinary();
00327
00328
00329
00330
00331 static ReadBuffer::Handle getEmptyReadBuffer();
00332 };
00333
00334 COH_CLOSE_NAMESPACE2
00335
00336 #endif // COH_ABSTRACT_READ_BUFFER_HPP