Subversion Repositories HomeAutomation

Rev

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