Base class for dispatcher in observer pattern. More...
#include <Dispatcher.hxx>


Public Member Functions | |
| virtual void | dispatch (Node *object, const std::string &event) |
| virtual void | dispatch2 (Node *object, const std::string &event, void *something) |
| virtual void | dispatchFromClone (Node *originalInstance, const std::string &event, Node *clonedInstanceGeneratingEvent) |
| virtual void | addObserver (Observer *observer, Node *object, const std::string &event) |
| virtual void | removeObserver (Observer *observer, Node *object, const std::string &event) |
| virtual void | printObservers () |
| virtual | ~Dispatcher () |
Static Public Member Functions | |
| static Dispatcher * | getDispatcher () |
| static void | setDispatcher (Dispatcher *dispatcher) |
Protected Attributes | |
| std::map< std::pair< Node *, std::string >, std::set< Observer * > > | _observers |
Static Protected Attributes | |
| static Dispatcher * | _singleton = 0 |
Base class for dispatcher in observer pattern.
Dispatcher and Observer objects can be used to be notified about events that occurs in editing or executing a calculation schema.
When an object wants to notify an event, it calls the dispatch method of the dispatcher with 2 arguments : the object reference and an event type. The dispatcher which is a singleton is obtained by calling the class method getDispatcher. The dispatcher notifies all the registered observers by calling their notifyObserver method.
Observers can be registered by calling the addObserver method with two arguments : an object reference and an event type. This observer will be notify with events coming only from this object.
Limitation : emitting objects can be only Node
Definition at line 73 of file Dispatcher.hxx.
|
virtual |
|
virtual |
Definition at line 125 of file Dispatcher.cxx.
References _observers.
Referenced by DefineCustomObservers(), and YACS::HMI::SubjectNode::SubjectNode().
|
virtual |
Reimplemented in MyDispatcher, and YACS::ENGINE::SALOMEDispatcher.
Definition at line 85 of file Dispatcher.cxx.
References _observers, and DEBTRACE.
Referenced by YACS::ENGINE::Executor::sendEvent(), and YACS::ENGINE::Node::sendEvent().
|
virtual |
Definition at line 99 of file Dispatcher.cxx.
References _observers.
Referenced by YACS::ENGINE::Node::sendEvent2().
|
virtual |
Definition at line 112 of file Dispatcher.cxx.
References _observers.
Referenced by YACS::ENGINE::Node::sendEvent().
|
static |
Definition at line 55 of file Dispatcher.cxx.
References _singleton.
Referenced by Yacs_i::addObserver(), main(), YACS::ENGINE::Executor::sendEvent(), YACS::ENGINE::Node::sendEvent(), and YACS::ENGINE::Node::sendEvent2().
|
virtual |
Definition at line 69 of file Dispatcher.cxx.
References _observers, and yacsorb.CORBAEngineTest::i.
|
virtual |
Definition at line 131 of file Dispatcher.cxx.
References _observers.
Referenced by PluginObserverKeeper::clean().
|
static |
Definition at line 64 of file Dispatcher.cxx.
References _singleton, and gui.CItems::dispatcher.
Referenced by main(), and YACS::ENGINE::SALOMEDispatcher::setSALOMEDispatcher().
|
protected |
Definition at line 86 of file Dispatcher.hxx.
Referenced by addObserver(), dispatch(), dispatch2(), dispatchFromClone(), printObservers(), and removeObserver().
|
staticprotected |
Definition at line 87 of file Dispatcher.hxx.
Referenced by getDispatcher(), setDispatcher(), and ~Dispatcher().