|
ACE 8.0.2
|
Defines an STL-like vector container. More...
#include <Vector_T.h>


Public Types | |
| typedef ACE_Vector_Iterator< T, DEFAULT_SIZE > | Iterator |
Public Types inherited from ACE_Array< T > | |
| typedef T | TYPE |
| typedef ACE_Array_Iterator< T > | ITERATOR |
Public Types inherited from ACE_Array_Base< T > | |
| typedef T | TYPE |
| typedef ACE_Array_Iterator< T > | ITERATOR |
| typedef T | value_type |
| typedef value_type * | iterator |
| typedef value_type const * | const_iterator |
| typedef value_type & | reference |
| typedef value_type const & | const_reference |
| typedef value_type * | pointer |
| typedef value_type const * | const_pointer |
| typedef ptrdiff_t | difference_type |
| typedef ACE_Allocator::size_type | size_type |
| typedef std::reverse_iterator< iterator > | reverse_iterator |
| typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
Public Member Functions | |
| ACE_Vector (const size_t init_size=DEFAULT_SIZE, ACE_Allocator *alloc=0) | |
| ~ACE_Vector ()=default | |
| size_t | capacity () const |
| size_t | size () const |
| void | clear () |
| void | resize (const size_t new_size, const T &t) |
| void | push_back (const T &elem) |
| void | pop_back () |
| void | dump () const |
| bool | operator== (const ACE_Vector< T, DEFAULT_SIZE > &s) const |
| Equality comparison operator. | |
| bool | operator!= (const ACE_Vector< T, DEFAULT_SIZE > &s) const |
| Inequality comparison operator. | |
| void | swap (ACE_Vector &rhs) |
| ACE_Array_Base< T >::iterator | end () |
| ACE_Array_Base< T >::const_iterator | end () const |
Public Member Functions inherited from ACE_Array< T > | |
| ACE_Array (size_t size=0, ACE_Allocator *alloc=0) | |
| Dynamically create an uninitialized array. | |
| ACE_Array (size_t size, const T &default_value, ACE_Allocator *alloc=0) | |
| Dynamically initialize the entire array to the {default_value}. | |
| ACE_Array (const ACE_Array< T > &s) | |
| Copy constructor. | |
| void | operator= (const ACE_Array< T > &s) |
| Assignment operator. | |
| bool | operator== (const ACE_Array< T > &s) const |
| Equality comparison operator. | |
| bool | operator!= (const ACE_Array< T > &s) const |
| Inequality comparison operator. | |
Public Member Functions inherited from ACE_Array_Base< T > | |
| ACE_Array_Base (size_type size=0, ACE_Allocator *the_allocator=0) | |
| Dynamically create an uninitialized array. | |
| ACE_Array_Base (size_type size, T const &default_value, ACE_Allocator *the_allocator=0) | |
| Dynamically initialize the entire array to the default_value. | |
| ACE_Array_Base (ACE_Array_Base< T > const &s) | |
| void | operator= (ACE_Array_Base< T > const &s) |
| ~ACE_Array_Base () | |
| Clean up the array (e.g., delete dynamically allocated memory). | |
| T & | operator[] (size_type slot) |
| T const & | operator[] (size_type slot) const |
| int | set (T const &new_item, size_type slot) |
| int | get (T &item, size_type slot) const |
| size_type | size () const |
| Returns the <cur_size_> of the array. | |
| int | size (size_type new_size) |
| size_type | max_size () const |
| Returns the <max_size_> of the array. | |
| int | max_size (size_type new_size) |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| reverse_iterator | rbegin () |
| reverse_iterator | rend () |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | rend () const |
| void | swap (ACE_Array_Base< T > &array) |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Protected Attributes | |
| size_t | length_ |
| } | |
| size_t | curr_max_size_ |
Protected Attributes inherited from ACE_Array_Base< T > | |
| size_type | max_size_ |
| size_type | cur_size_ |
| value_type * | array_ |
| Pointer to the array's storage buffer. | |
| ACE_Allocator * | allocator_ |
| Allocation strategy of the ACE_Array_Base. | |
Friends | |
| class | ACE_Vector_Iterator< T, DEFAULT_SIZE > |
Additional Inherited Members | |
Protected Member Functions inherited from ACE_Array_Base< T > | |
| bool | in_range (size_type slot) const |
Defines an STL-like vector container.
This is an STL-like template vector container, a wrapper around ACE_Array. It provides at least the basic std::vector look and feel: push_back(), clear(), resize(), capacity(). This template class uses the copy semantic paradigm, though it is okay to use reference counted smart pointers (see ACE_Ptr<T>) with this template class.
Requirements and Performance Characteristics
| typedef ACE_Vector_Iterator<T, DEFAULT_SIZE> ACE_Vector< T, DEFAULT_SIZE >::Iterator |
A short name for iterator for ACE_Vector.
|
inline |
|
default |
Destructor.
|
inline |
Returns the current vector capacity, that is, the currently allocated buffer size.
|
inline |
Clears out the vector. It does not reallocate the vector's buffer, it is just sets the vector's dynamic size to 0.
| void ACE_Vector< T, DEFAULT_SIZE >::dump | ( | ) | const |
This function dumps the content of the vector. TO BE MOVED out of this class. It needs to be implemented as a global template function that accepts a const ACE_Vector<T>, in order to make instances of this class compile on Linux. G++ and xlC have template instantiation algoriths, which are different from the one in Visual C++. The algorithms try to instantiate ALL methods declared in the template class, regardless of whether the functions are used or not. That is, all of the classes, that are used as elements in ACE_Vector's, have to have the dump() methods defined in them (seems to be overkill).
This function calls T::dump() for each element of the vector.
|
inline |
C++ Standard End Iterator {
|
inline |
|
inline |
Inequality comparison operator.
Compare this vector with
*this != *this == | bool ACE_Vector< T, DEFAULT_SIZE >::operator== | ( | const ACE_Vector< T, DEFAULT_SIZE > & | s | ) | const |
Equality comparison operator.
Compare this vector with
|
inline |
Deletes the last element from the vector ("pop back"). What this function really does is decrement the dynamic size of the vector. The vector's buffer does not get reallocated for performance.
| void ACE_Vector< T, DEFAULT_SIZE >::push_back | ( | const T & | elem | ) |
Appends a new element to the vector ("push back"). If the dynamic size of the vector is equal to the capacity of the vector (vector is at capacity), the vector automatically doubles its capacity.
| elem | A reference to the new element to be appended. By default, this parameters gets initialized with the default value of the class T. |
| size_t DEFAULT_SIZE void ACE_Vector< T, DEFAULT_SIZE >::resize | ( | const size_t | new_size, |
| const T & | t ) |
Resizes the vector to the new capacity. If the vector's current capacity is smaller than the size to be specified, then the buffer gets reallocated. If the new capacity is less than the current capacity of the vector, the buffer size stays the same.
| new_size | New capacity of the vector |
| t | A filler value (of the class T) for initializing the elements of the vector with. By default, if this parameter is not specified, the default value of the class T will be used (for more detail, see the initialization clause for this parameter). |
|
inline |
Returns the vector's dynamic size / actual current size of the vector. Do not confuse it with ACE_Array::size(), which returns the array's capacity. Unfortunately, ACE is not very consistent with the function names.
|
inline |
|
friend |
| ACE_Vector< T, DEFAULT_SIZE >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
|
protected |
Current capacity (buffer size) of the vector.
|
protected |
}
Dynamic size (length) of the vector.