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

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

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014
    00015 #ifndef INTERFACES_OBSERVATION_INTERFACE_HEADER_FILE
    00016 #define INTERFACES_OBSERVATION_INTERFACE_HEADER_FILE
    00017
    00018 #include <set>
    00019 #include <map>
    00020 #include <Mers/Utils/Exceptions/RuntimeException.h>
    00021 #include <Mers/Utils/Exceptions/IllegalArgumentException.h>
    00022
    00023 namespace Mers {
    00024         namespace Interfaces {
    00025
    00026                 class ContinuousVariable;
    00027                 class DiscreteVariable;
    00028                 class DiscreteValue;
    00029                 class ObservationUpdateListener;
    00030
    00037                 class ObservationInterface
    00038                 {
    00039                 public:
    00040                         typedef DiscreteValue * ValueIdentifier;
    00041                         typedef DiscreteVariable * DiscreteVariableIdentifier;
    00042                         typedef ContinuousVariable * ContinuousVariableIdentifier;
    00043
    00047                         ObservationInterface();
    00048
    00052                         virtual ~ObservationInterface();
    00053
    00064                         virtual DiscreteVariableIdentifier getDiscreteVariable(const char * varName);
    00065
    00076                         virtual ContinuousVariableIdentifier getContinuousVariable(const char * varName);
    00077
    00092                         virtual ValueIdentifier getValue(DiscreteVariableIdentifier varID, const char * value);
    00093
    00101                         virtual bool isValid(DiscreteVariableIdentifier varID);
    00102
    00110                         virtual bool isValid(ContinuousVariableIdentifier varID);
    00111
    00119                         virtual bool isValid(ValueIdentifier value);
    00120
    00129                         virtual bool isCurrentState(ValueIdentifier value);
    00130
    00141                         virtual ValueIdentifier getCurrentState(DiscreteVariableIdentifier varID) = 0;
    00142
    00153                         virtual double getCurrentState(ContinuousVariableIdentifier varID) = 0;
    00154
    00162                         virtual void addUpdateListener(ObservationUpdateListener * listener);
    00163
    00164                 protected:
    00171                         virtual void updateListeners(ValueIdentifier value);
    00172
    00181                         virtual void updateListeners(ContinuousVariableIdentifier varID, double value);
    00182
    00188                         virtual void addDiscreteVariable(DiscreteVariable * var);
    00189
    00195                         virtual void addContinuousVariable(ContinuousVariable * var);
    00196
    00207                         virtual void addDiscreteValue(DiscreteValue * value)
    00208                                 throw(Mers::Utils::Exceptions::IllegalArgumentException,
    00209                                 Mers::Utils::Exceptions::RuntimeException);
    00210
    00211                 protected:
    00213                         std::set<ObservationUpdateListener *> mListeners;
    00214
    00216                         std::set<DiscreteVariable *> mDiscreteVars;
    00217
    00219                         std::set<ContinuousVariable *> mContinuousVars;
    00220
    00222                         std::set<DiscreteValue *> mDiscreteValues;
    00223
    00225                         typedef std::map<DiscreteVariableIdentifier, std::set<DiscreteValue *> *>
    00226                         DiscreteValueMap;
    00227
    00230                          DiscreteValueMap mDiscreteValueMap;
    00231                 };
    00232         }
    00233 }
    00234
    00235 #endif
    00236