Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Array Class Template Reference

A dynamic array class. More...

#include <Containers_T.h>

Inheritance diagram for ACE_Array:

Inheritance graph
[legend]
Collaboration diagram for ACE_Array:

Collaboration graph
[legend]
List of all members.

Public Types

typedef T TYPE
typedef ACE_Array_Iterator<
T > 
ITERATOR

Public Methods

 ACE_Array (size_t size=0, ACE_Allocator *alloc=0)
 Dynamically create an uninitialized array. More...

 ACE_Array (size_t size, const T &default_value, ACE_Allocator *alloc=0)
 Dynamically initialize the entire array to the <default_value>. More...

 ACE_Array (const ACE_Array< T > &s)
 Copy constructor. More...

void operator= (const ACE_Array< T > &s)
 Assignment operator. More...

int operator== (const ACE_Array< T > &s) const
 Equality comparison operator. More...

int operator!= (const ACE_Array< T > &s) const
 Inequality comparison operator. More...


Detailed Description

template<class T>
class ACE_Array< T >

A dynamic array class.

This class extends ACE_Array_Base, adding comparison operators.

Requirements and Performance Characteristics

See also:
ACE_Array_Base. This class inherits its operations and requirements.

Definition at line 1915 of file Containers_T.h.


Member Typedef Documentation

template<class T>
typedef ACE_Array_Iterator<T> ACE_Array::ITERATOR
 

Reimplemented from ACE_Array_Base.

Definition at line 1921 of file Containers_T.h.

template<class T>
typedef T ACE_Array::TYPE
 

Reimplemented from ACE_Array_Base.

Definition at line 1919 of file Containers_T.h.


Constructor & Destructor Documentation

template<class T>
ACE_INLINE ACE_Array< T >::ACE_Array size_t    size = 0,
ACE_Allocator   alloc = 0
 

Dynamically create an uninitialized array.

Initialize an empty array of the specified size using the provided allocation strategy.

Definition at line 272 of file Containers_T.i.

00274   : ACE_Array_Base<T> (size, alloc)
00275 {
00276 }

template<class T>
ACE_INLINE ACE_Array< T >::ACE_Array size_t    size,
const T &    default_value,
ACE_Allocator   alloc = 0
 

Dynamically initialize the entire array to the <default_value>.

Initialize an array the given size placing the default_value in each index.

Definition at line 279 of file Containers_T.i.

00282   : ACE_Array_Base<T> (size, default_value, alloc)
00283 {
00284 }

template<class T>
ACE_INLINE ACE_Array< T >::ACE_Array const ACE_Array< T > &    s
 

Copy constructor.

The copy constructor performs initialization by making an exact copy of the contents of parameter <s>, i.e., *this == s will return true.

Definition at line 289 of file Containers_T.i.

00290    : ACE_Array_Base<T> (s)
00291 {
00292 }


Member Function Documentation

template<class T>
ACE_INLINE int ACE_Array< T >::operator!= const ACE_Array< T > &    s const
 

Inequality comparison operator.

Compare this array with <s> for inequality such that <*this> != <s> is always the complement of the boolean return value of <*this> == <s>.

Definition at line 308 of file Containers_T.i.

00309 {
00310   return !(*this == s);
00311 }

template<class T>
ACE_INLINE void ACE_Array< T >::operator= const ACE_Array< T > &    s
 

Assignment operator.

Assignment operator performs an assignment by making an exact copy of the contents of parameter <s>, i.e., *this == s will return true. Note that if the <max_size_> of <array_> is >= than <s.max_size_> we can copy it without reallocating. However, if <max_size_> is < <s.max_size_> we must delete the <array_>, reallocate a new <array_>, and then copy the contents of <s>.

Definition at line 297 of file Containers_T.i.

References ACE_Array_Base::operator=.

00298 {
00299   // Check for "self-assignment".
00300 
00301   if (this != &s)
00302     this->ACE_Array_Base<T>::operator= (s);
00303 }

template<class T>
int ACE_Array< T >::operator== const ACE_Array< T > &    s const
 

Equality comparison operator.

Compare this array with <s> for equality. Two arrays are equal if their <size>'s are equal and all the elements from 0 .. <size> are equal.

Definition at line 1861 of file Containers_T.cpp.

References ACE_Array_Base::size.

01862 {
01863   if (this == &s)
01864     return 1;
01865   else if (this->size () != s.size ())
01866     return 0;
01867 
01868   for (size_t slot = 0; slot < s.size (); slot++)
01869     if ((*this)[slot] != s[slot])
01870       return 0;
01871 
01872   return 1;
01873 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:44:54 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002