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

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

# Mers::Models::Base::BaseModelValueArray Class Reference

`#include <BaseModelValueArray.h>`

Inheritance diagram for Mers::Models::Base::BaseModelValueArray:

[legend]
Collaboration diagram for Mers::Models::Base::BaseModelValueArray:

[legend]
List of all members.

## Public Types
typedef BaseModelValue * | pointer
typedef const BaseModelValue * | const_pointer
typedef BaseModelValueArray | ContainerType
typedef Mers::Utils::Containers::IteratorTemplate< const_pointer, ContainerType > | const_iterator
typedef Mers::Utils::Containers::IteratorTemplate< pointer, ContainerType > | iterator
typedef const_iterator | ConstantIterator
typedef iterator | Iterator
## Public Member Functions
| BaseModelValueArray (bool myOwnershipStatus, BaseModelObject::ObjectType objType=BaseModelObject::BMDynamicArray)
| BaseModelValueArray (BaseModelValueArray const &other)
virtual | ~BaseModelValueArray ()
Iterator | begin ()
ConstantIterator | begin () const
Iterator | end ()
ConstantIterator | end () const
virtual int | pushBack (BaseModelValue *data)
BaseModelValue * | popBack ()
int | insert_value (BaseModelValue const &value)
BaseModelValue * | find (char const *valueName)
BaseModelValue const * | find (char const *valueName) const
BaseModelValue *& | operator[] (int elementIndex)
BaseModelValue *& | operator[] (unsigned int elementIndex)
BaseModelValue const *& | operator[] (int elementIndex) const
BaseModelValue const *& | operator[] (unsigned int elementIndex) const
BaseModelValueArray const & | operator= (BaseModelValueArray const &other)
BaseModelValueArray const & | operator+= (BaseModelValueArray const &other)
BaseModelValueArray const & | operator+= (BaseModelValue const &data)
bool | operator== (BaseModelValueArray const &other) const
bool | operator!= (BaseModelValueArray 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 | foundMatch (char const *elementName, void const *element) const
bool | isEqual (void const *element1, void const *element2) const

## Detailed Description

A dynamic array of BaseModelValue

Author:
  Paul H. Elliott

Definition at line 33 of file BaseModelValueArray.h.

## Constructor & Destructor Documentation

BaseModelValueArray::BaseModelValueArray | ( | bool | myOwnershipStatus,
|  | BaseModelObject::ObjectType | objType = `BaseModelObject::BMDynamicArray` |
| ) |  |  |

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.
  | objType | the type of value array - either normal or a domain.

Definition at line 30 of file BaseModelValueArray.cpp.

BaseModelValueArray::BaseModelValueArray | ( | BaseModelValueArray 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 BaseModelValueArray.cpp.

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

Here is the call graph for this function:

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

Destroys the array

Definition at line 54 of file BaseModelValueArray.cpp.

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

Here is the call graph for this function:

## Member Function Documentation

Iterator Mers::Models::Base::BaseModelValueArray::begin | ( |  | ) | `[inline]`

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

Returns:
  a iterator that starts this object

Definition at line 96 of file BaseModelValueArray.h.

ConstantIterator Mers::Models::Base::BaseModelValueArray::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 106 of file BaseModelValueArray.h.

Iterator Mers::Models::Base::BaseModelValueArray::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 117 of file BaseModelValueArray.h.

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

Here is the call graph for this function:

ConstantIterator Mers::Models::Base::BaseModelValueArray::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 127 of file BaseModelValueArray.h.

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

Here is the call graph for this function:

int BaseModelValueArray::pushBack | ( | BaseModelValue * | data | ) | `[virtual]`

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.

Reimplemented in Mers::Models::Base::BaseModelDomain, Mers::Models::Base::BaseModelDoubleDomain, and Mers::Models::Base::BaseModelIntegerDomain.

Definition at line 61 of file BaseModelValueArray.cpp.

References Mers::Utils::Containers::DynamicArray::getLength(), and Mers::Models::Base::BaseModelValue::setUID().

Referenced by insert_value(), tut::BMHelper::loadModelData(), Mers::Models::CCA::Io::Mof::MOFReader::loadMOFFromString(), Mers::Models::Base::BaseModelDomain::pushBack(), TestSuiteParser::variable(), and TestSuiteParser::variableWithProbs().

Here is the call graph for this function:

BaseModelValue * BaseModelValueArray::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 69 of file BaseModelValueArray.cpp.

int Mers::Models::Base::BaseModelValueArray::insert_value | ( | BaseModelValue const & | value | ) | `[inline]`

Inserts a copy of the new value, but only if the value doesn't already exist.

Parameters:

  | value | pointer to the value being added.

Returns:
  0 on success, a positive number if the data could not be added, or -1 if the data already exists

Definition at line 162 of file BaseModelValueArray.h.

References find(), Mers::Models::Base::BaseModelValue::getName(), newElement(), and pushBack().

Referenced by Mers::Models::CCA::createSimpleTechsat21Model(), and Mers::Models::CCA::createValveDriverModel().

Here is the call graph for this function:

BaseModelValue * BaseModelValueArray::find | ( | char const * | valueName | ) |

Finds the value with the specified name and returns it, if found. The search is case sensitive.

Parameters:

  | valueName | the name of the value being sought.

Returns:
  the value, if found, or NULL if a value with a matching name could not be found

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

Definition at line 76 of file BaseModelValueArray.cpp.

Referenced by Mers::Models::Base::BaseModelDomain::getValue(), insert_value(), and Mers::Solvers::Entailment::GI::GoalInterpreter::variableAndValueToUID().

BaseModelValue const * BaseModelValueArray::find | ( | char const * | valueName | ) | const

Finds the value with the specified name and returns it, if found. The search is case sensitive.

Parameters:

  | valueName | the name of the value being sought.

Returns:
  the value, if found, or NULL if a value with a matching name could not be found

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

Definition at line 83 of file BaseModelValueArray.cpp.

BaseModelValue *& BaseModelValueArray::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::Base::BaseModelDoubleDomain.

Definition at line 90 of file BaseModelValueArray.cpp.

Referenced by Mers::Models::Base::BaseModelDomain::getValue(), and Mers::Models::Base::BaseModelDoubleDomain::operator[]().

BaseModelValue *& BaseModelValueArray::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::Base::BaseModelDoubleDomain.

Definition at line 97 of file BaseModelValueArray.cpp.

BaseModelValue const *& BaseModelValueArray::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::Base::BaseModelDoubleDomain.

Definition at line 105 of file BaseModelValueArray.cpp.

BaseModelValue const *& BaseModelValueArray::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::Base::BaseModelDoubleDomain.

Definition at line 113 of file BaseModelValueArray.cpp.

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

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

Referenced by Mers::Models::Base::BaseModelDomain::operator+=().

BaseModelValueArray const & BaseModelValueArray::operator+= | ( | BaseModelValue 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

Definition at line 137 of file BaseModelValueArray.cpp.

bool Mers::Models::Base::BaseModelValueArray::operator== | ( | BaseModelValueArray const & | other | ) | const`[inline]`

Returns true if this array and the other array are the same.

Definition at line 265 of file BaseModelValueArray.h.

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

Referenced by Mers::Models::Base::BaseModelDoubleDomain::operator==(), and Mers::Models::Base::BaseModelDomain::operator==().

Here is the call graph for this function:

bool Mers::Models::Base::BaseModelValueArray::operator!= | ( | BaseModelValueArray const & | other | ) | const`[inline]`

Returns true if this array and the other array are different.

Definition at line 273 of file BaseModelValueArray.h.

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

Here is the call graph for this function:

void BaseModelValueArray::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 146 of file BaseModelValueArray.cpp.

void BaseModelValueArray::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 (BaseModelValue).

Parameters:

  | element | the BaesModelValue to delete

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

Reimplemented in Mers::Models::Base::BaseModelDoubleDomain.

Definition at line 155 of file BaseModelValueArray.cpp.

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

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

Parameters:

  | element | the element being copied

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

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

Reimplemented in Mers::Models::Base::BaseModelDoubleDomain.

Definition at line 162 of file BaseModelValueArray.cpp.

Referenced by insert_value().

bool BaseModelValueArray::foundMatch | ( | char const * | elementName,
|  | void const * | element |
| ) |  |  | const`[protected, virtual]`

Returns true if the specified element has the same name as elementName. This comparison is case sensitive.

Parameters:

  | elementName | the name of the object being sought
  | element | the element that is being queried

Returns:
  true if the element has the name elementName

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

Definition at line 169 of file BaseModelValueArray.cpp.

bool BaseModelValueArray::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 176 of file BaseModelValueArray.cpp.

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

- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModelValueArray.h
- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModelValueArray.cpp