NAME

ACE_Array_Base - Implement a simple dynamic array

SYNOPSIS

#include <ace/Containers.h>

template<class T> class ACE_Array_Base { public: typedef T TYPE; typedef ACE_Array_Iterator<T> ITERATOR; ACE_Array_Base (size_t size = 0, ACE_Allocator *alloc = 0); ACE_Array_Base ( size_t size, const T &default_value, ACE_Allocator *alloc = 0 ); ACE_Array_Base (const ACE_Array_Base<T> &s); void operator= (const ACE_Array_Base<T> &s); ~ACE_Array_Base (void); T &operator [] (size_t slot); const T &operator [] (size_t slot) const; int set (const T &new_item, size_t slot); int get (T &item, size_t slot) const; size_t size (void) const; int size (size_t new_size); size_t max_size (void) const; int max_size (size_t new_size); private: int in_range (size_t slot) const; size_t max_size_; size_t cur_size_; T *array_; ACE_Allocator *allocator_; friend class ACE_Array_Iterator<T>; };

DESCRIPTION

This parametric class implements a simple dynamic array; resizing must be controlled by the user. No comparison or find operations are implemented.

Initialization and termination methods.

ACE_Array_Base (size_t size = 0, ACE_Allocator *alloc = 0);

ACE_Array_Base (
    size_t size,
    const T &default_value,
    ACE_Allocator *alloc = 0
    );

ACE_Array_Base (const ACE_Array_Base<T> &s);

void operator= (const ACE_Array_Base<T> &s);

~ACE_Array_Base (void);

Set/get methods.

T &operator [] (size_t slot);

const T &operator [] (size_t slot) const;

int set (const T &new_item, size_t slot);

int get (T &item, size_t slot) const;

size_t size (void) const;

int size (size_t new_size);

size_t max_size (void) const;

int max_size (size_t new_size);

AUTHOR

Doug Schmidt

LIBRARY

ace