TAO::unbounded_value_sequence< CORBA::Octet > Class Template Reference

#include <Unbounded_Octet_Sequence_T.h>

List of all members.

Public Types

typedef CORBA::Octet value_type
typedef CORBA::Octet element_type
typedef CORBA::Octet const  const_value_type
typedef value_type & subscript_type
typedef value_type const & const_subscript_type
typedef details::unbounded_value_allocation_traits<
value_type, true > 
allocation_traits
typedef details::value_traits<
value_type, true > 
element_traits
typedef details::generic_sequence<
value_type, allocation_traits,
element_traits > 
implementation_type
typedef details::range_checking<
value_type, true > 
range

Public Member Functions

 unbounded_value_sequence ()
 unbounded_value_sequence (CORBA::ULong maximum)
 unbounded_value_sequence (CORBA::ULong maximum, CORBA::ULong length, value_type *data, CORBA::Boolean release=false)
 ~unbounded_value_sequence ()
 unbounded_value_sequence (CORBA::ULong length, const ACE_Message_Block *mb)
CORBA::ULong maximum () const
CORBA::Boolean release () const
CORBA::ULong length () const
void length (CORBA::ULong length)
value_type const & operator[] (CORBA::ULong i) const
value_type & operator[] (CORBA::ULong i)
void replace (CORBA::ULong maximum, CORBA::ULong length, value_type *data, CORBA::Boolean release=false)
value_type const * get_buffer () const
value_type * get_buffer (CORBA::Boolean orphan=false)
bool operator== (const unbounded_value_sequence< CORBA::Octet > &rhs) const
bool operator!= (const unbounded_value_sequence< CORBA::Octet > &rhs) const
void swap (unbounded_value_sequence &rhs) throw ()
ACE_Message_Blockmb (void) const
void replace (CORBA::ULong length, const ACE_Message_Block *mb)
 unbounded_value_sequence (const unbounded_value_sequence< CORBA::Octet > &rhs)
unbounded_value_sequence<
CORBA::Octet > & 
operator= (const unbounded_value_sequence< CORBA::Octet > &rhs)

Static Public Member Functions

value_type * allocbuf (CORBA::ULong maximum)
void freebuf (value_type *buffer)

Private Attributes

CORBA::ULong maximum_
 The maximum number of elements the buffer can contain.

CORBA::ULong length_
 The current number of elements in the buffer.

value_type * buffer_
CORBA::Boolean release_
ACE_Message_Blockmb_

template<>
class TAO::unbounded_value_sequence< CORBA::Octet >


Member Typedef Documentation

typedef details::unbounded_value_allocation_traits<value_type,true> TAO::unbounded_value_sequence< CORBA::Octet >::allocation_traits
 

Definition at line 41 of file Unbounded_Octet_Sequence_T.h.

typedef value_type const& TAO::unbounded_value_sequence< CORBA::Octet >::const_subscript_type
 

Definition at line 39 of file Unbounded_Octet_Sequence_T.h.

typedef CORBA::Octet const TAO::unbounded_value_sequence< CORBA::Octet >::const_value_type
 

Definition at line 37 of file Unbounded_Octet_Sequence_T.h.

typedef details::value_traits<value_type,true> TAO::unbounded_value_sequence< CORBA::Octet >::element_traits
 

Definition at line 42 of file Unbounded_Octet_Sequence_T.h.

typedef CORBA::Octet TAO::unbounded_value_sequence< CORBA::Octet >::element_type
 

Definition at line 36 of file Unbounded_Octet_Sequence_T.h.

typedef details::generic_sequence<value_type, allocation_traits, element_traits> TAO::unbounded_value_sequence< CORBA::Octet >::implementation_type
 

Definition at line 43 of file Unbounded_Octet_Sequence_T.h.

typedef details::range_checking<value_type,true> TAO::unbounded_value_sequence< CORBA::Octet >::range
 

Definition at line 44 of file Unbounded_Octet_Sequence_T.h.

typedef value_type& TAO::unbounded_value_sequence< CORBA::Octet >::subscript_type
 

Definition at line 38 of file Unbounded_Octet_Sequence_T.h.

typedef CORBA::Octet TAO::unbounded_value_sequence< CORBA::Octet >::value_type
 

Definition at line 35 of file Unbounded_Octet_Sequence_T.h.


Constructor & Destructor Documentation

TAO::unbounded_value_sequence< CORBA::Octet >::~unbounded_value_sequence  )  [inline]
 


Member Function Documentation

value_type* TAO::unbounded_value_sequence< CORBA::Octet >::allocbuf CORBA::ULong  maximum  )  [inline, static]
 

Definition at line 246 of file Unbounded_Octet_Sequence_T.h.

00246                                                    {
00247     return allocation_traits::allocbuf(maximum);
00248   }

void TAO::unbounded_value_sequence< CORBA::Octet >::freebuf value_type *  buffer  )  [inline, static]
 

Definition at line 249 of file Unbounded_Octet_Sequence_T.h.

00249                                            {
00250     allocation_traits::freebuf(buffer);
00251   }

value_type* TAO::unbounded_value_sequence< CORBA::Octet >::get_buffer CORBA::Boolean  orphan = false  )  [inline]
 

Definition at line 190 of file Unbounded_Octet_Sequence_T.h.

References TAO::unbounded_value_sequence< T >::allocbuf(), and TAO::unbounded_value_sequence< T >::swap().

00190                                                               {
00191     if (orphan && !release_)
00192     {
00193       return 0;
00194     }
00195     if (buffer_ == 0)
00196     {
00197       buffer_ = allocbuf(maximum_);
00198     }
00199     if (!orphan)
00200     {
00201       return buffer_;
00202     }
00203 
00204     unbounded_value_sequence<CORBA::Octet> tmp;
00205     swap(tmp);
00206     tmp.release_ = false;
00207 
00208     return tmp.buffer_;
00209   }

value_type const* TAO::unbounded_value_sequence< CORBA::Octet >::get_buffer  )  const [inline]
 

Definition at line 183 of file Unbounded_Octet_Sequence_T.h.

References TAO::unbounded_value_sequence< T >::allocbuf().

00183                                                {
00184     if (buffer_ == 0)
00185       {
00186         buffer_ = allocbuf(maximum_);
00187       }
00188     return buffer_;
00189   }

void TAO::unbounded_value_sequence< CORBA::Octet >::length CORBA::ULong  length  )  [inline]
 

Definition at line 129 of file Unbounded_Octet_Sequence_T.h.

References TAO::unbounded_value_sequence< T >::swap().

00129                                         {
00130     if (length <= maximum_ || length <= length_)
00131       {
00132         if (this->mb_ == 0)
00133           {
00134             if (length_ < length)
00135             {
00136               // TODO This code does not provide the strong-exception
00137               //      guarantee, but it does provide the weak-exception
00138               //      guarantee.  The problem would appear when
00139               //      initialize_range() raises an exception after several
00140               //      elements have been modified.  One could argue that
00141               //      this problem is irrelevant, as the elements already
00142               //      modified are unreachable to conforming applications.
00143               element_traits::initialize_range(
00144                   buffer_ + length_, buffer_ + length);
00145             }
00146             length_ = length;
00147           }
00148         else
00149           {
00150             unbounded_value_sequence<CORBA::Octet> tmp(length);
00151             tmp.length_ = length;
00152             element_traits::copy_range(
00153               buffer_, buffer_ + length, tmp.buffer_);
00154             swap(tmp);
00155           }
00156         return;
00157       }
00158 
00159     unbounded_value_sequence<CORBA::Octet> tmp(length);
00160     tmp.length_ = length;
00161     element_traits::copy_range(
00162         buffer_, buffer_ + length_, tmp.buffer_);
00163     element_traits::initialize_range(
00164         tmp.buffer_ + length_, tmp.buffer_ + length);
00165     swap(tmp);
00166   }

CORBA::ULong TAO::unbounded_value_sequence< CORBA::Octet >::length void   )  const [inline]
 

Definition at line 126 of file Unbounded_Octet_Sequence_T.h.

00126                                    {
00127     return length_;
00128   }

CORBA::ULong TAO::unbounded_value_sequence< CORBA::Octet >::maximum  )  const [inline]
 

Definition at line 120 of file Unbounded_Octet_Sequence_T.h.

00120                                     {
00121     return maximum_;
00122   }

ACE_Message_Block* TAO::unbounded_value_sequence< CORBA::Octet >::mb void   )  const [inline]
 

Returns the underlying message block, the caller must *not* release the copy.

Definition at line 255 of file Unbounded_Octet_Sequence_T.h.

00255                                             {
00256     return mb_;
00257   }

bool TAO::unbounded_value_sequence< CORBA::Octet >::operator!= const unbounded_value_sequence< CORBA::Octet > &  rhs  )  const [inline]
 

Definition at line 234 of file Unbounded_Octet_Sequence_T.h.

References operator==().

00235 {
00236   return !this->operator==(rhs);
00237 }

unbounded_value_sequence<CORBA::Octet>& TAO::unbounded_value_sequence< CORBA::Octet >::operator= const unbounded_value_sequence< CORBA::Octet > &  rhs  )  [inline]
 

Definition at line 298 of file Unbounded_Octet_Sequence_T.h.

References TAO::unbounded_value_sequence< T >::swap().

00299   {
00300     unbounded_value_sequence<CORBA::Octet> tmp(rhs);
00301     swap(tmp);
00302     return * this;
00303   }

bool TAO::unbounded_value_sequence< CORBA::Octet >::operator== const unbounded_value_sequence< CORBA::Octet > &  rhs  )  const [inline]
 

Definition at line 214 of file Unbounded_Octet_Sequence_T.h.

References TAO::unbounded_value_sequence< T >::length().

00215 {
00216   ::CORBA::ULong const rlen = rhs.length ();
00217 
00218   if (rlen != this->length ())
00219     {
00220       return false;
00221     }
00222 
00223   for (::CORBA::ULong i = 0; i < rlen; ++i)
00224     {
00225       if (rhs[i] != this->buffer_[i])
00226         {
00227           return false;
00228         }
00229     }
00230 
00231   return true;
00232 }

value_type& TAO::unbounded_value_sequence< CORBA::Octet >::operator[] CORBA::ULong  i  )  [inline]
 

Definition at line 171 of file Unbounded_Octet_Sequence_T.h.

00171                                                {
00172     range::check(i, length_, maximum_, "operator[]() non-const");
00173     return buffer_[i];
00174   }

value_type const& TAO::unbounded_value_sequence< CORBA::Octet >::operator[] CORBA::ULong  i  )  const [inline]
 

Definition at line 167 of file Unbounded_Octet_Sequence_T.h.

00167                                                            {
00168     range::check(i, length_, maximum_, "operator[]() const");
00169     return buffer_[i];
00170   }

CORBA::Boolean TAO::unbounded_value_sequence< CORBA::Octet >::release void   )  const [inline]
 

Definition at line 123 of file Unbounded_Octet_Sequence_T.h.

00123                                       {
00124     return release_;
00125   }

void TAO::unbounded_value_sequence< CORBA::Octet >::replace CORBA::ULong  length,
const ACE_Message_Block mb
[inline]
 

Replaces the current buffer with , using only bytes. It takes a duplicate of so the user still owns it.

Definition at line 261 of file Unbounded_Octet_Sequence_T.h.

References TAO::unbounded_value_sequence< T >::swap().

00261                                                                        {
00262     unbounded_value_sequence<CORBA::Octet> s (length, mb);
00263     swap (s);
00264   }

void TAO::unbounded_value_sequence< CORBA::Octet >::replace CORBA::ULong  maximum,
CORBA::ULong  length,
value_type *  data,
CORBA::Boolean  release = false
[inline]
 

Definition at line 175 of file Unbounded_Octet_Sequence_T.h.

References TAO::unbounded_value_sequence< T >::swap().

00179                                     {
00180     unbounded_value_sequence<CORBA::Octet> tmp(maximum, length, data, release);
00181     swap(tmp);
00182   }

void TAO::unbounded_value_sequence< CORBA::Octet >::swap unbounded_value_sequence< CORBA::Octet > &  rhs  )  throw () [inline]
 

Definition at line 239 of file Unbounded_Octet_Sequence_T.h.

00239                                                            {
00240     std::swap (mb_, rhs.mb_);
00241     std::swap (maximum_, rhs.maximum_);
00242     std::swap (length_, rhs.length_);
00243     std::swap (buffer_, rhs.buffer_);
00244     std::swap (release_, rhs.release_);
00245   }

TAO::unbounded_value_sequence< CORBA::Octet >::unbounded_value_sequence const unbounded_value_sequence< CORBA::Octet > &  rhs  )  [inline]
 

TAO::unbounded_value_sequence< CORBA::Octet >::unbounded_value_sequence CORBA::ULong  length,
const ACE_Message_Block mb
[inline]
 

Create a sequence of octets from a single message block (i.e. it ignores any chaining in the meesage block).

TAO::unbounded_value_sequence< CORBA::Octet >::unbounded_value_sequence CORBA::ULong  maximum,
CORBA::ULong  length,
value_type *  data,
CORBA::Boolean  release = false
[inline]
 

TAO::unbounded_value_sequence< CORBA::Octet >::unbounded_value_sequence CORBA::ULong  maximum  )  [inline, explicit]
 

TAO::unbounded_value_sequence< CORBA::Octet >::unbounded_value_sequence  )  [inline]
 


Member Data Documentation

value_type* TAO::unbounded_value_sequence< CORBA::Octet >::buffer_ [mutable, private]
 

The buffer with all the elements, casting must be done in derived classes.

Definition at line 314 of file Unbounded_Octet_Sequence_T.h.

CORBA::ULong TAO::unbounded_value_sequence< CORBA::Octet >::length_ [private]
 

The current number of elements in the buffer.

Definition at line 310 of file Unbounded_Octet_Sequence_T.h.

CORBA::ULong TAO::unbounded_value_sequence< CORBA::Octet >::maximum_ [private]
 

The maximum number of elements the buffer can contain.

Definition at line 307 of file Unbounded_Octet_Sequence_T.h.

ACE_Message_Block* TAO::unbounded_value_sequence< CORBA::Octet >::mb_ [private]
 

Definition at line 319 of file Unbounded_Octet_Sequence_T.h.

CORBA::Boolean TAO::unbounded_value_sequence< CORBA::Octet >::release_ [private]
 

If true then the sequence should release the buffer when it is destroyed.

Definition at line 318 of file Unbounded_Octet_Sequence_T.h.


The documentation for this class was generated from the following file:
Generated on Thu Nov 9 12:27:20 2006 for TAO by doxygen 1.3.6