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

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

# Mers::Utils::Containers::ObjectArray Class Reference

`#include <ObjectArray.h>`

Inheritance diagram for Mers::Utils::Containers::ObjectArray:

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

[legend]
List of all members.

## Public Types
typedef BaseModelObject * | pointer
typedef const BaseModelObject * | const_pointer
typedef ObjectArray | ContainerType
typedef IteratorTemplate< const_pointer, ContainerType > | const_iterator
typedef IteratorTemplate< pointer, ContainerType > | iterator
typedef const_iterator | ConstantIterator
typedef iterator | Iterator
## Public Member Functions
| ObjectArray (bool myOwnershipStatus)
| ObjectArray (ObjectArray const &other)
| ObjectArray (ObjectArray const *other)
virtual | ~ObjectArray ()
iterator | begin ()
const_iterator | begin () const
iterator | end ()
const_iterator | end () const
int | pushBack (BaseModelObject *data)
BaseModelObject * | popBack ()
BaseModelObject *& | operator[] (int elementIndex)
BaseModelObject *& | operator[] (unsigned int elementIndex)
BaseModelObject const *& | operator[] (int elementIndex) const
BaseModelObject const *& | operator[] (unsigned int elementIndex) const
ObjectArray const & | operator= (ObjectArray const &other)
ObjectArray const & | operator+= (ObjectArray const &other)
ObjectArray const & | operator+= (BaseModelObject const &data)
bool | operator== (ObjectArray const &other) const
bool | operator!= (ObjectArray const &other) 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 DynamicArray of BaseModelObject. Because this object is also a BaseModelObject it can contain itself. One should examine the BaseModelObject Type to determine what is in this array.

Author:
  Paul H. Elliott

Definition at line 34 of file ObjectArray.h.

## Constructor & Destructor Documentation

ObjectArray::ObjectArray | ( | bool | myOwnershipStatus | ) |

Creates a new, empty array.

Parameters:

  | myOwnershipStatus | the ownership status. If true, this object owns the array objects it contains and should delete them upon being deleted.

Definition at line 30 of file ObjectArray.cpp.

ObjectArray::ObjectArray | ( | ObjectArray 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 38 of file ObjectArray.cpp.

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

Here is the call graph for this function:

ObjectArray::ObjectArray | ( | ObjectArray 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 53 of file ObjectArray.cpp.

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

Here is the call graph for this function:

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

Destroys the array.

Definition at line 68 of file ObjectArray.cpp.

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

Here is the call graph for this function:

## Member Function Documentation

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

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

Returns:
  a iterator that starts this object

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 99 of file ObjectArray.h.

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

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

Returns:
  a constant iterator that starts this object

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 109 of file ObjectArray.h.

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

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

Returns:
  a iterator that ends this object

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 120 of file ObjectArray.h.

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

Here is the call graph for this function:

const_iterator Mers::Utils::Containers::ObjectArray::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

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 130 of file ObjectArray.h.

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

Here is the call graph for this function:

int Mers::Utils::Containers::ObjectArray::pushBack | ( | BaseModelObject * | 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.

Referenced by Mers::Executives::DeductiveController::Command::CommandDispatcher::addConnection().

BaseModelObject * ObjectArray::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.

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 82 of file ObjectArray.cpp.

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

Here is the call graph for this function:

BaseModelObject *& ObjectArray::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.

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 89 of file ObjectArray.cpp.

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

Here is the call graph for this function:

BaseModelObject *& ObjectArray::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.

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 96 of file ObjectArray.cpp.

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

Here is the call graph for this function:

BaseModelObject const *& ObjectArray::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.

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 104 of file ObjectArray.cpp.

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

Here is the call graph for this function:

BaseModelObject const *& ObjectArray::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.

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 112 of file ObjectArray.cpp.

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

Here is the call graph for this function:

ObjectArray const & ObjectArray::operator= | ( | ObjectArray 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 120 of file ObjectArray.cpp.

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

Here is the call graph for this function:

ObjectArray const & ObjectArray::operator+= | ( | ObjectArray 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 128 of file ObjectArray.cpp.

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

Here is the call graph for this function:

ObjectArray const& Mers::Utils::Containers::ObjectArray::operator+= | ( | BaseModelObject const & | 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

bool ObjectArray::operator== | ( | ObjectArray const & | other | ) | const

Returns true if the two arrays have all the same elements in the same order.

Parameters:

  | other | the array being compared to this array.

Returns:
  true if the two arrays have the same elements in the same order.

Definition at line 143 of file ObjectArray.cpp.

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

Here is the call graph for this function:

bool ObjectArray::operator!= | ( | ObjectArray const & | other | ) | const

Returns false if the two arrays have all the same elements in the same order.

Parameters:

  | other | the array being compared to this array.

Returns:
  false if the two arrays have the same elements in the same order.

Definition at line 150 of file ObjectArray.cpp.

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

Here is the call graph for this function:

void ObjectArray::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 159 of file ObjectArray.cpp.

void ObjectArray::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 (BaseModelObject).

Parameters:

  | element | the BaesModelAssignment to delete.

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

Definition at line 168 of file ObjectArray.cpp.

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

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

Parameters:

  | element | the element being copied

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

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

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 175 of file ObjectArray.cpp.

bool ObjectArray::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.

Reimplemented in Mers::Models::CCA::CCAAutomata, Mers::Models::CCA::CCAStates, and Mers::Models::CCA::CCATransitions.

Definition at line 187 of file ObjectArray.cpp.

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

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