Subversion Repositories HomeAutomation

Rev

Rev 1310 | 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 "../utils/Logger.h"
  14. #include <map>
  15. #include "Variable.h"
  16.  
  17. using namespace std;
  18. using namespace atom::utils;
  19.  
  20. namespace atom {
  21. namespace message {
  22.  
  23. class Message
  24. {
  25.     typedef std::map<std::string, Variable> variableMap;
  26.     typedef std::vector<std::string> responseList;
  27.  
  28. public:
  29.     typedef boost::shared_ptr<Message> pointer;
  30.  
  31.     Message(string moduletype, unsigned int moduleId, string type);
  32.     Message();
  33.     virtual ~Message();
  34.  
  35.     void setOrigin(const void *origin);
  36.     bool isOrigin(const void *origin);
  37.  
  38.     bool isFromModule();
  39.     string getModuletype();
  40.     unsigned int getModuleId();
  41.     string getType();
  42.     Variable & getVariable(string name);
  43.     responseList getResponses();
  44.  
  45.     void readBits(BitBuffer & buffer);
  46.  
  47. private:
  48.     Logger LOG;
  49.  
  50.     const void *myOrigin;
  51.  
  52.     bool myFromModule;
  53.     string myModuletype;
  54.     unsigned int myModuleId;
  55.     string myType;
  56.     variableMap myVariables;
  57.     responseList myResponses;
  58. };
  59.  
  60. }
  61. }
  62.  
  63. #endif /* MESSAGE_H_ */
  64.