00001 /* 00002 * AbstractState.h 00003 * 00004 * Created on: Jun 14, 2011 00005 * Author: Andreas Hertle 00006 */ 00007 00008 #ifndef ABSTRACTSTATE_H_ 00009 #define ABSTRACTSTATE_H_ 00010 00011 #include <string> 00012 #include <map> 00013 #include "FluentMapping.h" 00014 #include "oplObject.h" 00015 #include "ObjectLookupTable.h" 00016 #include "tfd_modules/module_api/OplCallbackInterface.h" 00017 00018 namespace opl 00019 { 00020 00021 namespace interface 00022 { 00023 00024 //class AbstractModule; 00025 typedef std::map<std::string, FluentMapping*> FluentMappingsType; 00026 typedef std::map<std::string, Object*> ObjectMappingsType; 00027 00028 class AbstractState : public ObjectLookupTable, public OplCallbackInterface 00029 { 00030 protected: 00031 FluentMappingsType fluentMappings; 00032 ObjectMappingsType returnObjectMappings; 00033 ObjectMappingsType objects; 00034 const TimeStampedState* currentState; 00035 00036 AbstractState(); 00037 00038 public: 00039 virtual void initialize() = 0; 00040 void updateFluentMappings(); 00041 void dump() const; 00042 void setCurrentState(const TimeStampedState* currentState){this->currentState = currentState;} 00043 const TimeStampedState* getCurrentState() const {return currentState;} 00044 00045 std::string createKey(const std::string& fluentName, const std::vector<std::string>& arguments) const; 00046 std::string createObjectKey(int index, double value) const; 00047 const FluentMapping* getVariable(const std::string& key) const; 00048 bool getPredicateValue(const FluentMapping* variable) const; 00049 double getNumericValue(const FluentMapping* variable) const; 00050 const Object* getObject(const FluentMapping* variable) const; 00051 00052 friend class AbstractStateFactory; 00053 }; 00054 00055 } 00056 00057 } 00058 00059 #endif /* ABSTRACTSTATE_H_ */