00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef ACE_CDR_STREAM_H
00041 #define ACE_CDR_STREAM_H
00042
00043 #include "ace/pre.h"
00044
00045 #include "ace/CDR_Base.h"
00046
00047 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00048 # pragma once
00049 #endif
00050
00051 #include "ace/SStringfwd.h"
00052 #include "ace/Message_Block.h"
00053
00054
00055
00056 #if defined ACE_LITTLE_ENDIAN
00057 # define ACE_CDR_BYTE_ORDER 1
00058
00059 #else
00060 # define ACE_CDR_BYTE_ORDER 0
00061
00062 #endif
00063
00064
00065 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00066
00067 class ACE_Char_Codeset_Translator;
00068 class ACE_WChar_Codeset_Translator;
00069
00070 class ACE_InputCDR;
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 class ACE_Export ACE_OutputCDR
00086 {
00087 public:
00088
00089
00090
00091
00092
00093 friend class ACE_Char_Codeset_Translator;
00094 friend class ACE_WChar_Codeset_Translator;
00095 friend class ACE_InputCDR;
00096
00097
00098
00099 ACE_OutputCDR (size_t size = 0,
00100 int byte_order = ACE_CDR_BYTE_ORDER,
00101 ACE_Allocator* buffer_allocator = 0,
00102 ACE_Allocator* data_block_allocator = 0,
00103 ACE_Allocator* message_block_allocator = 0,
00104 size_t memcpy_tradeoff =
00105 ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
00106 ACE_CDR::Octet major_version =
00107 ACE_CDR_GIOP_MAJOR_VERSION,
00108 ACE_CDR::Octet minor_version =
00109 ACE_CDR_GIOP_MINOR_VERSION);
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 ACE_OutputCDR (char *data,
00123 size_t size,
00124 int byte_order = ACE_CDR_BYTE_ORDER,
00125 ACE_Allocator* buffer_allocator = 0,
00126 ACE_Allocator* data_block_allocator = 0,
00127 ACE_Allocator* message_block_allocator = 0,
00128 size_t memcpy_tradeoff=
00129 ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
00130 ACE_CDR::Octet giop_major_version =
00131 ACE_CDR_GIOP_MAJOR_VERSION,
00132 ACE_CDR::Octet giop_minor_version =
00133 ACE_CDR_GIOP_MINOR_VERSION);
00134
00135
00136
00137 ACE_OutputCDR (ACE_Message_Block *data,
00138 int byte_order = ACE_CDR_BYTE_ORDER,
00139 size_t memcpy_tradeoff=
00140 ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
00141 ACE_CDR::Octet giop_major_version =
00142 ACE_CDR_GIOP_MAJOR_VERSION,
00143 ACE_CDR::Octet giop_minor_version =
00144 ACE_CDR_GIOP_MINOR_VERSION);
00145
00146
00147 ~ACE_OutputCDR (void);
00148
00149
00150
00151
00152
00153
00154
00155 struct ACE_Export from_boolean
00156 {
00157 explicit from_boolean (ACE_CDR::Boolean b);
00158 ACE_CDR::Boolean val_;
00159 };
00160
00161 struct ACE_Export from_octet
00162 {
00163 explicit from_octet (ACE_CDR::Octet o);
00164 ACE_CDR::Octet val_;
00165 };
00166
00167 struct ACE_Export from_char
00168 {
00169 explicit from_char (ACE_CDR::Char c);
00170 ACE_CDR::Char val_;
00171 };
00172
00173 struct ACE_Export from_wchar
00174 {
00175 explicit from_wchar (ACE_CDR::WChar wc);
00176 ACE_CDR::WChar val_;
00177 };
00178
00179 struct ACE_Export from_string
00180 {
00181 from_string (ACE_CDR::Char* s,
00182 ACE_CDR::ULong b,
00183 ACE_CDR::Boolean nocopy = 0);
00184 from_string (const ACE_CDR::Char* s,
00185 ACE_CDR::ULong b,
00186 ACE_CDR::Boolean nocopy = 0);
00187 ACE_CDR::Char *val_;
00188 ACE_CDR::ULong bound_;
00189 ACE_CDR::Boolean nocopy_;
00190 };
00191
00192 struct ACE_Export from_wstring
00193 {
00194 from_wstring (ACE_CDR::WChar* ws,
00195 ACE_CDR::ULong b,
00196 ACE_CDR::Boolean nocopy = 0);
00197 from_wstring (const ACE_CDR::WChar* ws,
00198 ACE_CDR::ULong b,
00199 ACE_CDR::Boolean nocopy = 0);
00200 ACE_CDR::WChar *val_;
00201 ACE_CDR::ULong bound_;
00202 ACE_CDR::Boolean nocopy_;
00203 };
00204
00205
00206
00207
00208 ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x);
00209 ACE_CDR::Boolean write_char (ACE_CDR::Char x);
00210 ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x);
00211 ACE_CDR::Boolean write_octet (ACE_CDR::Octet x);
00212 ACE_CDR::Boolean write_short (ACE_CDR::Short x);
00213 ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x);
00214 ACE_CDR::Boolean write_long (ACE_CDR::Long x);
00215 ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x);
00216 ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x);
00217 ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x);
00218 ACE_CDR::Boolean write_float (ACE_CDR::Float x);
00219 ACE_CDR::Boolean write_double (const ACE_CDR::Double &x);
00220 ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x);
00221
00222
00223
00224
00225 ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc);
00226
00227
00228 ACE_CDR::Boolean write_string (const ACE_CDR::Char *x);
00229 ACE_CDR::Boolean write_string (ACE_CDR::ULong len,
00230 const ACE_CDR::Char *x);
00231 ACE_CDR::Boolean write_string (const ACE_CString &x);
00232 ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x);
00233 ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length,
00234 const ACE_CDR::WChar *x);
00235
00236
00237
00238
00239
00240
00241 ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x,
00242 ACE_CDR::ULong length);
00243 ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x,
00244 ACE_CDR::ULong length);
00245 ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x,
00246 ACE_CDR::ULong length);
00247 ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x,
00248 ACE_CDR::ULong length);
00249 ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x,
00250 ACE_CDR::ULong length);
00251 ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x,
00252 ACE_CDR::ULong length);
00253 ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x,
00254 ACE_CDR::ULong length);
00255 ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x,
00256 ACE_CDR::ULong length);
00257 ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x,
00258 ACE_CDR::ULong length);
00259 ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x,
00260 ACE_CDR::ULong length);
00261 ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x,
00262 ACE_CDR::ULong length);
00263 ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x,
00264 ACE_CDR::ULong length);
00265 ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x,
00266 ACE_CDR::ULong length);
00267
00268
00269
00270 ACE_CDR::Boolean write_octet_array_mb (const ACE_Message_Block* mb);
00271
00272
00273
00274
00275
00276
00277 ACE_CDR::Boolean append_boolean (ACE_InputCDR &);
00278 ACE_CDR::Boolean append_char (ACE_InputCDR &);
00279 ACE_CDR::Boolean append_wchar (ACE_InputCDR &);
00280 ACE_CDR::Boolean append_octet (ACE_InputCDR &);
00281 ACE_CDR::Boolean append_short (ACE_InputCDR &);
00282 ACE_CDR::Boolean append_ushort (ACE_InputCDR &);
00283 ACE_CDR::Boolean append_long (ACE_InputCDR &);
00284 ACE_CDR::Boolean append_ulong (ACE_InputCDR &);
00285 ACE_CDR::Boolean append_longlong (ACE_InputCDR &);
00286 ACE_CDR::Boolean append_ulonglong (ACE_InputCDR &);
00287 ACE_CDR::Boolean append_float (ACE_InputCDR &);
00288 ACE_CDR::Boolean append_double (ACE_InputCDR &);
00289 ACE_CDR::Boolean append_longdouble (ACE_InputCDR &);
00290
00291 ACE_CDR::Boolean append_wstring (ACE_InputCDR &);
00292 ACE_CDR::Boolean append_string (ACE_InputCDR &);
00293
00294
00295
00296
00297
00298
00299 bool good_bit (void) const;
00300
00301
00302 void reset (void);
00303
00304
00305 size_t total_length (void) const;
00306
00307
00308
00309
00310
00311
00312 const ACE_Message_Block *begin (void) const;
00313
00314
00315 const ACE_Message_Block *end (void) const;
00316
00317
00318 const ACE_Message_Block *current (void) const;
00319
00320
00321
00322
00323
00324
00325 const char *buffer (void) const;
00326
00327
00328
00329
00330
00331
00332 size_t length (void) const;
00333
00334
00335
00336
00337
00338
00339
00340 int align_write_ptr (size_t alignment);
00341
00342
00343 ACE_Char_Codeset_Translator *char_translator (void) const;
00344 ACE_WChar_Codeset_Translator *wchar_translator (void) const;
00345
00346
00347 void char_translator (ACE_Char_Codeset_Translator *);
00348
00349 void wchar_translator (ACE_WChar_Codeset_Translator *);
00350
00351
00352
00353 static void wchar_maxbytes (int );
00354
00355
00356 static int wchar_maxbytes (void);
00357
00358
00359
00360
00361
00362
00363 size_t current_alignment (void) const;
00364
00365
00366
00367
00368
00369
00370
00371 int adjust (size_t size,
00372 char *&buf);
00373
00374
00375
00376 int adjust (size_t size,
00377 size_t align,
00378 char *&buf);
00379
00380
00381
00382 bool do_byte_swap (void) const;
00383
00384
00385
00386 int byte_order (void) const;
00387
00388
00389
00390
00391
00392 void reset_byte_order (int byte_order);
00393
00394
00395 int set_version (ACE_CDR::Octet major,
00396 ACE_CDR::Octet minor);
00397
00398
00399 int get_version (ACE_CDR::Octet &major,
00400 ACE_CDR::Octet &minor);
00401
00402 private:
00403
00404
00405
00406 ACE_Message_Block* find (char* loc);
00407
00408
00409 ACE_OutputCDR (const ACE_OutputCDR& rhs);
00410 ACE_OutputCDR& operator= (const ACE_OutputCDR& rhs);
00411
00412 ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x);
00413 ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x);
00414 ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x);
00415 ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x);
00416 ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x);
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430 ACE_CDR::Boolean write_array (const void *x,
00431 size_t size,
00432 size_t align,
00433 ACE_CDR::ULong length);
00434
00435
00436 ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x,
00437 ACE_CDR::ULong length);
00438
00439
00440
00441
00442
00443
00444
00445
00446 int grow_and_adjust (size_t size,
00447 size_t align,
00448 char *&buf);
00449
00450 private:
00451
00452 ACE_Message_Block start_;
00453
00454
00455 ACE_Message_Block *current_;
00456
00457 #if !defined (ACE_LACKS_CDR_IALIGNMENT)
00458
00459
00460
00461
00462
00463
00464
00465
00466 size_t current_alignment_;
00467 #endif
00468
00469
00470
00471
00472
00473
00474
00475 bool current_is_writable_;
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486 bool do_byte_swap_;
00487
00488
00489 bool good_bit_;
00490
00491
00492 size_t memcpy_tradeoff_;
00493
00494 protected:
00495
00496 ACE_CDR::Octet major_version_;
00497 ACE_CDR::Octet minor_version_;
00498
00499
00500 ACE_Char_Codeset_Translator *char_translator_;
00501 ACE_WChar_Codeset_Translator *wchar_translator_;
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512 static int wchar_maxbytes_;
00513 };
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533 class ACE_Export ACE_InputCDR
00534 {
00535 public:
00536
00537
00538 friend class ACE_Char_Codeset_Translator;
00539 friend class ACE_WChar_Codeset_Translator;
00540
00541
00542
00543
00544
00545
00546
00547
00548 ACE_InputCDR (const char *buf,
00549 size_t bufsiz,
00550 int byte_order = ACE_CDR_BYTE_ORDER,
00551 ACE_CDR::Octet major_version =
00552 ACE_CDR_GIOP_MAJOR_VERSION,
00553 ACE_CDR::Octet minor_version =
00554 ACE_CDR_GIOP_MINOR_VERSION);
00555
00556
00557
00558 ACE_InputCDR (size_t bufsiz,
00559 int byte_order = ACE_CDR_BYTE_ORDER,
00560 ACE_CDR::Octet major_version =
00561 ACE_CDR_GIOP_MAJOR_VERSION,
00562 ACE_CDR::Octet minor_version =
00563 ACE_CDR_GIOP_MINOR_VERSION);
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573 ACE_InputCDR (const ACE_Message_Block *data,
00574 int byte_order = ACE_CDR_BYTE_ORDER,
00575 ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
00576 ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION,
00577 ACE_Lock* lock = 0);
00578
00579
00580
00581
00582 ACE_InputCDR (ACE_Data_Block *data,
00583 ACE_Message_Block::Message_Flags flag = 0,
00584 int byte_order = ACE_CDR_BYTE_ORDER,
00585 ACE_CDR::Octet major_version =
00586 ACE_CDR_GIOP_MAJOR_VERSION,
00587 ACE_CDR::Octet minor_version =
00588 ACE_CDR_GIOP_MINOR_VERSION);
00589
00590
00591
00592
00593
00594 ACE_InputCDR (ACE_Data_Block *data,
00595 ACE_Message_Block::Message_Flags flag,
00596 size_t read_pointer_position,
00597 size_t write_pointer_position,
00598 int byte_order = ACE_CDR_BYTE_ORDER,
00599 ACE_CDR::Octet major_version =
00600 ACE_CDR_GIOP_MAJOR_VERSION,
00601 ACE_CDR::Octet minor_version =
00602 ACE_CDR_GIOP_MINOR_VERSION);
00603
00604
00605
00606
00607
00608
00609 ACE_InputCDR (const ACE_InputCDR& rhs);
00610
00611 ACE_InputCDR& operator= (const ACE_InputCDR& rhs);
00612
00613
00614
00615 ACE_InputCDR (const ACE_InputCDR& rhs,
00616 size_t size,
00617 ACE_CDR::Long offset);
00618
00619
00620
00621 ACE_InputCDR (const ACE_InputCDR& rhs,
00622 size_t size);
00623
00624
00625 ACE_InputCDR (const ACE_OutputCDR& rhs,
00626 ACE_Allocator* buffer_allocator = 0,
00627 ACE_Allocator* data_block_allocator = 0,
00628 ACE_Allocator* message_block_allocator = 0);
00629
00630
00631
00632
00633 struct ACE_Export Transfer_Contents
00634 {
00635 Transfer_Contents (ACE_InputCDR &rhs);
00636
00637 ACE_InputCDR &rhs_;
00638 };
00639
00640 ACE_InputCDR (Transfer_Contents rhs);
00641
00642
00643 ~ACE_InputCDR (void);
00644
00645
00646
00647
00648
00649 struct ACE_Export to_boolean
00650 {
00651 explicit to_boolean (ACE_CDR::Boolean &b);
00652 ACE_CDR::Boolean &ref_;
00653 };
00654
00655 struct ACE_Export to_char
00656 {
00657 explicit to_char (ACE_CDR::Char &c);
00658 ACE_CDR::Char &ref_;
00659 };
00660
00661 struct ACE_Export to_wchar
00662 {
00663 explicit to_wchar (ACE_CDR::WChar &wc);
00664 ACE_CDR::WChar &ref_;
00665 };
00666
00667 struct ACE_Export to_octet
00668 {
00669 explicit to_octet (ACE_CDR::Octet &o);
00670 ACE_CDR::Octet &ref_;
00671 };
00672
00673 struct ACE_Export to_string
00674 {
00675
00676
00677
00678
00679
00680 to_string (ACE_CDR::Char *&s,
00681 ACE_CDR::ULong b);
00682 to_string (const ACE_CDR::Char *&s,
00683 ACE_CDR::ULong b);
00684 const ACE_CDR::Char *&val_;
00685 ACE_CDR::ULong bound_;
00686 };
00687
00688 struct ACE_Export to_wstring
00689 {
00690
00691
00692
00693 to_wstring (ACE_CDR::WChar *&ws,
00694 ACE_CDR::ULong b);
00695 to_wstring (const ACE_CDR::WChar *&ws,
00696 ACE_CDR::ULong b);
00697 const ACE_CDR::WChar *&val_;
00698 ACE_CDR::ULong bound_;
00699 };
00700
00701
00702
00703
00704
00705
00706 ACE_CDR::Boolean read_boolean (ACE_CDR::Boolean& x);
00707 ACE_CDR::Boolean read_char (ACE_CDR::Char &x);
00708 ACE_CDR::Boolean read_wchar (ACE_CDR::WChar& x);
00709 ACE_CDR::Boolean read_octet (ACE_CDR::Octet& x);
00710 ACE_CDR::Boolean read_short (ACE_CDR::Short &x);
00711 ACE_CDR::Boolean read_ushort (ACE_CDR::UShort &x);
00712 ACE_CDR::Boolean read_long (ACE_CDR::Long &x);
00713 ACE_CDR::Boolean read_ulong (ACE_CDR::ULong &x);
00714 ACE_CDR::Boolean read_longlong (ACE_CDR::LongLong& x);
00715 ACE_CDR::Boolean read_ulonglong (ACE_CDR::ULongLong& x);
00716 ACE_CDR::Boolean read_float (ACE_CDR::Float &x);
00717 ACE_CDR::Boolean read_double (ACE_CDR::Double &x);
00718 ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x);
00719
00720 ACE_CDR::Boolean read_string (ACE_CDR::Char *&x);
00721 ACE_CDR::Boolean read_string (ACE_CString &x);
00722 ACE_CDR::Boolean read_wstring (ACE_CDR::WChar*& x);
00723
00724
00725
00726
00727
00728
00729
00730
00731 ACE_CDR::Boolean read_boolean_array (ACE_CDR::Boolean* x,
00732 ACE_CDR::ULong length);
00733 ACE_CDR::Boolean read_char_array (ACE_CDR::Char *x,
00734 ACE_CDR::ULong length);
00735 ACE_CDR::Boolean read_wchar_array (ACE_CDR::WChar* x,
00736 ACE_CDR::ULong length);
00737 ACE_CDR::Boolean read_octet_array (ACE_CDR::Octet* x,
00738 ACE_CDR::ULong length);
00739 ACE_CDR::Boolean read_short_array (ACE_CDR::Short *x,
00740 ACE_CDR::ULong length);
00741 ACE_CDR::Boolean read_ushort_array (ACE_CDR::UShort *x,
00742 ACE_CDR::ULong length);
00743 ACE_CDR::Boolean read_long_array (ACE_CDR::Long *x,
00744 ACE_CDR::ULong length);
00745 ACE_CDR::Boolean read_ulong_array (ACE_CDR::ULong *x,
00746 ACE_CDR::ULong length);
00747 ACE_CDR::Boolean read_longlong_array (ACE_CDR::LongLong* x,
00748 ACE_CDR::ULong length);
00749 ACE_CDR::Boolean read_ulonglong_array (ACE_CDR::ULongLong* x,
00750 ACE_CDR::ULong length);
00751 ACE_CDR::Boolean read_float_array (ACE_CDR::Float *x,
00752 ACE_CDR::ULong length);
00753 ACE_CDR::Boolean read_double_array (ACE_CDR::Double *x,
00754 ACE_CDR::ULong length);
00755 ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x,
00756 ACE_CDR::ULong length);
00757
00758
00759
00760
00761
00762
00763 ACE_CDR::Boolean skip_boolean (void);
00764 ACE_CDR::Boolean skip_char (void);
00765 ACE_CDR::Boolean skip_wchar (void);
00766 ACE_CDR::Boolean skip_octet (void);
00767 ACE_CDR::Boolean skip_short (void);
00768 ACE_CDR::Boolean skip_ushort (void);
00769 ACE_CDR::Boolean skip_long (void);
00770 ACE_CDR::Boolean skip_ulong (void);
00771 ACE_CDR::Boolean skip_longlong (void);
00772 ACE_CDR::Boolean skip_ulonglong (void);
00773 ACE_CDR::Boolean skip_float (void);
00774 ACE_CDR::Boolean skip_double (void);
00775 ACE_CDR::Boolean skip_longdouble (void);
00776
00777
00778
00779
00780
00781
00782
00783 ACE_CDR::Boolean skip_wstring (void);
00784 ACE_CDR::Boolean skip_string (void);
00785
00786
00787
00788
00789
00790 ACE_CDR::Boolean skip_bytes (size_t n);
00791
00792
00793 bool good_bit (void) const;
00794
00795
00796
00797
00798
00799
00800
00801
00802 const ACE_Message_Block* start (void) const;
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812 int grow (size_t newsize);
00813
00814
00815
00816
00817
00818
00819 void reset_byte_order (int byte_order);
00820
00821
00822
00823 void reset (const ACE_Message_Block *data,
00824 int byte_order);
00825
00826
00827 ACE_Message_Block *steal_contents (void);
00828
00829
00830
00831 void steal_from (ACE_InputCDR &cdr);
00832
00833
00834
00835
00836
00837
00838 void exchange_data_blocks (ACE_InputCDR &cdr);
00839
00840
00841
00842
00843
00844
00845
00846
00847 ACE_Data_Block* clone_from (ACE_InputCDR &cdr);
00848
00849
00850
00851 void reset_contents (void);
00852
00853
00854 char* rd_ptr (void);
00855
00856
00857 char* wr_ptr (void);
00858
00859
00860 size_t length (void) const;
00861
00862
00863
00864
00865
00866
00867
00868
00869 int align_read_ptr (size_t alignment);
00870
00871
00872
00873 bool do_byte_swap (void) const;
00874
00875
00876
00877 int byte_order (void) const;
00878
00879
00880 ACE_Char_Codeset_Translator *char_translator (void) const;
00881 ACE_WChar_Codeset_Translator *wchar_translator (void) const;
00882
00883
00884 void char_translator (ACE_Char_Codeset_Translator *);
00885 void wchar_translator (ACE_WChar_Codeset_Translator *);
00886
00887
00888
00889
00890
00891
00892
00893 int adjust (size_t size,
00894 char *&buf);
00895
00896
00897
00898 int adjust (size_t size,
00899 size_t align,
00900 char *&buf);
00901
00902
00903 int set_version (ACE_CDR::Octet major,
00904 ACE_CDR::Octet minor);
00905
00906
00907 int get_version (ACE_CDR::Octet &major,
00908 ACE_CDR::Octet &minor);
00909
00910 protected:
00911
00912
00913
00914 ACE_Message_Block start_;
00915
00916
00917
00918 bool do_byte_swap_;
00919
00920
00921 bool good_bit_;
00922
00923
00924 ACE_CDR::Octet major_version_;
00925 ACE_CDR::Octet minor_version_;
00926
00927
00928 ACE_Char_Codeset_Translator *char_translator_;
00929 ACE_WChar_Codeset_Translator *wchar_translator_;
00930
00931 private:
00932
00933 ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x);
00934 ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x);
00935 ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x);
00936 ACE_CDR::Boolean read_8 (ACE_CDR::ULongLong *x);
00937 ACE_CDR::Boolean read_16 (ACE_CDR::LongDouble *x);
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958 ACE_CDR::Boolean read_array (void* x,
00959 size_t size,
00960 size_t align,
00961 ACE_CDR::ULong length);
00962
00963
00964
00965
00966
00967
00968
00969 ACE_CDR::Boolean read_wchar_array_i (ACE_CDR::WChar * x,
00970 ACE_CDR::ULong length);
00971
00972
00973 void rd_ptr (size_t offset);
00974
00975
00976 char* end (void);
00977 };
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995 class ACE_Export ACE_Char_Codeset_Translator
00996 {
00997 public:
00998 virtual ~ACE_Char_Codeset_Translator ();
00999
01000
01001
01002 virtual ACE_CDR::Boolean read_char (ACE_InputCDR&,
01003 ACE_CDR::Char&) = 0;
01004
01005
01006
01007 virtual ACE_CDR::Boolean read_string (ACE_InputCDR&,
01008 ACE_CDR::Char *&) = 0;
01009
01010
01011
01012 virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&,
01013 ACE_CDR::Char*,
01014 ACE_CDR::ULong) = 0;
01015
01016
01017
01018 virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&,
01019 ACE_CDR::Char) = 0;
01020
01021
01022
01023 virtual ACE_CDR::Boolean write_string (ACE_OutputCDR&,
01024 ACE_CDR::ULong,
01025 const ACE_CDR::Char*) = 0;
01026
01027
01028
01029 virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR&,
01030 const ACE_CDR::Char*,
01031 ACE_CDR::ULong) = 0;
01032
01033 virtual ACE_CDR::ULong ncs () = 0;
01034 virtual ACE_CDR::ULong tcs () = 0;
01035 protected:
01036
01037
01038 ACE_CDR::Boolean read_1 (ACE_InputCDR& input,
01039 ACE_CDR::Octet *x);
01040 ACE_CDR::Boolean write_1 (ACE_OutputCDR& output,
01041 const ACE_CDR::Octet *x);
01042
01043
01044
01045 ACE_CDR::Boolean read_array (ACE_InputCDR& input,
01046 void* x,
01047 size_t size,
01048 size_t align,
01049 ACE_CDR::ULong length);
01050
01051
01052
01053
01054
01055
01056
01057 ACE_CDR::Boolean write_array (ACE_OutputCDR& output,
01058 const void *x,
01059 size_t size,
01060 size_t align,
01061 ACE_CDR::ULong length);
01062
01063
01064
01065
01066
01067
01068
01069
01070 int adjust (ACE_OutputCDR& out,
01071 size_t size,
01072 size_t align,
01073 char *&buf);
01074
01075
01076 void good_bit (ACE_OutputCDR& out, bool bit);
01077
01078
01079 ACE_CDR::Octet major_version (ACE_InputCDR& input);
01080 ACE_CDR::Octet minor_version (ACE_InputCDR& input);
01081 ACE_CDR::Octet major_version (ACE_OutputCDR& output);
01082 ACE_CDR::Octet minor_version (ACE_OutputCDR& output);
01083 };
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097 class ACE_Export ACE_WChar_Codeset_Translator
01098 {
01099 public:
01100 virtual ~ACE_WChar_Codeset_Translator ();
01101
01102 virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&,
01103 ACE_CDR::WChar&) = 0;
01104 virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&,
01105 ACE_CDR::WChar *&) = 0;
01106 virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR&,
01107 ACE_CDR::WChar*,
01108 ACE_CDR::ULong) = 0;
01109 virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR&,
01110 ACE_CDR::WChar) = 0;
01111 virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR&,
01112 ACE_CDR::ULong,
01113 const ACE_CDR::WChar*) = 0;
01114 virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR&,
01115 const ACE_CDR::WChar*,
01116 ACE_CDR::ULong) = 0;
01117
01118 virtual ACE_CDR::ULong ncs () = 0;
01119 virtual ACE_CDR::ULong tcs () = 0;
01120 protected:
01121
01122
01123 ACE_CDR::Boolean read_1 (ACE_InputCDR& input,
01124 ACE_CDR::Octet *x);
01125 ACE_CDR::Boolean read_2 (ACE_InputCDR& input,
01126 ACE_CDR::UShort *x);
01127 ACE_CDR::Boolean read_4 (ACE_InputCDR& input,
01128 ACE_CDR::ULong *x);
01129 ACE_CDR::Boolean write_1 (ACE_OutputCDR& output,
01130 const ACE_CDR::Octet *x);
01131 ACE_CDR::Boolean write_2 (ACE_OutputCDR& output,
01132 const ACE_CDR::UShort *x);
01133 ACE_CDR::Boolean write_4 (ACE_OutputCDR& output,
01134 const ACE_CDR::ULong *x);
01135
01136
01137
01138 ACE_CDR::Boolean read_array (ACE_InputCDR& input,
01139 void* x,
01140 size_t size,
01141 size_t align,
01142 ACE_CDR::ULong length);
01143
01144
01145
01146
01147
01148
01149
01150 ACE_CDR::Boolean write_array (ACE_OutputCDR& output,
01151 const void *x,
01152 size_t size,
01153 size_t align,
01154 ACE_CDR::ULong length);
01155
01156
01157
01158
01159
01160
01161
01162
01163 int adjust (ACE_OutputCDR& out,
01164 size_t size,
01165 size_t align,
01166 char *&buf);
01167
01168
01169 void good_bit (ACE_OutputCDR& out, bool bit);
01170
01171
01172 ACE_CDR::Octet major_version (ACE_InputCDR& input);
01173 ACE_CDR::Octet minor_version (ACE_InputCDR& input);
01174 ACE_CDR::Octet major_version (ACE_OutputCDR& output);
01175 ACE_CDR::Octet minor_version (ACE_OutputCDR& output);
01176
01177 };
01178
01179
01180
01181 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01182 const ACE_CString &x);
01183
01184 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01185 ACE_CString &x);
01186
01187
01188 ACE_END_VERSIONED_NAMESPACE_DECL
01189
01190 #if defined (__ACE_INLINE__)
01191 # include "ace/CDR_Stream.inl"
01192 #else
01193
01194 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
01195
01196
01197 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01198 ACE_CDR::Char x);
01199
01200
01201 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01202 ACE_CDR::Short x);
01203 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01204 ACE_CDR::UShort x);
01205 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01206 ACE_CDR::Long x);
01207 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01208 ACE_CDR::ULong x);
01209 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01210 ACE_CDR::LongLong x);
01211 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01212 ACE_CDR::ULongLong x);
01213 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR& os,
01214 ACE_CDR::LongDouble x);
01215 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01216 ACE_CDR::Float x);
01217 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01218 ACE_CDR::Double x);
01219
01220
01221
01222 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01223 ACE_OutputCDR::from_boolean x);
01224 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01225 ACE_OutputCDR::from_char x);
01226 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01227 ACE_OutputCDR::from_wchar x);
01228 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01229 ACE_OutputCDR::from_octet x);
01230 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01231 ACE_OutputCDR::from_string x);
01232 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01233 ACE_OutputCDR::from_wstring x);
01234 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01235 const ACE_CDR::Char* x);
01236 extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
01237 const ACE_CDR::WChar* x);
01238
01239
01240 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01241 ACE_CDR::Char &x);
01242
01243
01244 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01245 ACE_CDR::Short &x);
01246 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01247 ACE_CDR::UShort &x);
01248 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01249 ACE_CDR::Long &x);
01250 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01251 ACE_CDR::ULong &x);
01252 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01253 ACE_CDR::LongLong &x);
01254 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01255 ACE_CDR::ULongLong &x);
01256 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01257 ACE_CDR::LongDouble &x);
01258 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01259 ACE_CDR::Float &x);
01260 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01261 ACE_CDR::Double &x);
01262
01263
01264
01265 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01266 ACE_InputCDR::to_boolean x);
01267 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01268 ACE_InputCDR::to_char x);
01269 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01270 ACE_InputCDR::to_wchar x);
01271 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01272 ACE_InputCDR::to_octet x);
01273 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01274 ACE_InputCDR::to_string x);
01275 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01276 ACE_InputCDR::to_wstring x);
01277 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01278 ACE_CDR::Char*& x);
01279 extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
01280 ACE_CDR::WChar*& x);
01281
01282 ACE_END_VERSIONED_NAMESPACE_DECL
01283
01284 #endif
01285
01286 #include "ace/post.h"
01287
01288 #endif