00001 /* 00002 * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 */ 00009 #include "BaseMsg.h" 00010 00011 #include "MessagerAgent.h" 00012 00013 //----------------------------------------------------------------- 00014 /** 00015 * Create msg. 00016 * @param listenerName name of destination 00017 * @param name msg name 00018 */ 00019 BaseMsg::BaseMsg(const std::string &listenerName, const std::string &name) 00020 : m_listenerName(listenerName), m_name(name) 00021 { 00022 /* empty */ 00023 } 00024 //----------------------------------------------------------------- 00025 /** 00026 * Send copy of message. 00027 */ 00028 void 00029 BaseMsg::sendClone() const 00030 { 00031 //NOTE: message type must be preserved 00032 MessagerAgent::agent()->forwardNewMsg(clone()); 00033 } 00034 //----------------------------------------------------------------- 00035 std::string 00036 BaseMsg::toString() const 00037 { 00038 std::string result = m_listenerName; 00039 result.append("->" + m_name); 00040 return result; 00041 }