Debian Codegraph @

src/gengine/BaseMsg.cpp

raw
1 /*
2 * Copyright (C) 2004 Ivo Danihelka ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9 #include "BaseMsg.h"
10
11 #include "MessagerAgent.h"
12
13 //-----------------------------------------------------------------
14 /**
15 * Create msg.
16 * @param listenerName name of destination
17 * @param name msg name
18 */
19 BaseMsg::BaseMsg(const std::string &listenerName, const std::string &name)
20 : m_listenerName(listenerName), m_name(name)
21 {
22 /* empty */
23 }
24 //-----------------------------------------------------------------
25 /**
26 * Send copy of message.
27 */
28 void
29 BaseMsg::sendClone() const
30 {
31 //NOTE: message type must be preserved
32 MessagerAgent::agent()->forwardNewMsg(clone());
33 }
34 //-----------------------------------------------------------------
35 std::string
36 BaseMsg::toString() const
37 {
38 std::string result = m_listenerName;
39 result.append("->" + m_name);
40 return result;
41 }