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 "BaseListener.h" 00010 00011 #include "OptionAgent.h" 00012 #include "UnknownMsgException.h" 00013 #include "SimpleMsg.h" 00014 #include "IntMsg.h" 00015 #include "StringMsg.h" 00016 00017 //----------------------------------------------------------------- 00018 /** 00019 * Register self as watcher for param. 00020 * String msg param_changed(param) will be send when param has changed. 00021 */ 00022 void 00023 BaseListener::registerWatcher(const std::string ¶m) 00024 { 00025 StringMsg *event = new StringMsg(this, "param_changed", param); 00026 OptionAgent::agent()->addWatcher(param, event); 00027 } 00028 //----------------------------------------------------------------- 00029 void 00030 BaseListener::removeWatchers() 00031 { 00032 OptionAgent::agent()->removeWatchers(getName()); 00033 } 00034 //----------------------------------------------------------------- 00035 /** 00036 * @throws UnknownMsgException 00037 */ 00038 void 00039 BaseListener::receiveSimple(const SimpleMsg *msg) 00040 { 00041 throw UnknownMsgException(msg); 00042 } 00043 //----------------------------------------------------------------- 00044 /** 00045 * @throws UnknownMsgException 00046 */ 00047 void 00048 BaseListener::receiveInt(const IntMsg *msg) 00049 { 00050 throw UnknownMsgException(msg); 00051 } 00052 //----------------------------------------------------------------- 00053 /** 00054 * @throws UnknownMsgException 00055 */ 00056 void 00057 BaseListener::receiveString(const StringMsg *msg) 00058 { 00059 throw UnknownMsgException(msg); 00060 } 00061 00062