// This may look like C, but it's really -*- C++ -*- // // $Id$ // // ============================================================================ // // = LIBRARY // TAO // // = FILENAME // sequence.i // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems Inc. // // Aniruddha Gokhale and Carlos O'Ryan // // ============================================================================ // *************************************************** // operations on the generic unbounded sequence class // *************************************************** template ACE_INLINE TAO_Unbounded_Sequence::TAO_Unbounded_Sequence (void) { } template ACE_INLINE TAO_Unbounded_Sequence::TAO_Unbounded_Sequence (CORBA::ULong maximum) : TAO_Unbounded_Base_Sequence (maximum, TAO_Unbounded_Sequence::allocbuf (maximum)) { } template ACE_INLINE TAO_Unbounded_Sequence::TAO_Unbounded_Sequence (CORBA::ULong maximum, CORBA::ULong length, T *data, CORBA::Boolean release) : TAO_Unbounded_Base_Sequence (maximum, length, data, release) { } template ACE_INLINE T & TAO_Unbounded_Sequence::operator[] (CORBA::ULong i) { ACE_ASSERT (i < this->maximum_); T* tmp = ACE_reinterpret_cast(T*,this->buffer_); return tmp[i]; } template ACE_INLINE const T & TAO_Unbounded_Sequence::operator[] (CORBA::ULong i) const { ACE_ASSERT (i < this->maximum_); T* tmp = ACE_reinterpret_cast(T*,this->buffer_); return tmp[i]; } template ACE_INLINE T * TAO_Unbounded_Sequence::allocbuf (CORBA::ULong size) { return new T[size]; } template ACE_INLINE void TAO_Unbounded_Sequence::freebuf (T *buffer) { delete [] buffer; } // *************************************************** // operations on the generic Bounded sequence class // *************************************************** template ACE_INLINE TAO_Bounded_Sequence::TAO_Bounded_Sequence (void) { } template ACE_INLINE TAO_Bounded_Sequence::TAO_Bounded_Sequence (CORBA::ULong length, T *data, CORBA::Boolean release) : TAO_Bounded_Base_Sequence (length, MAX, data, release) { } template ACE_INLINE T & TAO_Bounded_Sequence::operator[] (CORBA::ULong i) { ACE_ASSERT (i < this->maximum_); T* tmp = ACE_reinterpret_cast(T*,this->buffer_); return tmp[i]; } template ACE_INLINE const T & TAO_Bounded_Sequence::operator[] (CORBA::ULong i) const { ACE_ASSERT (i < this->maximum_); T* tmp = ACE_reinterpret_cast(T*,this->buffer_); return tmp[i]; } template ACE_INLINE T * TAO_Bounded_Sequence::allocbuf (CORBA::ULong size) { return new T[size]; } template ACE_INLINE void TAO_Bounded_Sequence::freebuf (T *buffer) { delete [] buffer; } // ************************************************************* // Inline operations for class TAO_Object_Manager // ************************************************************* template ACE_INLINE TAO_Object_Manager::~TAO_Object_Manager (void) { } template ACE_INLINE TAO_Object_Manager::TAO_Object_Manager (const TAO_Object_Manager &rhs) : ptr_ (rhs.ptr_), release_ (rhs.release_) { } template ACE_INLINE TAO_Object_Manager::TAO_Object_Manager(T** buffer, CORBA::Boolean release) : ptr_ (buffer), release_ (release) { } template ACE_INLINE TAO_Object_Manager::operator const T* &() const // cast { return *this->ptr_; } template ACE_INLINE TAO_Object_Manager::operator T* &() // cast { return *this->ptr_; } // ************************************************************* // class TAO_Unbounded_Object_Sequence // ************************************************************* //default constructor template ACE_INLINE TAO_Unbounded_Object_Sequence::TAO_Unbounded_Object_Sequence (void) { } template ACE_INLINE TAO_Unbounded_Object_Sequence:: TAO_Unbounded_Object_Sequence (CORBA::ULong maximum, CORBA::ULong length, T* *value, CORBA::Boolean release) : TAO_Unbounded_Base_Sequence (maximum, length, value, release) { } template ACE_INLINE TAO_Object_Manager TAO_Unbounded_Object_Sequence::operator[] (CORBA::ULong index) const { ACE_ASSERT (index < this->maximum_); T** tmp = ACE_reinterpret_cast (T**, this->buffer_); return Manager (tmp + index, this->release_); } // ************************************************************* // class TAO_Bounded_Object_Sequence // ************************************************************* template ACE_INLINE TAO_Bounded_Object_Sequence::~TAO_Bounded_Object_Sequence (void) { this->_deallocate_buffer (); } template ACE_INLINE TAO_Bounded_Object_Sequence:: TAO_Bounded_Object_Sequence (CORBA::ULong length, T* *value, CORBA::Boolean release) : TAO_Bounded_Base_Sequence (MAX, length, value, release) { } template ACE_INLINE TAO_Object_Manager TAO_Bounded_Object_Sequence::operator[] (CORBA::ULong index) const { ACE_ASSERT (index < this->maximum_); T* tmp = ACE_reinterpret_cast (T*, this->buffer_); return Manager(tmp + index, this->release_); } // ************************************************************* // class TAO_Bounded_String_Sequence // ************************************************************* template ACE_INLINE TAO_Bounded_String_Sequence::~TAO_Bounded_String_Sequence (void) { this->_deallocate_buffer (); } template ACE_INLINE TAO_Bounded_String_Sequence:: TAO_Bounded_String_Sequence (CORBA::ULong length, char* *value, CORBA::Boolean release) : TAO_Bounded_Base_Sequence (MAX, length, value, release) { } template ACE_INLINE TAO_String_Manager TAO_Bounded_String_Sequence::operator[] (CORBA::ULong index) const { ACE_ASSERT (index < this->maximum_); char** tmp = ACE_reinterpret_cast (char**, this->buffer_); return Manager(tmp + index, this->release_); }