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

#include <Unbounded_Octet_Sequence_T.h>

Inheritance diagram for TAO::unbounded_value_sequence< CORBA::Octet >:

Inheritance graph
[legend]
Collaboration diagram for TAO::unbounded_value_sequence< CORBA::Octet >:

Collaboration graph
[legend]
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_typesubscript_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_typeoperator[] (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_typeget_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

static value_typeallocbuf (CORBA::ULong maximum)
static 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_typebuffer_
CORBA::Boolean release_
ACE_Message_Blockmb_

Detailed Description

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

Definition at line 34 of file Unbounded_Octet_Sequence_T.h.


Member Typedef Documentation

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

Definition at line 43 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 41 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 39 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 44 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 38 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 45 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 46 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 40 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 37 of file Unbounded_Octet_Sequence_T.h.


Constructor & Destructor Documentation

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

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

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 (  )  [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 ( const unbounded_value_sequence< CORBA::Octet > &  rhs  )  [inline]


Member Function Documentation

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

Definition at line 244 of file Unbounded_Octet_Sequence_T.h.

00244                                                    {
00245     return allocation_traits::allocbuf(maximum);
00246   }

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

Definition at line 247 of file Unbounded_Octet_Sequence_T.h.

00247                                            {
00248     allocation_traits::freebuf(buffer);
00249   }

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

Definition at line 196 of file Unbounded_Octet_Sequence_T.h.

00196                                                               {
00197     if (orphan && !release_)
00198     {
00199       return 0;
00200     }
00201     if (buffer_ == 0)
00202     {
00203       buffer_ = allocbuf(maximum_);
00204     }
00205     if (!orphan)
00206     {
00207       return buffer_;
00208     }
00209 
00210     unbounded_value_sequence<CORBA::Octet> tmp;
00211     swap(tmp);
00212     tmp.release_ = false;
00213 
00214     return tmp.buffer_;
00215   }

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

Definition at line 189 of file Unbounded_Octet_Sequence_T.h.

Referenced by operator<<(), and operator>>().

00189                                                {
00190     if (buffer_ == 0)
00191       {
00192         buffer_ = allocbuf(maximum_);
00193       }
00194     return buffer_;
00195   }

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

Definition at line 131 of file Unbounded_Octet_Sequence_T.h.

References ACE_make_checked_array_iterator().

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

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

Definition at line 128 of file Unbounded_Octet_Sequence_T.h.

Referenced by operator<<(), and operator>>().

00128                                    {
00129     return length_;
00130   }

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

Definition at line 122 of file Unbounded_Octet_Sequence_T.h.

00122                                     {
00123     return maximum_;
00124   }

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 253 of file Unbounded_Octet_Sequence_T.h.

Referenced by operator<<(), and operator>>().

00253                                             {
00254     return mb_;
00255   }

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

Definition at line 232 of file Unbounded_Octet_Sequence_T.h.

References operator==().

00233   {
00234     return !this->operator==(rhs);
00235   }

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

Definition at line 296 of file Unbounded_Octet_Sequence_T.h.

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

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

Definition at line 219 of file Unbounded_Octet_Sequence_T.h.

References ACE_OS::memcmp().

00219                                                                                   {
00220     unbounded_value_sequence<CORBA::Octet> const & lhs = *this;
00221     CORBA::ULong const len = lhs.length();
00222 
00223     // We use the subscript operator instead of get_buffer() to avoid a
00224     // potential buffer allocation.
00225     return
00226       (len == rhs.length()
00227        && (len == 0
00228            ? true
00229            : ACE_OS::memcmp(&lhs[0], &rhs[0], len) == 0));
00230   }

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

Definition at line 177 of file Unbounded_Octet_Sequence_T.h.

00177                                                {
00178     range::check(i, length_, maximum_, "operator[]() non-const");
00179     return buffer_[i];
00180   }

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

Definition at line 173 of file Unbounded_Octet_Sequence_T.h.

00173                                                            {
00174     range::check(i, length_, maximum_, "operator[]() const");
00175     return buffer_[i];
00176   }

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

Definition at line 125 of file Unbounded_Octet_Sequence_T.h.

00125                                       {
00126     return release_;
00127   }

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

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

Definition at line 259 of file Unbounded_Octet_Sequence_T.h.

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

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 181 of file Unbounded_Octet_Sequence_T.h.

References CORBA::release().

Referenced by operator>>().

00185                                     {
00186     unbounded_value_sequence<CORBA::Octet> tmp(maximum, length, data, release);
00187     swap(tmp);
00188   }

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

Definition at line 237 of file Unbounded_Octet_Sequence_T.h.

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


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 312 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 308 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 305 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 317 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 316 of file Unbounded_Octet_Sequence_T.h.


The documentation for this class was generated from the following file:
Generated on Tue Feb 2 17:39:58 2010 for TAO by  doxygen 1.4.7