summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp99
1 files changed, 99 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp
new file mode 100644
index 00000000000..255cd09c057
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp
@@ -0,0 +1,99 @@
+// $Id$
+
+#include "Event_Map_Observer_T.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "Event_Map_Observer_T.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(Notify, TAO_Event_Map_Observer_T, "$id$")
+
+#include "Proxy.h"
+#include "Peer.h"
+#include "Dispatch_Observer_T.h"
+#include "orbsvcs/ESF/ESF_Proxy_Collection.h"
+#include "Event_Map_T.h"
+
+/******************************************************************************************/
+
+template <class PROXY>
+TAO_NS_Update_Added_Worker<PROXY>::TAO_NS_Update_Added_Worker (const TAO_NS_EventType& event_type, TAO_NS_Updates_Dispatch_Observer* dispatch_observer)
+ :event_type_ (event_type), dispatch_observer_ (dispatch_observer)
+{
+}
+
+template <class PROXY> void
+TAO_NS_Update_Added_Worker<PROXY>::work (PROXY* proxy ACE_ENV_ARG_DECL)
+{
+ proxy->peer()->type_added (this->event_type_);
+ this->dispatch_observer_->enqueue (proxy->peer()); // Tell the observer that this peer has a update pending.
+}
+
+/******************************************************************************************/
+
+template <class PROXY>
+TAO_NS_Update_Removed_Worker<PROXY>::TAO_NS_Update_Removed_Worker (const TAO_NS_EventType& event_type, TAO_NS_Updates_Dispatch_Observer* dispatch_observer)
+ :event_type_ (event_type), dispatch_observer_ (dispatch_observer)
+{
+}
+
+template <class PROXY> void
+TAO_NS_Update_Removed_Worker<PROXY>::work (PROXY* proxy ACE_ENV_ARG_DECL)
+{
+ proxy->peer()->type_removed (this->event_type_);
+ this->dispatch_observer_->enqueue (proxy->peer()); // Tell the observer that this peer has a update pending.
+}
+
+/******************************************************************************************/
+
+template <class PROXY>
+TAO_NS_Event_Map_Observer_T<PROXY>::TAO_NS_Event_Map_Observer_T (void)
+ :event_map_ (0), dispatch_observer_ (0)
+{
+}
+
+template <class PROXY>
+TAO_NS_Event_Map_Observer_T<PROXY>::~TAO_NS_Event_Map_Observer_T ()
+{
+}
+
+template <class PROXY> void
+TAO_NS_Event_Map_Observer_T<PROXY>::init (EVENT_MAP* event_map, TAO_NS_Updates_Dispatch_Observer* dispatch_observer)
+{
+ this->event_map_ = event_map;
+ this->dispatch_observer_ = dispatch_observer;
+}
+
+template <class PROXY> void
+TAO_NS_Event_Map_Observer_T<PROXY>::type_added (const TAO_NS_EventType& event_type)
+{
+ UPDATE_ADDED_WORKER worker (event_type, this->dispatch_observer_);
+
+ PROXY_COLLECTION* proxys = this->event_map_->find (event_type ACE_ENV_ARG_PARAMETER);
+
+ if (proxys != 0)
+ proxys->for_each (&worker ACE_ENV_ARG_PARAMETER);
+
+ // Get the default broadcast collection.
+ proxys = this->event_map_->broadcast_collection ();
+
+ if (proxys != 0)
+ proxys->for_each (&worker ACE_ENV_ARG_PARAMETER);
+}
+
+template <class PROXY> void
+TAO_NS_Event_Map_Observer_T<PROXY>::type_removed (const TAO_NS_EventType& event_type)
+{
+ UPDATE_REMOVED_WORKER worker (event_type, this->dispatch_observer_);
+
+ PROXY_COLLECTION* proxys = this->event_map_->find (event_type ACE_ENV_ARG_PARAMETER);
+
+ if (proxys != 0)
+ proxys->for_each (&worker ACE_ENV_ARG_PARAMETER);
+
+ // Get the default broadcast collection.
+ proxys = this->event_map_->broadcast_collection ();
+
+ if (proxys != 0)
+ proxys->for_each (&worker ACE_ENV_ARG_PARAMETER);
+}