本文整理汇总了C++中EList::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ EList::getSize方法的具体用法?C++ EList::getSize怎么用?C++ EList::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EList
的用法示例。
在下文中一共展示了EList::getSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadWorker
int TaskManager::loadWorker(std::string workerFileName, OSFileSys* fsys)
{
int result = 0;
int errorCount = 0;
std::auto_ptr<EParser> aTest(new EParser(m_ostr));
//EParser* aTest = new EParser(m_ostr);
aTest->setFilename(workerFileName);
int res = aTest->extractInclude(workerFileName, TaskConfig::getDeployHome());
if(res != 0){
result = res;
errorCount = res;
}
if(aTest->getInclude() != 0){
//preprocessing include
EList<std::string> includedFiles = aTest->getInclude()->getIncludeFiles();
if(includedFiles.moveHead()){
do{
std::string fName = includedFiles.getCurObject();
//parsing
LOG_TRACE(m_log, "Reading the file, '%s'...", fName.c_str());
aTest->setFilename(fName);
errorCount = aTest->parseScript(TaskConfig::getDeployHome() + fName);
if(errorCount>0){
result = errorCount; ///////////////////////////////////에러코드정리
LOG_ERROR(m_log, "Parser can not open the file '%s'.", fName.c_str());
break;
}
}
while(includedFiles.moveNext());
}
}
if(errorCount == 0){
GparsedResult* pRslt = aTest->getParsingResult();
EList<Genum*>* enumlist = pRslt->getEnums();
EList<Gmodel*>* modellist = pRslt->getModels();
EList<Gaction*>* actionlist = pRslt->getActions();
// EList<Gworker*>* workerlist = pRslt->getWorkers(); //예전 방법 task 정의
EList<Gtask*>* tasklist = pRslt->getTasks(); //최근 방법 task 정의
EList<Gbehavior*>* bhvlist = pRslt->getbehaviors();
EList<Gconnector*>* connlist = pRslt->getconnectors();
SymTAB4Task* newSymT = new SymTAB4Task();
std::auto_ptr<RTObjBuilder> rtmBuilder(new RTObjBuilder(m_ostr, newSymT));
//RTObjBuilder *rtmBuilder = new RTObjBuilder(m_ostr, newSymT);
EList<RFSMtask*>* rtasks = NULL;
EList<RFSMbehavior*>* rbhvs = NULL;
EList<RFSMconnector*>* rconns = NULL;
try{
//model, action, enum 검사
LOG_TRACE(m_log, "Checking Model composed of Symbol, Function, Action and Enum ...");
rtmBuilder->makeSymTable(pRslt);
//TASK 명세 검사
LOG_TRACE(m_log, "Checking Tasks ...");
rtasks = rtmBuilder->checkSemantics(tasklist);
rbhvs = rtmBuilder->checkSemantics(bhvlist);
rconns = rtmBuilder->checkSemantics(connlist);
//Model 파일수가 여러개 이더라도 1개의 심볼테이블이 만들어진다.
//파일이 나누어져도 하나의 파일로 간주
//SymTAB4Task* newSymT = rtmBuilder->getSymT();
/*
if(workerlist !=NULL && workerlist->getSize()>0 && workerlist->moveHead()){
do{
Gworker* worker = workerlist->getCurObject();
std::string workerName = worker->getName()->getData();
//Task 들을 등록
result = m_taskMem->addTask(workerName, worker->getStartBhv()->getData());
//심볼테이블 등록
if(result ==0){
newSymT->pluRefCount();
result = m_taskMem->addSymbolT(workerName, newSymT);
}
else
result = 100; ///////////////////////////////////에러코드정리
}
while(workerlist->moveNext());
}
*/
if(rtasks !=NULL && rtasks->getSize()>0 && rtasks->moveHead()){
do{
RFSMtask* task = rtasks->getCurObject();
std::string taskName = task->getName();
//Task 들을 등록
result = m_taskMem->addTask2(taskName, task);
//여기까지 했다 다음부터 구현 할 것
//.........这里部分代码省略.........
示例2: 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();
//.........这里部分代码省略.........
示例3: getDot
std::string TaskManager::getDot(std::string workerName, RFSMtreenode* startNode, EList<std::string> tlist)
{
RFSMbehavior* startTask = (RFSMbehavior*)startNode;
if(typeid(*startNode)==typeid(RFSMbehavior)){
}
else if(typeid(*startNode)==typeid(RFSMconnector)){
return "";
}
else{
return "";
}
std::string dot;
dot.append("digraph G{\n");
dot.append("compound=true;\n");
// 1.Pre declaration
if(tlist.getSize()>0 && tlist.moveHead()){
do{
dot.append("subgraph cluster");//RFSMtask에서 이름앞에 'cluster'를 사용
dot.append(tlist.getCurObject());
dot.append(";\n");
}
while(tlist.moveNext());
}
// 2. worker의 시작 bhv
dot.append(startTask->getDot());
// 3. worker의 시작 Task에서 분기되는 Task들
std::vector<std::string> linkedTasks = startTask->getLinkedNodes();
if(linkedTasks.size()>0){
for(unsigned int i =0; i<linkedTasks.size();i++){
std::string tName = linkedTasks[i];
RFSMbehavior* t = m_taskMem->findBehavior(tName);
if(t != NULL){
std::string taskDot = t->getDot();
dot.append(taskDot);
}
}
}
// 4. %taskname%을 initial state 명으로 바꾼다.
while(true){
int s = dot.find_first_of("%");
int e = dot.find_first_of("*");
if(s<0 || e<0)break;
std::string sub = dot.substr(s, e-s+1);//시작, 시작으로부터offset
std::string stName = dot.substr(s+1, e-s-1);
RFSMbehavior* tt = m_taskMem->findBehavior(stName);
if(tt != NULL && tt->getInitialState() != NULL){
std::string isName = tt->getInitialState()->getName();
Estring::replaceAll(dot, sub, RFSMnamedItem::removePath(isName));
}
else{
//무한루프를 빠져나오기 위해서 bhv가 없더라도 반드시 %,*가 없는 이름으로 변환
Estring::replaceAll(dot, sub, stName);
}
}
dot.append("}\n");
return dot;
}