00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_WRITING_POF_HANDLER_HPP
00017 #define COH_WRITING_POF_HANDLER_HPP
00018
00019 #include "coherence/lang.ns"
00020
00021 #include "coherence/io/WriteBuffer.hpp"
00022 #include "coherence/io/pof/PofHandler.hpp"
00023 #include "coherence/io/pof/PofHelper.hpp"
00024 #include "coherence/util/Binary.hpp"
00025
00026 COH_OPEN_NAMESPACE3(coherence,io,pof)
00027
00028 using coherence::io::WriteBuffer;
00029 using coherence::util::Binary;
00030
00031
00032
00033
00034
00035
00036
00037
00038 class COH_EXPORT WritingPofHandler
00039 : public class_spec<WritingPofHandler,
00040 extends<PofHelper>,
00041 implements<PofHandler> >
00042 {
00043 friend class factory<WritingPofHandler>;
00044
00045
00046
00047 protected:
00048
00049
00050
00051
00052
00053
00054
00055
00056 WritingPofHandler(WriteBuffer::BufferOutput::Handle hOut);
00057
00058
00059
00060
00061 public:
00062
00063
00064
00065 virtual void registerIdentity(int32_t nId);
00066
00067
00068
00069
00070 virtual void onNullReference(int32_t iPos);
00071
00072
00073
00074
00075 virtual void onIdentityReference(int32_t iPos, int32_t nId);
00076
00077
00078
00079
00080 virtual void onInt16(int32_t iPos, int16_t n);
00081
00082
00083
00084
00085 virtual void onInt32(int32_t iPos, int32_t n);
00086
00087
00088
00089
00090 virtual void onInt64(int32_t iPos, int64_t n);
00091
00092
00093
00094
00095 virtual void onFloat32(int32_t iPos, float32_t fl);
00096
00097
00098
00099
00100 virtual void onFloat64(int32_t iPos, float64_t dfl);
00101
00102
00103
00104
00105 virtual void onBoolean(int32_t iPos, bool f);
00106
00107
00108
00109
00110 virtual void onOctet(int32_t iPos, octet_t b);
00111
00112
00113
00114
00115 virtual void onOctetString(int32_t iPos, Binary::View vBin);
00116
00117
00118
00119
00120 virtual void onChar(int32_t iPos, char16_t ch);
00121
00122
00123
00124
00125 virtual void onCharString(int32_t iPos, String::View vs);
00126
00127
00128
00129
00130 virtual void onDate(int32_t iPos, int32_t nYear, int32_t nMonth,
00131 int32_t nDay);
00132
00133
00134
00135
00136 virtual void onYearMonthInterval(int32_t iPos, int32_t cYears,
00137 int32_t cMonths);
00138
00139
00140
00141
00142 virtual void onTime(int32_t iPos, int32_t nHour, int32_t nMinute,
00143 int32_t nSecond, int32_t nNano, bool fUTC);
00144
00145
00146
00147
00148 virtual void onTime(int32_t iPos, int32_t nHour, int32_t nMinute,
00149 int32_t nSecond, int32_t nNano, int32_t nHourOffset,
00150 int32_t nMinuteOffset);
00151
00152
00153
00154
00155 virtual void onTimeInterval(int32_t iPos, int32_t cHours,
00156 int32_t cMinutes, int32_t cSeconds, int32_t cNanos);
00157
00158
00159
00160
00161 virtual void onDateTime(int32_t iPos, int32_t nYear, int32_t nMonth,
00162 int32_t nDay, int32_t nHour, int32_t nMinute, int32_t nSecond,
00163 int32_t nNano, bool fUTC);
00164
00165
00166
00167
00168 virtual void onDateTime(int32_t iPos, int32_t nYear, int32_t nMonth,
00169 int32_t nDay, int32_t nHour, int32_t nMinute, int32_t nSecond,
00170 int32_t nNano, int32_t nHourOffset, int32_t nMinuteOffset);
00171
00172
00173
00174
00175 virtual void onDayTimeInterval(int32_t iPos, int32_t cDays,
00176 int32_t cHours, int32_t cMinutes, int32_t cSeconds,
00177 int32_t cNanos);
00178
00179
00180
00181
00182 virtual void beginCollection(int32_t iPos, size32_t cElements);
00183
00184
00185
00186
00187 virtual void beginUniformCollection(int32_t iPos, size32_t cElements,
00188 int32_t nType);
00189
00190
00191
00192
00193 virtual void beginArray(int32_t iPos, size32_t cElements);
00194
00195
00196
00197
00198 virtual void beginUniformArray(int32_t iPos, size32_t cElements,
00199 int32_t nType);
00200
00201
00202
00203
00204 virtual void beginSparseArray(int32_t iPos, size32_t cElements);
00205
00206
00207
00208
00209 virtual void beginUniformSparseArray(int32_t iPos, size32_t cElements,
00210 int32_t nType);
00211
00212
00213
00214
00215 virtual void beginMap(int32_t iPos, size32_t cElements);
00216
00217
00218
00219
00220 virtual void beginUniformKeysMap(int32_t iPos, size32_t cElements,
00221 int32_t nTypeKeys);
00222
00223
00224
00225
00226 virtual void beginUniformMap(int32_t iPos, size32_t cElements,
00227 int32_t nTypeKeys, int32_t nTypeValues);
00228
00229
00230
00231
00232 virtual void beginUserType(int32_t iPos, int32_t nUserTypeId,
00233 int32_t nVersionId);
00234
00235
00236
00237
00238 virtual void endComplexValue();
00239
00240
00241
00242
00243 protected:
00244
00245
00246
00247
00248
00249
00250
00251
00252 virtual bool isSkippable() const;
00253
00254
00255
00256
00257
00258
00259
00260
00261 virtual bool isCompressable() const;
00262
00263
00264
00265
00266
00267
00268
00269 virtual void encodePosition(int32_t iPos);
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 virtual bool isTypeIdEncoded(int32_t nTypeId) const;
00281
00282
00283
00284
00285 public:
00286
00287
00288
00289
00290 class COH_EXPORT Complex
00291 : public class_spec<Complex>
00292 {
00293 friend class factory<Complex>;
00294
00295
00296
00297 protected:
00298
00299
00300
00301
00302
00303
00304
00305
00306 Complex(Complex::Handle hComplexCurrent,
00307 bool fEncodePosition);
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319 Complex(Complex::Handle hComplexCurrent,
00320 bool fEncodePosition, int32_t nUniformTypeId);
00321
00322
00323
00324 public:
00325
00326
00327
00328
00329
00330 virtual void onValue(int32_t iPos);
00331
00332
00333
00334 public:
00335
00336
00337
00338
00339
00340
00341
00342 virtual bool isUniform() const;
00343
00344
00345
00346
00347
00348
00349
00350 virtual int32_t getUniformType() const;
00351
00352
00353
00354
00355
00356
00357
00358
00359 virtual bool isSparse() const;
00360
00361
00362
00363
00364
00365
00366
00367 virtual Complex::Handle pop();
00368
00369
00370
00371
00372
00373
00374
00375 virtual Complex::View pop() const;
00376
00377
00378
00379 protected:
00380
00381
00382
00383
00384 const bool m_fSparse;
00385
00386
00387
00388
00389
00390
00391 const bool m_fUniform;
00392
00393
00394
00395
00396 const int32_t m_nTypeId;
00397
00398
00399
00400
00401
00402 FinalHandle<Complex> m_hComplexOuter;
00403 };
00404
00405
00406
00407
00408 public:
00409
00410
00411
00412
00413 class COH_EXPORT ComplexMap
00414 : public class_spec<ComplexMap,
00415 extends<Complex> >
00416 {
00417 friend class factory<ComplexMap>;
00418
00419
00420
00421 protected:
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431 ComplexMap(Complex::Handle hComplexCurrent,
00432 int32_t nUniformKeyTypeId);
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446 ComplexMap(Complex::Handle hComplexCurrent,
00447 int32_t nUniformKeyTypeId, int32_t nUniformValTypeId);
00448
00449
00450
00451 public:
00452
00453
00454
00455 virtual void onValue(int32_t iPos);
00456
00457
00458
00459 public:
00460
00461
00462
00463
00464
00465
00466
00467 virtual bool isUniform() const;
00468
00469
00470
00471
00472
00473
00474
00475 virtual int32_t getUniformType() const;
00476
00477
00478
00479 protected:
00480
00481
00482
00483
00484 bool m_fKey;
00485
00486
00487
00488
00489 const bool m_fUniformValue;
00490
00491
00492
00493
00494 const int32_t m_nValueTypeId;
00495 };
00496
00497
00498
00499
00500 public:
00501
00502
00503
00504
00505
00506
00507 virtual WriteBuffer::BufferOutput::Handle getBufferOutput();
00508
00509
00510
00511
00512
00513
00514
00515 virtual WriteBuffer::BufferOutput::View getBufferOutput() const;
00516
00517
00518
00519
00520
00521
00522
00523 virtual Complex::Handle getComplex();
00524
00525
00526
00527
00528
00529
00530
00531 virtual Complex::View getComplex() const;
00532
00533
00534
00535
00536 protected:
00537
00538
00539
00540 FinalHandle<WriteBuffer::BufferOutput> m_hOut;
00541
00542
00543
00544
00545 MemberHandle<Complex> m_hComplex;
00546
00547
00548
00549
00550
00551 bool m_fHasIdentity;
00552 };
00553
00554 COH_CLOSE_NAMESPACE3
00555
00556 #endif // COH_WRITING_POF_HANDLER_HPP
Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.