当前位置: 首页>>代码示例>>C++>>正文


C++ ListenerList::begin方法代码示例

本文整理汇总了C++中ListenerList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ListenerList::begin方法的具体用法?C++ ListenerList::begin怎么用?C++ ListenerList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListenerList的用法示例。


在下文中一共展示了ListenerList::begin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _renderScene

    //-----------------------------------------------------------------------
    void Camera::_renderScene(Viewport *vp, bool includeOverlays)
    {
        OgreProfileBeginGPUEvent("Camera: " + getName());

		//update the pixel display ratio
		if (mProjType == Ogre::PT_PERSPECTIVE)
		{
			mPixelDisplayRatio = (2 * Ogre::Math::Tan(mFOVy * 0.5f)) / vp->getActualHeight();
		}
		else
		{
			mPixelDisplayRatio = (mTop - mBottom) / vp->getActualHeight();
		}

		//notify prerender scene
		ListenerList listenersCopy = mListeners;
		for (ListenerList::iterator i = listenersCopy.begin(); i != listenersCopy.end(); ++i)
		{
			(*i)->cameraPreRenderScene(this);
		}

		//render scene
		mSceneMgr->_renderScene(this, vp, includeOverlays);

		// Listener list may have change
		listenersCopy = mListeners;

		//notify postrender scene
		for (ListenerList::iterator i = listenersCopy.begin(); i != listenersCopy.end(); ++i)
		{
			(*i)->cameraPostRenderScene(this);
		}
        OgreProfileEndGPUEvent("Camera: " + getName());
	}
开发者ID:Ali-il,项目名称:gamekit,代码行数:35,代码来源:OgreCamera.cpp

示例2: broadcastEvent

void EventManager::broadcastEvent(const Event &event)
{
    do
    {
        if (mListenerMap.empty())
            break;
        
        EventID eid = event.getEventID();
        ListenerList *listenerList = NULL;
        ListenerMap::iterator mapIter = mListenerMap.find(eid);
        
        if (mapIter == mListenerMap.end())
            break;
        
        listenerList = mapIter->second;
        if (listenerList->empty())
            break;
        
        ListenerList::iterator listIter;
        for (listIter = listenerList->begin(); listIter != listenerList->end(); ++listIter)
        {
            (*listIter)->handleEvent(event);
        }
        
    } while (0);
}
开发者ID:master-g,项目名称:hourglass,代码行数:26,代码来源:HGEventManager.cpp

示例3: removeListener

void EventManager::removeListener(GameObject *listener)
{
    do
    {
        if (mListenerMap.empty())
            break;
        
        ListenerMap::iterator mapIter = mListenerMap.begin();
        for (; mapIter != mListenerMap.end(); ++mapIter)
        {
            ListenerList *list = mapIter->second;
            if (list == NULL)
                continue;
            
            ListenerList::iterator listIter = list->begin();
            for (; listIter != list->end(); ++listIter)
            {
                if (*listIter == listener)
                {
                    list->erase(listIter);
                    break;
                }
            }
        }
        
    } while (0);
}
开发者ID:master-g,项目名称:hourglass,代码行数:27,代码来源:HGEventManager.cpp

示例4: lock

// ============================================================================
// Inherited IIncidentSvc overrides:
// ============================================================================
void IncidentSvc::addListener
( IIncidentListener* lis ,
  const std::string& type ,
  long prio, bool rethrow, bool singleShot)
{

  boost::recursive_mutex::scoped_lock lock(m_listenerMapMutex);

  std::string ltype;
  if( type == "" ) ltype = "ALL";
  else             ltype = type;
  // find if the type already exists
  ListenerMap::iterator itMap = m_listenerMap.find( ltype );
  if( itMap == m_listenerMap.end() ) {
    // if not found, create and insert now a list of listeners
    ListenerList* newlist = new ListenerList();
    std::pair<ListenerMap::iterator, bool> p;
    p = m_listenerMap.insert(ListenerMap::value_type(ltype, newlist));
    if( p.second ) itMap = p.first;
  }
  ListenerList* llist = (*itMap).second;
  // add Listener in the ListenerList according to the priority
  ListenerList::iterator itlist;
  for( itlist = llist->begin(); itlist != llist->end(); itlist++ ) {
    if( (*itlist).priority < prio ) {
      // We insert before the current position
      break;
    }
  }

  DEBMSG << "Adding [" << type << "] listener '" << getListenerName(lis)
         << "' with priority " << prio << endmsg;

  llist->insert(itlist, Listener(lis, prio, rethrow, singleShot));
}
开发者ID:l1calo,项目名称:gaudi,代码行数:38,代码来源:IncidentSvc.cpp

示例5: _notifyDestroy

void WeakRef::_notifyDestroy()
{
	incRefCount();

	ListenerList* listeners = _listeners;

	_listeners = NULL; // prevent removeListener mutate this

	if (listeners)
	{
		for (ListenerList::iterator itr = listeners->begin(), end = listeners->end(); itr != end; ++itr)
		{
			(*itr)->onDestroy(_object);
		}

		delete listeners;
	}

	_object = NULL;

	if (_listeners)
	{
		decRefCount();
		NIT_THROW_FMT(EX_INVALID_STATE, "Can't add listener while destroying one");
		return;
	}

	decRefCount();
}
开发者ID:noriter,项目名称:nit,代码行数:29,代码来源:RefCounted.cpp

示例6:

    //-----------------------------------------------------------------------
    Camera::~Camera()
    {
		ListenerList listenersCopy = mListeners;
		for (ListenerList::iterator i = listenersCopy.begin(); i != listenersCopy.end(); ++i)
		{
			(*i)->cameraDestroyed(this);
		}
    }
开发者ID:Ali-il,项目名称:gamekit,代码行数:9,代码来源:OgreCamera.cpp

示例7: cleanupUnusedListeners

void Environment::cleanupUnusedListeners(ListenerList& list)
{
  for(ListenerList::iterator giter = list.begin(); giter != list.end();){
    if((*giter)->isActive() == false){
      giter = list.erase(giter);
    } else ++giter;
  }
}
开发者ID:OMARTINEZ210,项目名称:server,代码行数:8,代码来源:script_environment.cpp

示例8: stopListener

bool Environment::stopListener(ListenerList& list, uint32_t id)
{
  for(ListenerList::iterator giter = list.begin(),
    gend = list.end(); giter != gend;
    ++giter)
  {
    if((*giter)->getID() == id && (*giter)->isActive()){
      (*giter)->deactivate();
      return true;
    }
  }
  return false;
}
开发者ID:OMARTINEZ210,项目名称:server,代码行数:13,代码来源:script_environment.cpp

示例9: _renderScene

	void Camera::_renderScene(Viewport *vp, BOOL includeOverlays)
	{
		if (mProjType == PT_PERSPECTIVE)
		{
			mPixelDisplayRatio = (2 * Math::Tan((Radian)(mFOVy * 0.5f))) / vp->getActualHeight();
		}
		else
		{
			mPixelDisplayRatio = (mTop - mBottom) / vp->getActualHeight();
		}

		ListenerList listenersCopy = mListeners;
		for (ListenerList::iterator i = listenersCopy.begin(); i != listenersCopy.end(); ++i)
		{
			(*i)->cameraPreRenderScene(this);
		}
		mSceneMgr->renderScene(this, vp, includeOverlays);
		listenersCopy = mListeners;

		for (ListenerList::iterator i = listenersCopy.begin(); i != listenersCopy.end(); ++i)
		{
			(*i)->cameraPostRenderScene(this);
		}
	}
开发者ID:523793658,项目名称:directX,代码行数:24,代码来源:Camera.cpp

示例10:

    //---------------------------------------------------------------------
    Viewport::~Viewport()
    {
        ListenerList listenersCopy;
        std::swap(mListeners, listenersCopy);
        for (ListenerList::iterator i = listenersCopy.begin(); i != listenersCopy.end(); ++i)
        {
            (*i)->viewportDestroyed(this);
        }

        RenderSystem* rs = Root::getSingleton().getRenderSystem();
        if ((rs) && (rs->_getViewport() == this))
        {
            rs->_setViewport(NULL);
        }
    }
开发者ID:Ketzer2002,项目名称:meridian59-engine,代码行数:16,代码来源:OgreViewport.cpp

示例11:

    void MamdaMultiSecurityManager::MamdaMultiSecurityManagerImpl::forwardMsg (
        ListenerList&         listeners,
        MamdaSubscription*    subscription,
        const MamaMsg&        msg,
        short                 msgType)
    {
        ListenerList::iterator end = listeners.end();
        ListenerList::iterator i   = listeners.begin();

        for (; i != end; ++i)
        {
            MamdaMsgListener* listener = *i;

            listener->onMsg (subscription, 
                             msg, 
                             msgType);
        }
    }
开发者ID:MattMulhern,项目名称:OpenMamaCassandra,代码行数:18,代码来源:MamdaMultiSecurityManager.cpp

示例12: 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 << "]");
//.........这里部分代码省略.........
开发者ID:jordanmisiura,项目名称:sirikata,代码行数:101,代码来源:EventManager.cpp


注:本文中的ListenerList::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。