- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Utils::Containers::IntegerArray Class Reference

`#include <IntegerArray.h>`

Inheritance diagram for Mers::Utils::Containers::IntegerArray:

[legend]
Collaboration diagram for Mers::Utils::Containers::IntegerArray:

[legend]
List of all members.

## Public Types
typedef int * | pointer
typedef const int * | const_pointer
typedef IntegerArray | ContainerType
typedef IteratorTemplate< const_pointer, ContainerType > | const_iterator
typedef IteratorTemplate< pointer, ContainerType > | iterator
typedef const_iterator | ConstantIterator
typedef iterator | Iterator
## Public Member Functions
| IntegerArray ()
| IntegerArray (IntegerArray const &other)
| IntegerArray (IntegerArray const *other)
virtual | ~IntegerArray ()
iterator | begin ()
const_iterator | begin () const
iterator | end ()
const_iterator | end () const
int | pushBack (int data)
int | popBack ()
void | insert (unsigned int elementIndex, int data)
void | setArrayTo (int value)
void | setArrayToZero ()
int & | operator[] (int elementIndex)
int & | operator[] (unsigned int elementIndex)
int & | operator[] (int elementIndex) const
int & | operator[] (unsigned int elementIndex) const
IntegerArray const & | operator= (IntegerArray const &other)
IntegerArray const & | operator+= (IntegerArray const &other)
IntegerArray const & | operator+= (int data)
void | print (std::ostream &out) const
## Protected Member Functions
void | printElement (std::ostream &out, void const *element) const
void | deleteElement (void *element) const
void * | newElement (void const *element) const
bool | isEqual (void const *element1, void const *element2) const

## Detailed Description

A dynamically resizeable array of integers.

Author:
  Paul H. Elliott

Definition at line 32 of file IntegerArray.h.

## Constructor & Destructor Documentation

IntegerArray::IntegerArray | ( |  | ) |

Creates a new, empty array.

Definition at line 30 of file IntegerArray.cpp.

IntegerArray::IntegerArray | ( | IntegerArray const & | other | ) |

Creates a new array with a copy of the contents from the other array. This can be an expensive operation.

Parameters:

  | other | the array whos contents are copied

Definition at line 39 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::copy(), and Mers::Utils::Containers::DynamicArray::getDynamicArrayType().

Here is the call graph for this function:

IntegerArray::IntegerArray | ( | IntegerArray const * | other | ) |

Creates a new array with a copy of the contents from the other array. This can be an expensive operation.

Parameters:

  | other | the array whos contents are copied

Definition at line 54 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::copy(), and Mers::Utils::Containers::DynamicArray::getDynamicArrayType().

Here is the call graph for this function:

IntegerArray::~IntegerArray | ( |  | ) | `[virtual]`

Destroys the array.

Definition at line 69 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::makeEmpty().

Here is the call graph for this function:

## Member Function Documentation

iterator Mers::Utils::Containers::IntegerArray::begin | ( |  | ) | `[inline]`

Returns a iterator that points to the first element of this array.

Returns:
  a iterator that starts this object

Definition at line 94 of file IntegerArray.h.

const_iterator Mers::Utils::Containers::IntegerArray::begin | ( |  | ) | const`[inline]`

Returns a constant iterator that points to the first element of this array.

Returns:
  a constant iterator that starts this object

Definition at line 104 of file IntegerArray.h.

iterator Mers::Utils::Containers::IntegerArray::end | ( |  | ) | `[inline]`

Returns a iterator that points just past the last element of this array.

Returns:
  a iterator that ends this object

Definition at line 115 of file IntegerArray.h.

References Mers::Utils::Containers::DynamicArray::getLength().

Here is the call graph for this function:

const_iterator Mers::Utils::Containers::IntegerArray::end | ( |  | ) | const`[inline]`

Returns a constant iterator that points just past the last element of this array.

Returns:
  a constant iterator that ends this object

Definition at line 125 of file IntegerArray.h.

References Mers::Utils::Containers::DynamicArray::getLength().

Here is the call graph for this function:

int IntegerArray::pushBack | ( | int | data | ) |

Adds a data element to the end of the array, allocating space if necessary for it to fit. This object assumes ownership of data object and will delete it when this object is destroyed.

Parameters:

  | data | pointer to the data being added

Returns:
  0 on success or a positive number if the data could not be added

Definition at line 76 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::pushBack().

Referenced by Mers::Generators::BFIG::BFIGAssignment::alternateValues(), Mers::Generators::BFIG::BFIGVariable::getDomain(), Mers::Generators::BFIG::BFIGVariable::getDomainTotal(), Mers::Estimation::Discrete::ModeEstimationPerformance::MEPerformanceMonitor::getEstimateFaultTransitions(), Mers::Solvers::Entailment::GI::GoalInterpreter::GoalInterpreter(), Mers::Executives::DeductiveController::DCInterface::init(), and TestSuiteParser::variableWithProbs().

Here is the call graph for this function:

int IntegerArray::popBack | ( |  | ) |

Returns the last element of the array and removes it from the array, also reduces the size of the array should it fall below 1/4 full.

Returns:
  the data element at the end of the current array

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 83 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::popBack().

Here is the call graph for this function:

void Mers::Utils::Containers::IntegerArray::insert | ( | unsigned int | elementIndex,
|  | int | data |
| ) |  |  | `[inline]`

Inserts a new element at the specified index.

Parameters:

  | elementIndex | the index that the item should be inserted at
  | data | the data being inserted

Definition at line 159 of file IntegerArray.h.

References Mers::Utils::Containers::DynamicArray::insert().

Here is the call graph for this function:

void IntegerArray::setArrayTo | ( | int | value | ) |

Sets all values in the array to the specified value.

Parameters:

  | value | the value the array is being set to

Definition at line 90 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::array, and Mers::Utils::Containers::DynamicArray::mSize.

void IntegerArray::setArrayToZero | ( |  | ) |

clears the array to 0. Equivalent to setArrayTo(0) but faster.

Definition at line 102 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::array, and Mers::Utils::Containers::DynamicArray::mSize.

int & IntegerArray::operator[] | ( | int | elementIndex | ) |

Retrieves the element at the specified index and returns it.

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 110 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::operator[]().

Here is the call graph for this function:

int & IntegerArray::operator[] | ( | unsigned int | elementIndex | ) |

Retrieves the element at the specified index and returns it.

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 117 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::operator[]().

Here is the call graph for this function:

int & IntegerArray::operator[] | ( | int | elementIndex | ) | const

Retrieves the element at the specified index and returns it.

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 125 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::operator[]().

Here is the call graph for this function:

int & IntegerArray::operator[] | ( | unsigned int | elementIndex | ) | const

Retrieves the element at the specified index and returns it.

Parameters:

  | elementIndex | location of the element to be accessed

Returns:
  the element requested if index is in range, otherwise it returns NULL

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 133 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::operator[]().

Here is the call graph for this function:

IntegerArray const & IntegerArray::operator= | ( | IntegerArray const & | other | ) |

Copies the data from the other array to this array. This can be expensive for long arrays. The origional data in this array is destroyed.

Parameters:

  | other | the array supplying the data for this array.

Returns:
  the other array

Definition at line 141 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::operator=().

Here is the call graph for this function:

IntegerArray const & IntegerArray::operator+= | ( | IntegerArray const & | other | ) |

Appends a copy of the data from the other array to this array. This can be expensive for long arrays.

Parameters:

  | other | the array supplying the data for this array.

Returns:
  this array

Definition at line 149 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::operator+=().

Here is the call graph for this function:

IntegerArray const & IntegerArray::operator+= | ( | int | data | ) |

Appends a copy of the data to this array. This is the same as pushBack except the data here is copied first, so this object doesn't assume ownership of data.

Parameters:

  | data | the element being copied and added to this array

Returns:
  this array

Definition at line 157 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::operator+=().

Here is the call graph for this function:

void IntegerArray::print | ( | std::ostream & | out | ) | const`[virtual]`

Prints out the Integer Array by calling printArray(out, ", ", false), causing the elements to be comma seperated. Derived classes should overide this function if they want to change the seperator.

Parameters:

  | out | the ostream being written to

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 166 of file IntegerArray.cpp.

References Mers::Utils::Containers::DynamicArray::printArray().

Here is the call graph for this function:

void IntegerArray::printElement | ( | std::ostream & | out,
|  | void const * | element |
| ) |  |  | const`[protected, virtual]`

Prints the element of this array to the ostream out. This is called by the DynamicArray::operator<< for each element being printed.

Parameters:

  | out | the stream being printed to.
  | element | the element being printed.

Implements Mers::Utils::Containers::DynamicArray.

Definition at line 171 of file IntegerArray.cpp.

void IntegerArray::deleteElement | ( | void * | element | ) | const`[protected, virtual]`

Called when an element should be deleted because it's storage space is being deleted. This function deletes the element (BaseModelInteger).

Parameters:

  | element | the BaesModelInteger to delete

Implements Mers::Utils::Containers::DynamicArray.

Definition at line 180 of file IntegerArray.cpp.

void * IntegerArray::newElement | ( | void const * | element | ) | const`[protected, virtual]`

Creates and returns a new BaseModelInteger that is a copy of the BaseModelInteger element.

Parameters:

  | element | the element being copied

Returns:
  the new BaseModelInteger object that is a copy of element

Implements Mers::Utils::Containers::DynamicArray.

Definition at line 188 of file IntegerArray.cpp.

bool IntegerArray::isEqual | ( | void const * | element1,
|  | void const * | element2 |
| ) |  |  | const`[protected, virtual]`

Returns true if the two elements are equal. This default function returns true if the pointers are the same.

Parameters:

  | element1 | the first element in the comparison
  | element2 | the second element in the comparison

Returns:
  true if they are the equal and false if they are not equal

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 196 of file IntegerArray.cpp.

The documentation for this class was generated from the following files:

- /Users/fpy/titan-1-5-MBARI/Mers/Utils/Containers/IntegerArray.h
- /Users/fpy/titan-1-5-MBARI/Mers/Utils/Containers/IntegerArray.cpp