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

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

# Mers::Models::Base::BaseModelVariableArray Class Reference

`#include <BaseModelVariableArray.h>`

Inheritance diagram for Mers::Models::Base::BaseModelVariableArray:

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

[legend]
List of all members.

## Public Types
typedef BaseModelVariable * | pointer
typedef const BaseModelVariable * | const_pointer
typedef BaseModelVariableArray | 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
| BaseModelVariableArray (bool myOwnershipStatus)
| BaseModelVariableArray (BaseModelVariableArray const &other)
virtual | ~BaseModelVariableArray ()
Iterator | begin ()
ConstantIterator | begin () const
Iterator | end ()
ConstantIterator | end () const
int | pushBack (BaseModelVariable *data)
BaseModelVariable * | popBack ()
BaseModelVariable * | find (char const *variableName)
BaseModelVariable const * | find (char const *variableName) const
void | insert (unsigned int elementIndex, BaseModelVariable *data)
BaseModelVariable *& | operator[] (int elementIndex)
BaseModelVariable *& | operator[] (unsigned int elementIndex)
BaseModelVariable const *& | operator[] (int elementIndex) const
BaseModelVariable const *& | operator[] (unsigned int elementIndex) const
BaseModelVariableArray const & | operator= (BaseModelVariableArray const &other)
BaseModelVariableArray const & | operator+= (BaseModelVariableArray const &other)
BaseModelVariableArray const & | operator+= (BaseModelVariable const &other)
bool | operator== (BaseModelVariableArray const &other) const
bool | operator!= (BaseModelVariableArray 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 BaseModelVariable

Author:
  Paul H. Elliott

Definition at line 33 of file BaseModelVariableArray.h.

## Constructor & Destructor Documentation

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

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

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

Here is the call graph for this function:

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

Destroys the array.

Definition at line 54 of file BaseModelVariableArray.cpp.

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

Here is the call graph for this function:

## Member Function Documentation

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

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

Returns:
  a iterator that starts this object

Definition at line 91 of file BaseModelVariableArray.h.

Referenced by Mers::Solvers::SAT::ISAT::ISATTester::addDomainConstraints(), Mers::Models::CCA::CCAVariables::front(), Mers::Models::CCA::CCAVariables::insert_variable(), rpInterface::rpInterface(), Mers::Models::CCA::Io::Mof::MOFReader::saveCCAModel(), and Mers::Models::CCA::CCAVariables::variable_p().

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

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

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

Referenced by Mers::Solvers::SAT::ISAT::ISATTester::addDomainConstraints(), Mers::Models::CCA::CCAVariables::back(), Mers::Models::CCA::CCAVariables::insert_variable(), rpInterface::rpInterface(), Mers::Models::CCA::Io::Mof::MOFReader::saveCCAModel(), and Mers::Models::CCA::CCAVariables::variable_p().

Here is the call graph for this function:

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

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

Here is the call graph for this function:

int BaseModelVariableArray::pushBack | ( | BaseModelVariable * | 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.

Reimplemented in Mers::Models::CCA::CCAVariables.

Definition at line 61 of file BaseModelVariableArray.cpp.

Referenced by Mers::Models::Base::BaseModel::addVariable(), tut::BMHelper::getVariableSubset(), tut::BMHelper::loadVariableData(), Mers::Estimation::Discrete::ModeEstimation::ModeEstimator::ModeEstimator(), TestSuiteParser::probTest(), Mers::Generators::BFIG::BFIGGenerator::sortBMVariables(), and TestSuiteParser::test().

BaseModelVariable * BaseModelVariableArray::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::CCAVariables.

Definition at line 68 of file BaseModelVariableArray.cpp.

BaseModelVariable * BaseModelVariableArray::find | ( | char const * | variableName | ) |

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

Parameters:

  | variableName | the name of the variable being sought.

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

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

Definition at line 75 of file BaseModelVariableArray.cpp.

Referenced by Mers::Executives::DeductiveController::Command::CommandDispatcher::addConnection(), Mers::Models::Base::BaseModel::getVariable(), and Mers::Solvers::Entailment::GI::GoalInterpreter::variableAndValueToUID().

BaseModelVariable const * BaseModelVariableArray::find | ( | char const * | variableName | ) | const

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

Parameters:

  | variableName | the name of the variable being sought.

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

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

Definition at line 82 of file BaseModelVariableArray.cpp.

void Mers::Models::Base::BaseModelVariableArray::insert | ( | unsigned int | elementIndex,
|  | BaseModelVariable * | 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 176 of file BaseModelVariableArray.h.

BaseModelVariable *& BaseModelVariableArray::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::CCAVariables.

Definition at line 89 of file BaseModelVariableArray.cpp.

BaseModelVariable *& BaseModelVariableArray::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::CCAVariables.

Definition at line 96 of file BaseModelVariableArray.cpp.

BaseModelVariable const *& BaseModelVariableArray::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::CCAVariables.

Definition at line 104 of file BaseModelVariableArray.cpp.

BaseModelVariable const *& BaseModelVariableArray::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::CCAVariables.

Definition at line 112 of file BaseModelVariableArray.cpp.

BaseModelVariableArray const & BaseModelVariableArray::operator= | ( | BaseModelVariableArray 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 BaseModelVariableArray.cpp.

BaseModelVariableArray const & BaseModelVariableArray::operator+= | ( | BaseModelVariableArray 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 BaseModelVariableArray.cpp.

BaseModelVariableArray const & BaseModelVariableArray::operator+= | ( | BaseModelVariable const & | other | ) |

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:

  | other | the element being copied and added to this array.

Returns:
  this array

Reimplemented in Mers::Models::CCA::CCAVariables.

Definition at line 136 of file BaseModelVariableArray.cpp.

bool BaseModelVariableArray::operator== | ( | BaseModelVariableArray 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 BaseModelVariableArray.cpp.

bool BaseModelVariableArray::operator!= | ( | BaseModelVariableArray 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 BaseModelVariableArray.cpp.

void BaseModelVariableArray::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 BaseModelVariableArray.cpp.

References Mers::Models::Base::BaseModelVariable::print().

Here is the call graph for this function:

void BaseModelVariableArray::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 (BaseModelVariable).

Parameters:

  | element | the BaesModelVariable to delete

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

Definition at line 169 of file BaseModelVariableArray.cpp.

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

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

Parameters:

  | element | the element being copied.

Returns:
  the new BaseModelVariable object that is a copy of element.

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

Reimplemented in Mers::Models::CCA::CCAVariables.

Definition at line 176 of file BaseModelVariableArray.cpp.

bool BaseModelVariableArray::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 183 of file BaseModelVariableArray.cpp.

bool BaseModelVariableArray::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::CCAVariables.

Definition at line 190 of file BaseModelVariableArray.cpp.

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

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