Debian Codegraph @

src/gengine/BaseMsg.h

raw
1 #ifndef HEADER_BASEMSG_H
2 #define HEADER_BASEMSG_H
3
4 class BaseListener;
5
6 #include <string>
7
8 /**
9 * Messgage.
10 */
11 class BaseMsg {
12 protected:
13 std::string m_listenerName;
14 std::string m_name;
15 public:
16 BaseMsg(const std::string &listenerName, const std::string &name);
17 virtual ~BaseMsg() {}
18 virtual BaseMsg *clone() const = 0;
19 virtual void sendActual(BaseListener *listener) const = 0;
20
21 void sendClone() const;
22 bool equalsName(const std::string &name) const
23 { return m_name == name; }
24 const std::string &getMsgName() const { return m_name; }
25 const std::string &getListenerName() const { return m_listenerName; }
26
27 virtual std::string toString() const;
28 };
29
30 /**
31 * Allow clone typed message.
32 */
33 #define CLONE(TYPE) \
34 virtual TYPE *clone() const { return new TYPE(*this); }
35
36 #endif