Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

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

#include <Unbounded_Octet_Sequence_T.h>

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_type & subscript_type
typedef value_type const & const_subscript_type
typedef ::CORBA::ULong size_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)
 Create a sequence of octets from a single message block (i.e. it /// ignores any chaining in the message block).
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
 Returns the underlying message block, the caller must *not* /// release the copy.
void replace (CORBA::ULong length, const ACE_Message_Block *mb)
 Replaces the current buffer with mb, using only length bytes. /// It takes a duplicate of <mb> so the user still owns it.
 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_type * allocbuf (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_type * buffer_
 The buffer with all the elements, casting must be done in derived /// classes.
CORBA::Boolean release_
 If true then the sequence should release the buffer when it is /// destroyed.
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 44 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 45 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 46 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 47 of file Unbounded_Octet_Sequence_T.h.

typedef ::CORBA::ULong TAO::unbounded_value_sequence< CORBA::Octet >::size_type

Definition at line 42 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 message 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 235 of file Unbounded_Octet_Sequence_T.h.

                                                   {
    return allocation_traits::allocbuf(maximum);
  }

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

Definition at line 238 of file Unbounded_Octet_Sequence_T.h.

                                           {
    allocation_traits::freebuf(buffer);
  }

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

Definition at line 183 of file Unbounded_Octet_Sequence_T.h.

                                                              {
    if (orphan && !release_)
    {
      return 0;
    }
    if (buffer_ == 0)
    {
      buffer_ = allocbuf(maximum_);
      if (!orphan)
        {
          release_ = true;
        }
    }
    if (!orphan)
    {
      return buffer_;
    }

    unbounded_value_sequence<CORBA::Octet> tmp;
    swap(tmp);
    tmp.release_ = false;

    return tmp.buffer_;
  }

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

Definition at line 175 of file Unbounded_Octet_Sequence_T.h.

                                               {
    if (buffer_ == 0)
      {
        buffer_ = allocbuf(maximum_);
        release_ = true;
      }
    return buffer_;
  }

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

Definition at line 128 of file Unbounded_Octet_Sequence_T.h.

                                   {
    return length_;
  }

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

Definition at line 131 of file Unbounded_Octet_Sequence_T.h.

                                        {
    if (length <= maximum_)
      {
        if (this->mb_ == 0)
          {
            length_ = length;
          }
        else
          {
            unbounded_value_sequence<CORBA::Octet> tmp(length);
            tmp.length_ = length;
            element_traits::copy_range(
              buffer_,
              buffer_ + length,
              ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_));
            swap(tmp);
          }
        return;
      }

    unbounded_value_sequence<CORBA::Octet> tmp(length);
    tmp.length_ = length;
    element_traits::copy_range(
      buffer_,
      buffer_ + length_,
      ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_));
    swap(tmp);
  }

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

Definition at line 122 of file Unbounded_Octet_Sequence_T.h.

                                    {
    return maximum_;
  }

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

                                            {
    return mb_;
  }

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

Definition at line 223 of file Unbounded_Octet_Sequence_T.h.

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

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

Definition at line 293 of file Unbounded_Octet_Sequence_T.h.

  {
    unbounded_value_sequence<CORBA::Octet> tmp(rhs);
    swap(tmp);
    return * this;
  }

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

Definition at line 210 of file Unbounded_Octet_Sequence_T.h.

                                                                                  {
    unbounded_value_sequence<CORBA::Octet> const & lhs = *this;
    CORBA::ULong const len = lhs.length();

    // We use the subscript operator instead of get_buffer() to avoid a
    // potential buffer allocation.
    return
      (len == rhs.length()
       && (len == 0
           ? true
           : ACE_OS::memcmp(&lhs[0], &rhs[0], len) == 0));
  }

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

Definition at line 159 of file Unbounded_Octet_Sequence_T.h.

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

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

Definition at line 163 of file Unbounded_Octet_Sequence_T.h.

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

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

Definition at line 125 of file Unbounded_Octet_Sequence_T.h.

                                      {
    return release_;
  }

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

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

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

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

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

Definition at line 228 of file Unbounded_Octet_Sequence_T.h.

                                                           {
    std::swap (mb_, rhs.mb_);
    std::swap (maximum_, rhs.maximum_);
    std::swap (length_, rhs.length_);
    std::swap (buffer_, rhs.buffer_);
    std::swap (release_, rhs.release_);
  }


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 309 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 305 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 302 of file Unbounded_Octet_Sequence_T.h.

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

Definition at line 314 of file Unbounded_Octet_Sequence_T.h.

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

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

Definition at line 313 of file Unbounded_Octet_Sequence_T.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines