#include <Array.h>
Inheritance diagram for Array:
Public Members | |||
![]() | ![]() | Array () | |
![]() | ![]() | Array (UInt32 size, Int alloc = kFirstAllocation) | |
![]() | ![]() | Array (const TArray &array) | |
![]() | ![]() | ~Array () | |
![]() | ![]() | T& | operator[] (Int i) |
![]() | ![]() | Indexing operator. | |
![]() | ![]() | const T& | operator[] (Int i) const |
![]() | ![]() | Indexing operator. | |
![]() | ![]() | Int | NumItems () const |
![]() | ![]() | Number of items in the array. | |
![]() | ![]() | TArray& | operator= (const TArray &array) |
![]() | ![]() | Assignment! | |
![]() | ![]() | T& | Top () |
![]() | ![]() | Return top of stack. | |
![]() | ![]() | Void | Pop () |
![]() | ![]() | Delete top of stack. | |
![]() | ![]() | Void | Push (const T &t) |
![]() | ![]() | Push item onto stack. | |
![]() | ![]() | Void | Append (const T &t) |
![]() | ![]() | Append single item to array. | |
![]() | ![]() | T& | Last () |
![]() | ![]() | Return last item in array. | |
![]() | ![]() | Void | Clear () |
![]() | ![]() | Delete all items. | |
![]() | ![]() | Void | PreAllocate (UInt32 numItems) |
![]() | ![]() | Preallocate space for array. | |
![]() | ![]() | Void | SetSize (Int newSize) |
![]() | ![]() | Set array size directly. | |
![]() | ![]() | Void | Add (Int n = 1) |
![]() | ![]() | Add n items to the array. | |
![]() | ![]() | Void | Shrink (Int n = 1) |
![]() | ![]() | shrink the array by n items. | |
![]() | ![]() | Void | Insert (Int i, Int n = 1) |
![]() | ![]() | Insert n items at i. | |
![]() | ![]() | Void | Delete (Int i, Int n = 1) |
![]() | ![]() | Delete n items at i. | |
![]() | ![]() | Void | ShrinkWrap () |
![]() | ![]() | Ensure allocated space =
space being used. | |
![]() | ![]() | Void | ClearTo (const T &t) |
![]() | ![]() | Clear the array using t. | |
![]() | ![]() | Void | Append (const TArray &a) |
![]() | ![]() | Append array to array. | |
![]() | ![]() | Void | SwapWith (TArray &a) |
![]() | ![]() | Swaps this array with a. | |
![]() | ![]() | Void | Replace (TArray &a) |
![]() | ![]() | Replace this array with a
& clear a. | |
![]() | ![]() | const T& | Item (Int i) const |
![]() | ![]() | T& | Item (Int i) |
![]() | ![]() | T* | Ref () const |
![]() | ![]() | Return pointer to array. | |
![]() | ![]() | T* | Detach () |
![]() | ![]() | As above, but the array
no longer owns the data. | |
![]() | ![]() | Void | Attach (T *itemsPtr, Int numItems, Bool shared) |
![]() | ![]() | Attach the array to the given chunk of memory. More... | |
![]() | ![]() | Void | WriteFile (const Char *filename) |
![]() | ![]() | Void | ReadFile (const Char *filename) |
![]() | ![]() | Int | FWrite (FILE *file) |
![]() | ![]() | Int | FRead (FILE *file) |
Protected Members | |||
![]() | ![]() | Void | Grow () |
![]() | ![]() | T* | item |
![]() | ![]() | pointer to array. | |
![]() | ![]() | UInt32 | items |
![]() | ![]() | items in the array. | |
![]() | ![]() | UInt32 | allocated |
![]() | ![]() | number of items we have space allocated for. |
It would be useful to have an array data structure that utilises a tree of fixed-size arrays, thus trading off access time (const vs. o(logbn)) against eliminating copies.
Definition at line 25 of file Array.h.
Array::Array () |
Array::Array (UInt32 size, Int alloc = kFirstAllocation) |
Array::Array (const TArray & array) |
Array::~Array () |
Void Array::Add (Int n = 1) |
Add n items to the array.
Void Array::Append (const TArray & a) |
Append array to array.
Void Array::Append (const T & t) [inline]
|
Append single item to array.
Void Array::Attach (T * itemsPtr, Int numItems, Bool shared) |
Attach the array to the given chunk of memory.
If shared is true, the memory won't be deleted when the array is destroyed.
Void Array::Clear () |
Delete all items.
Void Array::ClearTo (const T & t) |
Clear the array using t.
Void Array::Delete (Int start, Int length = 1) |
T * Array::Detach () [inline]
|
As above, but the array no longer owns the data.
Int Array::FRead (FILE * file) |
Int Array::FWrite (FILE * file) |
Void Array::Grow () [protected]
|
Void Array::Insert (Int i, Int n = 1) |
Insert n items at i.
T & Array::Item (Int i) [inline]
|
const T & Array::Item (Int i) const [inline]
|
T & Array::Last () [inline]
|
Return last item in array.
Int Array::NumItems () const [inline]
|
Number of items in the array.
Void Array::Pop () [inline]
|
Delete top of stack.
Void Array::PreAllocate (UInt32 numItems) |
Preallocate space for array.
Void Array::Push (const T & t) [inline]
|
Push item onto stack.
Void Array::ReadFile (const Char * filename) |
T * Array::Ref () const [inline]
|
Return pointer to array.
Void Array::Replace (TArray & a) |
Replace this array with a & clear a.
Void Array::SetSize (Int newSize) |
Set array size directly.
Void Array::Shrink (Int n = 1) |
shrink the array by n items.
Void Array::ShrinkWrap () |
Ensure allocated space = space being used.
Void Array::SwapWith (TArray & a) |
Swaps this array with a.
T & Array::Top () [inline]
|
Return top of stack.
Void Array::WriteFile (const Char * filename) |
TArray & Array::operator= (const TArray & array) |
Assignment!
const T & Array::operator[] (Int i) const [inline]
|
Indexing operator.
T & Array::operator[] (Int i) [inline]
|
Indexing operator.
UInt32 Array::allocated [protected]
|
T * Array::item [protected]
|
UInt32 Array::items [protected]
|