Scopira
20080306
|
#include <array.h>
Public Types | |
typedef T | data_type |
typedef T * | iterator |
typedef const T * | const_iterator |
Public Member Functions | |
basic_array (void) | |
basic_array (size_t len) | |
basic_array (const basic_array &rhs) | |
~basic_array () | |
Destructor. | |
void | resize (size_t newlen) |
void | array_swap (basic_array< T > &other) |
T * | array (void) |
const T * | array (void) const |
T * | c_array (void) |
const T * | c_array (void) const |
iterator | begin (void) |
iterator | end (void) |
const_iterator | begin (void) const |
const_iterator | end (void) const |
basic_array & | operator= (const basic_array &rhs) |
void | clear (void) |
void | clear_zero (void) |
size_t | size (void) const |
bool | empty (void) const |
void | set (size_t idx, const T &v) |
const T & | get (size_t idx) const |
T & | get (size_t idx) |
const T & | operator[] (size_t idx) const |
T & | operator[] (size_t idx) |
Protected Attributes | |
T * | dm_ary |
size_t | dm_len |
A generic, copyable array class. This should always be used instead of dynamic C-style arrays.
However, unlike std::vector, this one does NOT do incremental growth (or shrinkage)
|
inline |
Default constructor - makes a 0-length array.
|
inlineexplicit |
Initialization constructor - makes a array of the given size. Each object will be initializaed via its default constructor (thus primitives will have undefined values).
len | the length of the new array |
scopira::tool::basic_array< T >::basic_array | ( | const basic_array< T > & | rhs | ) |
Deep-copy constructor.
|
inline |
Raw access to the array
|
inline |
Raw access to the array
|
inline |
Trade internal strucuters with the given array. This is useful for implementing non-destructive resize methods externally. An internal implementation goes against the principals. of this structure.
other | The array to swap with. |
|
inline |
STL-like iteration
Referenced by scopira::tool::basic_array< byte_t >::basic_array(), scopira::tool::circular_vector< byte_t >::circular_vector(), scopira::tool::circular_vector< byte_t >::clear(), scopira::tool::circular_vector< byte_t >::full(), scopira::tool::basic_array< byte_t >::operator=(), scopira::tool::circular_vector< byte_t >::pop_all(), scopira::tool::circular_vector< byte_t >::pop_front(), scopira::tool::circular_vector< byte_t >::push_back(), scopira::tool::circular_vector< byte_t >::reserve(), and scopira::tool::circular_vector< byte_t >::short_rewind().
|
inline |
STL-like iteration
|
inline |
Raw access to the array
|
inline |
Raw access to the array
|
inline |
Does a resize(0)
|
inline |
Clears all the array values to binary 0. Does not resize the array. This is dangerous on non-POD classes.
|
inline |
Is the array empty (0 length)?
|
inline |
|
inline |
STL-like iteration
|
inline |
Individual element setter
|
inline |
Individual element setter
scopira::tool::basic_array< T > & scopira::tool::basic_array< T >::operator= | ( | const basic_array< T > & | rhs | ) |
Copy Operator. Does a deep copy.
|
inline |
Nice reference access
|
inline |
Nice reference access
void scopira::tool::basic_array< T >::resize | ( | size_t | newlen | ) |
Resizes the array. Please note the following: 1) If the new size is the current size, nothing will be done. 2) Resizes are destructive. All old values will be lost, and a new array is constructed (following the initialization rules specified in the constructor description)
newlen | the new length |
Referenced by scopira::tool::circular_vector< byte_t >::reserve().
|
inline |
Individual element setter
|
inline |
Gets the size of the array
Referenced by scopira::tool::circular_vector< byte_t >::capacity(), scopira::tool::regmatch::size(), and scopira::tool::circular_vector< byte_t >::size().