All Frameworks Class Hierarchy This Framework Previous Next Indexes
SPAkern Class position_array
SPAbase.ACIS_OBJECT
|
+---position_array
Usage: you must use this class as is. You should never derive it.
public class position_array
Creates dynamic arrays of positions.
Role:This class creates dynamic arrays of positions. There is an operator to cast a
position_array to a SPAposition* so it can be used when a SPAposition* is needed, but it
automatically grows as positions are added to it.
- See also:
- SPAposition
Constructor and Destructor Index
- o
position_array()
- C++ allocation constructor requests memory for this object but does not populate it.
- o
position_array(int)
- C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
- o
position_array(position_array&)
- C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.
- o
~position_array()
- C++ destructor, deleting a position_array.
Method Index
- o
Add(SPAposition&)
- Adds a SPAposition as the last position in the array, which expands the array as needed.
- o
CopyBuffer()
- Copies the position_array.
- o
ElementAt(int)
- Gets the element at a given index in the array, which expands the size of the array if needed.
- o
Empty()
- Empties the array.
- o
GetBuffer()
- Casts a position_array to a SPAposition* so that it can be used as an argument in procedures that require a SPAposition*.
- o
GetLast()
- Gets the last position in the array that is set.
- o
GetSize()
- Returns the size of the position_array.
- o
PositionAt(int)
- Provides a copy of the position at a given index.
- o
RemoveLast()
- Removes the last position in the array.
- o
SetSize(int)
- Sets the size of the array, which expands the array, if needed.
- o
Shrink()
- Truncates the size of the internal position buffer so that it is exactly big enough to hold the specified number of positions.
- o
operator SPAposition*()
- Returns a copy of the position.
- o
operator[](int)
- Makes the operator look like an array.
Constructor and Destructor
o position_array
-
C++ allocation constructor requests memory for this object but does not populate it.
o position_array
public position_array( | int | initialSize) |
-
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
- Parameters:
-
- initialSize
- initial size
o position_array
-
C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.
- Parameters:
-
- pos_arr
- position_array
o ~position_array
public virtual ~position_array( | ) |
-
C++ destructor, deleting a position_array.
Methods
o Add
-
Adds a SPAposition as the last position in the array, which expands the array as needed.
Role: Use the Add and RemoveLast methods for convenience to add positions to the array
without keeping track of the current index.
- Parameters:
-
- pos
- position
o CopyBuffer
-
Copies the position_array.
Role: The user must delete the returned buffer when it is no longer needed.
o ElementAt
-
Gets the element at a given index in the array, which expands the size of the array if needed.
Role: The element returns as a reference so that it can be used on the left side of an
assignment.
- Parameters:
-
- nIndex
- index value
o Empty
-
Empties the array.
Role: This sets the number of positions in the array to 0, but it does not free up
allocated storage.
o GetBuffer
-
Casts a position_array to a SPAposition* so that it can be used as an argument in procedures that require a SPAposition*.
Role: The returned pointer is only valid as long as the size of the array is not changed.
o GetLast
-
Gets the last position in the array that is set.
o GetSize
-
Returns the size of the position_array.
o PositionAt
-
Provides a copy of the position at a given index.
Role: This method also provides access to a constant position_array. The index must be
within the range.
- Parameters:
-
- nIndex
- index value
o RemoveLast
-
Removes the last position in the array. Use this with the Add method.
o SetSize
public void SetSize( | int | size) |
-
Sets the size of the array, which expands the array, if needed.
Role: If size is smaller than the current size, this sets the number of positions, but
it does not change the amount of allocated memory.
- Parameters:
-
- size
- size
o Shrink
-
Truncates the size of the internal position buffer so that it is exactly big enough to hold the specified number of positions.
o operator SPAposition*
public operator SPAposition*( | ) |
-
Returns a copy of the position.
Role: The user must must delete the returned buffer when it is no longer needed.
o operator[]
-
Makes the operator look like an array.
Role: Because this method returns a position, it can be used on the left side of an
assignment. The array is expanded, if needed, if the index is too large.
- Parameters:
-
- nIndex
- index value
This object is included in the file: posarray.hxx