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