Subversion Repositories HomeAutomation

Rev

Rev 1315 | Rev 1326 | 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 "log/Logger.h"
  15. #include "message/Variable.h"
  16. #include "message/Header.h"
  17. #include "protocol/Protocol.h"
  18. #include "utils/convert.h"
  19.  
  20. using namespace std;
  21.  
  22. namespace atom {
  23. namespace message {
  24.  
  25. class Message
  26. {
  27.     typedef std::map<std::string, Variable> variableMap;
  28.     typedef std::vector<std::string> responseList;
  29.  
  30. public:
  31.     typedef boost::shared_ptr<Message> pointer;
  32.  
  33.     Message(Header header);
  34.     Message();
  35.     virtual ~Message();
  36.  
  37.     void setOrigin(const void *origin);
  38.     bool isOrigin(const void *origin);
  39.  
  40.     Header & getHeader();
  41.     Variable & getVariable(string name);
  42.     responseList getResponses();
  43.  
  44.     void readBits(BitBuffer & buffer);
  45.     void writeBits(BitBuffer & buffeer);
  46.  
  47. private:
  48.     log::Logger LOG;
  49.  
  50.     const void *myOrigin;
  51.  
  52.     Header myHeader;
  53.     variableMap myVariables;
  54.     responseList myResponses;
  55. };
  56.  
  57. }
  58. }
  59.  
  60. #endif /* MESSAGE_H_ */
  61.