diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-03-21 03:41:34 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-03-21 03:41:34 +0000 |
commit | 74e117aef58fd99f85a74fbcdb31ec55eec8df5b (patch) | |
tree | 4644dc2b6a6cf64ff464f81a635152ad538bd0f1 | |
parent | 347a5ae4b5f7f0e4b135ff1a467c3c4f8115b41b (diff) | |
download | ATCD-74e117aef58fd99f85a74fbcdb31ec55eec8df5b.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/ChangeLog-98c | 3 | ||||
-rw-r--r-- | TAO/tao/sequence.h | 2 | ||||
-rw-r--r-- | TAO/tao/sequence_T.cpp | 48 | ||||
-rw-r--r-- | TAO/tao/sequence_T.i | 14 |
4 files changed, 49 insertions, 18 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 6afa65e4793..5f5ef03245d 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,5 +1,8 @@ Fri Mar 20 19:46:43 1998 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> + * tao/sequence_T: Added the full complement of get_buffer(), + replace(), and release() calls to TAO's sequences. + * docs/releasenotes/index.html (href): Reformatted the DOVE demo section of the release notes a bit. diff --git a/TAO/tao/sequence.h b/TAO/tao/sequence.h index 24deea53587..8cef2a2fce6 100644 --- a/TAO/tao/sequence.h +++ b/TAO/tao/sequence.h @@ -70,7 +70,7 @@ protected: // Assume ownership and set length to 0. TAO_Base_Sequence (const TAO_Base_Sequence &rhs); - TAO_Base_Sequence &operator=(const TAO_Base_Sequence &rhs); + TAO_Base_Sequence &operator= (const TAO_Base_Sequence &rhs); // Copy constructor and assignment operator are protected, the // derived classes must provided the right semantics for the buffer // copy, only the static fields are actually copy. diff --git a/TAO/tao/sequence_T.cpp b/TAO/tao/sequence_T.cpp index fa3190efe07..dd32f4a813b 100644 --- a/TAO/tao/sequence_T.cpp +++ b/TAO/tao/sequence_T.cpp @@ -15,7 +15,8 @@ TAO_Unbounded_Sequence (const TAO_Unbounded_Sequence<T> &rhs) : TAO_Unbounded_Base_Sequence (rhs) { T *tmp1 = TAO_Unbounded_Sequence<T>::allocbuf (this->maximum_); - T *tmp2 = ACE_reinterpret_cast (T *, rhs.buffer_); + T *tmp2 = ACE_reinterpret_cast (T *, + rhs.buffer_); for (CORBA::ULong i = 0; i < this->length_; ++i) tmp1[i] = tmp2[i]; @@ -34,7 +35,8 @@ TAO_Unbounded_Sequence<T>::operator= (const TAO_Unbounded_Sequence<T> &rhs) if (this->maximum_ < rhs.maximum_) { // free the old buffer - T *tmp = ACE_reinterpret_cast (T *, this->buffer_); + T *tmp = ACE_reinterpret_cast (T *, + this->buffer_); TAO_Unbounded_Sequence<T>::freebuf (tmp); this->buffer_ = TAO_Unbounded_Sequence<T>::allocbuf (rhs.maximum_); @@ -46,8 +48,10 @@ TAO_Unbounded_Sequence<T>::operator= (const TAO_Unbounded_Sequence<T> &rhs) TAO_Unbounded_Base_Sequence::operator= (rhs); - T *tmp1 = ACE_reinterpret_cast (T *, this->buffer_); - T *tmp2 = ACE_reinterpret_cast (T *, rhs.buffer_); + T *tmp1 = ACE_reinterpret_cast (T *, + this->buffer_); + T *tmp2 = ACE_reinterpret_cast (T *, + rhs.buffer_); for (CORBA::ULong i = 0; i < this->length_; ++i) tmp1[i] = tmp2[i]; @@ -68,7 +72,8 @@ void TAO_Unbounded_Sequence<T>::_allocate_buffer (CORBA::ULong length) if (this->buffer_ != 0) { - T *old = ACE_reinterpret_cast (T *, this->buffer_); + T *old = ACE_reinterpret_cast (T *, + this->buffer_); for (CORBA::ULong i = 0; i < this->length_; ++i) tmp[i] = old[i]; @@ -86,7 +91,8 @@ void TAO_Unbounded_Sequence<T>::_deallocate_buffer (void) if (this->buffer_ == 0 || this->release_ == 0) return; - T *tmp = ACE_reinterpret_cast (T *, this->buffer_); + T *tmp = ACE_reinterpret_cast (T *, + this->buffer_); TAO_Unbounded_Sequence<T>::freebuf (tmp); this->buffer_ = 0; @@ -103,7 +109,8 @@ TAO_Bounded_Sequence (const TAO_Bounded_Sequence<T, MAX> &rhs) { T *tmp1 = TAO_Bounded_Sequence<T, MAX>::allocbuf (MAX); - T *tmp2 = ACE_reinterpret_cast(T *, rhs.buffer_); + T *tmp2 = ACE_reinterpret_cast (T *, + rhs.buffer_); for (CORBA::ULong i = 0; i < this->length_; ++i) tmp1[i] = tmp2[i]; @@ -126,7 +133,8 @@ operator= (const TAO_Bounded_Sequence<T, MAX> &rhs) if (this->maximum_ < rhs.maximum_) { // free the old buffer - T *tmp = ACE_reinterpret_cast(T *, this->buffer_); + T *tmp = ACE_reinterpret_cast (T *, + this->buffer_); TAO_Bounded_Sequence<T>::freebuf (tmp); this->buffer_ = TAO_Bounded_Sequence<T>::allocbuf (rhs.maximum_); @@ -167,7 +175,8 @@ void TAO_Bounded_Sequence<T, MAX>::_deallocate_buffer (void) { if (this->buffer_ == 0 || this->release_ == 0) return; - T *tmp = ACE_reinterpret_cast (T *, this->buffer_); + T *tmp = ACE_reinterpret_cast (T *, + this->buffer_); TAO_Bounded_Sequence<T, MAX>::freebuf (tmp); this->buffer_ = 0; } @@ -232,7 +241,8 @@ TAO_Unbounded_Object_Sequence (const TAO_Unbounded_Object_Sequence<T> &rhs) : TAO_Unbounded_Base_Sequence (rhs) { T **tmp1 = TAO_Unbounded_Object_Sequence<T>::allocbuf (this->maximum_); - T **tmp2 = ACE_reinterpret_cast (T **, rhs.buffer_); + T **tmp2 = ACE_reinterpret_cast (T **, + rhs.buffer_); for (CORBA::ULong i = 0; i < rhs.length_; ++i) tmp1[i] = T::_duplicate (tmp2[i]); @@ -257,7 +267,8 @@ operator= (const TAO_Unbounded_Object_Sequence<T> &rhs) if (this->release_) { - T **tmp = ACE_reinterpret_cast (T **, this->buffer_); + T **tmp = ACE_reinterpret_cast (T **, + this->buffer_); for (CORBA::ULong i = 0; i < this->length_; ++i) { @@ -277,8 +288,10 @@ operator= (const TAO_Unbounded_Object_Sequence<T> &rhs) TAO_Unbounded_Base_Sequence::operator= (rhs); - T **tmp1 = ACE_reinterpret_cast (T **, this->buffer_); - T **tmp2 = ACE_reinterpret_cast (T **, rhs.buffer_); + T **tmp1 = ACE_reinterpret_cast (T **, + this->buffer_); + T **tmp2 = ACE_reinterpret_cast (T **, + rhs.buffer_); for (CORBA::ULong i = 0; i < rhs.length_; ++i) tmp1[i] = T::_duplicate (tmp2[i]); @@ -583,9 +596,10 @@ TAO_Bounded_String_Sequence<MAX>::allocbuf (CORBA::ULong) template<CORBA::ULong MAX> void TAO_Bounded_String_Sequence<MAX>::freebuf (char* *buffer) { - // How much do we deallocate? Easy! allocbuf() always creates MAX + // How much do we deallocate? Easy! <allocbuf> always creates MAX // elements and initialize them to 0 (they say NULL, yuck!). So we // can be complaint and call CORBA::string_free() on each one. + for (CORBA::ULong i = 0; i < MAX; ++i) { if (buffer[i] != 0) @@ -595,7 +609,7 @@ TAO_Bounded_String_Sequence<MAX>::freebuf (char* *buffer) } } - delete[] buffer; + delete [] buffer; } template<CORBA::ULong MAX> void @@ -621,7 +635,9 @@ template<CORBA::ULong MAX> void TAO_Bounded_String_Sequence<MAX>::_shrink_buffer (CORBA::ULong nl, CORBA::ULong ol) { - char **tmp = ACE_reinterpret_cast (char **, this->buffer_); + char **tmp = ACE_reinterpret_cast (char **, + this->buffer_); + for (CORBA::ULong i = nl; i < ol; ++i) { CORBA::string_free (tmp[i]); diff --git a/TAO/tao/sequence_T.i b/TAO/tao/sequence_T.i index cd70aa05a97..cea0714f853 100644 --- a/TAO/tao/sequence_T.i +++ b/TAO/tao/sequence_T.i @@ -18,7 +18,7 @@ // ============================================================================ // *************************************************** -// operations on the generic unbounded sequence class +// Operations on the generic unbounded sequence class. // *************************************************** template <class T> ACE_INLINE @@ -66,6 +66,12 @@ TAO_Unbounded_Sequence<T>::replace (CORBA::ULong max, T *data, CORBA::Boolean release) { + this->maximum_ = maximum; + this->length_ = length; + if (this->buffer_ && this->release_ == CORBA::B_TRUE) + TAO_Unbounded_Sequence<T>::freebuf (this->buffer_); + this->buffer_ = buffer; + this->release_ = release; } template <class T> ACE_INLINE @@ -156,6 +162,12 @@ TAO_Bounded_Sequence<T, MAX>::replace (CORBA::ULong max, T *data, CORBA::Boolean release) { + this->maximum_ = maximum; + this->length_ = length; + if (this->buffer_ && this->release_ == CORBA::B_TRUE) + TAO_Bounded_Sequence<T, MAX>::freebuf (this->buffer_); + this->buffer_ = buffer; + this->release_ = release; } template <class T, CORBA::ULong MAX> ACE_INLINE |