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

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

# Mers::Models::Base::BaseModelValue Class Reference

`#include <BaseModelValue.h>`

Inheritance diagram for Mers::Models::Base::BaseModelValue:

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

[legend]
List of all members.

## Public Types
enum | ValueType { STRING = 0, INTEGER = 1, DOUBLE = 2 }
## Public Member Functions
| BaseModelValue (char const *myName=NULL, ValueType myType=STRING)
| BaseModelValue (char const *myName, BaseModelDomain *myDomain, ValueType myType=STRING)
| BaseModelValue (BaseModelValue const &other)
virtual | ~BaseModelValue ()
void | setValueType (ValueType newType)
ValueType | getValueType () const
virtual int | setName (char const *newName)
virtual char const * | getName () const
virtual void | setUID (unsigned int newUID)
virtual unsigned int | getUID () const
virtual void | setDouble (double newValue)
virtual double | getDouble () const
virtual void | setInteger (int newValue)
virtual int | getInteger () const
virtual void | setDomain (BaseModelDomain *newDomain)
BaseModelDomain * | getDomain ()
BaseModelDomain const * | getDomain () const
BaseModelValue const & | operator= (BaseModelValue const &other)
bool | operator== (BaseModelValue const &other) const
bool | operator!= (BaseModelValue const &other) const
bool | operator< (BaseModelValue const &other) const
bool | operator<= (BaseModelValue const &other) const
bool | operator> (BaseModelValue const &other) const
bool | operator>= (BaseModelValue const &other) const
void | print (std::ostream &out) const
## Static Public Member Functions
static char const * | valueTypeToString (ValueType valueType)
## Protected Member Functions
virtual void | destroy ()
virtual int | copy (BaseModelValue const &value)
## Protected Attributes
ValueType | valueType
| The Value Type of this object.
unsigned int | uid
| The UID of this object, often the index of the object as well.
char * | name
| The string name of this object.
BaseModelDomain * | domain
| The domain of this value object.

## Detailed Description

A value of a domain which can be assigned to a variable.

Author:
  Paul H. Elliott

Definition at line 34 of file BaseModelValue.h.

## Member Enumeration Documentation

enum Mers::Models::Base::BaseModelValue::ValueType

The type of value stored in this value object

##########
## NOTE ##
##########

If you add a type, add it to the valueTypeToString() function as well.

Definition at line 47 of file BaseModelValue.h.

## Constructor & Destructor Documentation

BaseModelValue::BaseModelValue | ( | char const * | myName = `NULL`,
|  | ValueType | myType = `STRING` |
| ) |  |  |

Creates a new value of the requested type with the specified name.

Parameters:

  | myName | the name of this value, this name is copied into this object.
  | myType | the value type of this value.

Definition at line 29 of file BaseModelValue.cpp.

References domain, name, setName(), and uid.

Here is the call graph for this function:

BaseModelValue::BaseModelValue | ( | char const * | myName,
|  | BaseModelDomain * | myDomain,
|  | ValueType | myType = `STRING` |
| ) |  |  |

Creates a new value of the requested type with the specified name in the specified domain.

Parameters:

  | myName | the name of this value, this name is copied into this object.
  | myDomain | the domain that this value should reside in. The value will add itself to the domain if appropriate.
  | myType | the value type of this value

Definition at line 40 of file BaseModelValue.cpp.

References domain, name, setName(), and uid.

Here is the call graph for this function:

BaseModelValue::BaseModelValue | ( | BaseModelValue const & | other | ) |

Creates a new value with a copy of the contents from the other value

Parameters:

  | other | the value being copied

Definition at line 52 of file BaseModelValue.cpp.

References copy(), domain, and name.

Here is the call graph for this function:

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

Destroys the value

Definition at line 62 of file BaseModelValue.cpp.

References destroy().

Here is the call graph for this function:

## Member Function Documentation

char const * BaseModelValue::valueTypeToString | ( | ValueType | valueType | ) | `[static]`

returns a static string representation of the value type requested

Returns:
  the string equivalent for the value type

Definition at line 71 of file BaseModelValue.cpp.

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

void BaseModelValue::setValueType | ( | ValueType | newType | ) |

Sets the value type of this object

Parameters:

  | newType | the new type of this value

Definition at line 87 of file BaseModelValue.cpp.

References valueType.

BaseModelValue::ValueType BaseModelValue::getValueType | ( |  | ) | const

Returns the value's type

Returns:
  the ValueType of this object

Definition at line 94 of file BaseModelValue.cpp.

References valueType.

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

int BaseModelValue::setName | ( | char const * | newName | ) | `[virtual]`

Sets the name of this value to a copy of newName

Parameters:

  | newName | the new name for this value

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

Definition at line 101 of file BaseModelValue.cpp.

References name, and BaseModelUtils::setName().

Referenced by BaseModelValue(), and copy().

Here is the call graph for this function:

char const * BaseModelValue::getName | ( |  | ) | const`[virtual]`

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

Returns:
  the value's name

Definition at line 108 of file BaseModelValue.cpp.

References name.

Referenced by Mers::Models::CCA::CCAState::CCAState(), Mers::Models::CCA::CCAState::getName(), Mers::Models::Base::BaseModelValueArray::insert_value(), Mers::Models::CCA::CCAState::name(), Mers::Models::Base::BaseModelDoubleDomain::operator+=(), operator==(), Mers::Models::Base::BaseModelAssignment::print(), Mers::Models::Base::BaseModelDoubleDomain::registerValue(), Mers::Executives::DeductiveController::DCInterface::step(), Mers::Executives::DeductiveController::Task::Task(), Mers::Executives::DeductiveController::Task::toString(), Mers::Models::Base::BaseModelDoubleDomain::unregisterValue(), and Mers::Models::CCA::Io::Mof::MOFReader::writeText002().

void BaseModelValue::setUID | ( | unsigned int | newUID | ) | `[virtual]`

sets the UID of this value. This is generally the array index of the value in some enclosing value array

Parameters:

  | newUID | the new UID of this value

Definition at line 115 of file BaseModelValue.cpp.

References getDouble(), name, and uid.

Referenced by Mers::Models::Base::BaseModelIntegerDomain::newValue(), Mers::Models::Base::BaseModelValueArray::pushBack(), and Mers::Models::Base::BaseModelDoubleDomain::pushBack().

Here is the call graph for this function:

unsigned int BaseModelValue::getUID | ( |  | ) | const`[virtual]`

returns the current UID of this value.

Returns:
  the UID of this value

Definition at line 129 of file BaseModelValue.cpp.

References uid.

Referenced by Mers::Generators::BFIG::BFIGGenerator::addConflict(), Mers::Executives::DeductiveController::Command::CommandDispatcher::addConnection(), Mers::Estimation::Discrete::ModeEstimation::ModeEstimator::addGuardAssign(), Mers::Generators::BFIG::BFIGAssignment::alternateAssignments(), Mers::Generators::BFIG::BFIGAssignment::alternateAssignmentsTotal(), Mers::Generators::BFIG::BFIGAssignment::alternateValues(), Mers::Models::Base::BaseModelIntegerDomain::getValue(), Mers::Executives::DeductiveController::DCInterface::loadInitialState(), Mers::Executives::DeductiveController::DCInterface::step(), Mers::Executives::DeductiveController::Task::toString(), Mers::Models::Base::BaseModelDoubleDomain::unregisterValue(), and Mers::Solvers::Entailment::GI::GoalInterpreter::variableAndValueToUID().

void BaseModelValue::setDouble | ( | double | newValue | ) | `[virtual]`

sets the double value of this value object, if it has one, or it sets the integer value of this object to the rounded double

Parameters:

  | newValue | the new double value to store in this object

Reimplemented in Mers::Models::Base::BaseModelDoubleValue.

Definition at line 136 of file BaseModelValue.cpp.

References setInteger().

Here is the call graph for this function:

double BaseModelValue::getDouble | ( |  | ) | const`[virtual]`

returns the double value of this value object, if it has one, or it returns the double representation of the integer value (getInteger())

Returns:
  the double value of this value object

Reimplemented in Mers::Models::Base::BaseModelDoubleValue.

Definition at line 143 of file BaseModelValue.cpp.

References getInteger().

Referenced by Mers::Models::Base::BaseModelAssignment::assignmentHolds(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), print(), and setUID().

Here is the call graph for this function:

void BaseModelValue::setInteger | ( | int | newValue | ) | `[virtual]`

sets the integer value of this value object, if it has one

Parameters:

  | newValue | the integer value of this value object

Definition at line 150 of file BaseModelValue.cpp.

References uid, and valueType.

Referenced by setDouble().

int BaseModelValue::getInteger | ( |  | ) | const`[virtual]`

returns the integer value of this value object, if it has one, or it returns the integer representation of the UID

Returns:
  the integer value of this value object

Definition at line 158 of file BaseModelValue.cpp.

References uid.

Referenced by getDouble(), and print().

void BaseModelValue::setDomain | ( | BaseModelDomain * | newDomain | ) | `[virtual]`

sets the domain of this object. This value object will register itself with the new domain and unregister itself with the old domain as appropriate

Parameters:

  | newDomain | the new domain of this value

Reimplemented in Mers::Models::Base::BaseModelDoubleValue.

Definition at line 165 of file BaseModelValue.cpp.

References domain.

Referenced by Mers::Models::Base::BaseModelDomain::pushBack().

BaseModelDomain * BaseModelValue::getDomain | ( |  | ) |

returns the current domain of this value

Returns:
  this value's domain

Definition at line 172 of file BaseModelValue.cpp.

References domain.

Referenced by Mers::Models::Base::BaseModelAssignment::BaseModelAssignment(), Mers::Models::Base::BaseModelDoubleDomain::registerValue(), Mers::Models::Base::BaseModelDoubleDomain::unregisterValue(), and Mers::Solvers::Entailment::GI::GoalInterpreter::variableAndValueToUID().

BaseModelDomain const * BaseModelValue::getDomain | ( |  | ) | const

returns the current domain of this value

Returns:
  this value's domain

Definition at line 179 of file BaseModelValue.cpp.

References domain.

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

copies the other value to this value. The origional data in this value is destroyed. The new copy is registered with the other value's domain as appropriate

Parameters:

  | other | the value supplying the data for this value

Returns:
  the other value

Definition at line 188 of file BaseModelValue.cpp.

References copy().

Here is the call graph for this function:

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

Returns true if the two values have the same double value

Parameters:

  | other | the value being compared to this value

Returns:
  true if the two values are the same (doubleValue() is the same for both)

Definition at line 196 of file BaseModelValue.cpp.

References getDouble(), and getName().

Here is the call graph for this function:

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

Returns false if the two values have the same double value

Parameters:

  | other | the value being compared to this value

Returns:
  false if the two values are the same (doubleValue() is the same for both)

Definition at line 208 of file BaseModelValue.cpp.

References getDouble().

Here is the call graph for this function:

bool BaseModelValue::operator< | ( | BaseModelValue const & | other | ) | const

Returns true if the double value of this object is less than the double value of the other object

Parameters:

  | other | the value being compared to this value

Returns:
  true if this value is less than the other value

Definition at line 216 of file BaseModelValue.cpp.

References getDouble().

Here is the call graph for this function:

bool BaseModelValue::operator<= | ( | BaseModelValue const & | other | ) | const

Returns true if the double value of this object is less than or equal to the double value of the other object

Parameters:

  | other | the value being compared to this value

Returns:
  true if this value is less than the other value

Definition at line 223 of file BaseModelValue.cpp.

References getDouble().

Here is the call graph for this function:

bool BaseModelValue::operator> | ( | BaseModelValue const & | other | ) | const

Returns true if the double value of this object is greater than the double value of the other object

Parameters:

  | other | the value being compared to this value

Returns:
  true if this value is less than the other value

Definition at line 230 of file BaseModelValue.cpp.

References getDouble().

Here is the call graph for this function:

bool BaseModelValue::operator>= | ( | BaseModelValue const & | other | ) | const

Returns true if the double value of this object is greater than or equal to the double value of the other object

Parameters:

  | other | the value being compared to this value

Returns:
  true if this value is less than the other value

Definition at line 237 of file BaseModelValue.cpp.

References getDouble().

Here is the call graph for this function:

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

prints the contents of this value 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

Implements Mers::Utils::Lang::BaseModelObject.

Reimplemented in Mers::Models::Base::BaseModelDoubleValue.

Definition at line 246 of file BaseModelValue.cpp.

References getDouble(), getInteger(), name, and valueType.

Here is the call graph for this function:

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

Destroys the contents of this value object, freeing all allocated memory and reseting all values in preperation for a copy or delete operation. Derived classes should ensure this function is called as well

Reimplemented in Mers::Models::Base::BaseModelDoubleValue.

Definition at line 269 of file BaseModelValue.cpp.

References name.

Referenced by copy(), Mers::Models::Base::BaseModelDoubleValue::destroy(), and ~BaseModelValue().

int BaseModelValue::copy | ( | BaseModelValue const & | value | ) | `[protected, virtual]`

copies the contents of the other value to this value. This destroys the contents of this value

Parameters:

  | value | the value being copied to this value

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

Reimplemented in Mers::Models::Base::BaseModelDoubleValue.

Definition at line 278 of file BaseModelValue.cpp.

References destroy(), domain, name, setName(), uid, valueType, and valueTypeToString().

Referenced by BaseModelValue(), Mers::Models::Base::BaseModelDoubleValue::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/BaseModelValue.h
- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModelValue.cpp