From 3f5885a124ec90225ab9caee21a6ce4d247880c9 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 12 Jun 2008 14:43:58 +0000 Subject: [PATCH] - allows for AmEventQueue proxies (inherit from AmEventQueueInterface instead of AmEventQueue). git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1018 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmEventDispatcher.cpp | 10 +++++----- core/AmEventDispatcher.h | 12 ++++++------ core/AmEventQueue.h | 11 +++++++++-- core/AmSessionContainer.cpp | 10 +++++----- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/core/AmEventDispatcher.cpp b/core/AmEventDispatcher.cpp index 1fc49e91..1eaeb370 100644 --- a/core/AmEventDispatcher.cpp +++ b/core/AmEventDispatcher.cpp @@ -36,7 +36,7 @@ AmEventDispatcher* AmEventDispatcher::instance() } bool AmEventDispatcher::addEventQueue(const string& local_tag, - AmEventQueue* q, + AmEventQueueInterface* q, const string& callid, const string& remote_tag) { @@ -63,11 +63,11 @@ bool AmEventDispatcher::addEventQueue(const string& local_tag, 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(); diff --git a/core/AmEventDispatcher.h b/core/AmEventDispatcher.h index ab3d65ed..9781aaa2 100644 --- a/core/AmEventDispatcher.h +++ b/core/AmEventDispatcher.h @@ -35,8 +35,8 @@ class AmEventDispatcher { public: - typedef std::map EvQueueMap; - typedef EvQueueMap::iterator EvQueueMapIter; + typedef std::map EvQueueMap; + typedef EvQueueMap::iterator EvQueueMapIter; typedef std::map Dictionnary; typedef Dictionnary::iterator DictIter; @@ -73,13 +73,13 @@ public: 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 diff --git a/core/AmEventQueue.h b/core/AmEventQueue.h index 04644a29..ac632b67 100644 --- a/core/AmEventQueue.h +++ b/core/AmEventQueue.h @@ -33,6 +33,13 @@ #include +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 @@ public: AmEventQueue(AmEventHandler*); virtual ~AmEventQueue(); - virtual void postEvent(AmEvent*); + void postEvent(AmEvent*); void processEvents(); void waitForEvent(); void processSingleEvent(); diff --git a/core/AmSessionContainer.cpp b/core/AmSessionContainer.cpp index d6be14e9..198ed427 100644 --- a/core/AmSessionContainer.cpp +++ b/core/AmSessionContainer.cpp @@ -141,16 +141,16 @@ void AmSessionContainer::destroySession(AmSession* s) 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(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"); } }