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

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

# Mers::Interfaces::ObservationInterface Class Reference

`#include <ObservationInterface.h>`

Inheritance diagram for Mers::Interfaces::ObservationInterface:

[legend]
List of all members.

## Public Types
typedef DiscreteValue * | ValueIdentifier
typedef DiscreteVariable * | DiscreteVariableIdentifier
typedef ContinuousVariable * | ContinuousVariableIdentifier
## Public Member Functions
| ObservationInterface ()
virtual | ~ObservationInterface ()
virtual DiscreteVariableIdentifier | getDiscreteVariable (const char *varName)
virtual ContinuousVariableIdentifier | getContinuousVariable (const char *varName)
virtual ValueIdentifier | getValue (DiscreteVariableIdentifier varID, const char *value)
virtual bool | isValid (DiscreteVariableIdentifier varID)
virtual bool | isValid (ContinuousVariableIdentifier varID)
virtual bool | isValid (ValueIdentifier value)
virtual bool | isCurrentState (ValueIdentifier value)
virtual ValueIdentifier | getCurrentState (DiscreteVariableIdentifier varID)=0
virtual double | getCurrentState (ContinuousVariableIdentifier varID)=0
virtual void | addUpdateListener (ObservationUpdateListener *listener)
## Protected Types
typedef std::map< DiscreteVariableIdentifier, std::set< DiscreteValue * > * > | DiscreteValueMap
| A type that describes our internal ValueMap representation.
## Protected Member Functions
virtual void | updateListeners (ValueIdentifier value)
virtual void | updateListeners (ContinuousVariableIdentifier varID, double value)
virtual void | addDiscreteVariable (DiscreteVariable *var)
virtual void | addContinuousVariable (ContinuousVariable *var)
virtual void | addDiscreteValue (DiscreteValue *value) throw (Mers::Utils::Exceptions::IllegalArgumentException, Mers::Utils::Exceptions::RuntimeException)
## Protected Attributes
std::set< ObservationUpdateListener * > | mListeners
| The set of all ObservationUpdateListeners.
std::set< DiscreteVariable * > | mDiscreteVars
| The list of all available discrete variables.
std::set< ContinuousVariable * > | mContinuousVars
| The list of all available continuous variables.
std::set< DiscreteValue * > | mDiscreteValues
| The lsit of all available discrete values.
DiscreteValueMap | mDiscreteValueMap

## Detailed Description

This class defines the standard interface for querying observations.

Author:
  Paul H. Elliott

Definition at line 37 of file ObservationInterface.h.

## Constructor & Destructor Documentation

ObservationInterface::ObservationInterface | ( |  | ) |

Constructs a new Observation Interface.

Definition at line 31 of file ObservationInterface.cpp.

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

Destroys this object.

Definition at line 37 of file ObservationInterface.cpp.

## Member Function Documentation

ObservationInterface::DiscreteVariableIdentifier ObservationInterface::getDiscreteVariable | ( | const char * | varName | ) | `[virtual]`

Obtains the DiscreteVariableIdentifier for the named discrete variable.

Parameters:

  | varName | The name of the descrete variable desired.

Returns:
  The variable identifier of the requested variable or an invalid variable identifier if the variable did not exist. The validity of an identifier can be checked with isValid().

Reimplemented in Mers::Executives::DeductiveController::DCInterface.

Definition at line 62 of file ObservationInterface.cpp.

References mDiscreteVars.

ObservationInterface::ContinuousVariableIdentifier ObservationInterface::getContinuousVariable | ( | const char * | varName | ) | `[virtual]`

Obtains the ContinuousVariableIdentifier for the named continuous variable.

Parameters:

  | varName | The name of the continuous variable desired.

Returns:
  The variable identifier of the requested variable or an invalid variable identifier if the variable did not exist. The validity of an identifier can be checked with isValid().

Definition at line 70 of file ObservationInterface.cpp.

References mContinuousVars.

Referenced by Mers::Executives::DeductiveController::Observation::DiscreteObservationConverter::initialize().

ObservationInterface::ValueIdentifier ObservationInterface::getValue | ( | DiscreteVariableIdentifier | varID,
|  | const char * | value |
| ) |  |  | `[virtual]`

Returns the value identifier requested from the specified variable identifier, if it exists.

Parameters:

  | varID | The DiscreteVariableIdentifier of the variable for which we wish to obtain the named value.
  | value | The name of the value we wish to look up.

Returns:
  The value identifier of the requested value associated with the specified variable or an invalid value of the variable contained no such named value. The validity of an identifier can be checked with isValid();

Reimplemented in Mers::Executives::DeductiveController::DCInterface.

Definition at line 78 of file ObservationInterface.cpp.

References mDiscreteValueMap.

bool ObservationInterface::isValid | ( | DiscreteVariableIdentifier | varID | ) | `[virtual]`

Returns true if this is a valid variable.

Parameters:

  | varID | The variable identifier that is being verified.

Returns:
  True if the VariableIdentifier reflects a valid variable.

Reimplemented in Mers::Executives::DeductiveController::DCInterface.

Definition at line 91 of file ObservationInterface.cpp.

Referenced by Mers::Executives::DeductiveController::Observation::DiscreteObservationConverter::initialize().

bool ObservationInterface::isValid | ( | ContinuousVariableIdentifier | varID | ) | `[virtual]`

Returns true if this is a valid variable.

Parameters:

  | varID | The variable identifier that is being verified.

Returns:
  True if the VariableIdentifier reflects a valid variable.

Definition at line 98 of file ObservationInterface.cpp.

bool ObservationInterface::isValid | ( | ValueIdentifier | value | ) | `[virtual]`

Returns true if this is a valid value.

Parameters:

  | value | The value identifier that is being verified.

Returns:
  True if the ValueIdentifier reflects a valid task.

Reimplemented in Mers::Executives::DeductiveController::DCInterface.

Definition at line 105 of file ObservationInterface.cpp.

bool ObservationInterface::isCurrentState | ( | ValueIdentifier | value | ) | `[virtual]`

Returns true if the specified value matches the most likely state of its associated variable.

Parameters:

  | valID | The value that is being checked.

Returns:
  True if the most likely state matches this value.

Definition at line 112 of file ObservationInterface.cpp.

References getCurrentState(), and Mers::Interfaces::DiscreteValue::getVariable().

Here is the call graph for this function:

virtual ValueIdentifier Mers::Interfaces::ObservationInterface::getCurrentState | ( | DiscreteVariableIdentifier | varID | ) | `[pure virtual]`

Returns the most likely state of the specified variable. Note that it is guaranteed that this ValueIdentifier will be equal using == to another ValueIdentifier if and only if the states are the same.

Parameters:

  | varID | The identifier of the variable.

Returns:
  The ValueIdentifier of the most likely state.

Implemented in Mers::Executives::DeductiveController::DCInterface, and Mers::Executives::DeductiveController::Observation::DiscreteObservationConverter.

Referenced by isCurrentState().

virtual double Mers::Interfaces::ObservationInterface::getCurrentState | ( | ContinuousVariableIdentifier | varID | ) | `[pure virtual]`

Returns the most likely state of the specified variable. Note that it is guaranteed that this ValueIdentifier will be equal using == to another ValueIdentifier if and only if the states are the same.

Parameters:

  | varID | The identifier of the variable.

Returns:
  The ValueIdentifier of the most likely state.

Implemented in Mers::Executives::DeductiveController::DCInterface, and Mers::Executives::DeductiveController::Observation::DiscreteObservationConverter.

void ObservationInterface::addUpdateListener | ( | ObservationUpdateListener * | listener | ) | `[virtual]`

Adds an update listener. This listener will be called with incremental updates to the most likely state.

Parameters:

  | listener | The update listener that will now be listening to this interface.

Definition at line 120 of file ObservationInterface.cpp.

References mListeners.

void ObservationInterface::updateListeners | ( | ValueIdentifier | value | ) | `[protected, virtual]`

Updates all listeners that the variable associated with value has changed state such that value is the most likely state.

Parameters:

  | value | The new value of the variable.

Definition at line 127 of file ObservationInterface.cpp.

References mListeners.

Referenced by Mers::Executives::DeductiveController::Observation::DiscreteObservationConverter::observe(), Mers::Executives::DeductiveController::DCInterface::post_mode_estimate(), and Mers::Executives::DeductiveController::DCInterface::post_observation().

void ObservationInterface::updateListeners | ( | ContinuousVariableIdentifier | varID,
|  | double | value |
| ) |  |  | `[protected, virtual]`

Updates all listeners that the variable varID has changed state such that value is the most likely state.

Parameters:

  | varID | The variable who's value has changed.
  | value | The new value of the variable.

Definition at line 138 of file ObservationInterface.cpp.

References mListeners.

void ObservationInterface::addDiscreteVariable | ( | DiscreteVariable * | var | ) | `[protected, virtual]`

Adds a new Variable to the list of discrete variable identifiers.

Parameters:

  | var | The variable being added.

Definition at line 149 of file ObservationInterface.cpp.

References mDiscreteValueMap, and mDiscreteVars.

void ObservationInterface::addContinuousVariable | ( | ContinuousVariable * | var | ) | `[protected, virtual]`

Adds a new Variable to the list of continuous variable identifiers.

Parameters:

  | var | The variable being added.

Definition at line 159 of file ObservationInterface.cpp.

References mContinuousVars.

Referenced by Mers::Executives::DeductiveController::Observation::DiscreteObservationConverter::initialize().

void ObservationInterface::addDiscreteValue | ( | DiscreteValue * | value | ) | throw (Mers::Utils::Exceptions::IllegalArgumentException, Mers::Utils::Exceptions::RuntimeException)`[protected, virtual]`

Adds a new Value to the list of discrete value identifiers.

Parameters:

  | value | The value being added.

Exceptions:

  | IllegalArgumentException | If the variable of the value was not already inserted or if the value was NULL.
  | RuntimeException | If the data structure was corrupted.

Definition at line 166 of file ObservationInterface.cpp.

Referenced by Mers::Executives::DeductiveController::Observation::DiscreteObservationConverter::instantiateDomainData().

## Member Data Documentation

DiscreteValueMap Mers::Interfaces::ObservationInterface::mDiscreteValueMap`[protected]`

A map that maps discrete variable identifiers into a set of discrete values

Definition at line 230 of file ObservationInterface.h.

Referenced by addDiscreteVariable(), and getValue().

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

- /Users/fpy/titan-1-5-MBARI/Mers/Interfaces/ObservationInterface.h
- /Users/fpy/titan-1-5-MBARI/Mers/Interfaces/ObservationInterface.cpp