Main Page Class Hierarchy Compound List File List Compound Members File Members
NBaseArray Class Reference
#include <NArray.h>
Inheritance diagram for NBaseArray:
List of all members.
Detailed Description
Note: We grow the array in size exponentially. That is, every time we
need to increase the size of the array, we double its size rather than
increasing it by a fixed amount. For appending n items to an empty list,
this gives us O(n) copies, as opposed to the O(n^2) copies required if
we increment by a fixed size each time.
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)) and
poor insert/delete performance against eliminating copies.
Definition at line 30 of file NArray.h.
Constructor & Destructor Documentation
NBaseArray::NBaseArray (UInt32 es) [inline]
|
NBaseArray::NBaseArray (UInt32 es, Int size, Int alloc = kFirstNAllocation)
|
NBaseArray::NBaseArray (const NBaseArray & array)
|
NBaseArray::~NBaseArray ()
|
Member Function Documentation
Add n items to the array.
Definition at line 107 of file NArray.cc.
Void NBaseArray::Append (const NBaseArray & a)
|
Append array to array.
Definition at line 178 of file NArray.cc.
Void NBaseArray::Clear () [inline]
|
Delete all items.
Definition at line 153 of file NArray.h.
Delete n items at i.
Definition at line 130 of file NArray.cc.
UInt32 NBaseArray::EltSize () [inline]
|
Int NBaseArray::FRead (FILE * file)
|
Int NBaseArray::FWrite (FILE * file)
|
Void NBaseArray::Grow () [protected]
|
Insert n items at i.
Definition at line 118 of file NArray.cc.
Void NBaseArray::MemMap (const Char * filename)
|
Int NBaseArray::NumItems () const [inline]
|
Number of items in the array.
Definition at line 143 of file NArray.h.
Void NBaseArray::Pop () [inline]
|
Delete top of stack.
Definition at line 148 of file NArray.h.
Preallocate space for array.
Definition at line 77 of file NArray.cc.
Void NBaseArray::ReadFile (const Char * filename)
|
Void NBaseArray::Replace (NBaseArray & a)
|
Replace this array with a
& clear a.
Definition at line 203 of file NArray.cc.
Void NBaseArray::SetSize (Int newSize)
|
Set array size directly.
Definition at line 101 of file NArray.cc.
Void NBaseArray::Shrink (Int n = 1)
|
shrink the array by n items.
Definition at line 112 of file NArray.cc.
Void NBaseArray::ShrinkWrap ()
|
Ensure allocated space =
space being used.
Definition at line 142 of file NArray.cc.
Void NBaseArray::SwapWith (NBaseArray & a)
|
swaps this array with a.
Definition at line 192 of file NArray.cc.
Void NBaseArray::WriteFile (const Char * filename)
|
NBaseArray & NBaseArray::operator= (const NBaseArray & array)
|
Member Data Documentation
UInt32 NBaseArray::allocated [protected]
|
number of items we have space allocated for.
Definition at line 81 of file NArray.h.
UInt32 NBaseArray::eltSize [protected]
|
Byte * NBaseArray::item [protected]
|
pointer to array.
Definition at line 79 of file NArray.h.
UInt32 NBaseArray::items [protected]
|
items in the array.
Definition at line 80 of file NArray.h.
The documentation for this class was generated from the following files:
Generated at Sat Aug 5 00:16:34 2000 for Class Library by
1.1.0 written by Dimitri van Heesch,
© 1997-2000