Class: TRawArray

Declaration: RawArray.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TGPoint3DArray TGRPoint3DArray TGRPointArray TGPointArray

Purpose:

TRawArray provides a low-level substitute for traditional C arrays created with malloc and free. Unlike other C++ objects, the storage is managed with low-level heap operations. TRawArray's implementation can be seen in its header file. Warning: Only primitive types and objects with no virtual member functions should be stored in TRawArray. Because TRawArray does not call constructors for the space it allocates, objects with vtables are not properly initialized, resulting in mysterious crashes.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TRawArray::TRawArray

  1. TRawArray (unsigned long size =0)
  2. TRawArray (const TRawArray < AType > & source)

Interface Category:

API.

Purpose:

  1. Creates an TRawArray of type AType of the specified size. The items of the array are not initialized.
  2. Creates a TRawArray of type AType that is a copy of the specified array.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::~TRawArray

~ TRawArray ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::GetValue

AType GetValue (unsigned long i) const

Interface Category:

API.

Purpose:

Get the item of type AType at the specified index.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The member of the array at the specified index.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::SetValue

void SetValue (unsigned long i, const AType & p)

Interface Category:

API.

Purpose:

Sets the item of the TRawArray at the specified index, to the specified value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::GetNumberOfValues

unsigned long GetNumberOfValues () const

Interface Category:

API.

Purpose:

Returns the number of items in the TRawArray; in other words, the size of the array.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The number of items in the array.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::Resize

void Resize (unsigned long newsize)

Interface Category:

API.

Purpose:

Sets the size of the TRawArray to the specified size.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The items of the array are not initialized.

Member Function: TRawArray::Swap

void Swap (TRawArray < AType > & victim)

Interface Category:

API.

Purpose:

Swaps the contents of the TRawArray with the specified array.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::operator>>=

TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::operator<<=

TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::operator=

TRawArray < AType > & operator =(const TRawArray < AType > & obj)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::operator==

bool operator ==(const TRawArray < AType > & obj) const

Interface Category:

API.

Purpose:

Tests two TRawArrays for equality. If the two arrays are not of equal length, false is returned.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if all the items in the two arrays are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::operator!=

bool operator != (const TRawArray < AType > & obj) const

Interface Category:

API.

Purpose:

Tests two TRawArrays for inequality.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if any of the items in the two arrays are unequal, or if the two arrays are of different length.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TRawArray::SetGrowIncrement

void SetGrowIncrement (unsigned long increment)

Interface Category:

API.

Purpose:

The size of a RawArray is increased in fixed "clumps" to prevent thrashing the storage allocator when Append is called. This allows the clump size to be changed.

Calling Context:

Call directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:


Member Function: TRawArray::GetGrowIncrement

unsigned long GetGrowIncrement () const

Interface Category:

API.

Purpose:

This returns the GrowIncrement set by SetGrowIncrement.

Calling Context:

Call directly.

Parameters:

Return Value:

The grow increment, as number of values.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:


Member Function: TRawArray::operator[]

  1. AType & operator [] (unsigned long i)
  2. const AType & operator [] (unsigned long i) const

Interface Category:

API.

Purpose:

  1. Returns a reference to the indexed object.
  2. Returns a constant reference to the indexed object.

Calling Context:

  1. Called via the [] operator.
  2. Called via the [] operator when referencing a const TRawArray

Parameters:

Return Value:

The indexed value.

Exceptions:

This does NOT check array bounds, but instead does a straight C index. If the index is out of range, bad data or a processor exception may result.

Concurrency:

Not multithread safe.

Other Considerations:


Member Function: TRawArray::Append

void Append (const AType & p)

Interface Category:

API.

Purpose:

Appends an item to a RawArray, extending the size if needed.

Calling Context:

Call directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The array needs to be grown, it is extended by the amount specified by SetGrowIncrement
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.