本文整理汇总了C++中ActionSet::find方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionSet::find方法的具体用法?C++ ActionSet::find怎么用?C++ ActionSet::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionSet
的用法示例。
在下文中一共展示了ActionSet::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool Core::check_C1(const ActionSet &enabled, const ActionSet &le, State *s)
{
ActionSet::iterator it1;
ActionSet::iterator it2;
std::deque<Action> queue;
// This assume that there is no optimization for number of tokens in places
ActionSet processed = ample;
std::vector<bool> receive_blocked(ca::process_count * ca::process_count, false);
std::vector<int> enabled_priorities(ca::process_count, 0);
std::vector<int> marking = verif_configuration.get_marking(s);
if (cfg_debug) {
printf(" C1: Marking: {");
int place_count = marking.size() / ca::process_count;
for (size_t i = 0; i < marking.size(); i++) {
printf(" %d", marking[i]);
if ((i + 1) % place_count == 0 && i + 1 != marking.size()) {
printf(" |");
}
}
printf(" }\n");
printf(" C1: starting configuration {");
}
for (ActionSet::iterator i = enabled.begin(); i != enabled.end(); i++) {
if (ample.find(*i) != ample.end()) {
if (i->type == ActionReceive) {
receive_blocked[i->process * ca::process_count + i->data.receive.source] = true;
}
if (i->type == ActionFire) {
enabled_priorities[i->process] = i->data.fire.transition_def->get_priority();
}
} else {
if (i->type == ActionFire) {
processed.insert(*i);
queue.push_back(*i);
if (cfg_debug) {
printf(" %s", i->to_string().c_str());
}
const std::vector<ca::TransitionDef*> &transitions = net_def->get_transition_defs();
for (int t = 0; t < net_def->get_transitions_count(); t++) {
if (transitions[t]->get_priority() >= enabled_priorities[i->process]) continue;
if (s->is_transition_enabled(i->process, transitions[t])) {
Action a;
a.type = ActionFire;
a.data.fire.transition_def = transitions[t];
a.process = i->process;
processed.insert(a);
queue.push_back(a);
if (cfg_debug) {
printf(" %s", a.to_string().c_str());
}
}
}
continue;
}
if (i->type == ActionReceive) {
const State::PacketQueue& pq = s->get_packets(i->process, i->data.receive.source);
for (size_t p = 0; p < pq.size(); p++) {
Action a;
a.type = ActionReceive;
a.process = i->process;
a.data.receive.source = i->data.receive.source;
ca::Tokens *tokens = (ca::Tokens *) pq[p].data;
a.data.receive.edge_id = tokens->edge_id;
if (processed.find(a) == processed.end()) {
processed.insert(a);
queue.push_back(a);
if (cfg_debug) {
printf(" %s", a.to_string().c_str());
}
}
}
continue;
}
processed.insert(*i);
queue.push_back(*i);
if (cfg_debug) {
printf(" %s", i->to_string().c_str());
}
}
}
if (cfg_debug) {
printf(" }\n");
}
while(queue.size() > 0) {
for (ActionSet::iterator a = ample.begin(); a != ample.end(); a++) {
if (verif_configuration.is_dependent(*a, queue.front(), marking)) {
if (cfg_debug) {
printf(" C1: %s and %s are dependent.\n", a->to_string().c_str(), queue.front().to_string().c_str());
}
return false;
}
}
if (cfg_debug) {
size_t i = queue.size();
verif_configuration.compute_successors(queue.front(), queue, processed, receive_blocked, enabled_priorities, marking);
printf(" C1: successors of %s: {", queue.front().to_string().c_str());
//.........这里部分代码省略.........