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