T getCurrent() override {
    if (_node == nullptr) {
       while (1) {
          DequeNode &dNode = v.front();
          BSTNode *node = dNode.node;
          if (dNode.descendNode == false ||
              (!node->right && !node->left)) {
             _node = node;
             //cout << "Popping "<< _node->val << endl;
             v.pop_front();
             break;
          } else {
             if (node->right) {
                v.push_front(DequeNode(node->right));
                //cout << "Pushing "<< node->right->val << endl;
             }
             if (node->left) {
                v.push_front(DequeNode(node->left));
                //cout << "Pushing "<< node->left->val << endl;
             }
             dNode.descendNode = false;
          }
       }
    }
    return _node->val;
 }
//Realiza el algoritmo de Melkman para hallar el convex hull de un poligono simple
// La entrada Q debe ser un poligono simple ordenado 
void melkman(std::list<Point2D> & Q, std::deque<Point2D> & D){
    bool volar_b = false;
    bool volar_t = false;
    unsigned int m = 0;
    unsigned int b = 0;
    unsigned int t = 0;
    std::vector<Point2D> V;
    std::list<Point2D>::iterator p = Q.begin();
    while(p != Q.end()){
        V.push_back(*p);
        p++;
    }
    //Inicializa la deque con los primeros 3 en CCW
    if(right(V[0], V[1], V[2])){
        D.push_front(V[2]);
        D.push_front(V[1]);
        D.push_front(V[0]);
        D.push_front(V[2]);
    } else {
        D.push_front(V[2]);
        D.push_front(V[0]);
        D.push_front(V[1]);
        D.push_front(V[2]);
    }

    unsigned int n = Q.size();
    unsigned int i = 2;
    while((++i) < n){
        m = D.size();
        b = 0;
        t = D.size()-1;
        volar_b = right(V[i], D.at(b), D.at(b+1));
        volar_t = right(D.at(t-1), D.at(t), V[i]);
        
        if(!volar_b && !volar_t) //En el cono interno, no se agrega
            continue;

        while(volar_b){             
            D.pop_front();
            volar_b = right(V[i], D.at(b), D.at(b+1));
        }
        D.push_front(V[i]);//Dentro segun el primer segmento
        
        t = D.size()-1;
        volar_t = right(D.at(t-1), D.at(t), V[i]);
        while(volar_t){
            t--;
            D.pop_back();
            volar_t = right(D.at(t-1), D.at(t), V[i]);
        }
        D.push_back(V[i]); //Dentro segun el ultimo segmento
    }
}
unsigned char CSceneData::getPath(int sx,int sy,int tx,int ty, std::deque<char>& path)
{
	m_SearchedFlag++;
	m_nNodeCount=0;
	m_nAllNodeCount=0;
	m_nMinH = 1000;
	m_nMinHNode = 0;

	m_tx = tx;
	m_ty = ty;

	int dir = 0;
	addNode(sx,sy,-1,0,0);

	for(;m_nNodeCount>0;)
	{
		Node a = getNode(); // 取出一个节点
		if ((a.x == m_tx) && (a.y == m_ty)) // 目标
		{
			dir = m_allnode[a.n].dir;
			path.clear();
			m_nAllNodeCount = a.n;
			while(m_allnode[m_nAllNodeCount].dir != -1)
			{
				path.push_front(m_allnode[m_nAllNodeCount].dir);
				m_nAllNodeCount = m_allnode[m_nAllNodeCount].father;
			}
			return dir;
			break;
		}
		for (int i = 0; i<DIR_COUNT; i++)
		{
			addNode(a.x+DX[i], a.y+DY[i], i, a.level+ASTAR_F[i], a.n); // 扩展此节点
			if (m_nAllNodeCount>=MAX_ALLNODE || m_nNodeCount>=MAX_NODE)
			{
				break;
			}
		}
	}
	m_nAllNodeCount = m_nMinHNode;
	dir = m_allnode[m_nAllNodeCount].dir;
	path.clear();
	while(m_allnode[m_nAllNodeCount].dir != -1)
	{
		path.push_front(m_allnode[m_nAllNodeCount].dir);
		m_nAllNodeCount = m_allnode[m_nAllNodeCount].father;
	}
	return dir;
}
Exemple #4
0
/*
 * Obtain some details of a given call site.
 */
void COptimiser::getCallSite(int required, POS &i, POS begin, std::deque<CALL_PARAM> &params) const
{
	do
	{
		if (i->udt & UDT_LINE)
		{
			++i;
			break;
		}
		else
		{
			POS j = i;
			if ((i->udt & UDT_FUNC) && i->params)
			{
				// Another function!
				std::deque<CALL_PARAM> reparams;
				getCallSite(i->params, --j, begin, reparams);
			}
			params.push_front(std::pair<POS, POS>(j, i));
			i = j;
			if (!--required) break;
		}

	} while (i-- != begin);
}
Exemple #5
0
//Assuming this is already textured, 
//set all the neighboring rect's texture coordinates data
//invoking compute_texture_by_triangles().
bool mgTLRect::set_neighbor_tex_coord_data(
	mgTLData& tldata,
	std::deque<mgTLRect*>& rects	//modified rects will be prepended.
){
	//if(m_u1<.251&& m_v1<.5626 &&m_v0>.499)
	//	m_u1=m_u1;//****************************
	bool textured=false;
	int level=m_textured+1;
	for(size_t i=0; i<4; i++){
		std::list<mgTLRect*> neibors=neighbours(i);
		std::list<mgTLRect*>::iterator j=neibors.begin(), je=neibors.end();
		for(; j!=je; j++){
			mgTLRect* rectj=*j;
			if(rectj->status()==MGRECT_OUT)
				continue;
			if(rectj->is_textured())
				continue;
			rectj->compute_texture_from_neighbor(tldata,*this,i);
			//rectj->compute_texture_by_triangles(tldata);
			rectj->set_texture_level(level);
			rects.push_front(rectj);
			textured=true;
		}
	}
	return textured;
}
Exemple #6
0
void CArchiveScanner::ScanDir(const std::string& curPath, std::deque<std::string>& foundArchives)
{
	std::deque<std::string> subDirs = {curPath};

	while (!subDirs.empty()) {
		const std::string& subDir = FileSystem::EnsurePathSepAtEnd(subDirs.front());
		const std::vector<std::string>& foundFiles = dataDirsAccess.FindFiles(subDir, "*", FileQueryFlags::INCLUDE_DIRS);

		subDirs.pop_front();

		for (const std::string& fileName: foundFiles) {
			const std::string& fileNameNoSep = FileSystem::EnsureNoPathSepAtEnd(fileName);
			const std::string& lcFilePath = StringToLower(FileSystem::GetDirectory(fileNameNoSep));

			// Exclude archive files found inside directory archives (.sdd)
			if (lcFilePath.find(".sdd") != std::string::npos)
				continue;

			// Is this an archive we should look into?
			if (archiveLoader.IsArchiveFile(fileNameNoSep)) {
				foundArchives.push_front(fileNameNoSep); // push in reverse order!
				continue;
			}
			if (FileSystem::DirExists(fileNameNoSep)) {
				subDirs.push_back(fileNameNoSep);
			}
		}
	}
}
Exemple #7
0
// MT safe
int sio_readexpect(std::string &msg, const char * prefix, int * preflen, int timeout) {

  std::deque<std::string> rejected;

  // true timeout
  int64 stoptime = time64() + timeout*1000;

  int rv;
  while (stoptime > time64()) {
	int delta = (int)( (stoptime - time64()) / 1000 );
	rv=sio_read(msg, (delta>0)?delta:0);
	if (rv <= 0) break; //  error or timeout
	rv = sio_matchpref(msg.c_str(), prefix, preflen);
	if (rv > 0) break; // found it
	rejected.push_back(msg); 
	//printf("rejected: [%s] (%d)\n", msg.c_str(), rejected.size());
  };

  // push back the unanswered messages...
  std::string tmp;
  while (!rejected.empty()) {
	tmp = rejected.back();
	rejected.pop_back();
	postponed.push_front(tmp);
	//printf("postponed: [%s] (%d)\n", tmp.c_str(), postponed.size());
  };

  //printf("MESSAGE [%s] is number %d in list of\n%s\n", msg.c_str(), rv, prefix);
  return rv;
};
Exemple #8
0
bool FindMazePathRecursive(int **maze, int x, int y, int w, int h, std::deque<Direction>& path)
{
    static Direction direction[4] = {{1, 0},{0, 1},{-1, 0}, {0, -1}};

    if(x == w-1 && y == h-1) return true;
    for(int i=0; i<4; ++i)
    {
        int xx = x + direction[i].x;
        int yy = y + direction[i].y;

        if(xx >=0 && yy >=0 &&
                yy < h && xx < w &&
                maze[yy][xx] == 0)
        {
            maze[yy][xx] = 1;
            if(FindMazePathRecursive(maze, xx, yy, w, h, path))
            {
                Direction dir;
                dir.x = xx;
                dir.y = yy;
                path.push_front(dir);
                return true;
            }
            maze[yy][xx] = 0;
        }
    }
    return false;
}
int main(){
	scanf("%hd%hd%hd\n",&n.x,&n.y,&t);
	for(i.x=1;i.x<=n.x;scanf("\n"),i.x++)
		for(i.y=1;i.y<=n.y;map[i.x][i.y]=getchar()=='1',i.y++);
	short ans=0;
	for(i.x=1;i.x<=n.x;i.x++)
		for(i.y=1;i.y<=n.y;i.y++){
			for(j.x=1;j.x<=n.x;j.x++)
				for(j.y=1;j.y<=n.y;j.y++)
					dist[j.x][j.y]=t+1;
			dist[i.x][i.y]=map[i.x][i.y];
			q.push_back(i);
			while(!q.empty()){
				vec u=q.front(); q.pop_front();
				for(int d=0;d<4;d++){
					vec v(u.x+dir[d].x,u.y+dir[d].y);
					if(dist[u.x][u.y]+map[v.x][v.y]<dist[v.x][v.y]){
						dist[v.x][v.y]=dist[u.x][u.y]+map[v.x][v.y];
						if(map[v.x][v.y])
							q.push_back(v);
						else
							q.push_front(v);
					}
				}
			}
			for(j.x=i.x;j.x<=n.x;j.x++)
				for(j.y=1;j.y<=n.y;j.y++)
					if(dist[j.x][j.y]<t+1&&sqr(j.x-i.x)+sqr(j.y-i.y)>ans)
						ans=sqr(j.x-i.x)+sqr(j.y-i.y);
		}
	printf("%.6lf\n",sqrt((double)ans));
}
 postOrderIterator(BinarySearchTree<T> *tree) :
    iteratorInt(tree, BST_POSTORDER), _node(nullptr) {
    if (tree != nullptr) {
       BSTNode *node = tree->root;
       //cout << "Pushing "<< node->val << endl;
       v.push_front(DequeNode(node));
    }
 }
void LineRenderingSampleApp::mouseDrag(MouseEvent event)
{
    mMousePositions.push_front(vec3(event.getPos(), 0.0f));
    if (mMousePositions.size() > mMaxMousePositions)
    {
        mMousePositions.pop_back();
    }
}
Exemple #12
0
void EventTriggered(Event *e, EventParams params) {
	lock_guard guard(mutex_);

	DispatchQueueItem item;
	item.e = e;
	item.params = params;
	g_dispatchQueue.push_front(item);
}
 T getCurrent() override {
    if (_node == nullptr) {
       BSTNode *node = v.front();
       _node = node;
       //cout << "Popping "<< _node->val << endl;
       v.pop_front();
       if (node->right) {
          v.push_front(node->right);
          //cout << "Pushing "<< node->right->val << endl;
       }
       if (node->left) {
          v.push_front(node->left);
          //cout << "Pushing "<< node->left->val << endl;
       }
    }
    return _node->val;
 }
void GraphSearchWrigglerGrid::BuildPath(GraphSearchWrigglerGrid* pFinalNode, std::deque<GraphSearchWrigglerGrid*>& path)
{
	while((pFinalNode != nullptr) && (pFinalNode->m_pPrevious != nullptr))
	{
	   path.push_front(pFinalNode);
	   pFinalNode = pFinalNode->m_pPrevious;
	}
}
	void setup_players(std::deque<player_t *> &tournament_players) {
		tournament_players.assign(this->players.begin(), this->players.end());
		std::random_shuffle(tournament_players.begin(), tournament_players.end());

		/** Define o 1o elemento como "bye", se necessário" */
		if(tournament_players.size() % 2)
			tournament_players.push_front(nullptr);
	}
void Mips16TargetLowering::
getOpndList(SmallVectorImpl<SDValue> &Ops,
            std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
            bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
            CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const {
  SelectionDAG &DAG = CLI.DAG;
  const char* Mips16HelperFunction = 0;
  bool NeedMips16Helper = false;

  if (getTargetMachine().Options.UseSoftFloat && Mips16HardFloat) {
    //
    // currently we don't have symbols tagged with the mips16 or mips32
    // qualifier so we will assume that we don't know what kind it is.
    // and generate the helper
    //
    bool LookupHelper = true;
    if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(CLI.Callee)) {
      if (NoHelperNeeded.find(S->getSymbol()) != NoHelperNeeded.end()) {
        LookupHelper = false;
      }
    }
    if (LookupHelper) Mips16HelperFunction =
      getMips16HelperFunction(CLI.RetTy, CLI.Args, NeedMips16Helper);

  }

  SDValue JumpTarget = Callee;

  // T9 should contain the address of the callee function if
  // -reloction-model=pic or it is an indirect call.
  if (IsPICCall || !GlobalOrExternal) {
    unsigned V0Reg = Mips::V0;
    if (NeedMips16Helper) {
      RegsToPass.push_front(std::make_pair(V0Reg, Callee));
      JumpTarget = DAG.getExternalSymbol(Mips16HelperFunction, getPointerTy());
      JumpTarget = getAddrGlobal(JumpTarget, DAG, MipsII::MO_GOT);
    } else
      RegsToPass.push_front(std::make_pair((unsigned)Mips::T9, Callee));
  }

  Ops.push_back(JumpTarget);

  MipsTargetLowering::getOpndList(Ops, RegsToPass, IsPICCall, GlobalOrExternal,
                                  InternalLinkage, CLI, Callee, Chain);
}
Exemple #17
0
void AsynchIO::unread(BufferBase* buff) {
    assert(buff);
    buff->squish();

    bool queueWasEmpty = bufferQueue.empty();
    bufferQueue.push_front(buff);
    if (queueWasEmpty)
        DispatchHandle::rewatchRead();
}
Exemple #18
0
//####################################################################
void xml::node::erase_duplicate_ns_defs (void* nd, std::deque<ns_list_type>& defs) {
    xmlNodePtr current = reinterpret_cast<xmlNodePtr>(nd)->children;
    while (current) {
        erase_duplicate_ns_defs_single_node(current, defs);
        defs.push_front(get_namespace_definitions(current, xml::ns::type_unsafe_ns));
        erase_duplicate_ns_defs(current, defs);
        defs.pop_front();
        current = current->next;
    }
}
Exemple #19
0
void function_1() {
	int count = 10;
	while (count > 0) {
		std::unique_lock<mutex> locker(mu);
		q.push_front(count);
		locker.unlock();
		std::this_thread::sleep_for(chrono::seconds(1));
		count--;
	}
}
Exemple #20
0
void writeSystemLog( std::string text )
{
   if (text.size() > system_log_width)
      text.resize( system_log_width );
   system_log.push_front( text );
   system_log_scroll = 0;

   if (system_log.size() > system_log_memory)
      system_log.pop_back();
}
Exemple #21
0
int main(){
	//freopen("sun.in","r",stdin);
	//freopen("sun.out","w",stdout);
	scanf("%d",&n);
	scanf("%s",s);
	for (int i = 0; i < n; ++i){
		q.push_back(s[i]);
	}
	while(!q.empty()){
		if(q.front()<q.back()){
			putchar(q.front());
			q.pop_front();
		}else if(q.front()>q.back()){
			putchar(q.back());
			q.pop_back();
		}else{
			if(q.size()==1){
				putchar(q.front());
				break;
			}
			while(q.front()==q.back() && q.size()!=1){
				lq.push_back(q.front());
				rq.push_back(q.front());
				if(q.front()>q.back()){
					while(!rq.empty()){
						putchar(rq.front());
						rq.pop_front();
					}
					putchar(q.back());
					q.pop_back();
					while(!lq.empty()){
						q.push_front(lq.back());
						lq.pop_back();
					}
				}else{
					while(!rq.empty()){
						putchar(rq.front());
						rq.pop_front();
					}
					putchar(q.back());
					q.pop_front();
					while(!lq.empty()){
						q.push_back(lq.back());
						lq.pop_back();
					}
				}
			}

			
		}
	}
	putchar('\n');
	return 0;
}
Exemple #22
0
// Using conditional variable and mutex
void function_1() {
	int count = 10;
	while (count > 0) {
		std::unique_lock<mutex> locker(mu);
		q.push_front(count);
		locker.unlock();
		cond.notify_one();  // Notify one waiting thread, if there is one.
		std::this_thread::sleep_for(chrono::seconds(1));
		count--;
	}
}
Exemple #23
0
void AsynchIO::queueWrite(BufferBase* buff) {
    assert(buff);
    // If we've already closed the socket then throw the write away
    if (queuedClose) {
        queueReadBuffer(buff);
        return;
    } else {
        writeQueue.push_front(buff);
    }
    writePending = false;
    DispatchHandle::rewatchWrite();
}
  void resize_front(size_type new_size)
  {
    auto initial_size = pos_vec.size();

    if(new_size < initial_size){
      for(int i = 0; i < (initial_size - new_size); ++i)
        pos_vec.pop_front();
    }else{
      for(int i = 0; i < (new_size - initial_size); ++i)
        pos_vec.push_front(0);
    }
  };
Exemple #25
0
void function_1()
{
	int count = 10;
	while (count > 0) {
		std::unique_lock<std::mutex> locker(mu);
		q.push_front(count);
		locker.unlock();
		cond.notify_one();
		//std::this_thread::sleep_for(std::chrono::seconds(1));
		--count;
	}
}
Exemple #26
0
bool InterpreterHelper::getOperation(std::string & line, std::deque<char> & stack){
    if( startsWith(line,".sub(") ){
        line = eraseFirst(line,5);
        stack.push_front(CONTEXT_SUB);
        return true;
    }

    if( startsWith(line,".intersect(") ){
        line = eraseFirst(line,11);
        stack.push_front(CONTEXT_INT);
        return true;
    }

    if( startsWith(line,".add(") ){
        line = eraseFirst(line,5);
        stack.push_front(CONTEXT_ADD);
        return true;
    }

    return false;
}
UT_sint32 ABI_Collab_Import::_getIncomingAdjustmentForState(const UT_GenericVector<ChangeAdjust *>* pExpAdjusts, UT_sint32 iStart, UT_sint32 iEnd, UT_sint32 iIncomingPos, UT_sint32 iIncomingLength, const UT_UTF8String& sIncomingUUID, std::deque<int>& incAdjs)
{
	UT_DEBUGMSG(("ABI_Collab_Import::_getIncomingAdjustmentForState()\n"));
	UT_return_val_if_fail(pExpAdjusts, 0);

	UT_sint32 iAdjust = 0;
	for (UT_sint32 j = iEnd-1; j>=iStart; j--)
	{
		ChangeAdjust* pPrev = pExpAdjusts->getNthItem(j);
		if (sIncomingUUID == pPrev->getRemoteDocUUID())
		{
			UT_DEBUGMSG(("Looking at possible adjustment with queue pos: %d, -adjust: %d\n", j, -pPrev->getLocalAdjust()));

			if (static_cast<UT_sint32>(pPrev->getRemoteDocPos()) < iIncomingPos+iAdjust)
			{
				if (pPrev->getLocalAdjust() > 0)
				{
					if (_isOverlapping(pPrev->getRemoteDocPos(), pPrev->getLocalLength(), iIncomingPos+iAdjust, iIncomingLength))
					{
						// NOTE: if the position was in the middle of an insert done previously, 
						// then we only need to take the insertion adjust partially into account
						UT_DEBUGMSG(("ADJUST OVERLAP DETECTED with queue pos: %d, pPrev->getRemoteDocPos(): %d, pPrev->m_iLength: %d, iIncomingPos: %d, iAdjust: %d\n", 
									j, pPrev->getRemoteDocPos(), pPrev->getLocalLength(), iIncomingPos, iAdjust));
						iAdjust -= (iIncomingPos+iAdjust - pPrev->getRemoteDocPos());
						incAdjs.push_front(iIncomingPos+iAdjust - pPrev->getRemoteDocPos());
					}
					else
					{
						UT_DEBUGMSG(("ADJUSTMENT influenced normally by queue pos: %d\n", j));
						iAdjust -= pPrev->getLocalAdjust();
						incAdjs.push_front(pPrev->getLocalAdjust());
					}
				}
				else if (pPrev->getLocalAdjust() < 0)
				{
					// TODO: is the < 0 case correctly handled like this?
					UT_DEBUGMSG(("ADJUSTMENT influence by delete by queue pos: %d, pPrev->m_iProgDocPos: %d, pPrev->getRemoteDocPos(): %d\n", j, pPrev->getRemoteDocPos(), pPrev->getRemoteDocPos()));
					iAdjust -= pPrev->getLocalAdjust();
					incAdjs.push_front(pPrev->getLocalAdjust());		
				}
				else
				{
					UT_DEBUGMSG(("ADJUSTMENT influence of 0 by queue pos: %d, pPrev->m_iProgDocPos: %d, pPrev->getRemoteDocPos(): %d\n", j, pPrev->getRemoteDocPos(), pPrev->getRemoteDocPos()));
					incAdjs.push_front(0);
				}
			}
			else if (static_cast<UT_sint32>(pPrev->getRemoteDocPos()) > iIncomingPos+iAdjust)
			{
				UT_DEBUGMSG(("no ADJUSTMENT influence (insertion point smaller than checkpoint) by queue pos: %d, pPrev->m_iProgDocPos: %d, pPrev->getRemoteDocPos(): %d\n", j, pPrev->getRemoteDocPos(), pPrev->getRemoteDocPos()));
				incAdjs.push_front(0);
			}
			else
			{
				UT_DEBUGMSG(("no ADJUSTMENT influence (insertion point equals checkpoint) by queue pos: %d, pPrev->m_iProgDocPos: %d, pPrev->getRemoteDocPos(): %d\n", j, pPrev->getRemoteDocPos(), pPrev->getRemoteDocPos()));
				incAdjs.push_front(0);
			}
		}
	}
	return iAdjust;
}
Exemple #28
0
void		Timer::update(gdl::GameClock const& gameClock, gdl::Input& input, std::deque<AObject*>& map)
{
  (void)gameClock;
  (void)input;
  (void)map;
  this->_timer->update();

  float		elapsedTime = (this->_timer->getTotalElapsedTime());
  float		eltm = _timer->getElapsedTime();
  std::stringstream	tmp;

  if (123 - elapsedTime < 0)
    {
      while (map.size() > 0)
	if (map[0]->getType() != TIMER)
	  map.erase(map.begin());
	else
	  map.erase(map.begin() + 1);
      map.push_front(new MyCursor(0, 0));
      map.push_front(new MyMenu("libgdl_gl/images/bomber-accueil.png", 0, 0));
      for (unsigned int i = 0; i < map.size(); ++i)
	map[i]->initialize();
    }
  else if (120 - elapsedTime < 0 && 123 - elapsedTime >= 2)
    {
      while (map.size() > 0)
	map.erase(map.begin());
      map.push_front(new MyMenu("libgdl_gl/images/bomber-gameover.png", 0, 0));
      for (unsigned int i = 0; i < map.size(); ++i)
	map[i]->initialize();
    }
  else
    {
      if (eltm < 0.0333)
	usleep((int)((0.0333 - eltm) * 1000000));
      tmp << (120 - (int)elapsedTime);
      _time->setText(tmp.str());
    }
}
JNIEXPORT void JNICALL
Java_link_kjr_SimpleTerminal_MainActivity_read(JNIEnv *env, jclass type) {
    ssize_t count=1;
    do {
        unsigned char cbuf[500];
        count=read(master_terminal_fd,cbuf,500);
        for(int i=0;i<count;i++){
            buffer.push_front(cbuf[i]);
        }
        __android_log_print(ANDROID_LOG_INFO,APPNAME,"reading,count:%d buffersize:%d",count,buffer.size());

    } while (count>0);
    __android_log_print(ANDROID_LOG_INFO,APPNAME,"done reading");
}
Exemple #30
0
void ContextMenu::processMouseCallback(const MouseEvent &evt, std::deque<std::string> address) {
   static MenuHolder *holder = MenuHolder::getInstance();

   address.push_front(_label);
   if (_parentMenu == NULL) {
      if (evt.getState() == MouseEvent::UP) {
         holder->closeAllMenus();
         onMouseClick(evt, address);
         onMenuAccessed(address);
      } else if (evt.getState() == MouseEvent::MOTION) {
         onMouseOver(evt, address);
      }
   } else _parentMenu->processMouseCallback(evt, address);
}