[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LArray



Description:

LArray is a PowerPlant class that is used for implementing an ordered collection of fixed-size items. The first item is at index value 1. The index value 0 is used to indicate a nonexistent item.

Methods :

The methods in this class are:

 

LArray()  
~LArray()  
AddItem()  
AdjustAllocation()  
AdjustStorage()  
AssignItemsAt()  
AttachIterator()  
BinarySearch()  
BinarySearchByKey()  
CopyArray()  
DestroyArray()  
DetachIterator()  
FetchIndexOf()  
FetchIndexOfKey()  
FetchInsertIndexOf()  
FetchInsertIndexOfKey()  
FetchItemAt()  
GetComparator()  
GetCount()  
GetItemPtr()  
GetItemSize()  
GetItemsHandle()  
GrabItemRangeSize()  
GrabItemSize()  
InitArray()  
InsertItemsAt()  
InternalAdjustAllocation()  
InternalCopyItem()  
InternalMoveItem()  
InternalSwapItems()  
InvalidateSort()  
IsKeptSorted()  
IsSorted()  
ItemsInserted()  
ItemsRemoved()  
LinearSearch()  
LinearSearchByKey()  
Lock()  
MoveItem()  
PeekItem()  
PokeItem()  
Remove()  
RemoveItemsAt()  
SetComparator()  
SetKeepSorted()  
ShiftItems()  
Sort()  
StoreNewItems()  
SwapItems()  
Unlock()  
ValidIndex()  
operator=()  

Data Members:

The data members in this class are:

 

mComparator  
mDataAllocated  
mDataStored  
mIsSorted  
mItemCount  
mItemsH  
mItemSize  
mIteratorListHead  
mKeepSorted  
mLockCount  
mOwnsComparator  
 

Operation:

Index values are signed, 32-bit integers. When specifying an item, you pass a pointer to the item data as a parameter. The array stores a copy of the data, or returns a copy of the data to you.

You can insert, remove, get a value, assign a value, swap, move items, and get data about the array. PowerPlant defines the constants index_First and index_Last so that you can easily insert items at the beginning or end of the array.

Source files:

(Array Classes)

LArray.h

LArray.cp

See Also:

LArrayIterator

LComparator

LLockedArrayIterator

LArray()

Purpose:

The constructors create the object with the passed-in parameters.

Access:

Public

Prototypes:

LArray();

LArray( const LArray &inOriginal );

These constructors create an array with space pre-allocated for the specified number of items of the specified size. If nItemCount is not specified, then the array will be empty after creation.

LArray( USInt32 inItemCount,
USInt32 inItemSize,
LComparator *inComparator = nil,
Boolean inKeepSorted = false );

LArray( USInt32 inItemSize,
LComparator *inComparator = nil,
Boolean inKeepSorted = false );

LArray( USInt32 inItemSize,
Handle inItemsHandle,
LComparator *inComparator = nil,
Boolean inIsSorted = false,
Boolean inKeepSorted = false );
Parameters:

The parameters for this constructor are:

 

USInt32  
inItemCount  
The number of items to put in the array.  
USInt32  
inItemSize  
The size of one item.  
Handle  
inItemsHandle  
A handle to items for the array.  
LComparator*  
inComparator  
The Comparator object compares array items and must be allocated in the heap via "new". The array assumes ownership of the Comparator and is responsible for deleting it. The default is nil.  
Boolean  
inKeepSorted  
This specifies whether to keep the array sorted when items are inserted or assigned new values.The default is false.  
const LArray &  
inOriginal  
A reference to the object to copy.  

~LArray()

Purpose:

The destructor destroys the array.

Access:

Virtual, Public

Prototype:

virtual ~LArray();

AddItem()

Purpose:

Add one item to array. If the array is not sorted, add the item to the end of the array.

Access:

Virtual, Public

Prototype:

virtual ArrayIndexT AddItem( const void *inItem,
USInt32 inItemSize );
Parameters:

This method takes the following parameters:

 

const void*  
inItem  
The item to add to the array.  
USInt32  
inItemSize  
The size of the item in bytes.  

Return:

Returns the index point at which the item was inserted.

Remarks:

For unsorted Arrays, this function is a faster version of InsertItemsAt() since it doesn't have to bother with checking/adjusting the count and insertion index.

AdjustAllocation()

Purpose:

This method is a wrapper call to InternalAdjustAllocation().

Access:

Virtual, Public

Prototype:

virtual void AdjustAllocation(
USInt32 inExtraItems,
USInt32 inExtraData );
Parameters:

This method takes the following parameters:

 

USInt32  
inExtraItems  
The item to add to the array.  
USInt32  
inExtraData  
The size of the item in bytes. This has a default parameter value of zero and is ignored.

Return:

None

Remarks:

For fixed-size items, the number of items determines the amount of data stored.

AdjustStorage()

Purpose:

This method is called internally when the number of bytes used by items in the array changes.

Access:

Virtual, Protected

Prototype:

virtual void AdjustStorage(
SInt32 inDeltaItems,
SInt32 inDeltaData );
Parameters:

This method takes the following parameters:

 

SInt32  
inDeltaItems  
The change in the number of items in the array.  
SInt32  
inDeltaData  
Ignored, since the number of items determines the amount of data stored for fixed-size item arrays.

Return:

None

Remarks:

If the current allocation is too small, this implementation sets the internal allocation size to:


   current_alloc + max(current_alloc, delta_bytes)

For small adjustments (adding less bytes than what's already allocated), this doubles the allocation.

For large adjustments (adding more bytes than what's already allocated), this increases the allocation by the number of bytes added.

AssignItemsAt()

Purpose:

Assign the same value to items in the array starting at the specified index.

Access:

Virtual, Public

Prototype:

virtual ArrayIndexT AssignItemsAt(
USInt32 inCount,
ArrayIndexT inAtIndex,
const void *inValue,
USInt32 inItemSize)
Parameters:

This method takes the following parameters:

 

USInt32  
inCount  
The number of items to make the same.  
ArrayIndexT  
inAtIndex  
The starting index.
const void*  
inValue  
A pointer to the item data. The array makes and stores a copy of the item data.
USInt32  
inItemSize  
The size of the array item.

Return:

Returns index of first "assigned" item. This may be different from inAtIndex if the array is sorted. Returns LArray::index_Bad if inAtIndex is out of range.

Remarks:

Does nothing if inAtIndex is out of range.

AttachIterator()

Purpose:

Associate an iterator with an array.

Access:

Protected

Prototype:

void AttachIterator(
LArrayIterator *inIterator ) const;
Parameters:

This method takes the following parameter:

 

LArrayIterator*  
inIterator  
The iterator to associate with the array.  

Return:

None

BinarySearch()

Purpose:

This method returns the index of the specified item using a binary search. It assumes that the array is sorted.

Access:

Protected

Prototype:

ArrayIndexT BinarySearch(
const void *inItem,
USInt32 inItemSize) const;
Parameters:

This method takes the following parameters:

 

const void *  
inItem  
A pointer to the item to search for.
USInt32  
inItemSize  
The size of the array item.

Return:

The index at which the item was found. If not found, the value returned will be index_Bad.

BinarySearchByKey()

Purpose:

Return the index of the item with the specified key, using a binary search. It assumes that the array is sorted.

Access:

Protected

Prototype:

ArrayIndexT BinarySearchByKey(
const void *inKey) const;
Parameters:

This method takes the following parameter:

 

const void *  
inKey  
A pointer to the key to search for.

Return:

The index at which the item was found. If not found, the value returned will be index_Bad.

CopyArray()

Purpose:

Creates a deep copy by duplicating the items in the Array. However, if the items in the Array are pointers to other objects, those other objects aren't duplicated.

Access:

Private

Prototype:

void CopyArray( const LArray &inOriginal );
Parameters:

This method takes the following parameter:

 

const LArray&  
inOriginal  
A reference to the original object to copy.

Return:

None

Remarks:

DestroyArray()

Purpose:

Destroy the internal data an array.

Access:

Private

Prototype:

void DestroyArray();
Parameters:

None

Return:

None

DetachIterator()

Purpose:

Remove the association of an iterator from an array.

Access:

Protected

Prototype:

void DetachIterator(
LArrayIterator *inIterator) const;
Parameters:

This method takes the following parameter:

 

LArrayIterator*  
inIterator  
A pointer to the iterator.

Return:

None

FetchIndexOf()

Purpose:

Returns the index of the specified item within the array.

Access:

Virtual, Public

Prototype:

virtual ArrayIndexT FetchIndexOf(
const void *inItem,
USInt32 inItemSize)
Parameters:

This method takes the following parameters:

 

const void *  
inItem  
A pointer to the item to search for.
USInt32  
inItemSize  
The size of the array item.

Return:

Returns index_Bad if the item is not in the array.

FetchIndexOfKey()

Purpose:

Return the index of the item with the specified Key value.

Access:

Virtual, Public

Prototype:

virtual ArrayIndexT FetchIndexOfKey(
const void *inKey)
Parameters:

This method takes the following parameter:

 

const void *  
inKey  
A pointer to the key to search for.

Return:

Returns the index of the item.

FetchInsertIndexOf()

Purpose:

Return the index at which the specified item would be inserted.

Access:

Virtual, Public

Prototype:

virtual ArrayIndexT FetchInsertIndexOf(
const void *inItem,
USInt32 inItemSize)
Parameters:

This method takes the following parameters:

 

const void *  
inItem  
A pointer to the item to search for.
USInt32  
inItemSize  
The size of the array item.

Return:

Returns index_Last if the Array is not sorted or if the item is nil.

FetchInsertIndexOfKey()

Purpose:

Return the index at which an item with the specified Key would be inserted.

Access:

Virtual, Public

Prototype:

virtual ArrayIndexT FetchInsertIndexOfKey(
const void *inKey)
Parameters:

This method takes the following parameter:

 

const void *  
inKey  
A pointer to the key to search for.

Return:

Returns index_Last if the Array is not sorted or if the item is nil.

FetchItemAt()

Purpose:

Pass back the item at the specified index.

Access:

Virtual, Public

Prototype:

virtual Boolean FetchItemAt(
ArrayIndexT inAtIndex,
void *outItem,
USInt32 &ioItemSize ) const;

virtual Boolean FetchItemAt(
ArrayIndexT inAtIndex,
void *outItem ) const;
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inAtIndex  
The index to retrieve from.
void*  
outItem  
The pointer to the retrieved item. Caller must make sure that this points a buffer large enough to hold the item data.
USInt32&  
ioItemSize  
The size of the item.

Return:

Returns true if an item exists at inIndex (and sets outItem). Returns false if inIndex is out of range (and leaves outItem unchanged).

GetComparator()

Purpose:

This method returns the value of the mComparator data member.

Access:

Public

Prototype:

LComparator* GetComparator() const;
Parameters:

None

Return:

A pointer to the LComparator.

GetCount()

Purpose:

This method returns the value of the mItemCount data member.

Access:

Public

Prototype:

USInt32 GetCount() const;
Parameters:

None

Return:

USInt32 indicating the value of mItemCount.

GetItemPtr()

Purpose:

Returns a pointer to the start of an item's data within the internal storage Handle.

Access:

Virtual, Public

Prototype:

virtual void* GetItemPtr(
ArrayIndexT inAtIndex) const;
Parameters:

This method takes the following parameter:

 

ArrayIndexT  
inAtIndex  
The index to retrieve from.

Return:

A pointer to the start of the item data.

Remarks:

WARNING: The return pointer references information inside a relocatable block. This pointer will become invalid if the Handle block moves. Call Lock() and then Unlock() where necessary.

WARNING: For sorted arrays, be careful when changing the data using the pointer. If your changes alter the sorting order, call InvalidateSort() so that the array's internal flags correctly reflect the sorting state. Then call Sort() afterwards if you still want the array to be sorted.

GetItemSize()

Purpose:

This method returns the value of the mItemSize data member.

Access:

Virtual, Public

Prototype:

virtual USInt32 GetItemSize(ArrayIndexT inIndex) 
const;
Parameters:

This method takes the following parameter:

 

ArrayIndexT  
inIndex  
The index to retrieve the size of.

Return:

The value of mItemSize in a USInt32.

GetItemsHandle()

Purpose:

Return Handle used to store data for array items.

Access:

Public

Prototype:

Handle GetItemsHandle() const;
Parameters:

None

Return:

The handle to the array items.

GrabItemRangeSize()

Purpose:

This method returns the total size in bytes of the items in the array between (inclusive) the specified start and end indices.

Access:

Inline, Virtual, Protected

Prototype:

virtual USInt32 GrabItemRangeSize(
ArrayIndexT inStartIndex,
ArrayIndexT inEndIndex) const;
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inStartIndex  
The starting index.
ArrayIndexT  
inEndIndex  
The ending index.

Return:

A size in bytes stored in a USInt32.

GrabItemSize()

Purpose:

This data member returns the value of the mItemSize data member.

Access:

Virtual, Protected

Prototype:

virtual USInt32 GrabItemSize(
ArrayIndexT inIndex ) const;
Parameters:

This method takes the following parameter:

 

ArrayIndexT  
inIndex  
The index (unused).

Return:

USInt32 containing the value of the mItemSize member.

InitArray()

Purpose:

This is an internal method which initializes the data members for an array.

Access:

Private

Prototype:

void InitArray(
USInt32 inItemSize,
LComparator *inComparator,
Boolean inIsSorted,
Boolean inKeepSorted);
Parameters:

This method takes the following parameters:

 

USInt32  
inItemSize  
The size of the items for the array.
LComparator*  
inComparator  
The pointer to the comparator object.
Boolean  
inIsSorted  
A value indicating whether the array is sorted or not.
Boolean  
inKeepSorted  
A value indicating whether to keep the array sorted or not.

Return:

None

InsertItemsAt()

Purpose:

Insert items at the specified position in an array.

Access:

Virtual, Public

Prototype:

virtual ArrayIndexT InsertItemsAt(
USInt32 inCount,
ArrayIndexT inAtIndex,
const void *inItem,
USInt32 inItemSize);
Parameters:

This method takes the following parameters:

 

USInt32  
inCount  
The number of items to insert.
ArrayIndexT  
inAtIndex  
The index to begin inserting at.
const void*  
inItem  
A pointer to the item to insert.
USInt32  
inItemSize  
The size of the item in bytes.

Return:

The index at which items were inserted. This can differ from the input value of inAtIndex as described in the Remarks.

Remarks:

All items are set to the same value, as specified by inItem. inItem may be nil, in which case the data for the inserted items is unspecified (but space is allocated).

inAtIndex is adjusted if necessary:

> to sorted position if array is kept sorted > to after last item if inAtIndex is too big > to 1 if inAtIndex is too small

InternalAdjustAllocation()

Purpose:

Called internally to change the size of the storage used.

Access:

Virtual, Protected

Prototype:

virtual void InternalAdjustAllocation(
USInt32 inItemAllocation,
USInt32 inDataAllocation );
Parameters:

This method takes the following parameter:

 

USInt32  
inItemAllocation  
The the number of items to allocate space for.
USInt32  
inDataAllocation  
The the amount of data to allocate space for.

Remarks:

Fixed-size item Array only stores data, so inItemAllocation is ignored.

InternalCopyItem()

Purpose:

Set value of destination item to that of the source item.

Access:

Virtual, Protected

Prototype:

virtual void InternalCopyItem(
ArrayIndexT inSourceIndex,
ArrayIndexT inDestIndex);
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inSourceIndex  
The source index.
ArrayIndexT  
inDestIndex  
The destination index.

Return:

None

InternalMoveItem()

Purpose:

Move an item from one position to another in an array. The net result is the same as removing the item and inserting at a new position.

Access:

Virtual, Protected

Prototype:

virtual void InternalMoveItem(
ArrayIndexT inFromIndex,
ArrayIndexT inToIndex,
void *inBuffer);
Parameters:

This method takes the following parameters:

 

void*  
inBuffer  
A pointer to the data buffer.
ArrayIndexT  
inSourceIndex  
The source index.
ArrayIndexT  
inDestIndex  
The destination index.

Return:

None

InternalSwapItems()

Purpose:

Swap the values of the Items at the specified indices. This is an internal method for this class.

Access:

Virtual, Protected

Prototype:

virtual void InternalSwapItems(
ArrayIndexT inIndexA,
ArrayIndexT inIndexB,
void *inBuffer);
Parameters:

This method takes the following parameters:

 

void*  
inBuffer  
A pointer to the data buffer.
ArrayIndexT  
inIndexA  
The first index.
ArrayIndexT  
inIndexB  
The second index.

Return:

None

InvalidateSort()

Purpose:

This method sets the mIsSorted data member to false.

Access:

Public

Prototype:

void InvalidateSort();
Parameters:

None

Return:

None

IsKeptSorted()

Purpose:

This method returns the value of the mKeepSorted data member.

Access:

Inline, Public

Prototype:

Boolean IsKeptSorted() const;
Parameters:

None

Return:

Boolean true or false indicating the value of mKeepSorted.

IsSorted()

Purpose:

This method returns the value of the mIsSorted data member.

Access:

Inline, Public

Prototype:

Boolean IsSorted() const;
Parameters:

None

Return:

Boolean true or false indicating the value of mIsSorted.

ItemsInserted()

Purpose:

Notify Iterators associated with an array that items have been inserted.

Access:

Protected

Prototype:

void ItemsInserted(
USInt32 inCount,
ArrayIndexT inAtIndex);
Parameters:

This method takes the following parameters:

 

USInt32  
inCount  
The number of items that have been inserted.
ArrayIndexT  
inAtIndex  
The index of the insertion.

Return:

None

ItemsRemoved()

Purpose:

Notify Iterators associated with an Array that items have been removed

Access:

Protected

Prototype:

void ItemsRemoved(
USInt32 inCount,
ArrayIndexT inAtIndex);
Parameters:

This method takes the following parameters:

 

USInt32  
inCount  
The number of items that have been removed.
ArrayIndexT  
inAtIndex  
The index of the removal.

Return:

None

LinearSearch()

Purpose:

Return the index of the specified item, searching linearly from the start of the array.

Access:

Protected

Prototype:

ArrayIndexT LinearSearch(
const void *inItem,
USInt32 inItemSize) const;
Parameters:

This method takes the following parameters:

 

USInt32  
inItemSize  
The size of the item to search for.
const void*  
inItem  
The pointer to the item to search for.

Return:

The index at which the item is located, index_Bad if not found.

LinearSearchByKey()

Purpose:

Return the index of the item with the specified key, searching linearly from the start of the array.

Access:

Protected

Prototype:

ArrayIndexT LinearSearchByKey(
const void *inKey) const;
Parameters:

This method takes the following parameter:

 

const void*  
inKey  
A pointer to the key to search for.

Return:

The index at which the item is located, index_Bad if not found.

Lock()

Purpose:

Lock the Handle that stores the data for the items in the array.

Access:

Public

Prototype:

void Lock() const;
Parameters:

None

Return:

None

Remarks:

This class maintains a lock count, so each call to Lock() should be balanced by a corresponding call to Unlock().

MoveItem()

Purpose:

Move an item from one position to another in an array. The net result is the same as removing the item and inserting at a new position.

Access:

Virtual, Public

Prototype:

virtual void MoveItem(
ArrayIndexT inFromIndex,
ArrayIndexT inToIndex );
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inFromIndex  
The source index.
ArrayIndexT  
inToIndex  
The destination index.

Return:

None

Remarks:

Does nothing if either index is out of range or if the array is kept sorted (since moving could invalidate the sort).

PeekItem()

Purpose:

Pass back the data for the item at the specified index. This is used internally to read item data.

Access:

Virtual, Protected

Prototype:

virtual void PeekItem(
ArrayIndexT inAtIndex,
void *outItem ) const;
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inAtIndex  
The array index to peek at.
void *  
outItem  
The pointer to the item to return data for.

Return:

None

PokeItem()

Purpose:

Store data for the item at the specified index.

Access:

Virtual, Protected

Prototype:

virtual void PokeItem(
ArrayIndexT inAtIndex,
const void *inItem,
USInt32 inItemSize );
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inAtIndex  
The array index to poke at.
const void*  
outItem  
The pointer to the item to store data for.
USInt32  
inItemSize  
The size of the data block to store

Return:

None

Remove()

Purpose:

Remove an item from an array.

Access:

Virtual, Public

Prototype:

virtual void Remove(
const void *inItem,
USInt32 inItemSize);
Parameters:

This method takes the following parameters:

 

const void *  
outItem  
The pointer to the item to remove data for.
USInt32  
inItemSize  
The size of the data block to remove.

Return:

None

RemoveItemsAt()

Purpose:

Remove items from an array starting at a specified position.

Access:

Virtual, Public

Prototype:

virtual void RemoveItemsAt(
USInt32 inCount,
ArrayIndexT inAtIndex);
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inAtIndex  
The index to start removing at.
USInt32  
inItemSize  
The size of the data block to remove.

Return:

None

Remarks:

Does nothing if inAtIndex is out of range. Checks if inCount would remove items past the end of the array, and adjusts it accordingly to remove the items from inAtIndex to the end of the array. That means you can pass a large number to remove the items from inAtIndex to the end of the array.

SetComparator()

Purpose:

Specify the comparator for items in an array.

Access:

Public

Prototype:

void SetComparator(
LComparator *inComparator,
Boolean inTakeOwnership);
Parameters:

This method takes the following parameters:

 

LComparator*  
inComparator  
The comparator to use.
Boolean  
inTakeOwnership  
Indicates the value to set for mOwnsComparator.

Return:

None

SetKeepSorted()

Purpose:

Specify whether to keep an array sorted when items change.

Access:

Public

Prototype:

void SetKeepSorted( Boolean inKeepSorted );
Parameters:

This method takes the following parameter:

 

Boolean  
inKeepSorted  
Whether to keep the array sorted or not.

Return:

None

ShiftItems()

Purpose:

is an internal method that moves items within the Handle used for internal storage. It moves items in the range inStartIndex to inEndIndex (inclusive).

Access:

Virtual, Protected

Prototype:

virtual void ShiftItems(
ArrayIndexT inStartIndex,
ArrayIndexT inEndIndex,
SInt32 inIndexShift,
SInt32 inDataShift);
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inStartIndex  
The index to start shifting at.
ArrayIndexT  
inEndIndex  
The index to end shifting at.
SInt32  
inIndexShift  
The amount to shift.
SInt32  
inDataShift  
This is unused.

Return:

None

Sort()

Purpose:

Sort items in the array.

Access:

Virtual, Public

Prototype:

virtual void Sort();
Parameters:

None

Return:

None

StoreNewItems()

Purpose:

This is an internal method that stores values within the internal storage Handle. Items all have the same value, and space must already have been allocated for them.

Access:

Virtual, Protected

Prototype:

virtual void StoreNewItems(
USInt32 inCount,
ArrayIndexT inAtIndex,
const void *inItem,
USInt32 inItemSize);
Parameters:

This method takes the following parameters:

 

USInt32  
inCount  
The number of items.
ArrayIndexT  
inAtIndex  
The index to start storing at.
const void*  
inItem  
The item to store.
USInt32  
inItemSize  
The size of the item to store.

Return:

None

SwapItems()

Purpose:

Swap the values of the Items at the specified indices. This method does nothing if either index is out of range or if array is kept sorted (since swapping could invalidate the sort).

Access:

Virtual, Public

Prototype:

virtual void SwapItems(
ArrayIndexT inIndexA,
ArrayIndexT inIndexB);
Parameters:

This method takes the following parameters:

 

ArrayIndexT  
inIndexA  
The first index.
ArrayIndexT  
inIndexB  
The second index.

Return:

None

Unlock()

Purpose:

Unlock the Handle that stores the data for the items in the array. This class maintains a lock count, so each call to Lock() should be balanced by a corresponding call to Unlock().

Access:

Public

Prototype:

void Unlock() const;
Parameters:

None

Return:

None

ValidIndex()

Purpose:

Indicate whether an index is valid (between 1 and the number of items) for the array.

Access:

Public

Prototype:

Boolean ValidIndex(
ArrayIndexT &ioIndex ) const;
Parameters:

This method takes the following parameter:

 

ArrayIndexT&  
ioIndex  
The reference to the index to check. If ioIndex is the special flag index_Last, the index's value is changed to the actual index of the last item.

Return:

Boolean indicating whether the index is a valid one, false if it is invalid.

operator=()

Purpose:

Disposes array's existing data and copies data of the specified array. See comments for CopyArray() for detailed information about how the copy is done.

Access:

Public

Prototype:

LArray& operator=(
const LArray &inArray);
Parameters:

This method takes the following parameter:

 

const LArray&  
inArray  
The reference to the array.

Return:

A reference to the array.

mComparator

Purpose:

This data member stores the comparator for the array.

Access:

Protected

Prototype:

LComparator *mComparator;

mDataAllocated

Purpose:

Stores the data allocated.

Access:

Protected

Prototype:

USInt32 mDataAllocated;

mDataStored

Purpose:

Stores the amount of space to allocate for storage.

Access:

Protected

Prototype:

USInt32 mDataStored;

mIsSorted

Purpose:

Indicates whether the array is supposed to be sorted.

Access:

Protected

Prototype:

Boolean mIsSorted;

mItemCount

Purpose:

The number of items in the array.

Access:

Protected

Prototype:

USInt32 mItemCount;

mItemsH

Purpose:

The handle to the array items.

Access:

Protected

Prototype:

Handle mItemsH;

mItemSize

Purpose:

The size of the items.

Access:

Protected

Prototype:

USInt32 mItemSize;

mIteratorListHead

Purpose:

The head for the iterator for the array.

Access:

Protected

Prototype:

mutable LArrayIterator *mIteratorListHead;

mKeepSorted

Purpose:

Indicates whether the array is to be kept sorted.

Access:

Protected

Prototype:

Boolean mKeepSorted;

mLockCount

Purpose:

A reference counter to count the number of times the array is locked (decremented by Unlock()).

Access:

Protected

Prototype:

mutable USInt32 mLockCount;

mOwnsComparator

Purpose:

This indicates whether the array owns the comparator.

Access:

Protected

Prototype:

Boolean mOwnsComparator;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000