IRawArray
- IRawArray provides a low level substitute for traditional C arrays created with malloc and free.
The IRawArray class provides a low level substitute for traditional C arrays created with malloc and free.
The storage is managed with the low level heap storage routines. Only primitive types and objects with no
virtual member functions may be stored in an IRayArray object.
Because the IRawArray class does
not call constructors for the space it allocates, objects with vtables will not be
properly initialized, resulting in mysterious crashes.
Note that IRawArray does not check whether allocation is successful. Before constructing
a new array, check to ensure that there is enough memory and use a reasonable size.
IRawArray - Member Functions and Data by Group
Constructors & Destructor
Use the functions in this group to create and destroy IRawArray objects.
- ~IRawArray
public:
~IRawArray()
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- IRawArray
- These constructors create a raw array object of class IRawArray.
Overload 1
- Creates an IRawArray of type AType of the specified size. The items of the array are not initialized.
public:
IRawArray(unsigned long size = 0)
- size=0
- The size of the array.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Overload 2
- Copy constructor.
public:
IRawArray(const IRawArray < AType >& source)
- source
- The array to be copied.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Accessing the Elements of the Array
Use the functions in this group to access elements of the array.
- operator []
Overload 1
- Returns a reference to the indexed object. There is no bound checking.
public:
AType& operator [](unsigned long i)
- i
- Index of object referenced.
- Return
- The indexed value.
- Exception
| If
| the index is out of range, bad data or a processor exception may result.
|
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Overload 2
- Returns a constant reference to the indexed object. There is no bound checking.
public:
const AType& operator [](unsigned long i) const
- i
- Index of object referenced.
- Return
- The indexed value.
- Exception
| If
| the index is out of range, bad data or a processor exception may result.
|
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- setValue
public:
void setValue(unsigned long i, const AType& p)
- Sets the item of the IRawArray at the specified index, to the specified value.
- i
- The index.
- p
- The new value.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- value
public:
AType value(unsigned long i) const
- Gets the item at the specified index.
- i
- The index.
- Return
- The member of the array at the specified index.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Assignment Operator
Use the operator in this group to assign a given IRawArray object to the target one.
- operator =
public:
IRawArray < AType >&
operator =( const IRawArray < AType >& obj )
- Assignment operator.
- obj
- A constant reference to the array to be copied.
- Return
- A non-const reference to the left-hand side object.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Comparision Operators
Use the functions in this group to compare IRawArray objects.
- operator !=
public:
bool operator !=(const IRawArray < AType >& obj) const
- Tests two arrays for inequality.
- obj
- A constant reference to the array to be compared with this one.
- Return
- True if any of the items in the two arrays are unequal, or if the two arrays are of different length.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator ==
public:
bool operator ==(const IRawArray < AType >& obj) const
- Tests two arrays for equality.
- obj
- A constant reference to the array to be compared with this one.
- Return
- True if all the items in the two arrays are equal.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Manipulating the Array
Use the functions in this group to manipulate the array.
- append
public:
void append(const AType& p)
- Appends an item to an IRawArray, extending the size if needed.
- p
- Value to be added.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- resize
public:
void resize(unsigned long newsize)
- Sets the size of the IRawArray to the specified size. Reallocates the heap block.
- newsize
- The new array size.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- setGrowIncrement
public:
void setGrowIncrement(unsigned long increment)
- Sets the fixed "clumps" in which the size of an IRawArray is increased to prevent thrashing the storage allocator when append is called.
- increment
- The clump size to be set.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- swap
public:
void swap(IRawArray < AType >& victim)
- Swaps the contents of the IRawArray with the specified array.
- victim
- The array containing the items to be swapped with those of this one.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Obtaining Information About the Array
Use the functions in this group to obtain information about the array.
- growIncrement
public:
unsigned long growIncrement() const
- Returns the fixed "clumps" in which the size of an IRawArray is increased to prevent thrashing the storage allocator when append is called.
- Return
- The clumps size.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- numberOfValues
public:
unsigned long numberOfValues() const
- Returns the number of items in the IRawArray; in other words, the size of the array.
- Return
- The number of items in the array.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Streaming the Raw Array Object In and Out
Use the functions in this group to read or write this object from or to a stream.
- operator <<=
public:
IDataStream& operator <<=(IDataStream& fromWhere)
- Reads the raw array object in from the given stream.
- fromWhere
- A reference to the stream from which the object is read in.
- Return
- The original stream.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- operator >>=
public:
IDataStream& operator >>=(IDataStream& toStream) const
- Writing the raw array object out to the specified stream.
- toWhere
- A reference to the stream that the object is written out to.
- Overriding
- The original stream.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- readFromStream
public:
void readFromStream(IDataStream& fromWhere)
- Streams the raw array object in from the stream specified by fromWhere.
- fromWhere
- A reference to the stream from which the raw array object is read.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- writeToStream
public:
void writeToStream(IDataStream& toWhere) const
- Writes the raw array object out to the specified stream.
- toWhere
- A reference to the stream used to stream the quadrilateral object.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
IRawArray - Inherited Member Functions and Data
Inherited Public Functions
Inherited Public Data
Inherited Protected Functions
Inherited Protected Data