#include <Array_Base.h>
Inheritance diagram for ACE_Array_Base< T >:
Public Types | |
typedef T | TYPE |
typedef ACE_Array_Iterator< T > | ITERATOR |
Public Methods | |
ACE_Array_Base (size_t size=0, ACE_Allocator *the_allocator=0) | |
Dynamically create an uninitialized array. | |
ACE_Array_Base (size_t size, const T &default_value, ACE_Allocator *the_allocator=0) | |
Dynamically initialize the entire array to the <default_value>. | |
ACE_Array_Base (const ACE_Array_Base< T > &s) | |
void | operator= (const ACE_Array_Base< T > &s) |
~ACE_Array_Base (void) | |
Clean up the array (e.g., delete dynamically allocated memory). | |
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 |
Returns the <cur_size_> of the array. | |
int | size (size_t new_size) |
size_t | max_size (void) const |
Returns the <max_size_> of the array. | |
int | max_size (size_t new_size) |
Private Methods | |
int | in_range (size_t slot) const |
Private Attributes | |
size_t | max_size_ |
size_t | cur_size_ |
T * | array_ |
Pointer to the array's storage buffer. | |
ACE_Allocator * | allocator_ |
Allocation strategy of the ACE_Array_Base. | |
Friends | |
class | ACE_Array_Iterator< T > |
This parametric class implements a simple dynamic array; resizing must be controlled by the user. No comparison or find operations are implemented.
|
Reimplemented in ACE_Array< T >, ACE_Array< ACE_Get_Opt_Long_Option * >, and ACE_Array< ACE_INET_Addr >. |
|
Reimplemented in ACE_Array< T >, ACE_Array< ACE_Get_Opt_Long_Option * >, and ACE_Array< ACE_INET_Addr >. |
|
Dynamically create an uninitialized array.
|
|
Dynamically initialize the entire array to the <default_value>.
|
|
The copy constructor performs initialization by making an exact copy of the contents of parameter <s>, i.e., *this == s will return true. |
|
Clean up the array (e.g., delete dynamically allocated memory).
|
|
Get an item in the array at location <slot>. Returns -1 if <slot> is not in range, else returns 0. Note that this function copies the item. If you want to avoid the copy, you can use the const operator[], but then you'll be responsible for range checking. |
|
Returns 1 if <slot> is within range, i.e., 0 >= <slot> < <cur_size_>, else returns 0. |
|
Changes the size of the array to match <new_size>. It copies the old contents into the new array. Return -1 on failure. It does not affect new_size |
|
Returns the <max_size_> of the array.
|
|
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>. |
|
Get item in the array at location <slot>. Doesn't perform range checking. |
|
Set item in the array at location <slot>. Doesn't perform range checking. |
|
Set an item in the array at location <slot>. Returns -1 if <slot> is not in range, else returns 0. |
|
Changes the size of the array to match <new_size>. It copies the old contents into the new array. Return -1 on failure. |
|
Returns the <cur_size_> of the array.
Reimplemented in ACE_Vector< T, DEFAULT_SIZE >. |
|
|
|
Allocation strategy of the ACE_Array_Base.
|
|
Pointer to the array's storage buffer.
|
|
Current size of the array. This starts out being == to <max_size_>. However, if we are assigned a smaller array, then <cur_size_> will become less than <max_size_>. The purpose of keeping track of both sizes is to avoid reallocating memory if we don't have to. |
|
Maximum size of the array, i.e., the total number of <T> elements in <array_>. |