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

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

# Mers::Models::Base::BaseModelDoubleDomain Class Reference

`#include <BaseModelDoubleDomain.h>`

Inheritance diagram for Mers::Models::Base::BaseModelDoubleDomain:

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

[legend]
List of all members.

## Public Member Functions
| BaseModelDoubleDomain (bool myOwnershipStatus)
| BaseModelDoubleDomain (char const *myName, bool myOwnershipStatus, unsigned int myUID=0)
| BaseModelDoubleDomain (BaseModelDoubleDomain const &other)
virtual | ~BaseModelDoubleDomain ()
BaseModelValue * | getValue (char const *valueName)
BaseModelValue const * | getValue (char const *valueName) const
int | pushBack (BaseModelValue *data)
int | registerValue (BaseModelDoubleValue *data)
int | unregisterValue (BaseModelDoubleValue *data)
BaseModelDoubleValue *& | operator[] (int elementIndex)
BaseModelDoubleValue *& | operator[] (unsigned int elementIndex)
BaseModelDoubleValue const *& | operator[] (int elementIndex) const
BaseModelDoubleValue const *& | operator[] (unsigned int elementIndex) const
BaseModelDomain const & | operator= (BaseModelDomain const &other)
BaseModelDoubleDomain const & | operator= (BaseModelDoubleDomain const &other)
BaseModelDomain const & | operator+= (BaseModelDomain const &other)
BaseModelDoubleDomain const & | operator+= (BaseModelDoubleDomain const &other)
BaseModelDoubleDomain const & | operator+= (BaseModelDoubleValue const &other)
bool | operator== (BaseModelDoubleDomain const &other)
bool | operator!= (BaseModelDoubleDomain const &other)
virtual void | print (std::ostream &out) const
## Protected Member Functions
int | copy (BaseModelDomain const &domain)
int | copy (BaseModelDoubleDomain const &domain)
void | deleteElement (void *element) const
void * | newElement (void const *element) const
BaseModelDoubleValue * | newDoubleValue (char const *valueName, double value)
int | convertAToF (char const *valueName, double &value) const
## Protected Attributes
unsigned int | firstFreeSpot

## Detailed Description

A BaseModelDomain that describes the domain type Double. A double domain stores a unique UID for each BaseModelDoubleValue object that registers. The value of this double value may change but the UID will not. This also means that copies will have different UIDs but the same value This was done this way so all objects can be found by UID and so DoubleValues can follow some real value w/o worrying about creating a large number of objects or having the wrong value. (Requesting a copy of a domain, setting it to some value, and then looking it up by UID would result in the old value being returned if they had the same UID) This is a problem that only DoubleDomain and IntegerDomain should have since it is currently assumed that strings will not change on the fly.

Definition at line 42 of file BaseModelDoubleDomain.h.

## Constructor & Destructor Documentation

BaseModelDoubleDomain::BaseModelDoubleDomain | ( | bool | myOwnershipStatus | ) |

Creates a new, empty domain of doubles.

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 29 of file BaseModelDoubleDomain.cpp.

References firstFreeSpot.

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

Creates a new, empty domain of doubles 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 37 of file BaseModelDoubleDomain.cpp.

References firstFreeSpot.

BaseModelDoubleDomain::BaseModelDoubleDomain | ( | BaseModelDoubleDomain const & | other | ) |

Creates a new Domain of doubles as 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 46 of file BaseModelDoubleDomain.cpp.

References firstFreeSpot.

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

Destroys the Domain.

Definition at line 54 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelDomain::destroy().

Here is the call graph for this function:

## Member Function Documentation

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

Returns the value in this domain with the specified Name. The name should be a double value. The search returns the first value that has the same double value. The returned value will always be of type Double. If the value is not found, it is added and the new value is returned.

Parameters:

  | valueName | the Name/double of the value being sought.

Returns:
  the value with the (first) matching Name or NULL if it couldn't be created.

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

Definition at line 61 of file BaseModelDoubleDomain.cpp.

References convertAToF(), Mers::Models::Base::BaseModelDoubleValue::getDouble(), Mers::Utils::Containers::DynamicArray::getLength(), and newDoubleValue().

Here is the call graph for this function:

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

Returns the value in this domain with the specified Name. The name should be a double value. The search returns the first value that has the same double value. The returned value will always be of type Double. If the value is not found, it is added and the new value is returned.

Parameters:

  | valueName | the Name/double of the value being sought.

Returns:
  the value with the (first) matching Name or NULL if it couldn't be created.

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

Definition at line 93 of file BaseModelDoubleDomain.cpp.

References convertAToF(), Mers::Models::Base::BaseModelDoubleValue::getDouble(), and Mers::Utils::Containers::DynamicArray::getLength().

Here is the call graph for this function:

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

Adds the value to this domain of doubles. The Value should be a DoubleValue. The value is registered.with BaseModelDoubleDomain::register(data). The value will be added in the first available slot or at the end if no other slots are available. Slots become available when an object unregisters. 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 120 of file BaseModelDoubleDomain.cpp.

References firstFreeSpot, Mers::Utils::Containers::DynamicArray::getLength(), operator[](), Mers::Models::Base::BaseModelDomain::pushBack(), and Mers::Models::Base::BaseModelValue::setUID().

Referenced by registerValue().

Here is the call graph for this function:

int BaseModelDoubleDomain::registerValue | ( | BaseModelDoubleValue * | data | ) |

This function should only be called by a BaseModelDoubleValue. This function adds the specified Value to the Double Domain. It should not already exist.

Parameters:

  | data | the DoubleValue being added to this domain.

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

Definition at line 151 of file BaseModelDoubleDomain.cpp.

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

Referenced by Mers::Models::Base::BaseModelDoubleValue::BaseModelDoubleValue().

Here is the call graph for this function:

int BaseModelDoubleDomain::unregisterValue | ( | BaseModelDoubleValue * | data | ) |

This function should only be called by a BaseModelDoubleValue. This function removes the specified Value from the Double Domain.

Parameters:

  | data | the DoubleValue being removed from this domain.

Definition at line 163 of file BaseModelDoubleDomain.cpp.

References firstFreeSpot, Mers::Models::Base::BaseModelValue::getDomain(), Mers::Models::Base::BaseModelValue::getName(), Mers::Models::Base::BaseModelValue::getUID(), and operator[]().

Here is the call graph for this function:

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

Definition at line 178 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelValueArray::operator[]().

Referenced by pushBack(), and unregisterValue().

Here is the call graph for this function:

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

Definition at line 192 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelValueArray::operator[]().

Here is the call graph for this function:

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

Definition at line 185 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelValueArray::operator[]().

Here is the call graph for this function:

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

Definition at line 199 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelValueArray::operator[]().

Here is the call graph for this function:

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

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

Parameters:

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

Returns:
  the other domain.

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

Definition at line 206 of file BaseModelDoubleDomain.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:

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

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

Parameters:

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

Returns:
  the other domain.

Definition at line 218 of file BaseModelDoubleDomain.cpp.

References copy().

Here is the call graph for this function:

BaseModelDomain const & BaseModelDoubleDomain::operator+= | ( | BaseModelDomain const & | other | ) |

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

Parameters:

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

Returns:
  this domain

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

Definition at line 226 of file BaseModelDoubleDomain.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:

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

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

Parameters:

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

Returns:
  this domain

Definition at line 238 of file BaseModelDoubleDomain.cpp.

References Mers::Utils::Containers::DynamicArray::getLength(), newElement(), and Mers::Models::Base::BaseModelDoubleValue::setDomain().

Here is the call graph for this function:

BaseModelDoubleDomain const & BaseModelDoubleDomain::operator+= | ( | BaseModelDoubleValue const & | other | ) |

Appends a copy of the other value to this domain. This is almost the same as pushBack except this version makes a copy of the data instead of taking control of the data.

Parameters:

  | other | the value being copied and added to this domain.

Returns:
  this domain.

Definition at line 252 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelValue::getName(), newElement(), and Mers::Models::Base::BaseModelDoubleValue::setDomain().

Here is the call graph for this function:

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

Returns true if the two domains have all the same values in the same order.

Parameters:

  | other | the domain being compared to this domain.

Returns:
  true if the two domains have the same values in the same order

Definition at line 266 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelValueArray::operator==().

Referenced by operator!=().

Here is the call graph for this function:

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

Returns false if the two domains have all the same values in the same order.

Parameters:

  | other | the domain being compared to this domain.

Returns:
  false if the two domains have the same values in the same order.

Definition at line 275 of file BaseModelDoubleDomain.cpp.

References operator==().

Here is the call graph for this function:

void BaseModelDoubleDomain::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 284 of file BaseModelDoubleDomain.cpp.

int BaseModelDoubleDomain::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 293 of file BaseModelDoubleDomain.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 BaseModelDoubleDomain::copy | ( | BaseModelDoubleDomain 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 305 of file BaseModelDoubleDomain.cpp.

References Mers::Models::Base::BaseModelDomain::copy(), and firstFreeSpot.

Here is the call graph for this function:

void BaseModelDoubleDomain::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.

Parameters:

  | element | the array entry to delete

Reimplemented from Mers::Models::Base::BaseModelValueArray.

Definition at line 318 of file BaseModelDoubleDomain.cpp.

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

Creates and returns a new array object that is a copy of the element passed in.

Parameters:

  | element | the element being copied.

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

Reimplemented from Mers::Models::Base::BaseModelValueArray.

Definition at line 325 of file BaseModelDoubleDomain.cpp.

Referenced by operator+=().

BaseModelDoubleValue * BaseModelDoubleDomain::newDoubleValue | ( | char const * | valueName,
|  | double | value |
| ) |  |  | `[protected]`

Creates and returns a new BaseModelDoubleValue object with the specified creation properties and returns it. This double value is automatically added to this array.

Parameters:

  | valueName | the name of the new value (the string representation of the value).
  | value | the value of the new DoubleValue.

Returns:
  a new BaseModelDoubleValue

Definition at line 332 of file BaseModelDoubleDomain.cpp.

Referenced by getValue().

int BaseModelDoubleDomain::convertAToF | ( | char const * | valueName,
|  | double & | value |
| ) |  |  | const`[protected]`

Converts a string to a double. It also checks to make sure that the conversion was proper. (since it uses aotf).

Parameters:

  | valueName | the string of the double value.
  | value | the value of the double string is returned here.

Returns:
  0 on success, a positive number if the conversion failed (not a double), or a negative number if the conversion was questionable (a warning)

Definition at line 339 of file BaseModelDoubleDomain.cpp.

Referenced by getValue().

## Member Data Documentation

unsigned int Mers::Models::Base::BaseModelDoubleDomain::firstFreeSpot`[protected]`

Index of the first NULL element in this array. If equal to the size of this array then there are no NULL elements.

Definition at line 366 of file BaseModelDoubleDomain.h.

Referenced by BaseModelDoubleDomain(), copy(), pushBack(), and unregisterValue().

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

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