diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-29 01:17:15 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-29 01:17:15 +0000 |
commit | 4343e1e377e0ef9d8dcb23e06fc9df13abc6bc93 (patch) | |
tree | 11d5d736d88b195de16f9f5076aa37d6ca8e317f | |
parent | f8dbf5d57972577bbd263e276f67a521f97a623c (diff) | |
download | ATCD-4343e1e377e0ef9d8dcb23e06fc9df13abc6bc93.tar.gz |
Cosmetic fixes.
-rw-r--r-- | TAO/tao/DynAnyC.cpp | 48 | ||||
-rw-r--r-- | TAO/tao/DynAnyC.h | 280 | ||||
-rw-r--r-- | TAO/tao/DynAnyC.i | 174 |
3 files changed, 292 insertions, 210 deletions
diff --git a/TAO/tao/DynAnyC.cpp b/TAO/tao/DynAnyC.cpp index 41235fe8c58..7e0edbafc0e 100644 --- a/TAO/tao/DynAnyC.cpp +++ b/TAO/tao/DynAnyC.cpp @@ -885,6 +885,54 @@ static CORBA::TypeCode _tc_TAO_tc_CORBA_DynEnum (CORBA::tk_objref, CORBA::TypeCode_ptr _tc_CORBA_DynEnum = &_tc_TAO_tc_CORBA_DynEnum; +#if !defined (TAO_USE_SEQUENCE_TEMPLATES) + +#if !defined (__TAO_UNBOUNDED_SEQUENCE_CORBA_NAMEVALUEPAIRSEQ_CS_) +#define __TAO_UNBOUNDED_SEQUENCE_CORBA_NAMEVALUEPAIRSEQ_CS_ + + void + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::_allocate_buffer (CORBA::ULong length) + { + CORBA::NameValuePair* tmp = 0; + tmp = _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::allocbuf (length); + + if (this->buffer_ != 0) + { + CORBA::NameValuePair *old = ACE_reinterpret_cast (CORBA::NameValuePair *,this->buffer_); + + for (CORBA::ULong i = 0; i < this->length_; ++i) + tmp[i] = old[i]; + + if (this->release_) + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::freebuf (old); + + } + this->buffer_ = tmp; + } + + void + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::_deallocate_buffer (void) + { + if (this->buffer_ == 0 || this->release_ == 0) + return; + + CORBA::NameValuePair *tmp = ACE_reinterpret_cast (CORBA::NameValuePair *,this->buffer_); + + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::freebuf (tmp); + this->buffer_ = 0; + } + + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::~_TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (void) // Dtor. + { + this->_deallocate_buffer (); + } + + +#endif /* end #if !defined */ + + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ + #if !defined (_CORBA_NAME_VALUE_PAIR_SEQ_CS_) #define _CORBA_NAME_VALUE_PAIR_SEQ_CS_ diff --git a/TAO/tao/DynAnyC.h b/TAO/tao/DynAnyC.h index abed32304ed..70dc30d99db 100644 --- a/TAO/tao/DynAnyC.h +++ b/TAO/tao/DynAnyC.h @@ -593,189 +593,78 @@ struct TAO_Export CORBA_NameValuePair }; -class _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq : public TAO_Unbounded_Base_Sequence +#if !defined (TAO_USE_SEQUENCE_TEMPLATES) + +#if !defined (__TAO_UNBOUNDED_SEQUENCE_CORBA_NAMEVALUEPAIRSEQ_CH_) +#define __TAO_UNBOUNDED_SEQUENCE_CORBA_NAMEVALUEPAIRSEQ_CH_ + + class TAO_EXPORT_NESTED_MACRO _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq : public TAO_Unbounded_Base_Sequence + { + public: + // = Initialization and termination methods. + + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (void); // Default constructor. + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (CORBA::ULong maximum); + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (CORBA::ULong maximum, + CORBA::ULong length, + CORBA_NameValuePair *data, + CORBA::Boolean release = 0); + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (const _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &rhs); + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &operator= (const _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &rhs); + virtual ~_TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (void); // Dtor. + // = Accessors. + CORBA_NameValuePair &operator[] (CORBA::ULong i); + const CORBA_NameValuePair &operator[] (CORBA::ULong i) const; + // = Static operations. + static CORBA_NameValuePair *allocbuf (CORBA::ULong size); + static void freebuf (CORBA_NameValuePair *buffer); + virtual void _allocate_buffer (CORBA::ULong length); + virtual void _deallocate_buffer (void); + // Implement the TAO_Base_Sequence methods (see Sequence.h) + + CORBA_NameValuePair *get_buffer (CORBA::Boolean orphan = 0); + const CORBA_NameValuePair *get_buffer (void) const; + void replace (CORBA::ULong max, + CORBA::ULong length, + CORBA_NameValuePair *data, + CORBA::Boolean release); + }; + +#endif /* end #if !defined */ + + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ + +class CORBA_NameValuePairSeq_var; + +// ************************************************************* +// CORBA::NameValuePairSeq +// ************************************************************* +class TAO_Export CORBA_NameValuePairSeq : public +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) \ + || defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) \ + || !defined (ACE_HAS_TEMPLATE_SPECIALIZATION) + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq +#else /* AHETI */ + TAO_Unbounded_Sequence<CORBA_NameValuePair> +#endif /* AHETI */ { public: - // = Initialization and termination methods. - - _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (void) // Default constructor. - { - } - - _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (CORBA::ULong maximum) // Constructor using a maximum length value. - : TAO_Unbounded_Base_Sequence (maximum, allocbuf (maximum)) - { - } - - _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (CORBA::ULong maximum, + CORBA_NameValuePairSeq (void); // default ctor + CORBA_NameValuePairSeq (CORBA::ULong max); // uses max size + CORBA_NameValuePairSeq ( + CORBA::ULong max, CORBA::ULong length, - CORBA_NameValuePair *data, - CORBA::Boolean release = 0) - : TAO_Unbounded_Base_Sequence (maximum, length, data, release) - { - } - - _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (const _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &rhs) - // Copy constructor. - : TAO_Unbounded_Base_Sequence (rhs) - { - CORBA_NameValuePair *tmp1 = allocbuf (this->maximum_); - CORBA_NameValuePair * const tmp2 = ACE_reinterpret_cast (CORBA_NameValuePair * ACE_CAST_CONST, rhs.buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - tmp1[i] = tmp2[i]; - - this->buffer_ = tmp1; - } - - _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &operator= (const _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &rhs) - // Assignment operator. - { - if (this == &rhs) - return *this; - - if (this->release_) - { - if (this->maximum_ < rhs.maximum_) - { - // free the old buffer - CORBA_NameValuePair *tmp = ACE_reinterpret_cast (CORBA_NameValuePair *, this->buffer_); - freebuf (tmp); - this->buffer_ = allocbuf (rhs.maximum_); - } - } - else - this->buffer_ = allocbuf (rhs.maximum_); - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - CORBA_NameValuePair *tmp1 = ACE_reinterpret_cast (CORBA_NameValuePair *, this->buffer_); - CORBA_NameValuePair * const tmp2 = ACE_reinterpret_cast (CORBA_NameValuePair * ACE_CAST_CONST, rhs.buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - tmp1[i] = tmp2[i]; - - return *this; - } - - ~_TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (void) // Dtor. - { - this->_deallocate_buffer (); - } - - // = Accessors. - CORBA_NameValuePair &operator[] (CORBA::ULong i) - // operator [] - { - ACE_ASSERT (i < this->maximum_); - CORBA_NameValuePair* tmp = ACE_reinterpret_cast(CORBA_NameValuePair*,this->buffer_); - return tmp[i]; - } - - const CORBA_NameValuePair &operator[] (CORBA::ULong i) const - // operator [] - { - ACE_ASSERT (i < this->maximum_); - CORBA_NameValuePair * const tmp = ACE_reinterpret_cast (CORBA_NameValuePair* ACE_CAST_CONST, this->buffer_); - return tmp[i]; - } - - // = Static operations. - static CORBA_NameValuePair *allocbuf (CORBA::ULong size) - // Allocate storage for the sequence. - { - return new CORBA_NameValuePair[size]; - } - - static void freebuf (CORBA_NameValuePair *buffer) - // Free the sequence. - { - delete [] buffer; - } - - virtual void _allocate_buffer (CORBA::ULong length) - { - CORBA_NameValuePair* tmp = allocbuf (length); - - if (this->buffer_ != 0) - { - CORBA_NameValuePair *old = ACE_reinterpret_cast (CORBA_NameValuePair *,this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - tmp[i] = old[i]; - - if (this->release_) - freebuf (old); - - } - this->buffer_ = tmp; - } - - virtual void _deallocate_buffer (void) - { - if (this->buffer_ == 0 || this->release_ == 0) - return; - - CORBA_NameValuePair *tmp = ACE_reinterpret_cast (CORBA_NameValuePair *,this->buffer_); - - freebuf (tmp); - this->buffer_ = 0; - } - - // Implement the TAO_Base_Sequence methods (see Sequence.h) - - CORBA_NameValuePair *get_buffer (CORBA::Boolean orphan = 0) - { - CORBA_NameValuePair *result = 0; - if (orphan == 0) - { - // We retain ownership. - if (this->buffer_ == 0) - { - result = allocbuf (this->length_); - this->buffer_ = result; - } - else - { - result = ACE_reinterpret_cast (CORBA_NameValuePair*, this->buffer_); - } - } - else // if (orphan == 1) - { - if (this->release_ != 0) - { - // We set the state back to default and relinquish - // ownership. - result = ACE_reinterpret_cast(CORBA_NameValuePair*,this->buffer_); - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } - return result; - } - - const CORBA_NameValuePair *get_buffer (void) const - { - return ACE_reinterpret_cast(const CORBA_NameValuePair * ACE_CAST_CONST, this->buffer_); - } + CORBA_NameValuePair *buffer, + CORBA::Boolean release=0 + ); + CORBA_NameValuePairSeq (const CORBA_NameValuePairSeq &); // copy ctor + ~CORBA_NameValuePairSeq (void); // dtor - void replace (CORBA::ULong max, - CORBA::ULong length, - CORBA_NameValuePair *data, - CORBA::Boolean release) - { - this->maximum_ = max; - this->length_ = length; - if (this->buffer_ && this->release_ == 1) - { - CORBA_NameValuePair *tmp = ACE_reinterpret_cast(CORBA_NameValuePair*,this->buffer_); - freebuf (tmp); - } - this->buffer_ = data; - this->release_ = release; - } +#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 + typedef CORBA_NameValuePairSeq_var _var_type; +#endif /* __GNUC__ */ + // Useful for template programming. }; @@ -830,37 +719,6 @@ private: void operator= (const CORBA_NameValuePairSeq_var &); }; -// ************************************************************* -// CORBA::NameValuePairSeq -// ************************************************************* -class TAO_Export CORBA_NameValuePairSeq : public -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) \ - || defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) \ - || !defined (ACE_HAS_TEMPLATE_SPECIALIZATION) - _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq -#else /* AHETI */ - TAO_Unbounded_Sequence<CORBA_NameValuePair> -#endif /* AHETI */ -{ -public: - CORBA_NameValuePairSeq (void); // default ctor - CORBA_NameValuePairSeq (CORBA::ULong max); // uses max size - CORBA_NameValuePairSeq ( - CORBA::ULong max, - CORBA::ULong length, - CORBA_NameValuePair *buffer, - CORBA::Boolean release=0 - ); - CORBA_NameValuePairSeq (const CORBA_NameValuePairSeq &); // copy ctor - ~CORBA_NameValuePairSeq (void); // dtor - -#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 - typedef CORBA_NameValuePairSeq_var _var_type; -#endif /* __GNUC__ */ - // Useful for template programming. - -}; - class CORBA_DynStruct; typedef CORBA_DynStruct *CORBA_DynStruct_ptr; @@ -1262,6 +1120,8 @@ public: }; +class CORBA_AnySeq; + // ************************************************************* // class CORBA::AnySeq_var // ************************************************************* diff --git a/TAO/tao/DynAnyC.i b/TAO/tao/DynAnyC.i index 422c678371a..98408f82964 100644 --- a/TAO/tao/DynAnyC.i +++ b/TAO/tao/DynAnyC.i @@ -583,6 +583,178 @@ CORBA_NameValuePair_out::operator-> (void) return this->ptr_; } +#if !defined (TAO_USE_SEQUENCE_TEMPLATES) + + // = Static operations. + ACE_INLINE CORBA::NameValuePair * + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::allocbuf (CORBA::ULong size) + // Allocate storage for the sequence. + { + CORBA_NameValuePair *retval = 0; + ACE_NEW_RETURN (retval, CORBA_NameValuePair[size], 0); + return retval; + } + + ACE_INLINE void _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::freebuf (CORBA_NameValuePair *buffer) + // Free the sequence. + { + delete [] buffer; + } + + ACE_INLINE + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::_TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (void) // Default constructor. + { + } + + ACE_INLINE + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::_TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (CORBA::ULong maximum) // Constructor using a maximum length value. + : TAO_Unbounded_Base_Sequence (maximum, _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::allocbuf (maximum)) + { + } + + ACE_INLINE + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::_TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (CORBA::ULong maximum, + CORBA::ULong length, + CORBA_NameValuePair *data, + CORBA::Boolean release) + : TAO_Unbounded_Base_Sequence (maximum, length, data, release) + { + } + + ACE_INLINE + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::_TAO_Unbounded_Sequence_CORBA_NameValuePairSeq (const _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &rhs) + // Copy constructor. + : TAO_Unbounded_Base_Sequence (rhs) + { + if (rhs.buffer_ != 0) + { + CORBA_NameValuePair *tmp1 = _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::allocbuf (this->maximum_); + CORBA_NameValuePair * const tmp2 = ACE_reinterpret_cast (CORBA_NameValuePair * ACE_CAST_CONST, rhs.buffer_); + + for (CORBA::ULong i = 0; i < this->length_; ++i) + tmp1[i] = tmp2[i]; + + this->buffer_ = tmp1; + } + else + { + this->buffer_ = 0; + } + } + + ACE_INLINE _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq & + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::operator= (const _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq &rhs) + // Assignment operator. + { + if (this == &rhs) + return *this; + + if (this->release_) + { + if (this->maximum_ < rhs.maximum_) + { + // free the old buffer + CORBA_NameValuePair *tmp = ACE_reinterpret_cast (CORBA_NameValuePair *, this->buffer_); + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::freebuf (tmp); + this->buffer_ = _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::allocbuf (rhs.maximum_); + } + } + else + this->buffer_ = _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::allocbuf (rhs.maximum_); + + TAO_Unbounded_Base_Sequence::operator= (rhs); + + CORBA_NameValuePair *tmp1 = ACE_reinterpret_cast (CORBA_NameValuePair *, this->buffer_); + CORBA_NameValuePair * const tmp2 = ACE_reinterpret_cast (CORBA_NameValuePair * ACE_CAST_CONST, rhs.buffer_); + + for (CORBA::ULong i = 0; i < this->length_; ++i) + tmp1[i] = tmp2[i]; + + return *this; + } + + // = Accessors. + ACE_INLINE CORBA_NameValuePair & + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::operator[] (CORBA::ULong i) + // operator [] + { + ACE_ASSERT (i < this->maximum_); + CORBA_NameValuePair* tmp = ACE_reinterpret_cast(CORBA_NameValuePair*,this->buffer_); + return tmp[i]; + } + + ACE_INLINE const CORBA_NameValuePair & + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::operator[] (CORBA::ULong i) const + // operator [] + { + ACE_ASSERT (i < this->maximum_); + CORBA_NameValuePair * const tmp = ACE_reinterpret_cast (CORBA_NameValuePair* ACE_CAST_CONST, this->buffer_); + return tmp[i]; + } + + // Implement the TAO_Base_Sequence methods (see Sequence.h) + + ACE_INLINE CORBA_NameValuePair * + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::get_buffer (CORBA::Boolean orphan) + { + CORBA_NameValuePair *result = 0; + if (orphan == 0) + { + // We retain ownership. + if (this->buffer_ == 0) + { + result = _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::allocbuf (this->length_); + this->buffer_ = result; + } + else + { + result = ACE_reinterpret_cast (CORBA_NameValuePair*, this->buffer_); + } + } + else // if (orphan == 1) + { + if (this->release_ != 0) + { + // We set the state back to default and relinquish + // ownership. + result = ACE_reinterpret_cast(CORBA_NameValuePair*,this->buffer_); + this->maximum_ = 0; + this->length_ = 0; + this->buffer_ = 0; + this->release_ = 0; + } + } + return result; + } + + ACE_INLINE const CORBA_NameValuePair * + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::get_buffer (void) const + { + return ACE_reinterpret_cast(const CORBA_NameValuePair * ACE_CAST_CONST, this->buffer_); + } + + ACE_INLINE void + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::replace (CORBA::ULong max, + CORBA::ULong length, + CORBA_NameValuePair *data, + CORBA::Boolean release) + { + this->maximum_ = max; + this->length_ = length; + if (this->buffer_ && this->release_ == 1) + { + CORBA_NameValuePair *tmp = ACE_reinterpret_cast(CORBA_NameValuePair*,this->buffer_); + _TAO_Unbounded_Sequence_CORBA_NameValuePairSeq::freebuf (tmp); + } + this->buffer_ = data; + this->release_ = release; + } + +#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ + +#if !defined (_CORBA_NAMEVALUEPAIRSEQ_CI_) +#define _CORBA_NAMEVALUEPAIRSEQ_CI_ + // ************************************************************* // Inline operations for class CORBA_NameValuePairSeq_var // ************************************************************* @@ -766,6 +938,8 @@ CORBA_NameValuePairSeq_out::operator[] (CORBA::ULong slot) return this->ptr_->operator[] (slot); } +#endif /* end #if !defined */ + ACE_INLINE CORBA_DynStruct::CORBA_DynStruct (void) // default constructor {} |