Debian Codegraph @

src/gengine/BaseListener.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 "BaseListener.h"
10
11 #include "OptionAgent.h"
12 #include "UnknownMsgException.h"
13 #include "SimpleMsg.h"
14 #include "IntMsg.h"
15 #include "StringMsg.h"
16
17 //-----------------------------------------------------------------
18 /**
19 * Register self as watcher for param.
20 * String msg param_changed(param) will be send when param has changed.
21 */
22 void
23 BaseListener::registerWatcher(const std::string &param)
24 {
25 StringMsg *event = new StringMsg(this, "param_changed", param);
26 OptionAgent::agent()->addWatcher(param, event);
27 }
28 //-----------------------------------------------------------------
29 void
30 BaseListener::removeWatchers()
31 {
32 OptionAgent::agent()->removeWatchers(getName());
33 }
34 //-----------------------------------------------------------------
35 /**
36 * @throws UnknownMsgException
37 */
38 void
39 BaseListener::receiveSimple(const SimpleMsg *msg)
40 {
41 throw UnknownMsgException(msg);
42 }
43 //-----------------------------------------------------------------
44 /**
45 * @throws UnknownMsgException
46 */
47 void
48 BaseListener::receiveInt(const IntMsg *msg)
49 {
50 throw UnknownMsgException(msg);
51 }
52 //-----------------------------------------------------------------
53 /**
54 * @throws UnknownMsgException
55 */
56 void
57 BaseListener::receiveString(const StringMsg *msg)
58 {
59 throw UnknownMsgException(msg);
60 }
61
62