本文整理汇总了C++中EventPtr::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ EventPtr::getId方法的具体用法?C++ EventPtr::getId怎么用?C++ EventPtr::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventPtr
的用法示例。
在下文中一共展示了EventPtr::getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: waitforevent
void EventManager<T>::fire(EventPtr ev) {
mUnprocessed.push(ev);
SILOG(task,debug,"**** Firing event " << (void*)(&(*ev)) <<
" with " << ev->getId());
if (mEventCV && mEventLock && !mCleanup) {
boost::mutex *lock = (boost::mutex *)mEventLock;
boost::condition_variable *cv = (boost::condition_variable *)mEventCV;
if (++mPendingEvents == 1) {
boost::unique_lock<boost::mutex> waitforevent (*lock);
// we are the first ones to fire an event.
cv->notify_one();
}
}
};
示例2: ev
void EventManager<T>::temporary_processEventQueue(AbsTime forceCompletionBy) {
AbsTime startTime = AbsTime::now();
SILOG(task,insane," >>> Processing events.");
// swaps to allow people to keep adding new events
typename EventList::NodeIterator processingList(mUnprocessed);
// The events are swapped first to guarantee that listeners are at least as up-to-date as events.
// Events can be delayed, but we cannot allow any lost subscriptions/unsubscriptions.
{
typename ListenerRequestList::NodeIterator procListeners(mListenerRequests);
const ListenerRequest *req;
while ((req = procListeners.next()) != NULL) {
if (req->subscription) {
SILOG(task,debug," >>>\tDoing subscription listener "<< req->listenerId << " for event " << req->eventId << " (" << req->onlyPrimary << ").");
doSubscribeId(*req);
} else {
SILOGNOCR(task,debug," >>>\t");
if (req->notifyListener) {
SILOGNOCR(task,debug,"Notifying");
}
SILOG(task,debug,"UNSUBSCRIBED listener " << req->listenerId << ".");
doUnsubscribe(req->listenerId, req->notifyListener);
}
}
}
if (SILOGP(task,insane)){
SILOG(task,insane,"==== All Event Subscribers for " << (intptr_t)this << " ====");
typename PrimaryListenerMap::const_iterator priIter =
mListeners.begin();
while (priIter != mListeners.end()) {
SILOG(task,insane," ID " << (*priIter).first << ":");
PartiallyOrderedListenerList *primaryLists =
&((*priIter).second->first);
SecondaryListenerMap *secondaryMap =
&((*priIter).second->second);
for (int i = 0; i < NUM_EVENTORDER; i++) {
ListenerList *currentList = &(primaryLists->get(i));
for (typename ListenerList::const_iterator iter = currentList->begin();
iter != currentList->end(); ++iter) {
SILOG(task,insane," \t"
"[" << (i==MIDDLE?'=':i<MIDDLE?'*':'/') << "] " <<
(*iter).second);
}
}
typename SecondaryListenerMap::const_iterator secIter;
secIter = secondaryMap->begin();
while (secIter != secondaryMap->end()) {
SILOG(task,insane,"\tSec ID " << (*secIter).first << ":");
for (int i = 0; i < NUM_EVENTORDER; i++) {
ListenerList *currentList = &((*secIter).second->get(i));
for (typename ListenerList::const_iterator iter = currentList->begin();
iter != currentList->end(); ++iter) {
SILOG(task,insane," \t\t"
"[" << (i==MIDDLE?'=':i<MIDDLE?'*':'/') << "] " <<
(*iter).second);
}
}
++secIter;
}
++priIter;
}
SILOG(task,insane,"==== ---------------------------------- ====");
}
EventPtr *evTemp;
int numProcessed = 0;
while ((evTemp = processingList.next())!=NULL) {
EventPtr ev (*evTemp);
++numProcessed;
typename PrimaryListenerMap::iterator priIter =
mListeners.find(ev->getId().mPriId);
if (priIter == mListeners.end()) {
// FIXME: Should this ever happen?
SILOG(task,warning," >>>\tWARNING: No listeners for type " <<
"event type " << ev->getId().mPriId);
continue;
}
PartiallyOrderedListenerList *primaryLists =
&((*priIter).second->first);
SecondaryListenerMap *secondaryMap =
&((*priIter).second->second);
typename SecondaryListenerMap::iterator secIter;
secIter = secondaryMap->find(ev->getId().mSecId);
bool cancel = false;
EventHistory eventHistory=EVENT_UNHANDLED;
// Call once per event order.
for (int i = 0; i < NUM_EVENTORDER && cancel == false; i++) {
SILOG(task,debug," >>>\tFiring " << ev << ": " << ev->getId() <<
" [order " << i << "]");
//.........这里部分代码省略.........