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


C++ EList::delHead方法代码示例

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


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

示例1: unloadWorker

int TaskManager::unloadWorker(std::string workerName)
{
	//먼저 실행 중이 task는 모두 삭제부터 한다.
	stopAllWorker();

	//worker목록 제거
	/*
	StrMap*	taskTAB = m_taskMem->getTaskTAB();
	StrMap::iterator it1 = taskTAB->find(workerName);
	if(it1 != taskTAB->end()){
		taskTAB->erase(it1);
	}
	else{
		TaskTAB* taskTAB2 = m_taskMem->getTaskTAB2();
		TaskTAB::iterator it2 = taskTAB2->find(workerName);
		if(it2 != taskTAB2->end()){
			delete it2->second;
			taskTAB2->erase(it2);
		}
		else{
			LOG_ERROR(m_log, "Task <%s> dose not exist in the loaded task list.", workerName.c_str());
			return DB_UNLOAD_ERR_NO_WORKER;
		}
	}
	*/

	TaskTAB* taskTAB2 = m_taskMem->getTaskTAB2();
	TaskTAB::iterator it2 = taskTAB2->find(workerName);
	if(it2 != taskTAB2->end()){
		delete it2->second;
		taskTAB2->erase(it2);
	}
	else{
		LOG_ERROR(m_log, "Task <%s> dose not exist in the loaded task list.", workerName.c_str());
		return DB_UNLOAD_ERR_NO_WORKER;
	}

	//worker에서 이용하는 model(심볼테이블) 삭제
	SymTAB* symTAB = m_taskMem->getSymbolTAB();
	SymTAB::iterator it = m_taskMem->getSymbolTAB()->find(workerName);
	if(it != symTAB->end()){
		SymTAB4Task* symT = it->second;
		if(symT->getWorkerRefCount() <= 1){
			delete symT;
		}
		else{
			symT->minRefCount();
		}
		symTAB->erase(it);
	}
	else{
		LOG_ERROR(m_log, "The symbol table for task <%s> dose not exist", workerName.c_str());
		return DB_UNLOAD_ERR_NO_SYMTAB;
	}

	//worker에 포함된 bhv 찾기
	EList<std::string> delList;
	BehaviorTAB* behaviorTAB = m_taskMem->getBehaviorTAB();
	BehaviorTAB::iterator it3 = behaviorTAB->begin();
	for(; it3!=behaviorTAB->end(); it3++){
		RFSMbehavior* t = it3->second;
		int wNum = t->unRefTask(workerName);
		if(wNum == 0){//bhv를 이용하는 worker가 하나도 없으면
			//unloadTask(it3->first); //map을 검색하면서 자신을 지우면 안된다.
			delList.addTail(it3->first);
		}
	}
/*
	if(delList.moveHead()){
		do{
			std::string tName = delList.getCurObject();
			unloadBehavior(tName);			
		}
		while(delList.moveNext());
	}
*/
	while(delList.moveHead()){		
		std::string tName = delList.getCurObject();
		unloadBehavior(tName);			
		delList.delHead();
	}

	//m_taskMem->leakTest();

	//conexer삭제
	EList<std::string> delConList;
	ConnectorTAB* conTAB = m_taskMem->getConnectorTAB();
	ConnectorTAB::iterator it4 = conTAB->begin();
	for(; it4!=conTAB->end(); it4++){
		RFSMconnector* con = it4->second;
		int wNum = con->unRefTask(workerName);
		if(wNum == 0){//bhv를 이용하는 worker가 하나도 없으면
			//unloadTask(it3->first); //map을 검색하면서 자신을 지우면 안된다.
			delConList.addTail(it4->first);
		}
	}
	while(delConList.getSize()>0 && delConList.moveHead()){		
		std::string cName = delConList.getCurObject();
		unloadConnector(cName);			
		delConList.delHead();
//.........这里部分代码省略.........
开发者ID:OPRoS,项目名称:TaskEngine,代码行数:101,代码来源:TaskManager.cpp

示例2: loadWorker


//.........这里部分代码省略.........
				}while(rtasks->moveNext());
			}

			if(rbhvs != 0 && rbhvs->getSize()>0 && rbhvs->moveHead()){
				do{
					RFSMtreenode* rbhv = rbhvs->getCurObject();
					setSubNodes(rbhv);
				}while(rbhvs->moveNext());
			}

			if(rconns != 0 && rconns->getSize()>0 && rconns->moveHead()){
				do{
					RFSMtreenode* rconn = rconns->getCurObject();
					setSubNodes(rconn);
				}while(rconns->moveNext());
			}

			if(rconns != 0 && rconns->getSize()>0 && rconns->moveHead()){
				do{
					RFSMconnector* rconn = (RFSMconnector*)rconns->getCurObject();
					std::map<int, int>	synchInfo = checkValidSynchIDs(rconn);
					rconn->setSynchInfo(synchInfo);
					//rconn->checkValidSynchIDs();
				}while(rconns->moveNext());
			}

			if(rtasks != 0 && rtasks->getSize()>0 && rtasks->moveHead()){
				do{
					std::set<int> ids;
					RFSMtask* rtask = (RFSMtask*)(rtasks->getCurObject());
					rtask->setSynchidInTask();
				}while(rtasks->moveNext());
			}
			

			
			/* 삭제(껍데기만 내용은 TaskMem에 저장) */
			if(rtasks != NULL){
				while(rtasks->getSize()>0 && rtasks->moveHead()){
					//RFSMtask* obj = rtasks->getCurObject();
					//delete obj;
					rtasks->delHead();
				}
				delete rtasks; rtasks = NULL;
			}
			if(rbhvs != NULL){
				while(rbhvs->getSize()>0 && rbhvs->moveHead()){
					//RFSMbehavior* obj = rbhvs->getCurObject();
					//delete obj;
					rbhvs->delHead();
				}
				delete rbhvs; rbhvs = NULL;
			}
			if(rconns != NULL){
				while(rconns->getSize()>0 && rconns->moveHead()){
					//RFSMconnector* obj = rconns->getCurObject();
					//delete obj;
					rconns->delHead();
				}
				delete rconns; rconns = NULL;
			}		
/*			
			//시나리오 파일 처리
			if(pRslt->getSCs().size()>0){
				std::string inclstr;
				if(aTest->getInclude() != 0){
					Ginclude* inclList = aTest->getInclude();
					if(inclList->moveHead()){
						do{
							Gtoken* tok = inclList->getCurObject();
							std::string fname = tok->getFileName();
							std::string incl = tok->getData();
							if(fname==workerFileName)
								inclstr.append("#include \"").append(incl).append("\"\n");
						}
						while(inclList->moveNext());
					}
				}
				TPLGenerator tplGen(fsys, workerFileName, inclstr, pRslt->getSTasks(), pRslt->getSCs(), pRslt->getSBehaviors(), pRslt->getSEvents());
				tplGen.generateTPL();
			}
*/
		}
		catch(SemanticsEH& semEH){
			LOG_ERROR(m_log, "The parser returned %d errors, Task loading aborted.", semEH.hasError_());
			delete newSymT; newSymT = NULL;
			delete rtasks; rtasks = NULL;
			delete rbhvs; rbhvs = NULL;
			delete rconns; rconns = NULL;
			result = 100;/////////////////////////////////////////////////////에러코드 정리
		}

	}

	
	//aTest 에서 pRslt가 지워진다.
	//delete aTest;

	return result;
}
开发者ID:OPRoS,项目名称:TaskEngine,代码行数:101,代码来源:TaskManager.cpp


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