Definition at line 14 of file MessagerAgent.h.
Public Member Functions | |
void | addListener (BaseListener *listener) |
Remember listener under his name. | |
void | removeListener (const std::string &name) |
Forget listener. | |
void | forwardNewMsg (BaseMsg *msg) |
Forward message to her destination. |
|
Remember listener under his name. NOTE: listeners may be added before own_init()
Definition at line 26 of file MessagerAgent.cpp. 00027 { 00028 m_listeners[listener->getName()] = listener; 00029 }
|
|
Forward message to her destination.
Definition at line 47 of file MessagerAgent.cpp. 00048 { 00049 std::auto_ptr<BaseMsg> sure_delete(msg); 00050 00051 const std::string &listenerName = msg->getListenerName(); 00052 LOG_DEBUG(ExInfo("received new message") 00053 .addInfo("msg", msg->toString())); 00054 00055 t_listeners::iterator it = m_listeners.find(listenerName); 00056 if (m_listeners.end() == it) { 00057 throw NameException(ExInfo("cannot find listener") 00058 .addInfo("name", listenerName)); 00059 } 00060 00061 msg->sendActual(it->second); 00062 }
|
|
Forget listener.
Definition at line 36 of file MessagerAgent.cpp. 00037 { 00038 m_listeners.erase(listenerName); 00039 }
|