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


C++ ActionSet::begin方法代码示例

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


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

示例1:

bool Core::check_C2(const ActionSet &ample)
{
	for (ActionSet::iterator it = ample.begin(); it != ample.end(); it++) {
		if (it->type == ActionFire) {
			if (verif_configuration.is_visible(*it)) {
				if (cfg_debug) {
					printf("    C2: %s is visible transition.\n", it->to_string().c_str());
				}
				return false;
			}
		}
	}
	return true;
}
开发者ID:DiPi22,项目名称:kaira,代码行数:14,代码来源:statespace.cpp

示例2: compute_ample_set

ActionSet Core::compute_ample_set(State *s, const ActionSet &enable)
{
	ActionSet::iterator it;

	if (cfg_debug) {
		// print state name
		char *hashstr = (char*) alloca(mhash_get_block_size(MHASH_MD5) * 2 + 1);
		hashdigest_to_string(MHASH_MD5, s->compute_hash(MHASH_MD5) , hashstr);
		printf(">> state: %s: \nenable: { ", hashstr);
		for (it = enable.begin(); it != enable.end(); it++) {
			printf("%s ", it->to_string().c_str());
		}
		printf("}\n");
	}

	for (it = enable.begin(); it != enable.end(); it++) {
		ActionSet ample;
		ample.insert(*it);
		if (cfg_debug) {
			printf("  > ample: { ");
			for (ActionSet::iterator i = ample.begin(); i != ample.end(); i++) {
				printf("%s ", i->to_string().c_str());
			}
			printf("}\n");
		}
		if (check_C1(enable, ample, s) && check_C2(ample) && check_C3(s)) {
			if (cfg_debug) {
				printf("  This ample set is independent.\n");
			}
			return ample;
		}
		if (cfg_wait_for_key) {
			getchar();
		}
	}
	return enable;
}
开发者ID:DiPi22,项目名称:kaira,代码行数:37,代码来源:statespace.cpp

示例3: generate

void Node::generate(Core *core)
{
	if (state->get_quit_flag()) {
		return;
	}

	ActionSet enabled = compute_enable_set(core);
	ActionSet ws;
	if (cfg_partial_order_reduction) {
		ws = core->compute_ample_set(state, enabled);
	} else {
		ws = enabled;
	}

	State *s;

	ActionSet::iterator it;
	for (it = ws.begin(); it != ws.end(); it++) {
		if (++it != ws.end()) {
			s = new State(*state);
		} else {
			s = state;
		}
		it--;
		switch (it->type) {
			case ActionFire:
			{
				ca::Packer packer;
				if (core->generate_binding_in_nni(it->data.fire.transition_def->get_id())) {
					s->fire_transition_full_with_binding(it->process, it->data.fire.transition_def, packer);
				} else {
					s->fire_transition_full(it->process, it->data.fire.transition_def);
				}
				Node *n = core->add_state(s, this);
				NextNodeInfo nninfo;
				nninfo.node = n;
				nninfo.action = ActionFire;
				nninfo.data.fire.process_id = it->process;
				nninfo.data.fire.transition_id = it->data.fire.transition_def->get_id();
				if (core->generate_binding_in_nni(it->data.fire.transition_def->get_id())) {
					nninfo.data.fire.binding = core->hash_packer(packer);
				} else {
					nninfo.data.fire.binding = NULL;
				}
				nexts.push_back(nninfo);
				packer.free();
				break;
			}

			case ActionReceive:
			{
				s->receive(it->process, it->data.receive.source, true);
				Node *n = core->add_state(s, this);
				NextNodeInfo nninfo;
				nninfo.node = n;
				nninfo.action = ActionReceive;
				nninfo.data.receive.process_id = it->process;
				nninfo.data.receive.source_id = it->data.receive.source;
				nexts.push_back(nninfo);
				break;
			}
		}
	}
}
开发者ID:DiPi22,项目名称:kaira,代码行数:64,代码来源:statespace.cpp


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