Author: rco
Date: 2008-06-12 16:43:58 +0200 (Thu, 12 Jun 2008)
New Revision: 1018

Modified:
   trunk/core/AmEventDispatcher.cpp
   trunk/core/AmEventDispatcher.h
   trunk/core/AmEventQueue.h
   trunk/core/AmSessionContainer.cpp
Log:
- allows for AmEventQueue proxies (inherit from AmEventQueueInterface instead 
of AmEventQueue).


Modified: trunk/core/AmEventDispatcher.cpp
===================================================================
--- trunk/core/AmEventDispatcher.cpp    2008-06-12 11:02:55 UTC (rev 1017)
+++ trunk/core/AmEventDispatcher.cpp    2008-06-12 14:43:58 UTC (rev 1018)
@@ -36,7 +36,7 @@
 }
 
 bool AmEventDispatcher::addEventQueue(const string& local_tag, 
-                                     AmEventQueue* q,
+                                     AmEventQueueInterface* q,
                                      const string& callid, 
                                      const string& remote_tag)
 {
@@ -63,11 +63,11 @@
     return exists;
 }
 
-AmEventQueue* AmEventDispatcher::delEventQueue(const string& local_tag,
-                                              const string& callid, 
-                                              const string& remote_tag)
+AmEventQueueInterface* AmEventDispatcher::delEventQueue(const string& 
local_tag,
+                                                       const string& callid, 
+                                                       const string& 
remote_tag)
 {
-    AmEventQueue* q = NULL;
+    AmEventQueueInterface* q = NULL;
     
     m_queues.lock();
     

Modified: trunk/core/AmEventDispatcher.h
===================================================================
--- trunk/core/AmEventDispatcher.h      2008-06-12 11:02:55 UTC (rev 1017)
+++ trunk/core/AmEventDispatcher.h      2008-06-12 14:43:58 UTC (rev 1018)
@@ -35,8 +35,8 @@
 {
 public:
 
-    typedef std::map<string, AmEventQueue*> EvQueueMap;
-    typedef EvQueueMap::iterator            EvQueueMapIter;
+    typedef std::map<string, AmEventQueueInterface*> EvQueueMap;
+    typedef EvQueueMap::iterator                     EvQueueMapIter;
     
     typedef std::map<string,string>  Dictionnary;
     typedef Dictionnary::iterator    DictIter;
@@ -73,13 +73,13 @@
     bool post(const string& callid, const string& remote_tag, AmEvent* ev);
 
     bool addEventQueue(const string& local_tag, 
-                      AmEventQueue* q,
+                      AmEventQueueInterface* q,
                       const string& callid="", 
                       const string& remote_tag="");
 
-    AmEventQueue* delEventQueue(const string& local_tag,
-                               const string& callid="", 
-                               const string& remote_tag="");
+    AmEventQueueInterface* delEventQueue(const string& local_tag,
+                                        const string& callid="", 
+                                        const string& remote_tag="");
 };
 
 #endif

Modified: trunk/core/AmEventQueue.h
===================================================================
--- trunk/core/AmEventQueue.h   2008-06-12 11:02:55 UTC (rev 1017)
+++ trunk/core/AmEventQueue.h   2008-06-12 14:43:58 UTC (rev 1018)
@@ -33,6 +33,13 @@
 
 #include <queue>
 
+class AmEventQueueInterface
+{
+ public:
+  virtual ~AmEventQueueInterface() {}
+  virtual void postEvent(AmEvent*)=0;
+};
+
 /** 
  * \brief Asynchronous event queue implementation 
  * 
@@ -41,7 +48,7 @@
  * thread, which are then processed by the registered event
  *  handler.
  */
-class AmEventQueue
+class AmEventQueue: public AmEventQueueInterface
 {
 protected:
   AmEventHandler*   handler;
@@ -53,7 +60,7 @@
   AmEventQueue(AmEventHandler*);
   virtual ~AmEventQueue();
 
-  virtual void postEvent(AmEvent*);
+  void postEvent(AmEvent*);
   void processEvents();
   void waitForEvent();
   void processSingleEvent();

Modified: trunk/core/AmSessionContainer.cpp
===================================================================
--- trunk/core/AmSessionContainer.cpp   2008-06-12 11:02:55 UTC (rev 1017)
+++ trunk/core/AmSessionContainer.cpp   2008-06-12 14:43:58 UTC (rev 1018)
@@ -141,16 +141,16 @@
 void AmSessionContainer::destroySession(const string& local_tag)
 {
     AmSession* s = NULL;
-    AmEventQueue* q = AmEventDispatcher::instance()->
-       delEventQueue(local_tag);
+    AmEventQueueInterface* q = AmEventDispatcher::instance()->
+      delEventQueue(local_tag);
     
     if(q &&
        (s = dynamic_cast<AmSession*>(q))) {
-       
-       stopAndQueue(s);
+      
+      stopAndQueue(s);
     }
     else {
-       DBG("could not remove session: id not found or wrong type\n");
+      DBG("could not remove session: id not found or wrong type\n");
     }
 }
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to