summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-06 04:54:01 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-06 04:54:01 +0000
commite74c289222f80e1b8e84bf57ab5dd1101ed7f772 (patch)
tree4472003d64ac0756057b85a56720b714216a0198 /TAO
parent0d8ee7e4258f06f26d0a9dbb467ecf573dc5d689 (diff)
downloadATCD-e74c289222f80e1b8e84bf57ab5dd1101ed7f772.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO')
-rw-r--r--TAO/tao/Any.h80
-rw-r--r--TAO/tao/Any.i66
-rw-r--r--TAO/tao/CDR.cpp939
-rw-r--r--TAO/tao/CDR.h545
-rw-r--r--TAO/tao/CDR.i1035
-rw-r--r--TAO/tao/Connect.cpp4
-rw-r--r--TAO/tao/GIOP.cpp4
-rw-r--r--TAO/tao/Invocation.cpp1
-rw-r--r--TAO/tao/Invocation.i3
-rw-r--r--TAO/tao/ORB.cpp14
-rw-r--r--TAO/tao/ORB.h104
-rw-r--r--TAO/tao/ORB_Core.cpp2
-rw-r--r--TAO/tao/corba.h1
-rw-r--r--TAO/tao/orbconf.h48
-rw-r--r--TAO/tao/params.cpp2
15 files changed, 221 insertions, 2627 deletions
diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h
index 32dca6c5094..b6483c9f79b 100644
--- a/TAO/tao/Any.h
+++ b/TAO/tao/Any.h
@@ -165,41 +165,15 @@ public:
// = Special types.
// These are needed for insertion and extraction of booleans,
- // octets, chars, and bounded strings.
+ // octets, chars, and bounded strings. CORBA spec requires
+ // that they be here, we just typedef to the already-defined
+ // ACE_OutputCDR types.
- struct TAO_Export from_boolean
- {
- from_boolean (CORBA::Boolean b);
- CORBA::Boolean val_;
- };
-
- struct TAO_Export from_octet
- {
- from_octet (CORBA::Octet o);
- CORBA::Octet val_;
- };
-
- struct TAO_Export from_char
- {
- from_char (CORBA::Char c);
- CORBA::Char val_;
- };
-
- struct TAO_Export from_wchar
- {
- from_wchar (CORBA::WChar wc);
- CORBA::WChar val_;
- };
-
- struct TAO_Export from_string
- {
- from_string (char* s,
- CORBA::ULong b,
- CORBA::Boolean nocopy = 0);
- char *val_;
- CORBA::ULong bound_;
- CORBA::Boolean nocopy_;
- };
+ typedef ACE_OutputCDR::from_boolean from_boolean;
+ typedef ACE_OutputCDR::from_octet from_octet;
+ typedef ACE_OutputCDR::from_char from_char;
+ typedef ACE_OutputCDR::from_wchar from_wchar;
+ typedef ACE_OutputCDR::from_string from_string;
void operator<<= (from_boolean);
// insert a boolean
@@ -219,39 +193,15 @@ public:
// = Special types.
// These extract octets, chars, booleans, bounded strings, and
- // object references
+ // object references. All these are defined in ACE_InputCDR.
- struct TAO_Export to_boolean
- {
- to_boolean (CORBA::Boolean &b);
- CORBA::Boolean &ref_;
- };
-
- struct TAO_Export to_char
- {
- to_char (CORBA::Char &c);
- CORBA::Char &ref_;
- };
-
- struct TAO_Export to_wchar
- {
- to_wchar (CORBA::WChar &wc);
- CORBA::WChar &ref_;
- };
-
- struct TAO_Export to_octet
- {
- to_octet (CORBA::Octet &o);
- CORBA::Octet &ref_;
- };
-
- struct TAO_Export to_string
- {
- to_string (char *&s, CORBA::ULong b);
- char *&val_;
- CORBA::ULong bound_;
- };
+ typedef ACE_InputCDR::to_boolean to_boolean;
+ typedef ACE_InputCDR::to_char to_char;
+ typedef ACE_InputCDR::to_wchar to_wchar;
+ typedef ACE_InputCDR::to_octet to_octet;
+ typedef ACE_InputCDR::to_string to_string;
+ // This one's not in ACE.
struct TAO_Export to_object
{
to_object (CORBA::Object_ptr &obj);
diff --git a/TAO/tao/Any.i b/TAO/tao/Any.i
index 37d5c4783cb..132b7e81123 100644
--- a/TAO/tao/Any.i
+++ b/TAO/tao/Any.i
@@ -89,72 +89,6 @@ CORBA_Any::operator<<= (const char* s)
// implementing the special types
ACE_INLINE
-CORBA_Any::from_boolean::from_boolean (CORBA::Boolean b)
- : val_ (b)
-{
-}
-
-ACE_INLINE
-CORBA_Any::to_boolean::to_boolean (CORBA::Boolean &b)
- : ref_ (b)
-{
-}
-
-ACE_INLINE
-CORBA_Any::from_octet::from_octet (CORBA::Octet o)
- : val_ (o)
-{
-}
-
-ACE_INLINE
-CORBA_Any::to_octet::to_octet (CORBA::Octet &o)
- : ref_ (o)
-{
-}
-
-ACE_INLINE
-CORBA_Any::from_char::from_char (CORBA::Char c)
- : val_ (c)
-{
-}
-
-ACE_INLINE
-CORBA_Any::to_char::to_char (CORBA::Char &c)
- : ref_ (c)
-{
-}
-
-ACE_INLINE
-CORBA_Any::from_wchar::from_wchar (CORBA::WChar wc)
- : val_ (wc)
-{
-}
-
-ACE_INLINE
-CORBA_Any::to_wchar::to_wchar (CORBA::WChar &wc)
- : ref_ (wc)
-{
-}
-
-ACE_INLINE
-CORBA_Any::from_string::from_string (char *s,
- CORBA::ULong b,
- CORBA::Boolean nocopy)
- : val_ (s),
- bound_ (b),
- nocopy_ (nocopy)
-{
-}
-
-ACE_INLINE
-CORBA_Any::to_string::to_string (char *&s,
- CORBA::ULong b)
- : val_ (s),
- bound_ (b)
-{
-}
-
-ACE_INLINE
CORBA_Any::to_object::to_object (CORBA::Object_ptr &obj)
: ref_ (obj)
{
diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp
index 3e1bb59fbd9..c7674492476 100644
--- a/TAO/tao/CDR.cpp
+++ b/TAO/tao/CDR.cpp
@@ -69,942 +69,135 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_CDR_Timeprobe_Description,
#endif /* ACE_ENABLE_TIMEPROBES */
-int
-CDR::grow (ACE_Message_Block *mb, size_t minsize)
-{
- // Calculate the new buffer's length; if growing for encode, we
- // don't grow in "small" chunks because of the cost.
-
- size_t size = mb->size();
- size_t newsize = size;
-
- if (minsize == 0)
- {
- // TODO We should the growth strategy should be controlled using
- // the ORB parameters....
- if (newsize == 0)
- newsize = CDR::DEFAULT_BUFSIZE;
- else if (size < CDR::EXP_GROWTH_MAX)
- newsize *= 2;
- else
- newsize += CDR::LINEAR_GROWTH_CHUNK;
- }
- else if (minsize + CDR::MAX_ALIGNMENT <= size)
- return 0;
- else
- {
- if (newsize == 0)
- newsize = CDR::DEFAULT_BUFSIZE;
-
- while (newsize < minsize + CDR::MAX_ALIGNMENT)
- {
- if (newsize < CDR::EXP_GROWTH_MAX)
- newsize *= 2;
- else
- newsize += CDR::LINEAR_GROWTH_CHUNK;
- }
- }
-
-#if 0
- TAO_ORB_Core* orb_core = TAO_ORB_Core_instance ();
- ACE_Message_Block tmp (newsize,
- ACE_Message_Block::MB_DATA,
- 0, 0,
- orb_core->cdr_buffer_allocator (),
- 0,
- 0,
- ACE_Time_Value::zero,
- ACE_Time_Value::max_time,
- orb_core->data_block_allocator ());
-#else
- ACE_Message_Block tmp (newsize);
-#endif
- CDR::mb_align (&tmp);
-
- tmp.copy (mb->rd_ptr (), mb->length());
- mb->data_block (tmp.data_block ()->duplicate ());
- mb->rd_ptr (tmp.rd_ptr ());
- mb->wr_ptr (tmp.wr_ptr ());
-
- return 0;
-}
-
// ****************************************************************
// ****************************************************************
// ****************************************************************
TAO_OutputCDR::TAO_OutputCDR (size_t size,
int byte_order,
- TAO_Marshal_Factory *factory,
- ACE_Allocator *buffer_allocator,
- ACE_Allocator *data_block_allocator)
- : start_ (size?size:CDR::DEFAULT_BUFSIZE + CDR::MAX_ALIGNMENT,
- ACE_Message_Block::MB_DATA,
- 0, 0,
- buffer_allocator,
- 0,
- 0,
- ACE_Time_Value::zero,
- ACE_Time_Value::max_time,
- data_block_allocator),
- factory_ (factory),
- do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
- good_bit_ (1)
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *data_block_allocator,
+ size_t memcpy_tradeoff)
+ : ACE_OutputCDR (size,
+ byte_order,
+ buffer_allocator
+ ? buffer_allocator
+ : TAO_ORB_Core_instance ()->output_cdr_buffer_allocator (),
+ data_block_allocator
+ ? data_block_allocator
+ : TAO_ORB_Core_instance ()->output_cdr_dblock_allocator (),
+ memcpy_tradeoff
+ ? memcpy_tradeoff
+ : TAO_ORB_Core_instance ()->orb_params ()->cdr_memcpy_tradeoff ())
{
ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR1_ENTER);
- CDR::mb_align (&this->start_);
- this->current_ = &this->start_;
}
-TAO_OutputCDR::TAO_OutputCDR (char *data, size_t size,
+TAO_OutputCDR::TAO_OutputCDR (char *data,
+ size_t size,
int byte_order,
- TAO_Marshal_Factory *factory,
- ACE_Allocator *buffer_allocator,
- ACE_Allocator *data_block_allocator)
- : start_ (size,
- ACE_Message_Block::MB_DATA,
- 0,
- data,
- buffer_allocator,
- 0,
- 0,
- ACE_Time_Value::zero,
- ACE_Time_Value::max_time,
- data_block_allocator),
- factory_ (factory),
- do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
- good_bit_ (1)
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *data_block_allocator,
+ size_t memcpy_tradeoff)
+ : ACE_OutputCDR (data,
+ size,
+ byte_order,
+ buffer_allocator
+ ? buffer_allocator
+ : TAO_ORB_Core_instance ()->output_cdr_buffer_allocator (),
+ data_block_allocator
+ ? data_block_allocator
+ : TAO_ORB_Core_instance ()->output_cdr_dblock_allocator (),
+ memcpy_tradeoff
+ ? memcpy_tradeoff
+ : TAO_ORB_Core_instance ()->orb_params ()->cdr_memcpy_tradeoff ())
{
ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR2_ENTER);
- // We cannot trust the buffer to be properly aligned
- CDR::mb_align (&this->start_);
- this->current_ = &this->start_;
}
TAO_OutputCDR::TAO_OutputCDR (ACE_Message_Block *data,
int byte_order,
- TAO_Marshal_Factory *factory)
- : start_ (data->data_block ()->duplicate ()),
- factory_ (factory),
- do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
- good_bit_ (1)
+ size_t memcpy_tradeoff)
+ : ACE_OutputCDR (data,
+ byte_order,
+ memcpy_tradeoff
+ ? memcpy_tradeoff
+ : TAO_ORB_Core_instance ()->orb_params ()->cdr_memcpy_tradeoff ())
{
ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR3_ENTER);
- // We cannot trust the buffer to be properly aligned
- CDR::mb_align (&this->start_);
- this->current_ = &this->start_;
}
TAO_OutputCDR::~TAO_OutputCDR (void)
{
- if (this->start_.cont () != 0)
- {
- ACE_Message_Block::release (this->start_.cont ());
- this->start_.cont (0);
- }
- this->current_ = 0;
-}
-
-void
-TAO_OutputCDR::reset (void)
-{
- this->current_ = &this->start_;
- CDR::mb_align (&this->start_);
-}
-
-size_t
-TAO_OutputCDR::total_length (void) const
-{
- size_t l = 0;
- // Compute the total size.
- for (const ACE_Message_Block *i = this->begin ();
- i != this->end ();
- i = i->cont ())
- l += i->length ();
- return l;
-}
-
-int
-TAO_OutputCDR::grow_and_adjust (size_t size, size_t align, char*& buf)
-{
- if (this->current_->cont () == 0
- || this->current_->cont ()->size () < size + CDR::MAX_ALIGNMENT)
- {
- // Allocate the next block, it must be large enough.
- size_t block_size = CDR::DEFAULT_BUFSIZE;
- while (block_size < size + CDR::MAX_ALIGNMENT)
- {
- if (block_size < CDR::EXP_GROWTH_MAX)
- block_size *= 2;
- else
- block_size += CDR::LINEAR_GROWTH_CHUNK;
- }
- this->good_bit_ = 0;
- ACE_Message_Block* tmp;
- TAO_ORB_Core* orb_core = TAO_ORB_Core_instance ();
- ACE_NEW_RETURN (tmp,
- ACE_Message_Block (block_size,
- ACE_Message_Block::MB_DATA,
- 0, 0,
- orb_core->output_cdr_buffer_allocator (),
- 0,
- 0,
- ACE_Time_Value::zero,
- ACE_Time_Value::max_time,
- orb_core->output_cdr_dblock_allocator ()),
- -1);
- this->good_bit_ = 1;
-
- // The new block must start with the same alignment as the
- // previous block finished.
- ptr_arith_t tmpalign =
- ptr_arith_t(tmp->wr_ptr ()) % CDR::MAX_ALIGNMENT;
- ptr_arith_t curalign =
- ptr_arith_t(this->current_->wr_ptr ()) % CDR::MAX_ALIGNMENT;
- int offset = curalign - tmpalign;
- if (offset < 0)
- offset += CDR::MAX_ALIGNMENT;
- tmp->rd_ptr (offset);
- tmp->wr_ptr (tmp->rd_ptr ());
-
- // grow the chain and set the current block.
- tmp->cont (this->current_->cont ());
- this->current_->cont (tmp);
- }
- this->current_ = this->current_->cont ();
-
- // Now we are ready to set buf..
- // recompute the position....
- buf = ptr_align_binary (this->current_->wr_ptr(), align);
- this->current_->wr_ptr (buf + size);
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_1 (const CORBA::Octet* x)
-{
- char* buf;
- if (this->adjust (1, buf) == 0)
- {
- *ACE_reinterpret_cast(CORBA::Octet*, buf) = *x;
- return 1;
- }
-
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_2 (const CORBA::UShort* x)
-{
- char* buf;
- if (this->adjust (CDR::SHORT_SIZE, buf) == 0)
- {
-#if !defined (TAO_ENABLE_SWAP_ON_WRITE)
- *ACE_reinterpret_cast(CORBA::UShort*,buf) = *x;
- return 1;
-#else
- if (!this->do_byte_swap_)
- {
- *ACE_reinterpret_cast(CORBA::UShort*,buf) = *x;
- return 1;
- }
- else
- {
- CDR::swap_2 (ACE_reinterpret_cast(char*,x), buf);
- return 1;
- }
-#endif /* TAO_ENABLE_SWAP_ON_WRITE */
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_4 (const CORBA::ULong* x)
-{
- char* buf;
- if (this->adjust (CDR::LONG_SIZE, buf) == 0)
- {
-#if !defined (TAO_ENABLE_SWAP_ON_WRITE)
- *ACE_reinterpret_cast(CORBA::ULong*,buf) = *x;
- return 1;
-#else
- if (!this->do_byte_swap_)
- {
- *ACE_reinterpret_cast(CORBA::ULong*,buf) = *x;
- return 1;
- }
- else
- {
- CDR::swap_4 (ACE_reinterpret_cast(char*,x), buf);
- return 1;
- }
-#endif /* TAO_ENABLE_SWAP_ON_WRITE */
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_8 (const CORBA::ULongLong* x)
-{
- char* buf;
- if (this->adjust (CDR::LONGLONG_SIZE, buf) == 0)
- {
-#if !defined (TAO_ENABLE_SWAP_ON_WRITE)
- *ACE_reinterpret_cast(CORBA::ULongLong*,buf) = *x;
- return 1;
-#else
- if (!this->do_byte_swap_)
- {
- *ACE_reinterpret_cast(CORBA::ULongLong*,buf) = *x;
- return 1;
- }
- else
- {
- CDR::swap_8 (ACE_reinterpret_cast(char*,x), buf);
- return 1;
- }
-#endif /* TAO_ENABLE_SWAP_ON_WRITE */
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_16 (const CORBA::LongDouble* x)
-{
- char* buf;
- if (this->adjust (CDR::LONGDOUBLE_SIZE, CDR::LONGDOUBLE_ALIGN, buf) == 0)
- {
-#if !defined (TAO_ENABLE_SWAP_ON_WRITE)
- *ACE_reinterpret_cast(CORBA::LongDouble*,buf) = *x;
- return 1;
-#else
- if (!this->do_byte_swap_)
- {
- *ACE_reinterpret_cast(CORBA::LongDouble*,buf) = *x;
- return 1;
- }
- else
- {
- CDR::swap_16 (ACE_reinterpret_cast(char*,x), buf);
- return 1;
- }
-#endif /* TAO_ENABLE_SWAP_ON_WRITE */
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_array (const void* x,
- size_t size,
- size_t align,
- CORBA::ULong length)
-{
- char* buf;
- if (this->adjust (size * length, align, buf) == 0)
- {
-#if !defined (TAO_ENABLE_SWAP_ON_WRITE)
- ACE_OS::memcpy (buf, x, size*length);
- return 1;
-#else
- if (!this->do_byte_swap_)
- {
- ACE_OS::memcpy (buf, x, size*length);
- return 1;
- }
- else
- {
- // I cannot see any fast way out of this....
- typedef void (*SWAPPER)(const char*, char*);
- SWAPPER swapper;
- switch (size)
- {
- case 2:
- swapper = CDR::swap_2;
- break;
- case 4:
- swapper = CDR::swap_4;
- break;
- case 8:
- swapper = CDR::swap_8;
- break;
- case 16:
- swapper = CDR::swap_16;
- break;
- default:
- // TODO: print something?
- this->good_bit_ = 0;
- return 0;
- }
- char *source = ACE_reinterpret_cast(char*,x);
- char *end = source + size*length;
- for (; source != end; source += size, buf += size)
- {
- (*swapper)(source, buf);
- }
- }
-#endif /* TAO_ENABLE_SWAP_ON_WRITE */
- }
- this->good_bit_ = 0;
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_string (CORBA::ULong len,
- const CORBA::Char *x)
-{
- if (len != 0)
- {
- if (this->write_ulong (len + 1))
- {
- return this->write_char_array (x, len + 1);
- }
- }
- else
- {
- // Be nice to programmers: treat nulls as empty strings not
- // errors. (OMG-IDL supports languages that don't use the C/C++
- // notion of null v. empty strings; nulls aren't part of the OMG-IDL
- // string model.)
- if (this->write_ulong (1))
- {
- return this->write_char (0);
- }
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_wstring (CORBA::ULong len,
- const CORBA::WChar *x)
-{
- if (x != 0)
- {
- if (this->write_ulong (len + 1))
- {
- return this->write_wchar_array (x, len + 1);
- }
- }
- else
- {
- if (this->write_ulong (1))
- {
- return this->write_wchar (0);
- }
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb)
-{
- // If the buffer is small and it fits in the current message
- // block it is be cheaper just to copy the buffer.
- const size_t memcpy_tradeoff =
- TAO_ORB_Core_instance ()->orb_params ()->cdr_memcpy_tradeoff ();
-
- for (const ACE_Message_Block* i = mb;
- i != 0;
- i = i->cont ())
- {
- size_t length = i->length ();
-
-#if !defined (TAO_NO_COPY_OCTET_SEQUENCES)
- if (!this->write_array (i->rd_ptr (),
- CDR::OCTET_SIZE,
- CDR::OCTET_ALIGN,
- length) )
- {
- return 0;
- }
-#else
- // If the mb does not own its data we are forced to make a copy.
- if (ACE_BIT_ENABLED (i->flags (),
- ACE_Message_Block::DONT_DELETE))
- {
- if (! this->write_array (i->rd_ptr (),
- CDR::OCTET_SIZE,
- CDR::OCTET_ALIGN,
- length))
- {
- return 0;
- }
- continue;
- }
-
- if (length < memcpy_tradeoff
- && this->current_->wr_ptr () + length < this->current_->end ())
- {
- if (! this->write_array (i->rd_ptr (),
- CDR::OCTET_SIZE,
- CDR::OCTET_ALIGN,
- length) )
- {
- return 0;
- }
- continue;
- }
-
- ACE_Message_Block* cont =
- new ACE_Message_Block (i->data_block ()->duplicate ());
- if (cont != 0)
- {
- cont->cont (this->current_->cont ());
- this->current_->cont (cont);
- this->current_ = cont;
- cont->rd_ptr (i->rd_ptr ());
- cont->wr_ptr (i->wr_ptr ());
- }
- else
- {
- this->good_bit_ = 0;
- return 0;
- }
-#endif /* TAO_NO_COPY_OCTET_SEQUENCES */
- }
- return 1;
-}
-
-CORBA_Boolean
-TAO_OutputCDR::write_boolean_array (const CORBA::Boolean* x,
- CORBA::ULong length)
-{
- // It is hard to optimize this, the spec requires that on the wire
- // booleans be represented as a byte with value 0 or 1, but in
- // memoery it is possible (though very unlikely) that a boolean has
- // a non-zero value (different from 1).
- // We resort to a simple loop.
- const CORBA::Boolean* end = x + length;
- for (const CORBA::Boolean* i = x; i != end && this->good_bit(); ++i)
- {
- this->write_boolean (*i);
- }
- return this->good_bit ();
}
// ****************************************************************
-TAO_InputCDR::TAO_InputCDR (const char *buf, size_t bufsiz,
- int byte_order,
- TAO_Marshal_Factory *factory)
- : start_ (buf, bufsiz),
- factory_ (factory),
- do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
- good_bit_ (1)
+TAO_InputCDR::TAO_InputCDR (const char *buf,
+ size_t bufsiz,
+ int byte_order)
+ : ACE_InputCDR (buf,
+ bufsiz,
+ byte_order)
{
- this->start_.wr_ptr (bufsiz);
}
TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
- int byte_order,
- TAO_Marshal_Factory *factory)
- : start_ (bufsiz),
- factory_ (factory),
- do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
- good_bit_ (1)
+ int byte_order)
+ : ACE_InputCDR (bufsiz,
+ byte_order)
{
}
TAO_InputCDR::TAO_InputCDR (ACE_Message_Block *data,
- int byte_order,
- TAO_Marshal_Factory *factory)
- : start_ (data->data_block ()->duplicate ()),
- factory_ (factory),
- do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
- good_bit_ (1)
+ int byte_order)
+ : ACE_InputCDR (data,
+ byte_order)
{
- this->start_.rd_ptr (data->rd_ptr ());
- this->start_.wr_ptr (data->wr_ptr ());
}
TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
- int byte_order,
- TAO_Marshal_Factory *factory)
- : start_ (data),
- factory_ (factory),
- do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
- good_bit_ (1)
+ int byte_order)
+ : ACE_InputCDR (data,
+ byte_order)
{
}
TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
size_t size,
- CORBA::Long offset)
- : start_ (rhs.start_.data_block ()->duplicate ()),
- factory_ (rhs.factory_),
- do_byte_swap_ (rhs.do_byte_swap_),
- good_bit_ (1)
+ CDR::Long offset)
+ : ACE_InputCDR (rhs,
+ size,
+ offset)
{
- char* newpos = rhs.start_.rd_ptr() + offset;
- if (this->start_.base () <= newpos
- && newpos <= this->start_.end ()
- && newpos + size <= this->start_.end ())
- {
- this->start_.rd_ptr (newpos);
- this->start_.wr_ptr (newpos + size);
- }
- else
- {
- this->good_bit_ = 0;
- }
}
TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
size_t size)
- : start_ (rhs.start_.data_block ()->duplicate ()),
- factory_ (rhs.factory_),
- do_byte_swap_ (rhs.do_byte_swap_),
- good_bit_ (1)
+ : ACE_InputCDR (rhs,
+ size)
{
- char* newpos = rhs.start_.rd_ptr();
- if (this->start_.base () <= newpos
- && newpos <= this->start_.end ()
- && newpos + size <= this->start_.end ())
- {
- // Notice that ACE_Message_Block::duplicate may leave the
- // wr_ptr() with a higher value that what we actually want.
- this->start_.rd_ptr (newpos);
- this->start_.wr_ptr (newpos + size);
-
- CORBA::Octet byte_order;
- this->read_octet (byte_order);
- this->do_byte_swap_ = (byte_order != TAO_ENCAP_BYTE_ORDER);
- }
- else
- {
- this->good_bit_ = 0;
- }
}
TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs)
- : start_ (rhs.start_.data_block ()->duplicate ()),
- factory_ (rhs.factory_),
- do_byte_swap_ (rhs.do_byte_swap_),
- good_bit_ (1)
+ : ACE_InputCDR (rhs)
{
- this->start_.rd_ptr (rhs.start_.rd_ptr ());
- this->start_.wr_ptr (rhs.start_.wr_ptr ());
-}
-
-TAO_InputCDR&
-TAO_InputCDR::operator= (const TAO_InputCDR& rhs)
-{
- if (this != &rhs)
- {
- this->start_.data_block (rhs.start_.data_block ()->duplicate ());
- this->start_.rd_ptr (rhs.start_.rd_ptr ());
- this->start_.wr_ptr (rhs.start_.wr_ptr ());
- this->factory_ = rhs.factory_;
- this->do_byte_swap_ = rhs.do_byte_swap_;
- this->good_bit_ = 1;
- }
- return *this;
}
TAO_InputCDR::TAO_InputCDR (const TAO_OutputCDR& rhs,
ACE_Allocator* buffer_allocator,
ACE_Allocator* data_block_allocator)
- : start_ (rhs.total_length () + CDR::MAX_ALIGNMENT,
- ACE_Message_Block::MB_DATA,
- 0,
- 0,
- buffer_allocator,
- 0,
- 0,
- ACE_Time_Value::zero,
- ACE_Time_Value::max_time,
- data_block_allocator),
- factory_ (rhs.factory_),
- do_byte_swap_ (rhs.do_byte_swap_),
- good_bit_ (1)
+ : ACE_InputCDR (rhs,
+ buffer_allocator
+ ? buffer_allocator
+ : TAO_ORB_Core_instance ()->output_cdr_buffer_allocator (),
+ data_block_allocator
+ ? data_block_allocator
+ : TAO_ORB_Core_instance ()->output_cdr_dblock_allocator ())
{
- CDR::mb_align (&this->start_);
- for (const ACE_Message_Block *i = rhs.begin ();
- i != rhs.end ();
- i = i->cont ())
- this->start_.copy (i->rd_ptr (), i->length ());
}
TAO_InputCDR::~TAO_InputCDR (void)
{
}
-CORBA_Boolean
-TAO_InputCDR::read_string (CORBA::Char*& x)
-{
- CORBA::ULong len;
- this->read_ulong (len);
- if (this->good_bit() && len > 0)
- {
- x = CORBA::string_alloc (len);
- if (this->read_char_array (x, len))
- return 1;
- CORBA::string_free (x);
- }
- x = 0;
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_wstring (CORBA::WChar*& x)
-{
- CORBA::ULong len;
- this->read_ulong (len);
- if (this->good_bit())
- {
- x = CORBA::wstring_alloc (len);
- if (this->read_wchar_array (x, len))
- return 1;
-
- CORBA::wstring_free (x);
- }
- x = 0;
- return 0;
-}
-
-ACE_INLINE char*
-TAO_InputCDR::end (void)
-{
- return this->start_.end ();
-}
-
-ACE_INLINE void
-TAO_InputCDR::rd_ptr (size_t offset)
-{
- this->start_.rd_ptr (offset);
-}
-
-ACE_INLINE int
-TAO_InputCDR::adjust (size_t size,
- size_t align,
- char*& buf)
-{
- buf = ptr_align_binary (this->rd_ptr(), align);
- char *end = buf + size;
- if (end <= this->end ())
- {
- this->start_.rd_ptr (end);
- return 0;
- }
-
- this->good_bit_ = 0;
- return -1;
-}
-
-ACE_INLINE int
-TAO_InputCDR::adjust (size_t size,
- char*& buf)
-{
- return this->adjust (size, size, buf);
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_1 (CORBA::Octet* x)
-{
- if (this->rd_ptr () < this->end())
- {
- *x = *ACE_reinterpret_cast(CORBA::Octet*,this->rd_ptr());
- this->start_.rd_ptr (1);
- return 1;
- }
-
- this->good_bit_ = 0;
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_2 (CORBA::UShort* x)
-{
- char* buf;
- if (this->adjust (CDR::SHORT_SIZE, buf) == 0)
- {
-#if !defined (TAO_DISABLE_SWAP_ON_READ)
- if (!this->do_byte_swap_)
- {
- *x = *ACE_reinterpret_cast(CORBA::UShort*,buf);
- }
- else
- {
- CDR::swap_2 (buf, ACE_reinterpret_cast(char*,x));
- }
-#else
- *x = *ACE_reinterpret_cast(CORBA::UShort*,buf);
-#endif /* TAO_DISABLE_SWAP_ON_READ */
- return 1;
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_4 (CORBA::ULong* x)
-{
- char* buf;
- if (this->adjust (CDR::LONG_SIZE, buf) == 0)
- {
-#if !defined (TAO_DISABLE_SWAP_ON_READ)
- if (!this->do_byte_swap_)
- {
- *x = *ACE_reinterpret_cast(CORBA::ULong*,buf);
- }
- else
- {
- CDR::swap_4 (buf, ACE_reinterpret_cast(char*,x));
- }
-#else
- *x = *ACE_reinterpret_cast(CORBA::ULong*,buf);
-#endif /* TAO_DISABLE_SWAP_ON_READ */
- return 1;
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_8 (CORBA::ULongLong* x)
-{
- char* buf;
- if (this->adjust (CDR::LONGLONG_SIZE, buf) == 0)
- {
-#if !defined (TAO_DISABLE_SWAP_ON_READ)
- if (!this->do_byte_swap_)
- {
- *x = *ACE_reinterpret_cast(CORBA::ULongLong*,buf);
- }
- else
- {
- CDR::swap_8 (buf, ACE_reinterpret_cast(char*,x));
- }
-#else
- *x = *ACE_reinterpret_cast(CORBA::ULongLong*,buf);
-#endif /* TAO_DISABLE_SWAP_ON_READ */
- return 1;
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_16 (CORBA::LongDouble* x)
-{
- char* buf;
- if (this->adjust (CDR::LONGDOUBLE_SIZE,
- CDR::LONGDOUBLE_ALIGN,
- buf) == 0)
- {
-#if !defined (TAO_DISABLE_SWAP_ON_READ)
- if (!this->do_byte_swap_)
- {
- *x = *ACE_reinterpret_cast(CORBA::LongDouble*,buf);
- }
- else
- {
- CDR::swap_16 (buf, ACE_reinterpret_cast(char*,x));
- }
-#else
- *x = *ACE_reinterpret_cast(CORBA::LongDouble*,buf);
-#endif /* TAO_DISABLE_SWAP_ON_READ */
- return 1;
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_array (void* x,
- size_t size,
- size_t align,
- CORBA::ULong length)
-{
- char* buf;
- if (this->adjust (size * length, align, buf) == 0)
- {
-#if !defined (TAO_DISABLE_SWAP_ON_READ)
- if (!this->do_byte_swap_ || size == 1)
- {
- ACE_OS::memcpy (x, buf, size*length);
- }
- else
- {
- // I cannot see any fast way out of this....
- char *target = ACE_reinterpret_cast(char*,x);
- char *end = target + size*length;
- switch (size)
- {
- case 2:
- for (; target != end; target += size, buf += size)
- {
- CDR::swap_2(buf, target);
- }
- break;
- case 4:
- for (; target != end; target += size, buf += size)
- {
- CDR::swap_4(buf, target);
- }
- break;
- case 8:
- for (; target != end; target += size, buf += size)
- {
- CDR::swap_8(buf, target);
- }
- break;
- case 16:
- for (; target != end; target += size, buf += size)
- {
- CDR::swap_16(buf, target);
- }
- break;
- default:
- // TODO: print something?
- this->good_bit_ = 0;
- return 0;
- }
- }
-#else
- ACE_OS::memcpy (x, buf, size*length);
-#endif /* TAO_DISABLE_SWAP_ON_READ */
- return this->good_bit_;
- }
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::read_boolean_array (CORBA::Boolean* x,
- CORBA::ULong length)
-{
- // It is hard to optimize this, the spec requires that on the wire
- // booleans be represented as a byte with value 0 or 1, but in
- // memoery it is possible (though very unlikely) that a boolean has
- // a non-zero value (different from 1).
- // We resort to a simple loop.
- for (CORBA::ULong i = 0; i != length && this->good_bit_; ++i)
- {
- this->read_boolean (x[i]);
- }
- return this->good_bit_;
-}
-
-CORBA_Boolean
-TAO_InputCDR::skip_string (void)
-{
- CORBA::ULong len;
- if (this->read_ulong (len))
- {
- if (this->rd_ptr () + len <= this->end ())
- {
- this->rd_ptr (len);
- return 1;
- }
- this->good_bit_ = 0;
- }
-
- return 0;
-}
-
-CORBA_Boolean
-TAO_InputCDR::skip_bytes (size_t len)
-{
- if (this->rd_ptr () + len <= this->end ())
- {
- this->rd_ptr (len);
- return 1;
- }
- this->good_bit_ = 0;
- return 0;
-}
diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h
index d8903e60123..d2a1004e773 100644
--- a/TAO/tao/CDR.h
+++ b/TAO/tao/CDR.h
@@ -44,77 +44,7 @@
#ifndef TAO_CDR_H
#define TAO_CDR_H
-class TAO_Export CDR
-{
- // = TITLE
- // Keep constants and some routines common to both Output and
- // Input CDR streams.
- //
-public:
- // = Constants defined by the CDR protocol.
-
- // By defining these constants as enums we ensure they get inlined
- // and avoid pointless static memory allocations.
-
- enum
- {
- // Note that some of these get reused as part of the standard
- // binary format: unsigned is the same size as its signed cousin,
- // float is CDR_LONG_SIZE, and double is CDR_LONGLONG_SIZE.
-
- OCTET_SIZE = 1,
- SHORT_SIZE = 2,
- LONG_SIZE = 4,
- LONGLONG_SIZE = 8,
- LONGDOUBLE_SIZE = 16,
-
- OCTET_ALIGN = 1,
- SHORT_ALIGN = 2,
- LONG_ALIGN = 4,
- LONGLONG_ALIGN = 8,
- LONGDOUBLE_ALIGN = 8,
- // Note how the CORBA::LongDouble alignment requirements do not
- // match its size...
-
- MAX_ALIGNMENT = 8,
- // Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "long
- // double", size as above).
-
- DEFAULT_BUFSIZE = TAO_DEFAULT_CDR_BUFSIZE,
- // The default buffer size.
- // @@ TODO We want to add options to the ORB to control this
- // default value, so this constant should be read as the, default
- // default value ;-)
-
- EXP_GROWTH_MAX = TAO_DEFAULT_CDR_EXP_GROWTH_MAX,
- // The buffer size grows exponentially until it reaches this size;
- // afterwards it grows linearly using the next constant
-
- LINEAR_GROWTH_CHUNK = TAO_DEFAULT_CDR_LINEAR_GROWTH_CHUNK
- // Once exponential growth is ruled out the buffer size increases
- // in chunks of this size, note that this constants have the same
- // value right now, but it does not need to be so.
- };
-
- static void swap_2 (const char *orig, char *target);
- static void swap_4 (const char *orig, char *target);
- static void swap_8 (const char *orig, char *target);
- static void swap_16 (const char *orig, char *target);
- // Do byte swapping for each basic IDL type size.
- // There exist only routines to put byte, halfword (2 bytes), word
- // (4 bytes), doubleword (8 bytes) and quadword (16 byte); because
- // those are the IDL basic type sizes.
-
- static void mb_align (ACE_Message_Block* mb);
-
- static int grow (ACE_Message_Block *mb, size_t minsize);
- // Increase the capacity of mb to contain at least <minsize> bytes.
- // If <minsze> is zero the size is increased by an amount at least
- // large enough to contain any of the basic IDL types. Return -1 on
- // failure, 0 on success.
-};
-
-class TAO_Export TAO_OutputCDR
+class TAO_Export TAO_OutputCDR : public ACE_OutputCDR
{
//
// = TITLE
@@ -139,110 +69,41 @@ public:
friend class TAO_InputCDR;
// For reading from a output CDR stream.
+ // The default values for the allocators and memcpy_tradeoff
+ // in these constructors are not 0, but are generated by the
+ // ORB. Refer to the constructor bodies in CDR.cpp for the
+ // code that supplies these values to the base class constructor.
+
TAO_OutputCDR (size_t size = 0,
- int byte_order = TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
+ int byte_order = ACE_CDR_BYTE_ORDER,
ACE_Allocator* buffer_allocator = 0,
- ACE_Allocator* data_block_allocator = 0);
+ ACE_Allocator* data_block_allocator = 0,
+ size_t memcpy_tradeoff = 0);
// Default constructor, allocates <size> bytes in the internal
// buffer, if <size> == 0 it allocates the default size.
- TAO_OutputCDR (char *data, size_t size,
- int byte_order = TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
+ TAO_OutputCDR (char *data,
+ size_t size,
+ int byte_order = ACE_CDR_BYTE_ORDER,
ACE_Allocator* buffer_allocator = 0,
- ACE_Allocator* data_block_allocator = 0);
+ ACE_Allocator* data_block_allocator = 0,
+ size_t memcpy_tradeoff = 0);
// Build a CDR stream with an initial buffer, it will *not* remove
// <data>, since it did not allocated it.
TAO_OutputCDR (ACE_Message_Block *data,
- int byte_order = TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ size_t memcpy_tradeoff = 0);
// Build a CDR stream with an initial Message_Block chain, it will *not*
// remove <data>, since it did not allocate it.
~TAO_OutputCDR (void);
// destructor
- // = We have one method per basic IDL type....
- CORBA_Boolean write_boolean (CORBA::Boolean x);
- CORBA_Boolean write_char (CORBA::Char x);
- CORBA_Boolean write_wchar (CORBA::WChar x);
- CORBA_Boolean write_octet (CORBA::Octet x);
- CORBA_Boolean write_short (CORBA::Short x);
- CORBA_Boolean write_ushort (CORBA::UShort x);
- CORBA_Boolean write_long (CORBA::Long x);
- CORBA_Boolean write_ulong (CORBA::ULong x);
- CORBA_Boolean write_longlong (const CORBA::LongLong &x);
- CORBA_Boolean write_ulonglong (const CORBA::ULongLong &x);
- CORBA_Boolean write_float (CORBA::Float x);
- CORBA_Boolean write_double (const CORBA::Double &x);
- CORBA_Boolean write_longdouble (const CORBA::LongDouble &x);
-
- CORBA_Boolean write_string (const CORBA::Char *x);
- CORBA_Boolean write_string (CORBA::ULong length, const CORBA::Char *x);
- CORBA_Boolean write_wstring (const CORBA::WChar *x);
- CORBA_Boolean write_wstring (CORBA::ULong length, const CORBA::WChar *x);
- // For string we offer methods that accept a precomputed length.
-
- // = We add one method to write arrays of basic IDL types.
- // Note: the portion written starts at <x> and ends at <x + length>.
- // The length is *NOT* stored into the CDR stream.
- CORBA_Boolean write_boolean_array (const CORBA::Boolean* x,
- CORBA::ULong length);
- CORBA_Boolean write_char_array (const CORBA::Char* x,
- CORBA::ULong length);
- CORBA_Boolean write_wchar_array (const CORBA::WChar* x,
- CORBA::ULong length);
- CORBA_Boolean write_octet_array (const CORBA::Octet* x,
- CORBA::ULong length);
- CORBA_Boolean write_short_array (const CORBA::Short* x,
- CORBA::ULong length);
- CORBA_Boolean write_ushort_array (const CORBA::UShort* x,
- CORBA::ULong length);
- CORBA_Boolean write_long_array (const CORBA::Long* x,
- CORBA::ULong length);
- CORBA_Boolean write_ulong_array (const CORBA::ULong* x,
- CORBA::ULong length);
- CORBA_Boolean write_longlong_array (const CORBA::LongLong* x,
- CORBA::ULong length);
- CORBA_Boolean write_ulonglong_array (const CORBA::ULongLong* x,
- CORBA::ULong length);
- CORBA_Boolean write_float_array (const CORBA::Float* x,
- CORBA::ULong length);
- CORBA_Boolean write_double_array (const CORBA::Double* x,
- CORBA::ULong length);
- CORBA_Boolean write_longdouble_array (const CORBA::LongDouble* x,
- CORBA::ULong length);
-
- CORBA_Boolean write_octet_array_mb (const ACE_Message_Block* mb);
- // Write an octet array contained inside a MB, this can be optimized
- // to minimize copies.
-
- // = We have one method per basic IDL type....
- // They return 0 on failure and 1 on success.
- CORBA_Boolean append_boolean (TAO_InputCDR &);
- CORBA_Boolean append_char (TAO_InputCDR &);
- CORBA_Boolean append_wchar (TAO_InputCDR &);
- CORBA_Boolean append_octet (TAO_InputCDR &);
- CORBA_Boolean append_short (TAO_InputCDR &);
- CORBA_Boolean append_ushort (TAO_InputCDR &);
- CORBA_Boolean append_long (TAO_InputCDR &);
- CORBA_Boolean append_ulong (TAO_InputCDR &);
- CORBA_Boolean append_longlong (TAO_InputCDR &);
- CORBA_Boolean append_ulonglong (TAO_InputCDR &);
- CORBA_Boolean append_float (TAO_InputCDR &);
- CORBA_Boolean append_double (TAO_InputCDR &);
- CORBA_Boolean append_longdouble (TAO_InputCDR &);
- CORBA_Boolean append_wstring (TAO_InputCDR &);
- CORBA_Boolean append_string (TAO_InputCDR &);
-
CORBA::TypeCode::traverse_status append (CORBA::TypeCode_ptr tc,
- TAO_InputCDR *src,
- CORBA_Environment &TAO_IN_ENV = CORBA_Environment::default_environment ());
+ TAO_InputCDR *src,
+ CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment::default_environment ());
// Append the contents of the CDR stream based on information
// described by <tc>; returning any errors in <TAO_IN_ENV>.
@@ -251,34 +112,11 @@ public:
// = TAO specific methods.
- void reset (void);
- // Reuse the CDR stream to write on the old buffer.
-
- int good_bit (void) const;
- // Returns 0 if an error has ocurred, the only expected error is to
- // run out of memory.
-
- const ACE_Message_Block* begin (void) const;
- // Return the start of the message block chain for this CDR stream.
- // NOTE: The complete CDR stream is represented by a chain of
- // message blocks.
-
- const ACE_Message_Block* end (void) const;
- // Return the last message in the chain that is is use.
-
- const char* buffer (void) const;
- size_t length (void) const;
- // Return the start and size of the internal buffer.
- // NOTE: This methods only return information about the first block
- // in the chain.
-
- size_t total_length (void) const;
- // Add the length of each message block in the chain.
-
CORBA::TypeCode::traverse_status encode (CORBA::TypeCode_ptr tc,
- const void *data,
- const void *,
- CORBA_Environment &TAO_IN_ENV = CORBA_Environment::default_environment ());
+ const void *data,
+ const void *,
+ CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment::default_environment ());
// Marshalls the contents of <data> as described by the TypeCode in
// <tc>. Any errors are reported though the <TAO_IN_ENV> parameter.
@@ -286,78 +124,9 @@ private:
TAO_OutputCDR (const TAO_OutputCDR& rhs);
TAO_OutputCDR& operator= (const TAO_OutputCDR& rhs);
// disallow copying...
-
- int adjust (size_t size, char*& buf);
- // Returns (in <buf>) the next position in the buffer aligned to
- // <size>, it advances the Message_Block wr_ptr past the data
- // (i.e. <buf> + <size>). If necessary it grows the Message_Block
- // buffer.
- // Sets the good_bit to 0 and returns a -1 on failure.
-
- int adjust (size_t size, size_t align, char*& buf);
- // As above, but now the size and alignment requirements may be
- // different.
-
- int grow_and_adjust (size_t size, size_t align, char*& buf);
- // Grow the CDR stream. When it returns <buf> contains a pointer to
- // memory in the CDR stream, with at least <size> bytes ahead of it
- // and aligned to an <align> boundary. It moved the wr_ptr()
- // to <buf + size>.
-
- CORBA_Boolean write_1 (const CORBA::Octet* x);
- CORBA_Boolean write_2 (const CORBA::UShort* x);
- CORBA_Boolean write_4 (const CORBA::ULong* x);
- CORBA_Boolean write_8 (const CORBA::ULongLong* x);
- CORBA_Boolean write_16 (const CORBA::LongDouble* x);
- // Several types can be written using the same routines, since TAO
- // tries to use native types with known size for each CORBA type.
- // We could use void* or char* to make the interface more
- // consistent, but using native types let us exploit the strict
- // alignment requirements of CDR streams and implement the
- // operations using asignment.
-
- CORBA_Boolean write_array (const void* x, size_t size, size_t align,
- CORBA::ULong length);
- // write an array of <length> elements, each of <size> bytes and
- // the start aligned at a multiple of <align>. The elements are
- // assumed to be packed with the right alignment restrictions.
- // It is mostly designed for buffers of the basic types.
- //
- // This operation uses memcpy(); as explained above it is expected
- // that using assignment is faster that memcpy() for one element,
- // but for several elements memcpy() should be more efficient, it
- // could be interesting to find the break even point and optimize
- // for that case, but that would be too platform dependent.
-
- int do_byte_swap (void) const;
- // If non-zero then this stream is writing in non-native byte order,
- // this is only meaningful if TAO_ENABLE_SWAP_ON_WRITE is defined.
-
-private:
- ACE_Message_Block start_;
- // The start of the chain of message blocks.
-
- ACE_Message_Block* current_;
- // The current block in the chain were we are writing.
-
- TAO_Marshal_Factory *factory_;
- // maintain a factory that can make specialized marshaling objects
-
- int do_byte_swap_;
- // If not zero swap bytes at writing so the created CDR stream byte
- // order does *not* match the machine byte order.
- // The motivation for such a beast is that in some setting a few
- // (fast) machines can be serving hundreds of slow machines with the
- // opposite byte order, so it makes sense (as a load balancing
- // device) to put the responsability in the writers.
- // THIS IS NOT A STANDARD IN CORBA, USE AT YOUR OWN RISK (btw, isn't
- // that true for everything in ACE/TAO and your OS vendor?)
-
- int good_bit_;
- // Set to 0 when an error ocurrs.
};
-class TAO_Export TAO_InputCDR
+class TAO_Export TAO_InputCDR : public ACE_InputCDR
{
//
// = TITLE
@@ -383,44 +152,34 @@ public:
friend class TAO_GIOP;
// This class is able to "read" an InputCDR from a socket.
- TAO_InputCDR (const char* buf, size_t bufsiz,
- int byte_order = TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ TAO_InputCDR (const char* buf,
+ size_t bufsiz,
+ int byte_order = ACE_CDR_BYTE_ORDER);
// Create an input stream from an arbitrary buffer, care must be
// exercised wrt alignment, because this contructor will *not* work
// if the buffer is unproperly aligned.
TAO_InputCDR (size_t bufsiz,
- int byte_order = TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ int byte_order = ACE_CDR_BYTE_ORDER);
// Create an empty input stream. The caller is responsible for
// putting the right data and providing the right alignment.
TAO_InputCDR (ACE_Message_Block *data,
- int byte_order =
- TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ int byte_order = ACE_CDR_BYTE_ORDER);
// Create an input stream from an ACE_Message_Block
TAO_InputCDR (ACE_Data_Block *data,
- int byte_order =
- TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ int byte_order = ACE_CDR_BYTE_ORDER);
// Create an input stream from an ACE_Data_Block
TAO_InputCDR (const TAO_InputCDR& rhs);
- TAO_InputCDR& operator= (const TAO_InputCDR& rhs);
// Make a copy of the current stream state, but does not copy the
// internal buffer; so the same stream can be read multiple times
// efficiently.
TAO_InputCDR (const TAO_InputCDR& rhs,
size_t size,
- CORBA::Long offset);
+ CDR::Long offset);
// When interpreting indirected TypeCodes it is useful to make a
// "copy" of the stream starting in the new position.
@@ -429,6 +188,11 @@ public:
// This creates an encapsulated stream, the first byte must be (per
// the spec) the byte order of the encapsulation.
+ // The default values for the allocators
+ // in this constructor are not 0, but are generated by the
+ // ORB. Refer to the constructor body in CDR.cpp for the
+ // code that supplies these values to the base class constructor.
+
TAO_InputCDR (const TAO_OutputCDR& rhs,
ACE_Allocator* buffer_allocator = 0,
ACE_Allocator* data_block_allocator = 0);
@@ -437,186 +201,38 @@ public:
~TAO_InputCDR (void);
// destructor
- // = We have one method per basic IDL type....
- // They return 0 on failure and 1 on success.
- CORBA_Boolean read_boolean (CORBA::Boolean& x);
- CORBA_Boolean read_char (CORBA::Char& x);
- CORBA_Boolean read_wchar (CORBA::WChar& x);
- CORBA_Boolean read_octet (CORBA::Octet& x);
- CORBA_Boolean read_short (CORBA::Short& x);
- CORBA_Boolean read_ushort (CORBA::UShort& x);
- CORBA_Boolean read_long (CORBA::Long& x);
- CORBA_Boolean read_ulong (CORBA::ULong& x);
- CORBA_Boolean read_longlong (CORBA::LongLong& x);
- CORBA_Boolean read_ulonglong (CORBA::ULongLong& x);
- CORBA_Boolean read_float (CORBA::Float& x);
- CORBA_Boolean read_double (CORBA::Double& x);
- CORBA_Boolean read_longdouble (CORBA::LongDouble& x);
- CORBA_Boolean read_string (CORBA::Char*& x);
- CORBA_Boolean read_wstring (CORBA::WChar*& x);
-
- // = One method for each basic IDL type...
- // The buffer <x> must be large enough to contain <length>
- // elements.
- // They return 0 on failure and 1 on success.
- CORBA_Boolean read_boolean_array (CORBA::Boolean* x,
- CORBA::ULong length);
- CORBA_Boolean read_char_array (CORBA::Char* x,
- CORBA::ULong length);
- CORBA_Boolean read_wchar_array (CORBA::WChar* x,
- CORBA::ULong length);
- CORBA_Boolean read_octet_array (CORBA::Octet* x,
- CORBA::ULong length);
- CORBA_Boolean read_short_array (CORBA::Short* x,
- CORBA::ULong length);
- CORBA_Boolean read_ushort_array (CORBA::UShort* x,
- CORBA::ULong length);
- CORBA_Boolean read_long_array (CORBA::Long* x,
- CORBA::ULong length);
- CORBA_Boolean read_ulong_array (CORBA::ULong* x,
- CORBA::ULong length);
- CORBA_Boolean read_longlong_array (CORBA::LongLong* x,
- CORBA::ULong length);
- CORBA_Boolean read_ulonglong_array (CORBA::ULongLong* x,
- CORBA::ULong length);
- CORBA_Boolean read_float_array (CORBA::Float* x,
- CORBA::ULong length);
- CORBA_Boolean read_double_array (CORBA::Double* x,
- CORBA::ULong length);
- CORBA_Boolean read_longdouble_array (CORBA::LongDouble* x,
- CORBA::ULong length);
-
// = TAO specific methods.
- CORBA::TypeCode::traverse_status decode (CORBA::TypeCode_ptr tc,
- const void *data,
- const void *,
- CORBA_Environment &TAO_IN_ENV = CORBA_Environment::default_environment ());
+ CORBA::TypeCode::traverse_status decode (
+ CORBA::TypeCode_ptr tc,
+ const void *data,
+ const void *,
+ CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment::default_environment ());
// Demarshall the contents of the CDR stream into <data> as
// described by <tc>; returning any errors in <TAO_IN_ENV>.
- // = We have one method per basic IDL type....
- // They return 0 on failure and 1 on success.
- CORBA_Boolean skip_boolean (void);
- CORBA_Boolean skip_char (void);
- CORBA_Boolean skip_wchar (void);
- CORBA_Boolean skip_octet (void);
- CORBA_Boolean skip_short (void);
- CORBA_Boolean skip_ushort (void);
- CORBA_Boolean skip_long (void);
- CORBA_Boolean skip_ulong (void);
- CORBA_Boolean skip_longlong (void);
- CORBA_Boolean skip_ulonglong (void);
- CORBA_Boolean skip_float (void);
- CORBA_Boolean skip_double (void);
- CORBA_Boolean skip_longdouble (void);
- CORBA_Boolean skip_wstring (void);
- CORBA_Boolean skip_string (void);
- // The next field must be a string, this method skips it. It is
- // useful in parsing a TypeCode.
- // Return 0 on failure and 1 on success.
-
- CORBA_Boolean skip_bytes (size_t n);
- // Skip <n> bytes in the CDR stream.
- // Return 0 on failure and 1 on success.
-
- CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc,
- CORBA_Environment &TAO_IN_ENV = CORBA_Environment::default_environment ());
+ CORBA::TypeCode::traverse_status skip (
+ CORBA::TypeCode_ptr tc,
+ CORBA_Environment &TAO_IN_ENV =
+ CORBA_Environment::default_environment ());
// Skip the contents of the CDR stream based on information
// described by <tc>; returning any errors in <TAO_IN_ENV>.
-
- int good_bit (void) const;
- // returns zero if a problem has been detected.
-
- const ACE_Message_Block* start (void) const;
- // Return the start of the message block chain for this CDR stream.
- // NOTE: In the current implementation the chain has length 1, but
- // we are planning to change that.
-
- char* rd_ptr (void);
- // Returns the current position for the rd_ptr....
-
- size_t length (void) const;
- // Return how many bytes are left in the stream.
-
-private:
- void rd_ptr (size_t offset);
- char* end (void);
- // short cuts for the underlying message block.
-
- int adjust (size_t size, char*& buf);
- // Returns (in <buf>) the next position in the buffer aligned to
- // <size>, it advances the Message_Block rd_ptr past the data
- // (i.e. <buf> + <size>).
- // Sets the good_bit to 0 and returns a -1 on failure.
-
- int adjust (size_t size, size_t align, char*& buf);
- // As above, but now the size and alignment requirements may be
- // different.
-
- CORBA_Boolean read_1 (CORBA::Octet* x);
- CORBA_Boolean read_2 (CORBA::UShort* x);
- CORBA_Boolean read_4 (CORBA::ULong* x);
- CORBA_Boolean read_8 (CORBA::ULongLong* x);
- CORBA_Boolean read_16 (CORBA::LongDouble* x);
- // Several types can be read using the same routines, since TAO
- // tries to use native types with known size for each CORBA type.
- // We could use void* or char* to make the interface more
- // consistent, but using native types let us exploit the strict
- // alignment requirements of CDR streams and implement the
- // operations using asignment.
-
- CORBA_Boolean read_array (void* x, size_t size, size_t align,
- CORBA::ULong length);
- // read an array of <length> elements, each of <size> bytes and
- // the start aligned at a multiple of <align>. The elements are
- // assumed to be packed with the right alignment restrictions.
- // It is mostly designed for buffers of the basic types.
- //
- // This operation uses memcpy(); as explained above it is expected
- // that using assignment is faster that memcpy() for one element,
- // but for several elements memcpy() should be more efficient, it
- // could be interesting to find the break even point and optimize
- // for that case, but that would be too platform dependent.
-
-private:
- ACE_Message_Block start_;
- // The start of the chain of message blocks, even though in the
- // current version the chain always has length 1.
-
- TAO_Marshal_Factory *factory_;
- // Maintain a factory that can make specialized marshaling objects.
-
- int do_byte_swap_;
- // The CDR stream byte order does not match the one on the machine,
- // swapping is needed while reading.
-
- int good_bit_;
- // set to 0 when an error occurs.
};
#if defined(__ACE_INLINE__)
# include "tao/CDR.i"
#else
-// CDR output operators for primitive types
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::Short x);
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::UShort x);
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::Long x);
+
+// CDR output operators for CORBA types
+
+// This one must be redefined in TAO to ease some compilers'
+// overload resolution difficulties in
+// TAO_GIOP_Service_Context and TAO_GIOP_Invocation.
+// It simply calls the ACE operator inline.
extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
CORBA::ULong x);
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::LongLong x);
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::ULongLong x);
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::LongDouble x);
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::Float x);
-extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
- CORBA::Double x);
+
extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
const CORBA::Any &x);
extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
@@ -624,39 +240,15 @@ extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
extern TAO_Export CORBA_Boolean operator<< (TAO_OutputCDR& cdr,
const CORBA::TypeCode *x);
-// CDR output operator from helper classes
-extern TAO_Export CORBA_Boolean operator << (TAO_OutputCDR& cdr,
- CORBA::Any::from_boolean x);
-extern TAO_Export CORBA_Boolean operator << (TAO_OutputCDR& cdr,
- CORBA::Any::from_char x);
-extern TAO_Export CORBA_Boolean operator << (TAO_OutputCDR& cdr,
- CORBA::Any::from_wchar x);
-extern TAO_Export CORBA_Boolean operator << (TAO_OutputCDR& cdr,
- CORBA::Any::from_octet x);
-extern TAO_Export CORBA_Boolean operator << (TAO_OutputCDR& cdr,
- CORBA::Any::from_string x);
-extern TAO_Export CORBA_Boolean operator << (TAO_OutputCDR& cdr,
- const char* x);
-
-// CDR input operators for primitive types
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::Short &x);
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::UShort &x);
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::Long &x);
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::ULong &x);
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::LongLong &x);
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::ULongLong &x);
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::LongDouble &x);
-extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::Float &x);
+// CDR input operators for CORBA types
+
+// This one must be redefined in TAO to ease some compilers'
+// overload resolution difficulties in
+// TAO_GIOP_Service_Context and TAO_GIOP_Invocation.
+// It simply calls the ACE operator inline.
extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::Double &x);
+ CORBA::ULong x);
+
extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
CORBA::Any &x);
extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
@@ -664,19 +256,6 @@ extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
extern TAO_Export CORBA_Boolean operator>> (TAO_InputCDR& cdr,
CORBA::TypeCode *&x);
-// CDR output operator from helper classes
-extern TAO_Export CORBA_Boolean operator >> (TAO_InputCDR& cdr,
- CORBA::Any::to_boolean x);
-extern TAO_Export CORBA_Boolean operator >> (TAO_InputCDR& cdr,
- CORBA::Any::to_char x);
-extern TAO_Export CORBA_Boolean operator >> (TAO_InputCDR& cdr,
- CORBA::Any::to_wchar x);
-extern TAO_Export CORBA_Boolean operator >> (TAO_InputCDR& cdr,
- CORBA::Any::to_octet x);
-extern TAO_Export CORBA_Boolean operator >> (TAO_InputCDR& cdr,
- CORBA::Any::to_string x);
-extern TAO_Export CORBA_Boolean operator >> (TAO_InputCDR& cdr,
- char*& x);
#endif /* __ACE_INLINE */
diff --git a/TAO/tao/CDR.i b/TAO/tao/CDR.i
index b5e394a0e7a..1dbf5f6e74d 100644
--- a/TAO/tao/CDR.i
+++ b/TAO/tao/CDR.i
@@ -3,342 +3,6 @@
// ****************************************************************
-ACE_INLINE
-void CDR::swap_2 (const char *orig, char* target)
-{
- target[1] = *orig++;
- target[0] = *orig++;
-}
-
-ACE_INLINE
-void CDR::swap_4 (const char *orig, char* target)
-{
- target [3] = *orig++;
- target [2] = *orig++;
- target [1] = *orig++;
- target [0] = *orig++;
-}
-
-ACE_INLINE
-void CDR::swap_8 (const char *orig, char* target)
-{
- target [7] = *orig++;
- target [6] = *orig++;
- target [5] = *orig++;
- target [4] = *orig++;
- target [3] = *orig++;
- target [2] = *orig++;
- target [1] = *orig++;
- target [0] = *orig++;
-}
-
-ACE_INLINE
-void CDR::swap_16 (const char *orig, char* target)
-{
- target [15] = *orig++;
- target [14] = *orig++;
- target [13] = *orig++;
- target [12] = *orig++;
- target [11] = *orig++;
- target [10] = *orig++;
- target [9] = *orig++;
- target [8] = *orig++;
- target [7] = *orig++;
- target [6] = *orig++;
- target [5] = *orig++;
- target [4] = *orig++;
- target [3] = *orig++;
- target [2] = *orig++;
- target [1] = *orig++;
- target [0] = *orig++;
-}
-
-ACE_INLINE void
-CDR::mb_align (ACE_Message_Block* mb)
-{
- char* start = ptr_align_binary (mb->base (), CDR::MAX_ALIGNMENT);
- mb->rd_ptr (start);
- mb->wr_ptr (start);
-
-#if defined (ACE_HAS_PURIFY)
- // This is a good place to zero the buffer; this is not needed
- // by IIOP, but makes Purify happy.
- if (mb->base () != 0)
- {
- (void) ACE_OS::memset (mb->base(), 0, mb->size());
- }
-#endif /* ACE_HAS_PURIFY */
-}
-
-// ****************************************************************
-
-// Decode the CDR stream.
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_char (CORBA::Char x)
-{
- return this->write_1 (ACE_reinterpret_cast(const CORBA::Octet*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_wchar (CORBA::WChar x)
-{
- return this->write_2 (ACE_reinterpret_cast(const CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_octet (CORBA::Octet x)
-{
- return this->write_1 (ACE_reinterpret_cast(const CORBA::Octet*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_boolean (CORBA::Boolean x)
-{
- return this->write_octet (x?1:0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_short (CORBA::Short x)
-{
- return this->write_2 (ACE_reinterpret_cast(const CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_ushort (CORBA::UShort x)
-{
- return this->write_2 (ACE_reinterpret_cast(const CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_long (CORBA::Long x)
-{
- return this->write_4 (ACE_reinterpret_cast(const CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_ulong (CORBA::ULong x)
-{
- return this->write_4 (ACE_reinterpret_cast(const CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_longlong (const CORBA::LongLong &x)
-{
- return this->write_8 (ACE_reinterpret_cast(const CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_ulonglong (const CORBA::ULongLong &x)
-{
- return this->write_8 (ACE_reinterpret_cast(const CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_float (CORBA::Float x)
-{
- return this->write_4 (ACE_reinterpret_cast(const CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_double (const CORBA::Double &x)
-{
- return this->write_8 (ACE_reinterpret_cast(const CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_longdouble (const CORBA::LongDouble &x)
-{
- return this->write_16 (ACE_reinterpret_cast(const CORBA::LongDouble*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_string (const CORBA::Char *x)
-{
- if (x != 0)
- return this->write_string (ACE_OS::strlen (x), x);
- return this->write_string (0, 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_wstring (const CORBA::WChar *x)
-{
- if (x != 0)
- return this->write_wstring (ACE_OS::wslen (x), x);
- return this->write_wstring (0, 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_char_array (const CORBA::Char* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::OCTET_SIZE,
- CDR::OCTET_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_wchar_array (const CORBA::WChar* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::SHORT_SIZE,
- CDR::SHORT_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_octet_array (const CORBA::Octet* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::OCTET_SIZE,
- CDR::OCTET_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_short_array (const CORBA::Short* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::SHORT_SIZE,
- CDR::SHORT_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_ushort_array (const CORBA::UShort* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::SHORT_SIZE,
- CDR::SHORT_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_long_array (const CORBA::Long* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::LONG_SIZE,
- CDR::LONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_ulong_array (const CORBA::ULong* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::LONG_SIZE,
- CDR::LONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_longlong_array (const CORBA::LongLong* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::LONGLONG_SIZE,
- CDR::LONGLONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_ulonglong_array (const CORBA::ULongLong* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::LONGLONG_SIZE,
- CDR::LONGLONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_float_array (const CORBA::Float* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::LONG_SIZE,
- CDR::LONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_double_array (const CORBA::Double* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::LONGLONG_SIZE,
- CDR::LONGLONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::write_longdouble_array (const CORBA::LongDouble* x,
- CORBA::ULong length)
-{
- return this->write_array (x,
- CDR::LONGDOUBLE_SIZE,
- CDR::LONGDOUBLE_ALIGN,
- length);
-}
-
-ACE_INLINE int
-TAO_OutputCDR::good_bit (void) const
-{
- return this->good_bit_;
-}
-
-ACE_INLINE const ACE_Message_Block*
-TAO_OutputCDR::begin (void) const
-{
- return &this->start_;
-}
-
-ACE_INLINE const ACE_Message_Block*
-TAO_OutputCDR::end (void) const
-{
- return this->current_->cont ();
-}
-
-ACE_INLINE const char*
-TAO_OutputCDR::buffer (void) const
-{
- return this->start_.rd_ptr ();
-}
-
-ACE_INLINE size_t
-TAO_OutputCDR::length (void) const
-{
- return this->start_.length ();
-}
-
-ACE_INLINE int
-TAO_OutputCDR::adjust (size_t size, size_t align, char*& buf)
-{
- buf = ptr_align_binary (this->current_->wr_ptr(), align);
- char *end = buf + size;
-
- if (end <= this->current_->end ())
- {
- this->current_->wr_ptr (end);
- return 0;
- }
-
- return this->grow_and_adjust (size, align, buf);
-}
-
-ACE_INLINE int
-TAO_OutputCDR::adjust (size_t size, char*& buf)
-{
- return this->adjust (size, size, buf);
-}
-
ACE_INLINE CORBA::TypeCode::traverse_status
TAO_OutputCDR::encode (CORBA::TypeCode_ptr tc,
const void *data,
@@ -346,7 +10,8 @@ TAO_OutputCDR::encode (CORBA::TypeCode_ptr tc,
CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- this->factory_->make_marshal_object (tc, TAO_IN_ENV);
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
if (!mobj)
@@ -355,321 +20,17 @@ TAO_OutputCDR::encode (CORBA::TypeCode_ptr tc,
return mobj->encode (tc, data, data2, this, TAO_IN_ENV);
}
-ACE_INLINE int
-TAO_OutputCDR::do_byte_swap (void) const
-{
- return this->do_byte_swap_;
-}
-
// ****************************************************************
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_char (CORBA::Char& x)
-{
- return this->read_1 (ACE_reinterpret_cast(CORBA::Octet*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_wchar (CORBA::WChar& x)
-{
- return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_octet (CORBA::Octet& x)
-{
- return this->read_1 (&x);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_boolean (CORBA::Boolean& x)
-{
- CORBA::Octet tmp;
- this->read_octet (tmp);
- x = tmp ? 1 : 0;
- return this->good_bit_;
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_short (CORBA::Short& x)
-{
- return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_ushort (CORBA::UShort& x)
-{
- return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_long (CORBA::Long& x)
-{
- return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_ulong (CORBA::ULong& x)
-{
- return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_longlong (CORBA::LongLong& x)
-{
- return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_ulonglong (CORBA::ULongLong& x)
-{
- return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_float (CORBA::Float& x)
-{
- return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_double (CORBA::Double& x)
-{
- return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_longdouble (CORBA::LongDouble& x)
-{
- return this->read_16 (ACE_reinterpret_cast(CORBA::LongDouble*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_char_array (CORBA::Char* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::OCTET_SIZE,
- CDR::OCTET_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_wchar_array (CORBA::WChar* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::SHORT_SIZE,
- CDR::SHORT_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_octet_array (CORBA::Octet* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::OCTET_SIZE,
- CDR::OCTET_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_short_array (CORBA::Short* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::SHORT_SIZE,
- CDR::SHORT_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_ushort_array (CORBA::UShort* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::SHORT_SIZE,
- CDR::SHORT_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_long_array (CORBA::Long* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::LONG_SIZE,
- CDR::LONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_ulong_array (CORBA::ULong* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::LONG_SIZE,
- CDR::LONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_longlong_array (CORBA::LongLong* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::LONGLONG_SIZE,
- CDR::LONGLONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_ulonglong_array (CORBA::ULongLong* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::LONGLONG_SIZE,
- CDR::LONGLONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_float_array (CORBA::Float* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::LONG_SIZE,
- CDR::LONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_double_array (CORBA::Double* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::LONGLONG_SIZE,
- CDR::LONGLONG_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::read_longdouble_array (CORBA::LongDouble* x,
- CORBA::ULong length)
-{
- return this->read_array (x,
- CDR::LONGDOUBLE_SIZE,
- CDR::LONGDOUBLE_ALIGN,
- length);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_char (void)
-{
- CORBA::Char x;
- return this->read_1 (ACE_reinterpret_cast(CORBA::Octet*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_wchar (void)
-{
- CORBA::WChar x;
- return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_octet (void)
-{
- CORBA::Octet x;
- return this->read_1 (&x);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_boolean (void)
-{
- CORBA::Octet tmp;
- this->read_octet (tmp);
- return this->good_bit_;
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_short (void)
-{
- CORBA::Short x;
- return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_ushort (void)
-{
- CORBA::UShort x;
- return this->read_2 (ACE_reinterpret_cast(CORBA::UShort*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_long (void)
-{
- CORBA::Long x;
- return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_ulong (void)
-{
- CORBA::ULong x;
- return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_longlong (void)
-{
- CORBA::LongLong x;
- return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_ulonglong (void)
-{
- CORBA::ULongLong x;
- return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_float (void)
-{
- CORBA::Float x;
- return this->read_4 (ACE_reinterpret_cast(CORBA::ULong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_double (void)
-{
- CORBA::Double x;
- return this->read_8 (ACE_reinterpret_cast(CORBA::ULongLong*,&x));
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_InputCDR::skip_longdouble (void)
-{
- CORBA::LongDouble x;
- return this->read_16 (ACE_reinterpret_cast(CORBA::LongDouble*,&x));
-}
-
-ACE_INLINE int
-TAO_InputCDR::good_bit (void) const
-{
- return this->good_bit_;
-}
-
ACE_INLINE CORBA::TypeCode::traverse_status
TAO_InputCDR::decode (CORBA::TypeCode_ptr tc,
- const void *data,
- const void *data2,
- CORBA::Environment &TAO_IN_ENV)
+ const void *data,
+ const void *data2,
+ CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- this->factory_->make_marshal_object (tc, TAO_IN_ENV);
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
if (!mobj)
@@ -683,7 +44,8 @@ TAO_InputCDR::skip (CORBA::TypeCode_ptr tc,
CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- this->factory_->make_marshal_object (tc, TAO_IN_ENV);
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
if (mobj == 0)
@@ -692,88 +54,12 @@ TAO_InputCDR::skip (CORBA::TypeCode_ptr tc,
return mobj->skip (tc, this, TAO_IN_ENV);
}
-ACE_INLINE size_t
-TAO_InputCDR::length (void) const
-{
- return this->start_.length ();
-}
-
-ACE_INLINE const ACE_Message_Block*
-TAO_InputCDR::start (void) const
-{
- return &this->start_;
-}
-
-ACE_INLINE char*
-TAO_InputCDR::rd_ptr (void)
-{
- return this->start_.rd_ptr ();
-}
-
// ****************************************************************
-// @@ TODO: Use the CORBA_* types when they become available.
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Short x)
-{
- cdr.write_short (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::UShort x)
-{
- cdr.write_short (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Long x)
-{
- cdr.write_long (x);
- return cdr.good_bit ();
-}
ACE_INLINE CORBA_Boolean
operator<< (TAO_OutputCDR& cdr, CORBA::ULong x)
{
- cdr.write_long (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::LongLong x)
-{
- cdr.write_longlong (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::ULongLong x)
-{
- cdr.write_ulonglong (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::LongDouble x)
-{
- cdr.write_longdouble (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Float x)
-{
- cdr.write_float (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Double x)
-{
- cdr.write_double (x);
- return cdr.good_bit ();
+ return operator<< (cdr, x);
}
ACE_INLINE CORBA_Boolean
@@ -782,7 +68,11 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::Any &x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_ANY::instance ()->encode (0, &x, 0, &cdr, TAO_TRY_ENV);
+ TAO_MARSHAL_ANY::instance ()->encode (0,
+ &x,
+ 0,
+ &cdr,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
if (status== CORBA::TypeCode::TRAVERSE_CONTINUE)
@@ -803,7 +93,11 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::Object *x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_OBJREF::instance ()->encode (0, &x, 0, &cdr, TAO_TRY_ENV);
+ TAO_MARSHAL_OBJREF::instance ()->encode (0,
+ &x,
+ 0,
+ &cdr,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
if (status == CORBA::TypeCode::TRAVERSE_CONTINUE)
@@ -824,7 +118,11 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::TypeCode *x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_TYPECODE::instance ()->encode (0, &x, 0, &cdr, TAO_TRY_ENV);
+ TAO_MARSHAL_TYPECODE::instance ()->encode (0,
+ &x,
+ 0,
+ &cdr,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
if (status == CORBA::TypeCode::TRAVERSE_CONTINUE)
@@ -839,112 +137,12 @@ operator<< (TAO_OutputCDR& cdr, const CORBA::TypeCode *x)
return 0;
}
-// The following use the helper classes
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Any::from_boolean x)
-{
- cdr.write_boolean (x.val_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Any::from_char x)
-{
- cdr.write_char (x.val_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Any::from_wchar x)
-{
- cdr.write_wchar (x.val_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Any::from_octet x)
-{
- cdr.write_octet (x.val_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, CORBA::Any::from_string x)
-{
- cdr.write_string (x.bound_, x.val_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator<< (TAO_OutputCDR& cdr, const char* x)
-{
- cdr.write_string (x);
- return cdr.good_bit ();
-}
-
// ****************************************************************
ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Short &x)
-{
- cdr.read_short (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::UShort &x)
-{
- cdr.read_ushort (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Long &x)
-{
- cdr.read_long (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::ULong &x)
-{
- cdr.read_ulong (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::LongLong &x)
-{
- cdr.read_longlong (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::ULongLong &x)
-{
- cdr.read_ulonglong (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::LongDouble &x)
-{
- cdr.read_longdouble (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Float &x)
-{
- cdr.read_float (x);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Double &x)
+operator>> (TAO_InputCDR& cdr, CORBA::ULong x)
{
- cdr.read_double (x);
- return cdr.good_bit ();
+ return operator>> (cdr, x);
}
ACE_INLINE CORBA_Boolean
@@ -953,7 +151,11 @@ operator>> (TAO_InputCDR& cdr, CORBA::Any &x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_ANY::instance ()->decode (0, &x, 0, &cdr, TAO_TRY_ENV);
+ TAO_MARSHAL_ANY::instance ()->decode (0,
+ &x,
+ 0,
+ &cdr,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
if (status != CORBA::TypeCode::TRAVERSE_CONTINUE)
@@ -974,7 +176,11 @@ operator>> (TAO_InputCDR& cdr, CORBA::Object *&x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_OBJREF::instance ()->decode (0, &x, 0, &cdr, TAO_TRY_ENV);
+ TAO_MARSHAL_OBJREF::instance ()->decode (0,
+ &x,
+ 0,
+ &cdr,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
if (status != CORBA::TypeCode::TRAVERSE_CONTINUE)
@@ -995,7 +201,11 @@ operator>> (TAO_InputCDR& cdr, CORBA::TypeCode *&x)
TAO_TRY
{
CORBA::TypeCode::traverse_status status =
- TAO_MARSHAL_TYPECODE::instance ()->decode (0, &x, 0, &cdr, TAO_TRY_ENV);
+ TAO_MARSHAL_TYPECODE::instance ()->decode (0,
+ &x,
+ 0,
+ &cdr,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
if (status != CORBA::TypeCode::TRAVERSE_CONTINUE)
@@ -1010,172 +220,19 @@ operator>> (TAO_InputCDR& cdr, CORBA::TypeCode *&x)
return 1;
}
-// The following use the helper classes
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Any::to_boolean x)
-{
- cdr.read_boolean (x.ref_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Any::to_char x)
-{
- cdr.read_char (x.ref_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Any::to_wchar x)
-{
- cdr.read_wchar (x.ref_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Any::to_octet x)
-{
- cdr.read_octet (x.ref_);
- return cdr.good_bit ();
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::Any::to_string x)
-{
- cdr.read_string (x.val_);
- // check if the bounds are satisfied
- return (cdr.good_bit () &&
- (ACE_OS::strlen (x.val_) <= x.bound_));
-}
-
-ACE_INLINE CORBA_Boolean
-operator>> (TAO_InputCDR& cdr, char*& x)
-{
- cdr.read_string (x);
- return cdr.good_bit ();
-}
-
// ***************************************************************************
-// We must define these methods here because they use the "read_*" inlined
-// methods of the TAO_InputCDR class
+// We must define this method here because it uses the "read_*" inlined
+// methods of the ACE_InputCDR class
// ***************************************************************************
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_boolean (TAO_InputCDR &stream)
-{
- CORBA::Boolean x;
- return (stream.read_boolean (x) ? this->write_boolean (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_char (TAO_InputCDR &stream)
-{
- CORBA::Char x;
- return (stream.read_char (x) ? this->write_char (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_wchar (TAO_InputCDR &stream)
-{
- CORBA::WChar x;
- return (stream.read_wchar (x) ? this->write_wchar (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_octet (TAO_InputCDR &stream)
-{
- CORBA::Octet x;
- return (stream.read_octet (x) ? this->write_octet (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_short (TAO_InputCDR &stream)
-{
- CORBA::Short x;
- return (stream.read_short (x) ? this->write_short (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_ushort (TAO_InputCDR &stream)
-{
- CORBA::UShort x;
- return (stream.read_ushort (x) ? this->write_ushort (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_long (TAO_InputCDR &stream)
-{
- CORBA::Long x;
- return (stream.read_long (x) ? this->write_long (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_ulong (TAO_InputCDR &stream)
-{
- CORBA::ULong x;
- return (stream.read_ulong (x) ? this->write_ulong (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_longlong (TAO_InputCDR &stream)
-{
- CORBA::LongLong x;
- return (stream.read_longlong (x) ? this->write_longlong (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_ulonglong (TAO_InputCDR &stream)
-{
- CORBA::ULongLong x;
- return (stream.read_ulonglong (x) ? this->write_ulonglong (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_float (TAO_InputCDR &stream)
-{
- CORBA::Float x;
- return (stream.read_float (x) ? this->write_float (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_double (TAO_InputCDR &stream)
-{
- CORBA::Double x;
- return (stream.read_double (x) ? this->write_double (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_longdouble (TAO_InputCDR &stream)
-{
- CORBA::LongDouble x;
- return (stream.read_longdouble (x) ? this->write_longdouble (x) : 0);
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_string (TAO_InputCDR &stream)
-{
- char *x;
- CORBA::Boolean flag = (stream.read_string (x) ? this->write_string (x) : 0);
- CORBA::string_free (x);
- return flag;
-}
-
-ACE_INLINE CORBA_Boolean
-TAO_OutputCDR::append_wstring (TAO_InputCDR &stream)
-{
- CORBA::WChar *x;
- CORBA::Boolean flag = (stream.read_wstring (x) ? this->write_wstring (x) : 0);
- CORBA::wstring_free (x);
- return flag;
-}
-
ACE_INLINE CORBA::TypeCode::traverse_status
TAO_OutputCDR::append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
CORBA::Environment &TAO_IN_ENV)
{
TAO_Marshal_Object *mobj =
- this->factory_->make_marshal_object (tc, TAO_IN_ENV);
+ TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc,
+ TAO_IN_ENV);
TAO_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);
if (mobj == 0)
diff --git a/TAO/tao/Connect.cpp b/TAO/tao/Connect.cpp
index d8e22edc894..6262b418630 100644
--- a/TAO/tao/Connect.cpp
+++ b/TAO/tao/Connect.cpp
@@ -533,8 +533,7 @@ TAO_Server_Connection_Handler::handle_input (ACE_HANDLE)
// allocator. It is better to use a message block than a on stack
// buffer because we cannot minimize memory copies in that case.
TAO_InputCDR input (this->orb_core_->create_input_cdr_data_block (CDR::DEFAULT_BUFSIZE),
- TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ TAO_ENCAP_BYTE_ORDER);
char repbuf[CDR::DEFAULT_BUFSIZE];
#if defined(ACE_HAS_PURIFY)
@@ -542,7 +541,6 @@ TAO_Server_Connection_Handler::handle_input (ACE_HANDLE)
#endif /* ACE_HAS_PURIFY */
TAO_OutputCDR output (repbuf, sizeof(repbuf),
TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
this->orb_core_->output_cdr_buffer_allocator (),
this->orb_core_->output_cdr_buffer_allocator ());
diff --git a/TAO/tao/GIOP.cpp b/TAO/tao/GIOP.cpp
index cd91afe9096..324ac0d1faf 100644
--- a/TAO/tao/GIOP.cpp
+++ b/TAO/tao/GIOP.cpp
@@ -227,7 +227,7 @@ TAO_GIOP::send_request (TAO_Transport *transport,
CORBA::ULong bodylen = total_len - header_len;
-#if !defined (TAO_ENABLE_SWAP_ON_WRITE)
+#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*ACE_reinterpret_cast(CORBA::ULong*,buf + offset) = bodylen;
#else
if (!stream->do_byte_swap ())
@@ -237,7 +237,7 @@ TAO_GIOP::send_request (TAO_Transport *transport,
CDR::swap_4 (ACE_reinterpret_cast (char *,
&bodylen),
buf + offset);
-#endif /* TAO_ENABLE_SWAP_ON_WRITE */
+#endif /* ACE_ENABLE_SWAP_ON_WRITE */
// Strictly speaking, should not need to loop here because the
// socket never gets set to a nonblocking mode ... some Linux
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index c7a261aeb43..7557b9e7028 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -61,7 +61,6 @@ TAO_GIOP_Invocation::TAO_GIOP_Invocation (STUB_Object *data,
my_request_id_ (0),
out_stream_ (buffer, sizeof buffer, /* CDR::DEFAULT_BUFSIZE */
TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
orb_core->output_cdr_buffer_allocator (),
orb_core->output_cdr_dblock_allocator ()),
orb_core_ (orb_core)
diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i
index 17db54809e9..36b2d8543c0 100644
--- a/TAO/tao/Invocation.i
+++ b/TAO/tao/Invocation.i
@@ -26,8 +26,7 @@ TAO_GIOP_Twoway_Invocation (STUB_Object *data,
TAO_ORB_Core *orb_core)
: TAO_GIOP_Invocation (data, operation, orb_core),
inp_stream_ (orb_core->create_input_cdr_data_block (CDR::DEFAULT_BUFSIZE),
- TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY)
+ TAO_ENCAP_BYTE_ORDER)
{
}
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index c54dfe5bdd5..81f60ffa99b 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -116,20 +116,6 @@ CORBA::string_dup (const CORBA::Char *str)
return CORBA::string_copy (str);
}
-#if defined (NONNATIVE_LONGDOUBLE)
-int
-CORBA::LongDouble::operator== (CORBA::LongDouble &rhs)
-{
- return ACE_OS::memcmp (this->ld, rhs.ld, 16) == 0;
-}
-
-int
-CORBA::LongDouble::operator!= (CORBA::LongDouble &rhs)
-{
- return ACE_OS::memcmp (this->ld, rhs.ld, 16) != 0;
-}
-#endif /* NONNATIVE_LONGDOUBLE */
-
CORBA_ORB::InvalidName::InvalidName (void)
{
}
diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h
index 961987f9af2..d9f5502157a 100644
--- a/TAO/tao/ORB.h
+++ b/TAO/tao/ORB.h
@@ -184,13 +184,10 @@ class TAO_ServantBase;
// enum values defined in nvlist.h, bitwise ORed.
typedef u_int CORBA_Flags;
-#if defined (ghs) && defined (CHORUS)
- // This is non-compliant, but a nasty but with Green Hills C++68000 1.8.8
- // forces us into it. TAO/tests/POA/RootPOA/RootPOA reveals the problem.
- typedef unsigned long CORBA_Boolean;
-#else /* ! (ghs && CHORUS) */
- typedef u_char CORBA_Boolean;
-#endif /* ! (ghs && CHORUS) */
+// This and the other CORBA IDL types below are
+// typedef'd to the corresponding CDR types
+// already defined in ACE.
+typedef CDR::Boolean CORBA_Boolean;
typedef struct TAO_Leader_Follower_Info_Struct
{
@@ -227,21 +224,24 @@ public:
typedef Boolean &Boolean_out;
// Out type for boolean.
- typedef u_char Octet;
+// This and the other CORBA IDL types below are
+// typedef'd to the corresponding CDR types
+// already defined in ACE.
+ typedef CDR::Octet Octet;
typedef Octet &Octet_out;
// Out type for octet.
- typedef ACE_INT16 Short;
+ typedef CDR::Short Short;
typedef Short &Short_out;
// Out type for Short.
- typedef ACE_UINT16 UShort;
+ typedef CDR::UShort UShort;
typedef UShort &UShort_out;
// Out type for UShort.
// = CORBA "Long" (and its unsigned cousin) are 32 bits.
- typedef ACE_INT32 Long;
- typedef ACE_UINT32 ULong;
+ typedef CDR::Long Long;
+ typedef CDR::ULong ULong;
// 94-9-32 Appendix A, also the OMG C++ mapping, stipulate that 64
// bit integers are "LongLong".
@@ -253,34 +253,8 @@ public:
// = The following are IDL extensions, not yet standard.
- typedef ACE_UINT64 ULongLong;
-# if defined (_MSC_VER) && _MSC_VER >= 900
- typedef __int64 LongLong;
-# elif ACE_SIZEOF_LONG == 8
- typedef long LongLong;
-# elif ACE_SIZEOF_LONG_LONG == 8 && !defined (ACE_LACKS_LONGLONG_T)
-# if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T)
- // sun #defines u_longlong_t, maybe other platforms do also.
- // Use it, at least with g++, so that its -pedantic doesn't
- // complain about no ANSI C++ long long.
- typedef longlong_t LongLong;
-# else
- // LynxOS 2.5.0 and Linux don't have u_longlong_t.
- typedef long long LongLong;
-# endif /* sun */
-# else /* no native 64 bit integer type */
-
- // If "long long" isn't native, programs can't use these data
- // types in normal arithmetic expressions. If any particular
- // application can cope with the loss of range, it can define
- // conversion operators itself.
-# define NONNATIVE_LONGLONG
-# if defined (ACE_BIG_ENDIAN)
- struct LongLong { Long h, l; };
-# else
- struct LongLong { Long l, h; };
-# endif /* ! ACE_BIG_ENDIAN */
-# endif /* no native 64 bit integer type */
+ typedef CDR::LongLong LongLong;
+ typedef CDR::ULongLong ULongLong;
typedef LongLong &LongLong_out;
// Out type for long long.
@@ -288,38 +262,10 @@ public:
typedef ULongLong &ULongLong_out;
// Out type for unsigned long long.
-# if ACE_SIZEOF_FLOAT == 4
- typedef float Float;
-# else /* ACE_SIZEOF_FLOAT != 4 */
-# define TAO_NONNATIVE_FLOAT
- struct Float
- {
-# if ACE_SIZEOF_INT == 4
- // Use u_int to get word alignment.
- u_int f;
-# else /* ACE_SIZEOF_INT != 4 */
- // Applications will probably have trouble with this.
- char f[4];
-# endif /* ACE_SIZEOF_INT != 4 */
- };
-# endif /* ACE_SIZEOF_FLOAT != 4 */
+ typedef CDR::Float Float;
typedef Float &Float_out; // out type for float
-# if ACE_SIZEOF_DOUBLE == 8
- typedef double Double;
-# else /* ACE_SIZEOF_DOUBLE != 8 */
-# define TAO_NONNATIVE_DOUBLE
- struct Double
- {
-# if ACE_SIZEOF_LONG == 8
- // Use u_long to get word alignment.
- u_long f;
-# else /* ACE_SIZEOF_INT != 8 */
- // Applications will probably have trouble with this.
- char f[8];
-# endif /* ACE_SIZEOF_INT != 8 */
- };
-# endif /* ACE_SIZEOF_DOUBLE != 8 */
+ typedef CDR::Double Double;
typedef Double &Double_out;
// Out type for double.
@@ -328,23 +274,11 @@ public:
// exponent (compared to "double"). This is an IDL extension, not
// yet standard.
-# if ACE_SIZEOF_LONG_DOUBLE == 16
- typedef long double LongDouble;
-# else
-# define NONNATIVE_LONGDOUBLE
- struct TAO_Export LongDouble
- {
- char ld[16];
- int operator== (LongDouble &rhs);
- int operator!= (LongDouble &rhs);
- // @@ also need other comparison operators.
- };
-# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */
-
+ typedef CDR::LongDouble LongDouble;
typedef LongDouble &LongDouble_out;
// Out type for long doubles.
- typedef char Char;
+ typedef CDR::Char Char;
typedef Char &Char_out;
// Out type for char.
@@ -463,7 +397,7 @@ public:
// WChar is an IDL extension, not yet standard. We use 32 bits
// because that's what many platforms use for their native wchar_t.
- typedef ACE_OS::WChar WChar;
+ typedef CDR::WChar WChar;
typedef WChar *WString;
typedef WChar &WChar_out;
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index fb735261651..96e201f701f 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -118,7 +118,7 @@ TAO_ORB_Core::init (int &argc, char *argv[])
ACE_CString host;
CORBA::UShort port = defport;
CORBA::Boolean use_ior = 1;
- int cdr_tradeoff = TAO_DEFAULT_CDR_MEMCPY_TRADEOFF;
+ int cdr_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF;
int iiop_lite = 0;
diff --git a/TAO/tao/corba.h b/TAO/tao/corba.h
index 7a1b394c12b..7308c1378e0 100644
--- a/TAO/tao/corba.h
+++ b/TAO/tao/corba.h
@@ -55,6 +55,7 @@
#include "ace/Synch.h"
#include "ace/Svc_Handler.h"
#include "ace/Containers.h"
+#include "ace/CDR.h"
#if !defined (TAO_HAS_DLL)
// On Windows NT, the default is to build TAO as a DLL library.
diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h
index 8760785077c..e2f8e656025 100644
--- a/TAO/tao/orbconf.h
+++ b/TAO/tao/orbconf.h
@@ -157,39 +157,13 @@
#define TAO_NAMESPACE_DEFINE(TYPE,NAME,RHS) NAME = RHS;
#endif /* ACE_HAS_USING_KEYWORD */
-// In some environments it is useful to swap the bytes on write, for
-// instance: a fast server can be feeding a lot of slow clients that
-// happen to have the wrong byte order.
-// This macro enables the functionality to support that, but we still
-// need a way to activate it on a per-connection basis.
-//
-// #define TAO_ENABLE_SWAP_ON_WRITE
-
-// In some environements we never need to swap bytes when reading, for
-// instance embebbed systems (such as avionics) or homogenous
-// networks.
-// Setting this macro disables the capabilities to demarshall streams
-// in the wrong byte order.
-//
-// #define TAO_DISABLE_SWAP_ON_READ
-
-// For some applications it is important to optimize octet sequences
-// and minimize the number of copies made of the sequence buffer.
-// TAO supports this optimizations by sharing the CDR stream buffer
-// and the octet sequences buffer via ACE_Message_Block's.
-// This feature can be disabled for: debugging, performance
-// comparisons, complaince checking (the octet sequences add an API to
-// access the underlying message block).
-//
+// Instead of replacing this with the ACE macro
+// in 20+ files, define it conditionally.
+// The TAO_OutputCDR class uses the ACE macro, which
+// is defined by default.
+#if defined (ACE_NO_COPY_OCTET_SEQUENCES)
#define TAO_NO_COPY_OCTET_SEQUENCES
-
-// Even though the strategy above minimizes copies in some cases it is
-// more efficient just to copy the octet sequence, for instance, while
-// enconding a "small" octet sequence in a buffer that has enough
-// space.
-// This parameter controls the default value for "small enough", but
-// can also be set using the command line option -ORBCDRtradeoff
-#define TAO_DEFAULT_CDR_MEMCPY_TRADEOFF 256
+#endif /* ACE_NO_COPY_OCTET_SEQUENCES */
#if defined (ACE_HAS_EXCEPTIONS)
# define TAO_HAS_EXCEPTIONS
@@ -200,16 +174,6 @@
# error "tao/orbconf.h: You can only use exceptions in TAO if ACE supports them"
#endif /* TAO_HAS_EXCEPTIONS */
-// The CDR growing strategy is control by several parameters:
-// + The default or initial CDR buffer size.
-// + From that value the CDR buffer is grown exponentially (size
-// duplicated each time) until it reaches EXP_GROWTH_MAX.
-// + From then on the buffer is grown linearly in chunks of
-// LINEAR_GROWTH_MAX
-#define TAO_DEFAULT_CDR_BUFSIZE 512
-#define TAO_DEFAULT_CDR_EXP_GROWTH_MAX 4096
-#define TAO_DEFAULT_CDR_LINEAR_GROWTH_CHUNK 4096
-
// BC++ seems to have a different convention for detecting Win32 than
// VC++.
diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp
index fbfd7acd12f..e638a979305 100644
--- a/TAO/tao/params.cpp
+++ b/TAO/tao/params.cpp
@@ -13,7 +13,7 @@ TAO_ORB_Parameters::TAO_ORB_Parameters (void)
trading_service_port_ (0),
sock_rcvbuf_size_ (ACE_DEFAULT_MAX_SOCKET_BUFSIZ),
sock_sndbuf_size_ (ACE_DEFAULT_MAX_SOCKET_BUFSIZ),
- cdr_memcpy_tradeoff_ (TAO_DEFAULT_CDR_MEMCPY_TRADEOFF),
+ cdr_memcpy_tradeoff_ (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF),
use_lite_protocol_ (0)
{
}