2 #include "tao/SystemException.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
8 TAO_OutputCDR::~TAO_OutputCDR ()
13 TAO_OutputCDR::more_fragments () const
15 return this->more_fragments_;
19 TAO_OutputCDR::more_fragments (bool more)
21 this->more_fragments_ = more;
25 TAO_OutputCDR::message_attributes (CORBA::ULong request_id,
27 TAO_Message_Semantics message_semantics,
28 ACE_Time_Value * timeout)
30 this->request_id_ = request_id;
32 this->message_semantics_ = message_semantics;
33 this->timeout_ = timeout;
36 ACE_INLINE CORBA::ULong
37 TAO_OutputCDR::request_id () const
39 return this->request_id_;
43 TAO_OutputCDR::stub () const
48 ACE_INLINE TAO_Message_Semantics
49 TAO_OutputCDR::message_semantics () const
51 return this->message_semantics_;
54 ACE_INLINE ACE_Time_Value *
55 TAO_OutputCDR::timeout () const
57 return this->timeout_;
61 TAO_OutputCDR::get_version (TAO_GIOP_Message_Version& giop_version)
63 giop_version.set_version (this->major_version_, this->minor_version_);
66 ACE_INLINE TAO_OutputCDR::Repo_Id_Map_Handle&
67 TAO_OutputCDR::get_repo_id_map ()
69 return this->repo_id_map_;
72 #ifdef TAO_HAS_VALUETYPE_CODEBASE
73 ACE_INLINE TAO_OutputCDR::Codebase_URL_Map_Handle&
74 TAO_OutputCDR::get_codebase_url_map ()
76 return this->codebase_map_;
80 ACE_INLINE TAO_OutputCDR::Value_Map_Handle&
81 TAO_OutputCDR::get_value_map ()
83 return this->value_map_;
87 TAO_OutputCDR::set_repo_id_map (TAO_OutputCDR::Repo_Id_Map_Handle& map)
89 this->repo_id_map_ = map;
92 #ifdef TAO_HAS_VALUETYPE_CODEBASE
94 TAO_OutputCDR::set_codebase_url_map (TAO_OutputCDR::Codebase_URL_Map_Handle& map)
96 this->codebase_map_ = map;
101 TAO_OutputCDR::set_value_map (TAO_OutputCDR::Value_Map_Handle& map)
103 this->value_map_ = map;
107 TAO_OutputCDR::reset_vt_indirect_maps ()
109 if (! this->repo_id_map_.is_nil () && this->repo_id_map_->get()->current_size () != 0)
111 this->repo_id_map_->get()->unbind_all ();
113 #ifdef TAO_HAS_VALUETYPE_CODEBASE
114 if (! this->codebase_map_.is_nil () && this->codebase_map_->get()->current_size () != 0)
116 this->codebase_map_->get()->unbind_all ();
119 if (! this->value_map_.is_nil () && this->value_map_->get()->current_size () != 0)
121 this->value_map_->get()->unbind_all ();
125 // -------------------------------------------------------------------
128 TAO_InputCDR::TAO_InputCDR (const char *buf,
131 ACE_CDR::Octet major_version,
132 ACE_CDR::Octet minor_version,
133 TAO_ORB_Core* orb_core)
144 TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
146 ACE_CDR::Octet major_version,
147 ACE_CDR::Octet minor_version,
148 TAO_ORB_Core* orb_core)
149 : ACE_InputCDR (bufsiz,
158 TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
160 ACE_CDR::Octet major_version,
161 ACE_CDR::Octet minor_version,
162 TAO_ORB_Core* orb_core)
163 : ACE_InputCDR (data,
172 TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
175 ACE_CDR::Octet major_version,
176 ACE_CDR::Octet minor_version,
177 TAO_ORB_Core* orb_core)
178 : ACE_InputCDR (data,
188 TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
189 ACE_Message_Block::Message_Flags flag,
191 ACE_CDR::Octet major_version,
192 ACE_CDR::Octet minor_version,
193 TAO_ORB_Core* orb_core)
194 : ACE_InputCDR (data,
205 TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
206 ACE_Message_Block::Message_Flags flag,
210 ACE_CDR::Octet major_version,
211 ACE_CDR::Octet minor_version,
212 TAO_ORB_Core* orb_core)
213 : ACE_InputCDR (data,
226 TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
228 ACE_CDR::Long offset)
232 orb_core_ (rhs.orb_core_)
237 TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
241 orb_core_ (rhs.orb_core_)
246 TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs)
247 : ACE_InputCDR (rhs),
248 orb_core_ (rhs.orb_core_),
249 repo_id_map_ (rhs.repo_id_map_),
250 codebase_map_ (rhs.codebase_map_),
251 value_map_ (rhs.value_map_)
256 TAO_InputCDR::TAO_InputCDR (ACE_InputCDR::Transfer_Contents rhs,
257 TAO_ORB_Core* orb_core)
258 : ACE_InputCDR (rhs),
265 TAO_InputCDR::~TAO_InputCDR ()
269 ACE_INLINE TAO_ORB_Core*
270 TAO_InputCDR::orb_core () const
272 return this->orb_core_;
276 ACE_INLINE TAO_InputCDR::Repo_Id_Map_Handle&
277 TAO_InputCDR::get_repo_id_map ()
279 return this->repo_id_map_;
282 ACE_INLINE TAO_InputCDR::Codebase_URL_Map_Handle&
283 TAO_InputCDR::get_codebase_url_map ()
285 return this->codebase_map_;
288 ACE_INLINE TAO_InputCDR::Value_Map_Handle&
289 TAO_InputCDR::get_value_map ()
291 return this->value_map_;
295 TAO_InputCDR::set_repo_id_map (TAO_InputCDR::Repo_Id_Map_Handle& map)
297 this->repo_id_map_ = map;
301 TAO_InputCDR::set_codebase_url_map (TAO_InputCDR::Codebase_URL_Map_Handle& map)
303 this->codebase_map_ = map;
307 TAO_InputCDR::set_value_map (TAO_InputCDR::Value_Map_Handle& map)
309 this->value_map_ = map;
313 TAO_InputCDR::reset_vt_indirect_maps ()
315 if (! this->repo_id_map_.is_nil () && this->repo_id_map_->get()->current_size () != 0)
317 this->repo_id_map_->get()->unbind_all ();
319 if (! this->codebase_map_.is_nil () && this->codebase_map_->get()->current_size () != 0)
321 this->codebase_map_->get()->unbind_all ();
323 if (! this->value_map_.is_nil () && this->value_map_->get()->current_size () != 0)
325 this->value_map_->get()->unbind_all ();
329 // ****************************************************************
331 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
335 os.fragment_stream (ACE_CDR::SHORT_ALIGN,
336 sizeof (CORBA::Short))
337 && static_cast<ACE_OutputCDR &> (os) << x;
340 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
344 os.fragment_stream (ACE_CDR::SHORT_ALIGN,
345 sizeof (CORBA::UShort))
346 && static_cast<ACE_OutputCDR &> (os) << x;
349 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
353 os.fragment_stream (ACE_CDR::LONG_ALIGN,
354 sizeof (CORBA::Long))
355 && static_cast<ACE_OutputCDR &> (os) << x;
358 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
362 os.fragment_stream (ACE_CDR::LONG_ALIGN,
363 sizeof (CORBA::ULong))
364 && static_cast<ACE_OutputCDR &> (os) << x;
367 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
371 os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
372 sizeof (CORBA::LongLong))
373 && static_cast<ACE_OutputCDR &> (os) << x;
376 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
380 os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
381 sizeof (CORBA::ULongLong))
382 && static_cast<ACE_OutputCDR &> (os) << x;
385 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR& os,
389 os.fragment_stream (ACE_CDR::LONGDOUBLE_ALIGN,
390 sizeof (CORBA::LongDouble))
391 && static_cast<ACE_OutputCDR &> (os) << x;
394 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
398 os.fragment_stream (ACE_CDR::LONG_ALIGN,
399 sizeof (CORBA::Float))
400 && static_cast<ACE_OutputCDR &> (os) << x;
403 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
407 os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
408 sizeof (CORBA::Double))
409 && static_cast<ACE_OutputCDR &> (os) << x;
412 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
416 os.fragment_stream (ACE_CDR::OCTET_ALIGN,
418 && static_cast<ACE_OutputCDR &> (os) << x;
421 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
422 const CORBA::WChar * x)
425 os.fragment_stream ((sizeof (CORBA::WChar) == 2
426 ? ACE_CDR::SHORT_ALIGN
427 : ACE_CDR::LONG_ALIGN),
428 sizeof (CORBA::WChar))
429 && static_cast<ACE_OutputCDR &> (os) << x;
432 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
433 ACE_OutputCDR::from_string x)
435 if (x.bound_ != 0 && x.val_ != 0 &&
436 std::strlen (x.val_) > x.bound_)
438 throw CORBA::BAD_PARAM ();
443 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
444 ACE_OutputCDR::from_wstring x)
446 if (x.bound_ != 0 && x.val_ != 0 &&
447 ACE_OS::strlen (x.val_) > x.bound_)
449 throw CORBA::BAD_PARAM ();
454 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
455 const std::string &x)
458 os.fragment_stream (ACE_CDR::OCTET_ALIGN,
460 && static_cast<ACE_OutputCDR &> (os) << x;
463 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
464 ACE_OutputCDR::from_std_string x)
467 static_cast<ACE_CDR::ULong> (x.val_.size ()) > x.bound_)
469 throw CORBA::BAD_PARAM ();
474 #if !defined(ACE_LACKS_STD_WSTRING)
475 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
476 const std::wstring &x)
479 os.fragment_stream ((sizeof (CORBA::WChar) == 2
480 ? ACE_CDR::SHORT_ALIGN
481 : ACE_CDR::LONG_ALIGN),
482 sizeof (CORBA::WChar))
483 && static_cast<ACE_OutputCDR &> (os) << x;
486 ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
487 ACE_OutputCDR::from_std_wstring x)
490 static_cast<ACE_CDR::ULong> (x.val_.size ()) > x.bound_)
492 throw CORBA::BAD_PARAM ();
496 #endif /* ACE_LACKS_STD_WSTRING */
498 // ****************************************************************
500 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
503 return static_cast<ACE_InputCDR &> (is) >> x;
506 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
509 return static_cast<ACE_InputCDR &> (is) >> x;
512 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
515 return static_cast<ACE_InputCDR&> (is) >> x;
518 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
521 return static_cast<ACE_InputCDR &> (is) >> x;
524 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
527 return static_cast<ACE_InputCDR &> (is) >> x;
530 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
533 return static_cast<ACE_InputCDR &> (is) >> x;
536 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
537 CORBA::LongDouble &x)
539 return static_cast<ACE_InputCDR &> (is) >> x;
542 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
545 return static_cast<ACE_InputCDR &> (is) >> x;
548 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
551 return static_cast<ACE_InputCDR &> (is) >> x;
554 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
557 return static_cast<ACE_InputCDR &> (is) >> x;
560 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
563 return static_cast<ACE_InputCDR &> (is) >> x;
566 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
567 ACE_InputCDR::to_string x)
569 CORBA::Boolean const marshal_flag =
570 is >> const_cast<ACE_CDR::Char *&> (x.val_);
571 if (marshal_flag && x.bound_ != 0 && x.val_ != 0 &&
572 std::strlen (x.val_) > x.bound_)
574 throw CORBA::BAD_PARAM ();
579 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
580 ACE_InputCDR::to_wstring x)
582 CORBA::Boolean const marshal_flag =
583 is >> const_cast<ACE_CDR::WChar *&> (x.val_);
584 if (marshal_flag && x.bound_ != 0 && x.val_ != 0 &&
585 ACE_OS::strlen (x.val_) > x.bound_)
587 throw CORBA::BAD_PARAM ();
592 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
595 return static_cast<ACE_InputCDR &> (is) >> x;
598 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
599 ACE_InputCDR::to_std_string x)
601 CORBA::Boolean const marshal_flag = is >> x.val_;
602 if (marshal_flag && x.bound_ != 0 && x.val_.size () > x.bound_)
604 throw CORBA::BAD_PARAM ();
609 #if !defined(ACE_LACKS_STD_WSTRING)
610 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
613 return static_cast<ACE_InputCDR &> (is) >> x;
616 ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
617 ACE_InputCDR::to_std_wstring x)
619 CORBA::Boolean const marshal_flag = is >> x.val_;
620 if (marshal_flag && x.bound_ != 0 && x.val_.size () > x.bound_)
622 throw CORBA::BAD_PARAM ();
626 #endif /* ACE_LACKS_STD_WSTRING */
628 TAO_END_VERSIONED_NAMESPACE_DECL