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

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

# Mers::Models::Base::BaseModelIntegerDomain Class Reference

`#include <BaseModelIntegerDomain.h>`

Inheritance diagram for Mers::Models::Base::BaseModelIntegerDomain:

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

[legend]
List of all members.

## Public Member Functions
| BaseModelIntegerDomain (bool myOwnershipStatus)
| BaseModelIntegerDomain (char const *myName, bool myOwnershipStatus, unsigned int myUID=0)
| BaseModelIntegerDomain (BaseModelIntegerDomain const &other)
virtual | ~BaseModelIntegerDomain ()
BaseModelValue * | getValue (unsigned int valueUID)
BaseModelValue const * | getValue (unsigned int valueUID) const
BaseModelValue * | getValue (char const *valueName)
BaseModelValue const * | getValue (char const *valueName) const
int | pushBack (BaseModelValue *data)
BaseModelDomain const & | operator= (BaseModelDomain const &other)
virtual BaseModelIntegerDomain const & | operator= (BaseModelIntegerDomain const &other)
bool | operator== (BaseModelIntegerDomain const &other)
bool | operator!= (BaseModelIntegerDomain const &other)
void | print (std::ostream &out) const
## Protected Member Functions
int | copy (BaseModelDomain const &domain)
int | copy (BaseModelIntegerDomain const &domain)
virtual BaseModelValue * | newValue (char const *valueName, unsigned int valueInt)
int | convertAToI (char const *valueName, int &value) const

## Detailed Description

A BaseModelDomain that describes the domain type Integer. The IntegerDomain stores a copy of each object returned for deletion purposes but does not search through them for the specified UID. It doesn't store the values for searching purposes because the value of the integer is the same as the UID and so we can't index it differently from the value. We don't want to search each time the UID is requested since this can be expensive (as compared to creating a new object). The alternative is to make this domain behave the same as the DoubleDomain but then we have to add another Derived class from BaseModelValue called BaseModelIntegerValue, which will have the extra integer for the value apart from the UID.

Definition at line 40 of file BaseModelIntegerDomain.h.

## Constructor & Destructor Documentation

BaseModelIntegerDomain::BaseModelIntegerDomain | ( | bool | myOwnershipStatus | ) |

Creates a new, empty domain of integers.

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 28 of file BaseModelIntegerDomain.cpp.

BaseModelIntegerDomain::BaseModelIntegerDomain | ( | char const * | myName,
|  | bool | myOwnershipStatus,
|  | unsigned int | myUID = `0` |
| ) |  |  |

Creates a new, empty domain with the specified name and UID.

Parameters:

  | myName | the name of this domain, this name is copied into this object.
  | myUID | the UID of this domain, which can be used to find it in a BaseModelDomainArray.
  | myOwnershipStatus | the ownership status. If true, this object owns the array objects it contains and should delete them upon being deleted.

Definition at line 35 of file BaseModelIntegerDomain.cpp.

BaseModelIntegerDomain::BaseModelIntegerDomain | ( | BaseModelIntegerDomain const & | other | ) |

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

Parameters:

  | other | the Domain being copied to this Domain

Definition at line 44 of file BaseModelIntegerDomain.cpp.

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

Destroys the Domain

Definition at line 51 of file BaseModelIntegerDomain.cpp.

## Member Function Documentation

BaseModelValue * BaseModelIntegerDomain::getValue | ( | unsigned int | valueUID | ) | `[virtual]`

This domain does not store the values in the same way as other domains. Requesting a UID will always return a new object, which will be stored at the end of this array. This means that this array will delete the object when it finishes but the contents of the array aren't important.

Parameters:

  | valueUID | the numeric value of the Integer Value of the Value returned.

Returns:
  a new BaseModelValue object with a value of valueUID

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 58 of file BaseModelIntegerDomain.cpp.

References newValue(), and pushBack().

Here is the call graph for this function:

BaseModelValue const * BaseModelIntegerDomain::getValue | ( | unsigned int | valueUID | ) | const`[virtual]`

This domain does not store the values in the same way as other domains. Requesting a UID will always return a new object, which will be stored at the end of this array. This means that this array will delete the object when it finishes but the contents of the array aren't important. But, since this is a constant function, we're going to have to search for an existing value, since we can't add one, so this will do a linear search for the UID. (Which can be very expensive).

Parameters:

  | valueUID | the numeric value of the Integer Value of the Value returned.

Returns:
  a new BaseModelValue object with a value of valueUID

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 74 of file BaseModelIntegerDomain.cpp.

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

Here is the call graph for this function:

BaseModelValue * BaseModelIntegerDomain::getValue | ( | char const * | valueName | ) | `[virtual]`

The name should be a number. The name is converted to a UID This domain does not store the values in the same way as other domains. Requesting a UID will always return a new object, which will be stored at the end of this array. This means that this array will delete the object when it finishes but the contents of the array aren't important.

Parameters:

  | valueName | the numeric value of the Integer Value of the Value returned.

Returns:
  a new BaseModelValue object with a value of valueName

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 89 of file BaseModelIntegerDomain.cpp.

References convertAToI(), and newValue().

Here is the call graph for this function:

BaseModelValue const * BaseModelIntegerDomain::getValue | ( | char const * | valueName | ) | const`[virtual]`

The name should be a number. The name is converted to a UID This domain does not store the values in the same way as other domains. Requesting a UID will always return a new object, which will be stored at the end of this array. This means that this array will delete the object when it finishes but the contents of the array aren't important. But, since this is a constant function, we're going to have to search for an existing value, since we can't add one, so this will do a linear search for the UID. (Which can be very expensive).

Parameters:

  | valueName | the numeric value of the Integer Value of the Value returned.

Returns:
  a new BaseModelValue object with a value of valueName

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 103 of file BaseModelIntegerDomain.cpp.

References convertAToI(), and Mers::Utils::Containers::DynamicArray::getLength().

Here is the call graph for this function:

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

Adds the value to this domain of doubles. The Value should be a Value of type Integer. The value is appended to the end of the array. The array will be grown as needed. This object assumes ownership of data object and will delete it when this object is destroyed. This routine verifies the value type before accepting it into this domain.

Parameters:

  | data | the value being added.

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

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 125 of file BaseModelIntegerDomain.cpp.

References Mers::Models::Base::BaseModelDomain::domainType, Mers::Models::Base::BaseModelDomain::domainTypeToString(), Mers::Models::Base::BaseModelValue::getValueType(), and Mers::Models::Base::BaseModelValue::valueTypeToString().

Referenced by getValue(), and newValue().

Here is the call graph for this function:

BaseModelDomain const & BaseModelIntegerDomain::operator= | ( | BaseModelDomain const & | other | ) |

Copies the data from the other domain to this domain. The origional data in this domain is destroyed. Since the Integer Domain doesn't store values for lookup, this only copies the non-array elements of the domain.

Parameters:

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

Returns:
  the other domain.

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 140 of file BaseModelIntegerDomain.cpp.

References Mers::Models::Base::BaseModelDomain::domainType, Mers::Models::Base::BaseModelDomain::domainTypeToString(), and Mers::Models::Base::BaseModelDomain::getDomainType().

Here is the call graph for this function:

BaseModelIntegerDomain const & BaseModelIntegerDomain::operator= | ( | BaseModelIntegerDomain const & | other | ) | `[virtual]`

Copies the data from the other domain to this domain. The origional data in this domain is destroyed. Since the Integer Domain doesn't store values for lookup, this only copies the non-array elements of the domain.

Parameters:

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

Returns:
  the other domain

Definition at line 153 of file BaseModelIntegerDomain.cpp.

References copy().

Here is the call graph for this function:

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

Always returns true since all integer domains are alike.

Parameters:

  | other | the domain being compared to this domain.

Returns:
  true.

Definition at line 161 of file BaseModelIntegerDomain.cpp.

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

Always returns false since all integer domains are alike.

Parameters:

  | other | the domain being compared to this domain.

Returns:
  false.

Definition at line 170 of file BaseModelIntegerDomain.cpp.

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

Prints the contents of this domain to the ostream out. Derived classes should overide this function to change printing behavior.

Parameters:

  | out | all the data from this object is printed to this ostream object.

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 181 of file BaseModelIntegerDomain.cpp.

int BaseModelIntegerDomain::copy | ( | BaseModelDomain const & | domain | ) | `[protected, virtual]`

Copies the contents of the other domain to this domain. This destroys the contents of this domain and copies each element in the other domain.

Parameters:

  | domain | the domain being copied to this domain.

Returns:
  0 on success or a positive number if the copy failed.

Reimplemented from Mers::Models::Base::BaseModelDomain.

Definition at line 190 of file BaseModelIntegerDomain.cpp.

References Mers::Models::Base::BaseModelDomain::domainType, Mers::Models::Base::BaseModelDomain::domainTypeToString(), and Mers::Models::Base::BaseModelDomain::getDomainType().

Referenced by operator=().

Here is the call graph for this function:

int BaseModelIntegerDomain::copy | ( | BaseModelIntegerDomain const & | domain | ) | `[protected]`

Copies the contents of the other domain to this domain. This destroys the contents of this domain and copies each element in the other domain.

Parameters:

  | domain | the domain being copied to this domain.

Returns:
  0 on success or a positive number if the copy failed.

Definition at line 202 of file BaseModelIntegerDomain.cpp.

References Mers::Models::Base::BaseModelDomain::destroy(), Mers::Models::Base::BaseModelDomain::getName(), Mers::Models::Base::BaseModelDomain::getUID(), Mers::Models::Base::BaseModelDomain::setName(), and Mers::Models::Base::BaseModelDomain::setUID().

Here is the call graph for this function:

BaseModelValue * BaseModelIntegerDomain::newValue | ( | char const * | valueName,
|  | unsigned int | valueInt |
| ) |  |  | `[protected, virtual]`

Creates a new value object with the specified parameters and inserts it into this domain.

Parameters:

  | valueName | the string representation of the number.
  | valueInt | the Integer value of the new BaseModelValue object.

Returns:
  a new BaseModelValue object.

Definition at line 211 of file BaseModelIntegerDomain.cpp.

References pushBack(), and Mers::Models::Base::BaseModelValue::setUID().

Referenced by getValue().

Here is the call graph for this function:

int BaseModelIntegerDomain::convertAToI | ( | char const * | valueName,
|  | int & | value |
| ) |  |  | const`[protected]`

Converts a string to an integer. If the string wasn't an integer it will return an error code.

Parameters:

  | valueName | the integer in string form.
  | value | the string is converted to an integer and returned here.

Returns:
  0 on success or a positive number if it wasn't a number.

Definition at line 228 of file BaseModelIntegerDomain.cpp.

Referenced by getValue().

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

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