本文整理汇总了C++中Flow::getStartLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ Flow::getStartLabel方法的具体用法?C++ Flow::getStartLabel怎么用?C++ Flow::getStartLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flow
的用法示例。
在下文中一共展示了Flow::getStartLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateCode
string PromelaCodeGenerator::generateCode(Flow& automaton, int id, EdgeAnnotationMap edgeAnnotationMap,
bool useTransitionIds, boost::unordered_map<string, int>& transitionIdMap) {
stringstream ss;
ss << "/* Process "<<id<<" */" << endl;
ss << "active proctype Proc"<<id<<"()" << endl;
ss << "{" << endl;
ss << " int state = "<<automaton.getStartLabel().getId()<<";" << endl;
ss << " do" << endl;
set<Label> visited; //TODO: maybe change to hashset
list<Label> worklist;
worklist.push_back(automaton.getStartLabel());
visited.insert(automaton.getStartLabel());
while (!worklist.empty()) {
Label label = worklist.front();
worklist.pop_front();
ss << " :: state == "<<label.getId()<<" ->" << endl;
ss << " atomic {" << endl;
ss << " if" << endl;
Flow outEdges = automaton.outEdges(label);
for (Flow::iterator i=outEdges.begin(); i!= outEdges.end(); ++i) {
ss << " :: "<<communicationDetails((*i).getAnnotation(), id, edgeAnnotationMap, useTransitionIds, transitionIdMap) << endl;
ss << " state = "<<(*i).target().getId()<<";" << endl;
if (visited.find((*i).target()) == visited.end()) {
worklist.push_back((*i).target());
visited.insert((*i).target());
}
}
ss << " fi" << endl;
ss << " }" << endl;
}
ss << " od" << endl;
ss << "}" << endl;
return ss.str();
}