00001 #ifndef HEADER_BASEMSG_H 00002 #define HEADER_BASEMSG_H 00003 00004 class BaseListener; 00005 00006 #include <string> 00007 00008 /** 00009 * Messgage. 00010 */ 00011 class BaseMsg { 00012 protected: 00013 std::string m_listenerName; 00014 std::string m_name; 00015 public: 00016 BaseMsg(const std::string &listenerName, const std::string &name); 00017 virtual ~BaseMsg() {} 00018 virtual BaseMsg *clone() const = 0; 00019 virtual void sendActual(BaseListener *listener) const = 0; 00020 00021 void sendClone() const; 00022 bool equalsName(const std::string &name) const 00023 { return m_name == name; } 00024 const std::string &getMsgName() const { return m_name; } 00025 const std::string &getListenerName() const { return m_listenerName; } 00026 00027 virtual std::string toString() const; 00028 }; 00029 00030 /** 00031 * Allow clone typed message. 00032 */ 00033 #define CLONE(TYPE) \ 00034 virtual TYPE *clone() const { return new TYPE(*this); } 00035 00036 #endif