11 class COptionEventBus;
14 template<typename ValueType>COptionEvent(const std::string& k,
20 bool get_bool() const;
21 std::string get_string() const;
22 std::vector<std::string> get_string_list() const;
23 std::vector<string_pair> get_string_pair_list() const;
26 * string_pair get_string_pair() const;
27 * std::vector<bool> get_bool_list() const;
28 * std::vector<int> get_int_list() const;
36 variant_(const std::string&);
38 variant_(const std::vector<std::string>&);
39 variant_(const std::vector<string_pair>&);
44 std::vector<std::string> d_strings;
45 std::vector<string_pair> d_string_pair_list;
60 class EXPORTED IConfigurable
66 * onConfigChanged will be called whenever an option is changed
67 * @param event presents the changed option
68 * @return true if the event is consumed, and not intented to be
69 * sent to another event listener, false otherwise.
71 virtual bool onConfigChanged(const COptionEvent&) { return false; }
78 * listener will receive a message whenever an option is changed
79 * @param listener who is interested in a change of options
81 void registerAsListener(IConfigurable* listener);
84 * remove listener from the subscriber list
85 * @param listener who is no more interested in a change of options
87 void unregisterAsListener(IConfigurable* listener);
90 * publish an event to all listeners of this event bus
91 * @param event the event which presents an option change
93 void publishEvent(const COptionEvent& event);
94 template<class> friend class SingletonHolder;
99 typedef std::list<IConfigurable*> Subscribers;
100 Subscribers m_listeners;
103 typedef SingletonHolder<COptionEventBus> AOptionEventBus;
105 #endif // _IMI_SESSION_H