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
00041
00042 #ifndef TAO_CDR_H
00043 #define TAO_CDR_H
00044
00045 #include "ace/pre.h"
00046
00047 #include "tao/orbconf.h"
00048
00049 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00050 # pragma once
00051 #endif
00052
00053 #include "tao/TAO_Export.h"
00054 #include "tao/Basic_Types.h"
00055 #include "tao/GIOP_Message_Version.h"
00056 #include "tao/Message_Semantics.h"
00057 #include "tao/Intrusive_Ref_Count_Handle_T.h"
00058 #include "tao/Intrusive_Ref_Count_Object_T.h"
00059
00060 #include "ace/CDR_Stream.h"
00061 #include "ace/SString.h"
00062 #include "ace/Hash_Map_Manager_T.h"
00063 #include "ace/Null_Mutex.h"
00064
00065 #include <string>
00066
00067 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00068
00069 class TAO_ORB_Core;
00070 class TAO_GIOP_Fragmentation_Strategy;
00071 class TAO_Stub;
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 class TAO_Export TAO_OutputCDR : public ACE_OutputCDR
00092 {
00093 public:
00094
00095 friend class TAO_InputCDR;
00096 typedef ACE_Hash_Map_Manager<ACE_CString, char*, ACE_Null_Mutex> Repo_Id_Map;
00097 typedef Repo_Id_Map Codebase_URL_Map;
00098 typedef ACE_Hash_Map_Manager<void*, char*, ACE_Null_Mutex> Value_Map;
00099
00100 typedef TAO_Intrusive_Ref_Count_Object<Repo_Id_Map, ACE_Null_Mutex> RC_Repo_Id_Map;
00101 typedef TAO_Intrusive_Ref_Count_Object<Codebase_URL_Map, ACE_Null_Mutex> RC_Codebase_URL_Map;
00102 typedef TAO_Intrusive_Ref_Count_Object<Value_Map, ACE_Null_Mutex> RC_Value_Map;
00103
00104 typedef TAO_Intrusive_Ref_Count_Handle<RC_Repo_Id_Map> Repo_Id_Map_Handle;
00105 typedef TAO_Intrusive_Ref_Count_Handle<RC_Codebase_URL_Map> Codebase_URL_Map_Handle;
00106 typedef TAO_Intrusive_Ref_Count_Handle<RC_Value_Map> Value_Map_Handle;
00107
00108
00109
00110
00111
00112
00113
00114
00115 TAO_OutputCDR (size_t size = 0,
00116 int byte_order = ACE_CDR_BYTE_ORDER,
00117 ACE_Allocator* buffer_allocator = 0,
00118 ACE_Allocator* data_block_allocator = 0,
00119 ACE_Allocator* message_block_allocator = 0,
00120 size_t memcpy_tradeoff = 0,
00121 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00122 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR);
00123
00124
00125
00126 TAO_OutputCDR (char *data,
00127 size_t size,
00128 int byte_order = ACE_CDR_BYTE_ORDER,
00129 ACE_Allocator* buffer_allocator = 0,
00130 ACE_Allocator* data_block_allocator = 0,
00131 ACE_Allocator* message_block_allocator = 0,
00132 size_t memcpy_tradeoff = 0,
00133 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00134 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR);
00135
00136
00137
00138
00139 TAO_OutputCDR (char *data,
00140 size_t size,
00141 int byte_order,
00142 ACE_Allocator* buffer_allocator,
00143 ACE_Allocator* data_block_allocator,
00144 ACE_Allocator* message_block_allocator,
00145 size_t memcpy_tradeoff,
00146 TAO_GIOP_Fragmentation_Strategy * fs,
00147 ACE_CDR::Octet major_version,
00148 ACE_CDR::Octet minor_version);
00149
00150
00151
00152 TAO_OutputCDR (ACE_Message_Block *data,
00153 int byte_order = ACE_CDR_BYTE_ORDER,
00154 size_t memcpy_tradeoff = 0,
00155 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00156 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR);
00157
00158
00159
00160 TAO_OutputCDR (ACE_Data_Block *data,
00161 int byte_order = ACE_CDR_BYTE_ORDER,
00162 ACE_Allocator* message_block_allocator = 0,
00163 size_t memcpy_tradeoff = 0,
00164 TAO_GIOP_Fragmentation_Strategy * fs = 0,
00165 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00166 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR);
00167
00168
00169 ~TAO_OutputCDR (void);
00170
00171
00172
00173
00174
00175 static void throw_stub_exception (int error_num);
00176 static void throw_skel_exception (int error_num);
00177
00178 void get_version (TAO_GIOP_Message_Version& giop_version);
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 bool fragment_stream (ACE_CDR::ULong pending_alignment,
00193 ACE_CDR::ULong pending_length);
00194
00195
00196 bool more_fragments (void) const;
00197
00198
00199 void more_fragments (bool more);
00200
00201
00202 void message_attributes (CORBA::ULong request_id,
00203 TAO_Stub * stub,
00204 TAO_Message_Semantics message_semantics,
00205 ACE_Time_Value * timeout);
00206
00207
00208 CORBA::ULong request_id (void) const;
00209
00210
00211 TAO_Stub * stub (void) const;
00212
00213
00214 TAO_Message_Semantics message_semantics (void) const;
00215
00216
00217 ACE_Time_Value * timeout (void) const;
00218
00219
00220
00221
00222 Repo_Id_Map_Handle& get_repo_id_map ();
00223 #ifdef TAO_HAS_VALUETYPE_CODEBASE
00224 Codebase_URL_Map_Handle& get_codebase_url_map ();
00225 #endif
00226 Value_Map_Handle& get_value_map ();
00227
00228
00229
00230
00231 void set_repo_id_map (Repo_Id_Map_Handle& map);
00232 #ifdef TAO_HAS_VALUETYPE_CODEBASE
00233 Codebase_URL_Map_Handle& get_codebase_url_map ();
00234 void set_codebase_url_map (Codebase_URL_Map_Handle& map);
00235 #endif
00236 void set_value_map (Value_Map_Handle& map);
00237
00238
00239
00240 void reset_vt_indirect_maps ();
00241
00242
00243 int offset (char* pos);
00244
00245 private:
00246
00247
00248 TAO_OutputCDR (const TAO_OutputCDR& rhs);
00249 TAO_OutputCDR& operator= (const TAO_OutputCDR& rhs);
00250
00251 private:
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 TAO_GIOP_Fragmentation_Strategy * const fragmentation_strategy_;
00263
00264
00265 bool more_fragments_;
00266
00267
00268 CORBA::ULong request_id_;
00269
00270
00271 TAO_Stub * stub_;
00272
00273
00274
00275
00276
00277 TAO_Message_Semantics message_semantics_;
00278
00279
00280 ACE_Time_Value * timeout_;
00281
00282
00283
00284 Repo_Id_Map_Handle repo_id_map_;
00285 #ifdef TAO_HAS_VALUETYPE_CODEBASE
00286 Codebase_URL_Map_Handle codebase_map_;
00287 #endif
00288 Value_Map_Handle value_map_;
00289 };
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311 class TAO_Export TAO_InputCDR : public ACE_InputCDR
00312 {
00313 public:
00314 typedef ACE_Hash_Map_Manager<void*, ACE_CString, ACE_Null_Mutex> Repo_Id_Map;
00315 typedef Repo_Id_Map Codebase_URL_Map;
00316 typedef ACE_Hash_Map_Manager<void*, void*, ACE_Null_Mutex> Value_Map;
00317
00318 typedef TAO_Intrusive_Ref_Count_Object<Repo_Id_Map, ACE_Null_Mutex> RC_Repo_Id_Map;
00319 typedef TAO_Intrusive_Ref_Count_Object<Codebase_URL_Map, ACE_Null_Mutex> RC_Codebase_URL_Map;
00320 typedef TAO_Intrusive_Ref_Count_Object<Value_Map, ACE_Null_Mutex> RC_Value_Map;
00321
00322 typedef TAO_Intrusive_Ref_Count_Handle<RC_Repo_Id_Map> Repo_Id_Map_Handle;
00323 typedef TAO_Intrusive_Ref_Count_Handle<RC_Codebase_URL_Map> Codebase_URL_Map_Handle;
00324 typedef TAO_Intrusive_Ref_Count_Handle<RC_Value_Map> Value_Map_Handle;
00325
00326
00327
00328
00329
00330
00331 TAO_InputCDR (const char* buf,
00332 size_t bufsiz,
00333 int byte_order = ACE_CDR_BYTE_ORDER,
00334 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00335 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR,
00336 TAO_ORB_Core* orb_core = 0);
00337
00338
00339
00340 TAO_InputCDR (size_t bufsiz,
00341 int byte_order = ACE_CDR_BYTE_ORDER,
00342 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00343 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR,
00344 TAO_ORB_Core* orb_core = 0);
00345
00346
00347 TAO_InputCDR (const ACE_Message_Block *data,
00348 int byte_order = ACE_CDR_BYTE_ORDER,
00349 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00350 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR,
00351 TAO_ORB_Core* orb_core = 0);
00352
00353
00354
00355 TAO_InputCDR (const ACE_Message_Block *data,
00356 ACE_Lock* lock,
00357 int byte_order = ACE_CDR_BYTE_ORDER,
00358 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00359 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR,
00360 TAO_ORB_Core* orb_core = 0);
00361
00362
00363
00364 TAO_InputCDR (ACE_Data_Block *data,
00365 ACE_Message_Block::Message_Flags flag = 0,
00366 int byte_order = ACE_CDR_BYTE_ORDER,
00367 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00368 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR,
00369 TAO_ORB_Core* orb_core = 0);
00370
00371
00372 TAO_InputCDR (ACE_Data_Block *data,
00373 ACE_Message_Block::Message_Flags flag,
00374 size_t read_pointer_position,
00375 size_t write_pointer_position,
00376 int byte_order = ACE_CDR_BYTE_ORDER,
00377 ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
00378 ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR,
00379 TAO_ORB_Core* orb_core = 0);
00380
00381
00382
00383
00384
00385
00386 TAO_InputCDR (const TAO_InputCDR& rhs);
00387
00388
00389
00390 TAO_InputCDR (const TAO_InputCDR& rhs,
00391 size_t size,
00392 ACE_CDR::Long offset);
00393
00394
00395
00396
00397
00398
00399
00400
00401 TAO_InputCDR (const TAO_InputCDR& rhs,
00402 size_t size);
00403
00404
00405 TAO_InputCDR (const TAO_OutputCDR& rhs,
00406 ACE_Allocator* buffer_allocator = 0,
00407 ACE_Allocator* data_block_allocator = 0,
00408 ACE_Allocator* message_block_allocator = 0,
00409 TAO_ORB_Core* orb_core = 0);
00410
00411
00412
00413 TAO_InputCDR (ACE_InputCDR::Transfer_Contents rhs,
00414 TAO_ORB_Core* orb_core = 0);
00415
00416
00417 ~TAO_InputCDR (void);
00418
00419
00420
00421
00422 TAO_ORB_Core *orb_core (void) const;
00423
00424 ACE_Message_Block::Message_Flags
00425 clr_mb_flags( ACE_Message_Block::Message_Flags less_flags );
00426
00427
00428 static void throw_stub_exception (int error_num);
00429 static void throw_skel_exception (int error_num);
00430
00431
00432
00433 Repo_Id_Map_Handle& get_repo_id_map ();
00434 Codebase_URL_Map_Handle& get_codebase_url_map ();
00435 Value_Map_Handle& get_value_map ();
00436
00437
00438
00439
00440 void set_repo_id_map (Repo_Id_Map_Handle& map);
00441 void set_codebase_url_map (Codebase_URL_Map_Handle& map);
00442 void set_value_map (Value_Map_Handle& map);
00443
00444
00445
00446 void reset_vt_indirect_maps ();
00447
00448 private:
00449
00450 TAO_ORB_Core* orb_core_;
00451
00452
00453 Repo_Id_Map_Handle repo_id_map_;
00454 Codebase_URL_Map_Handle codebase_map_;
00455 Value_Map_Handle value_map_;
00456 };
00457
00458 TAO_END_VERSIONED_NAMESPACE_DECL
00459
00460 #if defined(__ACE_INLINE__)
00461 # include "tao/CDR.inl"
00462 #else
00463
00464 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00465
00466
00467
00468 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00469 CORBA::Short x);
00470 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00471 CORBA::UShort x);
00472 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00473 CORBA::Long x);
00474 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00475 CORBA::ULong x);
00476 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00477 CORBA::LongLong x);
00478 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00479 CORBA::ULongLong x);
00480 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR& os,
00481 CORBA::LongDouble x);
00482 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00483 CORBA::Float x);
00484 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00485 CORBA::Double x);
00486 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00487 const CORBA::Char* x);
00488 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00489 const CORBA::WChar* x);
00490 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00491 ACE_OutputCDR::from_string x);
00492 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00493 ACE_OutputCDR::from_wstring x);
00494 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
00495 const std::string &x);
00496
00497
00498
00499 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00500 CORBA::Short &x);
00501 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00502 CORBA::UShort &x);
00503 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00504 CORBA::Long &x);
00505 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00506 CORBA::ULong &x);
00507 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00508 CORBA::LongLong &x);
00509 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00510 CORBA::ULongLong &x);
00511 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00512 CORBA::LongDouble &x);
00513 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00514 CORBA::Float &x);
00515 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00516 CORBA::Double &x);
00517 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00518 CORBA::Char* &x);
00519 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
00520 CORBA::WChar* &x);
00521 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os,
00522 ACE_InputCDR::to_string x);
00523 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os,
00524 ACE_InputCDR::to_wstring x);
00525 TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os,
00526 std::string &x);
00527
00528 TAO_END_VERSIONED_NAMESPACE_DECL
00529
00530 #endif
00531
00532 #include "ace/post.h"
00533 #endif