- 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
sayer/1.4-spce2.6
Raphael Coeffic 18 years ago
parent 5300ea3bab
commit 3f5885a124

@ -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();

@ -35,8 +35,8 @@ class AmEventDispatcher
{
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 @@ 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

@ -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 @@ public:
AmEventQueue(AmEventHandler*);
virtual ~AmEventQueue();
virtual void postEvent(AmEvent*);
void postEvent(AmEvent*);
void processEvents();
void waitForEvent();
void processSingleEvent();

@ -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<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");
}
}

Loading…
Cancel
Save