class ID


Public Methods

ID()
ID(int)
ID(int size, int arraySize)
ID(const ID &)
~ID()
int Size(void) const
void Zero(void)
inline int& operator)(int x)
inline int operator)(int x) const
int& operator[](int)
ID& operator=(const ID &V)
int getLocation(int value) const
int removeValue(int value)
friend ostream& operator<<(ostream &s, const ID &V)
friend istream& operator>>(istream &s, ID &V)
inline int ID::Size(void) const

Documentation

The ID class provides the abstraction for an integer Vector. The class is introduced in addition to the Vector class, to save memory and casting when integer arrays are required. An ID of order size is an ordered 1d array of size integer values. For example an ID id of order 5:

ID()

To construct an ID of size 0. No memory is allocated for the storage of the data.

ID(int)

To construct a ID of size idSize. The constructor creates an integer array of size idSize to store the data and zeroes this array by invoking Zero() on itself. If not enough memory is available an error message is printed and an ID of size 0 is returned.

ID(int size, int arraySize)

To construct a ID of size idSize. The constructor creates an integer array of size arraySize to store the data and zeroes this array. If arraySize is less than idSize, the new arraySize is set equal to idSize. If not enough memory is available an error message is printed and the program is terminated. This constructor is provided to allow an ID to grow.

ID(const ID &)

To construct an ID using another ID M. The new ID will be identical to the ID M, same order and same size of array to hold the integer values. If not enough memory is available a warning message is printed and both the order and arraySize of the ID are set to 0.

~ID()

Will invoke delete on the integer array used to store the components

int Size(void) const

Returns the order of the ID

void Zero(void)

Zeros out the ID, i.e. sets all the components of the ID to 0. This is accomplished by zeroing the first this.Size() components of the array.

inline int& operator)(int x)

Returns the data at location x in the ID. Assumes (x) is a valid location in the ID, a segmentation fault or erroneous results can occur if this is not the case.

inline int operator)(int x) const

Used to set the data at location(x) in the ID. Assumes (x) is a valid location in the ID, a segmentation fault or erroneous results can occur if this is not the case.

int& operator[](int)

Used to set the data at location(x) in the ID. If x is outside the order of the ID the ID is order of the ID is enlarged to x+1. When increasing the order, a check is first made to see if the current array is large enough; if it is the components between the old end and the new component are set to 0 and the order of the ID is set to x+1, if not a new array is created. The size of this array is max(2*old array size, x). A copy of the components of the old array into the new array is made, with any new components set to 0. If not enough space is available or x is less than 0, a warning message is printed and the contents of ID_ERROR returned.

ID& operator=(const ID &V)

Sets the current ID to be equal to the ID given by M. If the IDs are of different sizes, the current data is deallocated and more space allocated before the contents are copied. If not enough memory is available, the order and arraySize of the current ID is set to 0 and the ID is returned without copying the components.

int getLocation(int value) const

int removeValue(int value)

friend ostream& operator<<(ostream &s, const ID &V)

friend istream& operator>>(istream &s, ID &V)

inline int ID::Size(void) const


This class has no child classes.

alphabetic index Contents

this page has been generated automatically by a slightly modified version of doc++ for OpenSees

Copyright Contact Us