Subversion Repositories HomeAutomation

Rev

Rev 1309 | Rev 1311 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * Message.h
  3.  *
  4.  *  Created on: Apr 25, 2009
  5.  *      Author: Mattias Runge
  6.  */
  7.  
  8. #ifndef MESSAGE_H_
  9. #define MESSAGE_H_
  10.  
  11. #include <string>
  12. #include <vector>
  13. #include <map>
  14. #include "utils/Logger.h"
  15. #include "message/Variable.h"
  16. #include "db/Database.h"
  17.  
  18. using namespace std;
  19. using namespace atom::utils;
  20.  
  21. namespace atom {
  22. namespace message {
  23.  
  24. class Message
  25. {
  26.     typedef std::map<std::string, Variable> variableMap;
  27.     typedef std::vector<std::string> responseList;
  28.  
  29. public:
  30.     typedef boost::shared_ptr<Message> pointer;
  31.  
  32.     Message(string moduletype, unsigned int moduleId, string type);
  33.     Message();
  34.     virtual ~Message();
  35.  
  36.     void setOrigin(const void *origin);
  37.     bool isOrigin(const void *origin);
  38.  
  39.     bool isFromModule();
  40.     string getModuletype();
  41.     unsigned int getModuleId();
  42.     string getType();
  43.     Variable & getVariable(string name);
  44.     responseList getResponses();
  45.  
  46.     void readBits(BitBuffer & buffer);
  47.  
  48. private:
  49.     Logger LOG;
  50.  
  51.     const void *myOrigin;
  52.  
  53.     bool myFromModule;
  54.     string myModuletype;
  55.     unsigned int myModuleId;
  56.     string myType;
  57.     variableMap myVariables;
  58.     responseList myResponses;
  59. };
  60.  
  61. }
  62. }
  63.  
  64. #endif /* MESSAGE_H_ */
  65.