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

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

# Mers::Models::Base::BaseModelDomain Class Reference

`#include <BaseModelDomain.h>`

Inheritance diagram for Mers::Models::Base::BaseModelDomain:

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

[legend]
List of all members.

## Public Types
enum | DomainType { Normal = 0, Integer = 1, Double = 2, String = 3 }
## Public Member Functions
| BaseModelDomain (bool myOwnershipStatus, DomainType myType=Normal)
| BaseModelDomain (char const *myName, bool myOwnershipStatus, unsigned int myUID=0, DomainType myType=Normal)
| BaseModelDomain (BaseModelDomain const &other)
virtual | ~BaseModelDomain ()
int | setName (char const *newName)
char const * | getName () const
void | setUID (unsigned int newUID)
unsigned int | getUID () const
DomainType | getDomainType () const
virtual BaseModelValue * | getValue (unsigned int valueUID)
virtual BaseModelValue const * | getValue (unsigned int valueUID) const
virtual BaseModelValue * | getValue (char const *valueName)
virtual BaseModelValue const * | getValue (char const *valueName) const
virtual int | pushBack (BaseModelValue *data)
BaseModelDomain const & | operator= (BaseModelDomain const &other)
BaseModelDomain const & | operator+= (BaseModelDomain const &other)
bool | operator== (BaseModelDomain const &other) const
bool | operator!= (BaseModelDomain const &other) const
virtual void | print (std::ostream &out) const
## Static Public Member Functions
static char const * | domainTypeToString (DomainType domainType)
static int | stringToDomainType (const char *domainTypeName, DomainType &domainType)
## Protected Member Functions
void | destroy ()
virtual int | copy (BaseModelDomain const &domain)
## Protected Attributes
DomainType const | domainType
| The domain type identifier for this domain.
char * | name
| The string name of this domain.
unsigned int | uid
| The UID or array index of this domain.

## Detailed Description

A BaseModelValueArray. Describes a logical domain. Domains can be finite or infinite. This generic domain is a finite collection of strings.

Author:
  Paul H. Elliott

Definition at line 34 of file BaseModelDomain.h.

## Member Enumeration Documentation

enum Mers::Models::Base::BaseModelDomain::DomainType

The type of information stored in this domain. Normal is of type String whereas String is an infinite domain of strings

Definition at line 40 of file BaseModelDomain.h.

## Constructor & Destructor Documentation

BaseModelDomain::BaseModelDomain | ( | bool | myOwnershipStatus,
|  | DomainType | myType = `Normal` |
| ) |  |  |

Creates a new, empty domain.

Parameters:

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

Definition at line 28 of file BaseModelDomain.cpp.

BaseModelDomain::BaseModelDomain | ( | char const * | myName,
|  | bool | myOwnershipStatus,
|  | unsigned int | myUID = `0`,
|  | DomainType | myType = `Normal` |
| ) |  |  |

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.
  | myType | the clause type of this clause (Disjunctive or Conjunctive).

Definition at line 36 of file BaseModelDomain.cpp.

References setName().

Here is the call graph for this function:

BaseModelDomain::BaseModelDomain | ( | BaseModelDomain 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 46 of file BaseModelDomain.cpp.

References copy().

Here is the call graph for this function:

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

Destroys the Domain

Definition at line 55 of file BaseModelDomain.cpp.

References destroy().

Here is the call graph for this function:

## Member Function Documentation

char const * BaseModelDomain::domainTypeToString | ( | DomainType | domainType | ) | `[static]`

Converts a DomainType to a string representation.

Parameters:

  | domainType | the domain type of the domain string being sought.

Returns:
  a static string representing the specified domain type

Definition at line 62 of file BaseModelDomain.cpp.

Referenced by Mers::Models::Base::BaseModelIntegerDomain::copy(), Mers::Models::Base::BaseModelDoubleDomain::copy(), copy(), Mers::Models::Base::BaseModelDoubleDomain::operator+=(), operator+=(), Mers::Models::Base::BaseModelIntegerDomain::operator=(), Mers::Models::Base::BaseModelDoubleDomain::operator=(), Mers::Models::Base::BaseModelIntegerDomain::pushBack(), and Mers::Models::Base::BaseModelDoubleValue::setDomain().

int BaseModelDomain::stringToDomainType | ( | const char * | domainTypeName,
|  | DomainType & | domainType |
| ) |  |  | `[static]`

Converts a DomainType String to a DomainType representation.

Parameters:

  | domainTypeName | the string name of the domain type that is to be converted into the DomainType Enum.
  | domainType | the domain type of the domain string being sought.

Returns:
  0 on success or a positive value if the string did not match any domain types.

Definition at line 80 of file BaseModelDomain.cpp.

int BaseModelDomain::setName | ( | char const * | newName | ) |

Sets the name of this Domain to a copy of newName.

Parameters:

  | newName | the new name for this Domain.

Returns:
  0 on success or a positive number if the name could not be duplicated.

Definition at line 106 of file BaseModelDomain.cpp.

References name, and BaseModelUtils::setName().

Referenced by BaseModelDomain(), Mers::Models::Base::BaseModelIntegerDomain::copy(), and copy().

Here is the call graph for this function:

char const * BaseModelDomain::getName | ( |  | ) | const

Returns a handle to the current name of this domain. This may be NULL if this domain doesn't have a name.

Returns:
  the domain's name

Definition at line 113 of file BaseModelDomain.cpp.

References name.

Referenced by Mers::Models::Base::BaseModelIntegerDomain::copy(), Mers::Models::Base::BaseModelVariable::operator==(), Mers::Models::Base::BaseModelVariable::print(), and Mers::Generators::BFIG::BFIGVariable::toString().

void BaseModelDomain::setUID | ( | unsigned int | newUID | ) |

Sets the UID of this domain. This is generally the array index of the domain in some enclosing domain array.

Parameters:

  | newUID | the new UID of this domain

Definition at line 120 of file BaseModelDomain.cpp.

References uid.

Referenced by Mers::Models::Base::BaseModel::addDomain(), and Mers::Models::Base::BaseModelIntegerDomain::copy().

unsigned int BaseModelDomain::getUID | ( |  | ) | const

Returns the current UID of this domain.

Returns:
  the UID of this domain

Definition at line 127 of file BaseModelDomain.cpp.

References uid.

Referenced by Mers::Models::Base::BaseModelIntegerDomain::copy().

BaseModelDomain::DomainType BaseModelDomain::getDomainType | ( |  | ) | const

Returns the domain type for this domain.

Returns:
  this domain's type

Definition at line 134 of file BaseModelDomain.cpp.

References domainType.

Referenced by Mers::Models::Base::BaseModelIntegerDomain::copy(), Mers::Models::Base::BaseModelDoubleDomain::copy(), Mers::Models::Base::BaseModelDoubleDomain::operator+=(), Mers::Models::Base::BaseModelIntegerDomain::operator=(), Mers::Models::Base::BaseModelDoubleDomain::operator=(), and Mers::Models::Base::BaseModelDoubleValue::setDomain().

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

Returns the value in this domain with the specified UID. The UID is assumed to be just an array index.

Parameters:

  | valueUID | the UID of the value being sought.

Returns:
  the value with the matching UID or NULL if it couldn't be found.

Reimplemented in Mers::Models::Base::BaseModelIntegerDomain.

Definition at line 141 of file BaseModelDomain.cpp.

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

Referenced by Mers::Models::Base::BaseModelVariable::getValue(), and Mers::Models::Base::BaseModelStringDomain::getValue().

Here is the call graph for this function:

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

Returns the value in this domain with the specified UID. The UID is assumed to be just an array index.

Parameters:

  | valueUID | the UID of the value being sought.

Returns:
  the value with the matching UID or NULL if it couldn't be found.

Reimplemented in Mers::Models::Base::BaseModelIntegerDomain.

Definition at line 148 of file BaseModelDomain.cpp.

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

Here is the call graph for this function:

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

Returns the value in this domain with the specified Name. The name is case sensitive.

Parameters:

  | valueName | the Name of the value being sought.

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

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

Definition at line 155 of file BaseModelDomain.cpp.

References Mers::Models::Base::BaseModelValueArray::find().

Here is the call graph for this function:

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

Returns the value in this domain with the specified Name. The name is case sensitive.

Parameters:

  | valueName | the Name of the value being sought.

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

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

Definition at line 162 of file BaseModelDomain.cpp.

References Mers::Models::Base::BaseModelValueArray::find().

Here is the call graph for this function:

int BaseModelDomain::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 from Mers::Models::Base::BaseModelValueArray.

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

Definition at line 169 of file BaseModelDomain.cpp.

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

Referenced by tut::BMHelper::loadDomain(), Mers::Models::Base::BaseModel::newDomain(), Mers::Models::Base::BaseModelStringDomain::newValue(), and Mers::Models::Base::BaseModelDoubleDomain::pushBack().

Here is the call graph for this function:

BaseModelDomain const & BaseModelDomain::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 in Mers::Models::Base::BaseModelDoubleDomain, and Mers::Models::Base::BaseModelIntegerDomain.

Definition at line 177 of file BaseModelDomain.cpp.

References copy().

Here is the call graph for this function:

BaseModelDomain const & BaseModelDomain::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 in Mers::Models::Base::BaseModelDoubleDomain.

Definition at line 185 of file BaseModelDomain.cpp.

References domainType, domainTypeToString(), and Mers::Models::Base::BaseModelValueArray::operator+=().

Here is the call graph for this function:

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

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 197 of file BaseModelDomain.cpp.

References domainType, name, Mers::Models::Base::BaseModelValueArray::operator==(), and uid.

Referenced by operator!=().

Here is the call graph for this function:

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

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 212 of file BaseModelDomain.cpp.

References operator==().

Here is the call graph for this function:

void BaseModelDomain::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::Utils::Containers::DynamicArray.

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

Definition at line 221 of file BaseModelDomain.cpp.

References name, and Mers::Utils::Containers::DynamicArray::printArray().

Here is the call graph for this function:

void BaseModelDomain::destroy | ( |  | ) | `[protected, virtual]`

Deletes all the elements in the domain, setting up the domain for a copy, destructor or fresh start. Derived classes should ensure this function is called as well BaseModelDomain::destroy();

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

Definition at line 232 of file BaseModelDomain.cpp.

References Mers::Utils::Containers::DynamicArray::destroy(), and name.

Referenced by Mers::Models::Base::BaseModelIntegerDomain::copy(), ~BaseModelDomain(), and Mers::Models::Base::BaseModelDoubleDomain::~BaseModelDoubleDomain().

Here is the call graph for this function:

int BaseModelDomain::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 in Mers::Models::Base::BaseModelDoubleDomain, and Mers::Models::Base::BaseModelIntegerDomain.

Definition at line 242 of file BaseModelDomain.cpp.

References Mers::Utils::Containers::DynamicArray::copy(), domainType, domainTypeToString(), Mers::Utils::Containers::DynamicArray::getLength(), name, setName(), and uid.

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

Here is the call graph for this function:

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

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