diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2002-12-17 17:49:18 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2002-12-17 17:49:18 +0000 |
commit | 68cd5a4ca8489a1a28811b6410e6779203d60b4d (patch) | |
tree | a781095b629f3ce121040359fe5fefce646899b8 /ace | |
parent | 164b6c49d272d5a691520422816ed68764e23f3d (diff) | |
download | ATCD-68cd5a4ca8489a1a28811b6410e6779203d60b4d.tar.gz |
ChangeLog tag: Tue Dec 17 11:22:31 2002 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/CDR_Stream.cpp | 32 | ||||
-rw-r--r-- | ace/CDR_Stream.h | 459 | ||||
-rw-r--r-- | ace/CDR_Stream.i | 42 | ||||
-rw-r--r-- | ace/Codeset_IBM1047.cpp | 25 | ||||
-rw-r--r-- | ace/Codeset_IBM1047.h | 14 |
5 files changed, 261 insertions, 311 deletions
diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index 0c98d01ca1c..2269dd038cd 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -41,7 +41,7 @@ ACE_OutputCDR::ACE_OutputCDR (size_t size, char_translator_ (0), wchar_translator_ (0), wchar_allowed_(1) - + { ACE_CDR::mb_align (&this->start_); this->current_ = &this->start_; @@ -175,7 +175,7 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) return (this->good_bit_ = 0); } if (this->wchar_translator_ != 0) - return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x)); + return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x)); if (ACE_static_cast (ACE_CDR::Short, major_version_) == 1 && ACE_static_cast (ACE_CDR::Short, minor_version_) == 2) { @@ -193,7 +193,7 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) if (sizeof (ACE_CDR::WChar) == 2) return this->write_2 (ACE_reinterpret_cast (const ACE_CDR::UShort *, &x)); else - return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong *, &x)); + return this->write_4 (ACE_reinterpret_cast (const ACE_CDR::ULong *, &x)); } ACE_CDR::Boolean @@ -648,10 +648,6 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, wchar_translator_ (rhs.wchar_translator_), wchar_allowed_ (rhs.wchar_allowed_) { - if (this->char_translator_) - this->char_translator_->add_ref(); - if (this->wchar_translator_) - this->wchar_translator_->add_ref(); // Align the base pointer assuming that the incoming stream is also // aligned the way we are aligned char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), @@ -682,10 +678,6 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, wchar_translator_ (rhs.wchar_translator_), wchar_allowed_ (rhs.wchar_allowed_) { - if (this->char_translator_) - this->char_translator_->add_ref(); - if (this->wchar_translator_) - this->wchar_translator_->add_ref(); // Align the base pointer assuming that the incoming stream is also // aligned the way we are aligned char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), @@ -721,10 +713,6 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs) wchar_translator_ (rhs.wchar_translator_), wchar_allowed_ (rhs.wchar_allowed_) { - if (this->char_translator_) - this->char_translator_->add_ref(); - if (this->wchar_translator_) - this->wchar_translator_->add_ref(); char *buf = ACE_ptr_align_binary (rhs.start_.base (), ACE_CDR::MAX_ALIGNMENT); @@ -744,10 +732,6 @@ ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x) wchar_translator_ (x.rhs_.wchar_translator_), wchar_allowed_ (x.rhs_.wchar_allowed_) { - if (this->char_translator_) - this->char_translator_->add_ref(); - if (this->wchar_translator_) - this->wchar_translator_->add_ref(); this->start_.rd_ptr (x.rhs_.start_.rd_ptr ()); this->start_.wr_ptr (x.rhs_.start_.wr_ptr ()); @@ -767,11 +751,6 @@ ACE_InputCDR::operator= (const ACE_InputCDR& rhs) this->do_byte_swap_ = rhs.do_byte_swap_; this->good_bit_ = 1; this->char_translator_ = rhs.char_translator_; - if (this->char_translator_) - this->char_translator_->add_ref(); - this->wchar_translator_ = rhs.wchar_translator_; - if (this->wchar_translator_) - this->wchar_translator_->add_ref(); this->wchar_allowed_ = rhs.wchar_allowed_; this->major_version_ = rhs.major_version_; this->minor_version_ = rhs.minor_version_; @@ -802,11 +781,6 @@ ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs, wchar_translator_ (rhs.wchar_translator_), wchar_allowed_ (rhs.wchar_allowed_) { - if (this->char_translator_) - this->char_translator_->add_ref(); - if (this->wchar_translator_) - this->wchar_translator_->add_ref(); - ACE_CDR::mb_align (&this->start_); for (const ACE_Message_Block *i = rhs.begin (); i != rhs.end (); diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h index e54d92415b9..8ef367055a6 100644 --- a/ace/CDR_Stream.h +++ b/ace/CDR_Stream.h @@ -77,16 +77,16 @@ public: /// Default constructor, allocates <size> bytes in the internal /// buffer, if <size> == 0 it allocates the default size. ACE_OutputCDR (size_t size = 0, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0, - size_t memcpy_tradeoff = - ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + int byte_order = ACE_CDR_BYTE_ORDER, + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0, + ACE_Allocator* message_block_allocator = 0, + size_t memcpy_tradeoff = + ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, + ACE_CDR::Octet major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /// Build a CDR stream with an initial buffer, it will *not* remove /// <data>, since it did not allocated it. It's important to be careful @@ -98,30 +98,30 @@ public: * output stream. begin()->rd_prt() points to the start off the * output stream. See ACE_ptr_align_binary() to properly align a * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment. - */ + */ ACE_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* message_block_allocator = 0, - size_t memcpy_tradeoff= - ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + size_t size, + int byte_order = ACE_CDR_BYTE_ORDER, + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0, + ACE_Allocator* message_block_allocator = 0, + size_t memcpy_tradeoff= + ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, + ACE_CDR::Octet giop_major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet giop_minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /// Build a CDR stream with an initial Message_Block chain, it will /// *not* remove <data>, since it did not allocate it. ACE_OutputCDR (ACE_Message_Block *data, - int byte_order = ACE_CDR_BYTE_ORDER, - size_t memcpy_tradeoff= - ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, - ACE_CDR::Octet giop_major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet giop_minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + int byte_order = ACE_CDR_BYTE_ORDER, + size_t memcpy_tradeoff= + ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, + ACE_CDR::Octet giop_major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet giop_minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /// destructor ~ACE_OutputCDR (void); @@ -159,11 +159,11 @@ public: struct ACE_Export from_string { from_string (ACE_CDR::Char* s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); from_string (const ACE_CDR::Char* s, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); ACE_CDR::Char *val_; ACE_CDR::ULong bound_; ACE_CDR::Boolean nocopy_; @@ -172,11 +172,11 @@ public: struct ACE_Export from_wstring { from_wstring (ACE_CDR::WChar* ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); from_wstring (const ACE_CDR::WChar* ws, - ACE_CDR::ULong b, - ACE_CDR::Boolean nocopy = 0); + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); ACE_CDR::WChar *val_; ACE_CDR::ULong bound_; ACE_CDR::Boolean nocopy_; @@ -202,43 +202,43 @@ public: /// For string we offer methods that accept a precomputed length. ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); ACE_CDR::Boolean write_string (ACE_CDR::ULong len, - const ACE_CDR::Char *x); + const ACE_CDR::Char *x); ACE_CDR::Boolean write_string (const ACE_CString &x); ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x); ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, - const ACE_CDR::WChar *x); + const ACE_CDR::WChar *x); //@} /// Note: the portion written starts at <x> and ends - /// at <x + length>. + /// at <x + length>. /// The length is *NOT* stored into the CDR stream. //@{ @name Array write operations ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); /// Write an octet array contained inside a MB, this can be optimized /// to minimize copies. @@ -291,14 +291,14 @@ public: const ACE_Message_Block *current (void) const; /** - * Access the underlying buffer (read only). NOTE: This + * Access the underlying buffer (read only). NOTE: This * method only returns a pointer to the first block in the * chain. */ const char *buffer (void) const; /** - * Return the start and size of the internal buffer. NOTE: This + * Return the start and size of the internal buffer.NOTE: This * method only returns information about the first block in the * chain. */ @@ -335,13 +335,13 @@ public: * buffer. Sets the good_bit to 0 and returns a -1 on failure. */ int adjust (size_t size, - char *&buf); + char *&buf); /// As above, but now the size and alignment requirements may be /// different. int adjust (size_t size, - size_t align, - char *&buf); + size_t align, + char *&buf); /// If non-zero then this stream is writing in non-native byte order, /// this is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. @@ -355,11 +355,11 @@ public: /// set GIOP version info int set_version (ACE_CDR::Octet major, - ACE_CDR::Octet minor); + ACE_CDR::Octet minor); /// Set the underlying GIOP version.. int get_version (ACE_CDR::Octet &major, - ACE_CDR::Octet &minor); + ACE_CDR::Octet &minor); private: /// disallow copying... ACE_OutputCDR (const ACE_OutputCDR& rhs); @@ -384,9 +384,9 @@ private: * for that case, but that would be too platform dependent. */ ACE_CDR::Boolean write_array (const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); + size_t size, + size_t align, + ACE_CDR::ULong length); /** * Grow the CDR stream. When it returns <buf> contains a pointer to @@ -395,8 +395,8 @@ private: * + size>. */ int grow_and_adjust (size_t size, - size_t align, - char *&buf); + size_t align, + char *&buf); private: /// The start of the chain of message blocks. @@ -450,7 +450,7 @@ protected: ACE_WChar_Codeset_Translator *wchar_translator_; /** - * There are some situations when it is an error to attempt wchar + * There are some situations when it is an error to attempt wchar * i/o of any kind. This may be when using GIOP 1.0, or no valid * NCSW defined. */ @@ -485,26 +485,26 @@ public: /** * Create an input stream from an arbitrary buffer. The buffer must * be properly aligned because this contructor will *not* work if - * the buffer is aligned unproperly. See ACE_ptr_align_binary() for + * the buffer is aligned unproperly.See ACE_ptr_align_binary() for * instructions on how to align a pointer properly and use * ACE_CDR::MAX_ALIGNMENT for the correct alignment. */ ACE_InputCDR (const char *buf, - size_t bufsiz, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + size_t bufsiz, + int byte_order = ACE_CDR_BYTE_ORDER, + ACE_CDR::Octet major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /// Create an empty input stream. The caller is responsible for /// putting the right data and providing the right alignment. ACE_InputCDR (size_t bufsiz, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + int byte_order = ACE_CDR_BYTE_ORDER, + ACE_CDR::Octet major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /// Create an input stream from an ACE_Message_Block /** @@ -515,36 +515,36 @@ public: * upon return. */ ACE_InputCDR (const ACE_Message_Block *data, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + int byte_order = ACE_CDR_BYTE_ORDER, + ACE_CDR::Octet major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /// Create an input stream from an ACE_Data_Block. The <flag> - /// indicates whether the <data> can be deleted by the CDR stream + /// indicates whether the <data> can be deleted by the CDR stream /// or not ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag = 0, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + ACE_Message_Block::Message_Flags flag = 0, + int byte_order = ACE_CDR_BYTE_ORDER, + ACE_CDR::Octet major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /// Create an input stream from an ACE_Data_Block. It also sets the /// read and write pointers at the desired positions. This would be /// helpful if the applications desires to create a new CDR stream /// from a semi-processed datablock. ACE_InputCDR (ACE_Data_Block *data, - ACE_Message_Block::Message_Flags flag, - size_t read_pointer_position, - size_t write_pointer_position, - int byte_order = ACE_CDR_BYTE_ORDER, - ACE_CDR::Octet major_version = - ACE_CDR_GIOP_MAJOR_VERSION, - ACE_CDR::Octet minor_version = - ACE_CDR_GIOP_MINOR_VERSION); + ACE_Message_Block::Message_Flags flag, + size_t read_pointer_position, + size_t write_pointer_position, + int byte_order = ACE_CDR_BYTE_ORDER, + ACE_CDR::Octet major_version = + ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = + ACE_CDR_GIOP_MINOR_VERSION); /** * These make a copy of the current stream state, but do not copy @@ -558,19 +558,19 @@ public: /// When interpreting indirected TypeCodes it is useful to make a /// "copy" of the stream starting in the new position. ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size, - ACE_CDR::Long offset); + size_t size, + ACE_CDR::Long offset); /// This creates an encapsulated stream, the first byte must be (per /// the spec) the byte order of the encapsulation. ACE_InputCDR (const ACE_InputCDR& rhs, - size_t size); + size_t size); /// Create an input CDR from an output CDR. ACE_InputCDR (const ACE_OutputCDR& rhs, - ACE_Allocator* buffer_allocator = 0, - ACE_Allocator* data_block_allocator = 0, - ACE_Allocator* message_block_allocator = 0); + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0, + ACE_Allocator* message_block_allocator = 0); /// Helper class to transfer the contents from one input CDR to /// another without requiring any extra memory allocations, data @@ -621,9 +621,9 @@ public: /// now deprecated (C++ mapping 00-01-02), but we /// keep it around for backward compatibility. to_string (ACE_CDR::Char *&s, - ACE_CDR::ULong b); + ACE_CDR::ULong b); to_string (const ACE_CDR::Char *&s, - ACE_CDR::ULong b); + ACE_CDR::ULong b); const ACE_CDR::Char *&val_; ACE_CDR::ULong bound_; }; @@ -634,9 +634,9 @@ public: /// now deprecated (C++ mapping 00-01-02), but we /// keep it around for backward compatibility. to_wstring (ACE_CDR::WChar *&ws, - ACE_CDR::ULong b); + ACE_CDR::ULong b); to_wstring (const ACE_CDR::WChar *&ws, - ACE_CDR::ULong b); + ACE_CDR::ULong b); const ACE_CDR::WChar *&val_; ACE_CDR::ULong bound_; }; @@ -672,31 +672,31 @@ public: */ //@{ @name Read basic IDL types arrays ACE_CDR::Boolean read_boolean_array (ACE_CDR::Boolean* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_char_array (ACE_CDR::Char *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_wchar_array (ACE_CDR::WChar* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_octet_array (ACE_CDR::Octet* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_short_array (ACE_CDR::Short *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_ushort_array (ACE_CDR::UShort *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_long_array (ACE_CDR::Long *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_ulong_array (ACE_CDR::ULong *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_longlong_array (ACE_CDR::LongLong* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_ulonglong_array (ACE_CDR::ULongLong* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_float_array (ACE_CDR::Float *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_double_array (ACE_CDR::Double *x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x, - ACE_CDR::ULong length); + ACE_CDR::ULong length); //@} /** @@ -760,7 +760,7 @@ public: /// Re-initialize the CDR stream, copying the contents of the chain /// of message_blocks starting from <data>. void reset (const ACE_Message_Block *data, - int byte_order); + int byte_order); /// Steal the contents from the current CDR. ACE_Message_Block *steal_contents (void); @@ -825,21 +825,21 @@ public: * on failure. */ int adjust (size_t size, - char *&buf); + char *&buf); /// As above, but now the size and alignment requirements may be /// different. int adjust (size_t size, - size_t align, - char *&buf); + size_t align, + char *&buf); /// Set the underlying GIOP version.. int set_version (ACE_CDR::Octet major, - ACE_CDR::Octet minor); + ACE_CDR::Octet minor); /// Set the underlying GIOP version.. int get_version (ACE_CDR::Octet &major, - ACE_CDR::Octet &minor); + ACE_CDR::Octet &minor); protected: /// The start of the chain of message blocks, even though in the /// current version the chain always has length 1. @@ -861,7 +861,7 @@ protected: ACE_WChar_Codeset_Translator *wchar_translator_; /** - * There are some situations when it is an error to attempt wchar + * There are some situations when it is an error to attempt wchar * i/o of any kind. This may be when using GIOP 1.0, or no valid * NCSW defined. */ @@ -894,9 +894,9 @@ private: * for that case, but that would be too platform dependent. */ ACE_CDR::Boolean read_array (void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); + size_t size, + size_t align, + ACE_CDR::ULong length); /// Move the rd_ptr ahead by <offset> bytes. void rd_ptr (size_t offset); @@ -918,52 +918,46 @@ private: * both CDR Input streams and CDR Output streams. * * Translators are reference counted. This allows for stateful as well - * as stateless translators. Stateless translators will be allocated + * as stateless translators. Stateless translators will be allocated * once whereas CDR Streams own their own copy of a stateful translator. */ class ACE_Export ACE_Char_Codeset_Translator { public: - ACE_Char_Codeset_Translator (); - virtual ~ACE_Char_Codeset_Translator () {}; - /// Increment the reference count. - void add_ref (); - void remove_ref (); - /// Read a single character from the stream, converting from the /// stream codeset to the native codeset virtual ACE_CDR::Boolean read_char (ACE_InputCDR&, - ACE_CDR::Char&) = 0; + ACE_CDR::Char&) = 0; /// Read a string from the stream, including the length, converting /// the characters from the stream codeset to the native codeset virtual ACE_CDR::Boolean read_string (ACE_InputCDR&, - ACE_CDR::Char *&) = 0; + ACE_CDR::Char *&) = 0; /// Read an array of characters from the stream, converting the /// characters from the stream codeset to the native codeset. virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&, - const ACE_CDR::Char*, - ACE_CDR::ULong) = 0; + const ACE_CDR::Char*, + ACE_CDR::ULong) = 0; /// Write a single character to the stream, converting from the /// native codeset to the stream codeset virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&, - ACE_CDR::Char) = 0; + ACE_CDR::Char) = 0; /// Write a string to the stream, including the length, converting /// from the native codeset to the stream codeset virtual ACE_CDR::Boolean write_string (ACE_OutputCDR&, - ACE_CDR::ULong, - const ACE_CDR::Char*) = 0; + ACE_CDR::ULong, + const ACE_CDR::Char*) = 0; /// Write an array of characters to the stream, converting from the /// native codeset to the stream codeset virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR&, - const ACE_CDR::Char*, - ACE_CDR::ULong) = 0; + const ACE_CDR::Char*, + ACE_CDR::ULong) = 0; virtual ACE_CDR::ULong ncs () = 0; virtual ACE_CDR::ULong tcs () = 0; @@ -971,17 +965,17 @@ protected: /// Children have access to low-level routines because they cannot /// use read_char or something similar (it would recurse). ACE_CDR::Boolean read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x); + ACE_CDR::Octet *x); ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x); + const ACE_CDR::Octet *x); /// Efficiently read <length> elements of size <size> each from /// <input> into <x>; the data must be aligned to <align>. ACE_CDR::Boolean read_array (ACE_InputCDR& input, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); + void* x, + size_t size, + size_t align, + ACE_CDR::ULong length); /** * Efficiently write <length> elements of size <size> from <x> into @@ -990,10 +984,10 @@ protected: * stream. */ ACE_CDR::Boolean write_array (ACE_OutputCDR& output, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); + const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length); /** * Exposes the stream implementation of <adjust>, this is useful in @@ -1003,9 +997,9 @@ protected: * Results */ int adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf); + size_t size, + size_t align, + char *&buf); /// Used by derived classes to set errors in the CDR stream. void good_bit (ACE_OutputCDR& out, int bit); @@ -1015,12 +1009,6 @@ protected: ACE_CDR::Octet minor_version (ACE_InputCDR& input); ACE_CDR::Octet major_version (ACE_OutputCDR& output); ACE_CDR::Octet minor_version (ACE_OutputCDR& output); - -protected: - -private: - short refcount_; - }; // **************************************************************** @@ -1038,50 +1026,47 @@ private: class ACE_Export ACE_WChar_Codeset_Translator { public: - ACE_WChar_Codeset_Translator (); - - void add_ref (); - void remove_ref (); + virtual ~ACE_WChar_Codeset_Translator () {} virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&, - ACE_CDR::WChar&) = 0; + ACE_CDR::WChar&) = 0; virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&, - ACE_CDR::WChar *&) = 0; + ACE_CDR::WChar *&) = 0; virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR&, - const ACE_CDR::WChar*, - ACE_CDR::ULong) = 0; + const ACE_CDR::WChar*, + ACE_CDR::ULong) = 0; virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR&, - ACE_CDR::WChar) = 0; + ACE_CDR::WChar) = 0; virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR&, - ACE_CDR::ULong, - const ACE_CDR::WChar*) = 0; + ACE_CDR::ULong, + const ACE_CDR::WChar*) = 0; virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR&, - const ACE_CDR::WChar*, - ACE_CDR::ULong) = 0; + const ACE_CDR::WChar*, + ACE_CDR::ULong) = 0; protected: /// Children have access to low-level routines because they cannot /// use read_char or something similar (it would recurse). ACE_CDR::Boolean read_1 (ACE_InputCDR& input, - ACE_CDR::Octet *x); + ACE_CDR::Octet *x); ACE_CDR::Boolean read_2 (ACE_InputCDR& input, - ACE_CDR::UShort *x); + ACE_CDR::UShort *x); ACE_CDR::Boolean read_4 (ACE_InputCDR& input, - ACE_CDR::ULong *x); + ACE_CDR::ULong *x); ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, - const ACE_CDR::Octet *x); + const ACE_CDR::Octet *x); ACE_CDR::Boolean write_2 (ACE_OutputCDR& output, - const ACE_CDR::UShort *x); + const ACE_CDR::UShort *x); ACE_CDR::Boolean write_4 (ACE_OutputCDR& output, - const ACE_CDR::ULong *x); + const ACE_CDR::ULong *x); /// Efficiently read <length> elements of size <size> each from /// <input> into <x>; the data must be aligned to <align>. ACE_CDR::Boolean read_array (ACE_InputCDR& input, - void* x, - size_t size, - size_t align, - ACE_CDR::ULong length); + void* x, + size_t size, + size_t align, + ACE_CDR::ULong length); /** * Efficiently write <length> elements of size <size> from <x> into @@ -1090,10 +1075,10 @@ protected: * stream. */ ACE_CDR::Boolean write_array (ACE_OutputCDR& output, - const void *x, - size_t size, - size_t align, - ACE_CDR::ULong length); + const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length); /** * Exposes the stream implementation of <adjust>, this is useful in @@ -1103,9 +1088,9 @@ protected: * Results */ int adjust (ACE_OutputCDR& out, - size_t size, - size_t align, - char *&buf); + size_t size, + size_t align, + char *&buf); /// Used by derived classes to set errors in the CDR stream. void good_bit (ACE_OutputCDR& out, int bit); @@ -1118,21 +1103,15 @@ protected: virtual ACE_CDR::ULong ncs () = 0; virtual ACE_CDR::ULong tcs () = 0; -protected: - virtual ~ACE_WChar_Codeset_Translator () {}; - -private: - short refcount_; - }; // @@ These operators should not be inlined since they force SString.h // to be included in this header. extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CString &x); + const ACE_CString &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CString &x); + ACE_CString &x); #if defined (__ACE_INLINE__) @@ -1141,89 +1120,89 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, // Not used by CORBA or TAO extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Char x); + ACE_CDR::Char x); // CDR output operators for primitive types extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Short x); + ACE_CDR::Short x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::UShort x); + ACE_CDR::UShort x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Long x); + ACE_CDR::Long x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::ULong x); + ACE_CDR::ULong x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::LongLong x); + ACE_CDR::LongLong x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::ULongLong x); + ACE_CDR::ULongLong x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR& os, - ACE_CDR::LongDouble x); + ACE_CDR::LongDouble x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Float x); + ACE_CDR::Float x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_CDR::Double x); + ACE_CDR::Double x); // CDR output operator from helper classes extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_boolean x); + ACE_OutputCDR::from_boolean x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_char x); + ACE_OutputCDR::from_char x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_wchar x); + ACE_OutputCDR::from_wchar x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_octet x); + ACE_OutputCDR::from_octet x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_string x); + ACE_OutputCDR::from_string x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - ACE_OutputCDR::from_wstring x); + ACE_OutputCDR::from_wstring x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CDR::Char* x); + const ACE_CDR::Char* x); extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, - const ACE_CDR::WChar* x); + const ACE_CDR::WChar* x); // Not used by CORBA or TAO extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Char &x); + ACE_CDR::Char &x); // CDR input operators for primitive types extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Short &x); + ACE_CDR::Short &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::UShort &x); + ACE_CDR::UShort &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Long &x); + ACE_CDR::Long &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::ULong &x); + ACE_CDR::ULong &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::LongLong &x); + ACE_CDR::LongLong &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::ULongLong &x); + ACE_CDR::ULongLong &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::LongDouble &x); + ACE_CDR::LongDouble &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Float &x); + ACE_CDR::Float &x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Double &x); + ACE_CDR::Double &x); // CDR input operator from helper classes extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_boolean x); + ACE_InputCDR::to_boolean x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_char x); + ACE_InputCDR::to_char x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_wchar x); + ACE_InputCDR::to_wchar x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_octet x); + ACE_InputCDR::to_octet x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_string x); + ACE_InputCDR::to_string x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_InputCDR::to_wstring x); + ACE_InputCDR::to_wstring x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::Char*& x); + ACE_CDR::Char*& x); extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, - ACE_CDR::WChar*& x); + ACE_CDR::WChar*& x); #endif /* __ACE_INLINE__ */ diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i index f1859b2d0bb..a39ffe0542c 100644 --- a/ace/CDR_Stream.i +++ b/ace/CDR_Stream.i @@ -141,10 +141,6 @@ ACE_OutputCDR::~ACE_OutputCDR (void) this->start_.cont (0); } this->current_ = 0; - if (this->char_translator_) - this->char_translator_->remove_ref(); - if (this->wchar_translator_) - this->wchar_translator_->remove_ref(); } ACE_INLINE void @@ -525,16 +521,12 @@ ACE_OutputCDR::wchar_translator (void) const ACE_INLINE void ACE_OutputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) { - if (this->char_translator_) - this->char_translator_->remove_ref(); this->char_translator_ = ctran; } ACE_INLINE void ACE_OutputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) { - if (this->wchar_translator_) - this->wchar_translator_->remove_ref(); this->wchar_translator_ = wctran; this->wchar_allowed_ = 1; } @@ -550,10 +542,6 @@ ACE_OutputCDR::wchar_allowed (int allowed) ACE_INLINE ACE_InputCDR::~ACE_InputCDR (void) { - if (this->char_translator_) - this->char_translator_->remove_ref(); - if (this->wchar_translator_) - this->wchar_translator_->remove_ref(); } ACE_INLINE ACE_CDR::Boolean @@ -1469,16 +1457,12 @@ ACE_InputCDR::wchar_translator (void) const ACE_INLINE void ACE_InputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) { - if (this->char_translator_) - this->char_translator_->remove_ref(); this->char_translator_ = ctran; } ACE_INLINE void ACE_InputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) { - if (this->wchar_translator_) - this->wchar_translator_->remove_ref(); this->wchar_translator_ = wctran; this->wchar_allowed_ = 1; } @@ -1490,19 +1474,6 @@ ACE_InputCDR::wchar_allowed (int allowed) } // **************************************************************** -ACE_INLINE void -ACE_Char_Codeset_Translator::add_ref() -{ - this->refcount_++; -} - -ACE_INLINE void -ACE_Char_Codeset_Translator::remove_ref() -{ - if (this->refcount_-- <= 0) - delete this; -} - ACE_INLINE ACE_CDR::Boolean ACE_Char_Codeset_Translator::read_1 (ACE_InputCDR& input, ACE_CDR::Octet *x) @@ -1578,19 +1549,6 @@ ACE_Char_Codeset_Translator::minor_version (ACE_OutputCDR& output) // **************************************************************** -ACE_INLINE void -ACE_WChar_Codeset_Translator::add_ref() -{ - this->refcount_++; -} - -ACE_INLINE void -ACE_WChar_Codeset_Translator::remove_ref() -{ - if (this->refcount_-- <= 0) - delete this; -} - ACE_INLINE ACE_CDR::Boolean ACE_WChar_Codeset_Translator::read_1 (ACE_InputCDR& input, ACE_CDR::Octet *x) diff --git a/ace/Codeset_IBM1047.cpp b/ace/Codeset_IBM1047.cpp index 45ae7932665..e529f1b15ee 100644 --- a/ace/Codeset_IBM1047.cpp +++ b/ace/Codeset_IBM1047.cpp @@ -34,6 +34,18 @@ ACE_IBM1047_ISO8859::~ACE_IBM1047_ISO8859 (void) { } +ACE_CDR::ULong +ACE_IBM1047_ISO8859::ncs () +{ + return 0x10020417; +} + +ACE_CDR::ULong +ACE_IBM1047_ISO8859::tcs () +{ + return 0x00010001; +} + ACE_CDR::Boolean ACE_IBM1047_ISO8859::read_char (ACE_InputCDR &in, ACE_CDR::Char &x) @@ -139,6 +151,19 @@ ACE_ISO8859_IBM1047::~ACE_ISO8859_IBM1047 (void) { } +ACE_CDR::ULong +ACE_ISO8859_IBM1047::ncs () +{ + return 0x00010001; +} + +ACE_CDR::ULong +ACE_ISO8859_IBM1047::tcs () +{ + return 0x10020417; +} + + ACE_CDR::Boolean ACE_ISO8859_IBM1047::read_char (ACE_InputCDR& in, ACE_CDR::Char& x) diff --git a/ace/Codeset_IBM1047.h b/ace/Codeset_IBM1047.h index 575b3d2f2e9..a9a10739836 100644 --- a/ace/Codeset_IBM1047.h +++ b/ace/Codeset_IBM1047.h @@ -68,6 +68,13 @@ public: virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, const ACE_CDR::Char *, ACE_CDR::ULong); + + /// return the native codeset ID as defined in the OSF code and character + /// set registry, 0x10020417 + virtual ACE_CDR::ULong ncs (); + /// return the translated codeset ID as defined in the OSF code and character + /// set registry, 0x00010001 + virtual ACE_CDR::ULong tcs (); }; /** @@ -104,6 +111,13 @@ public: virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, const ACE_CDR::Char *, ACE_CDR::ULong); + + /// return the native codeset ID as defined in the OSF code and character + /// set registry, 0x00010001 + virtual ACE_CDR::ULong ncs (); + /// return the translated codeset ID as defined in the OSF code and character + /// set registry, 0x10020417 + virtual ACE_CDR::ULong tcs (); }; #endif /* ACE_MVS */ |