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


C++ OID::get方法代码示例

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


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

示例1: test_construct

void test_construct(Test &test) {
	dstring str("hello world");
	OID obj = str;
	CHECK((char)obj.get(0) == 'h');
	CHECK((int)obj.get(Size) == 11);
	DONE	
}
开发者ID:dharc,项目名称:Cadence-Embedded,代码行数:7,代码来源:dstring-test.cpp

示例2: toString

void Definition::toString(char *buf, int max, int indent) const {
	int index=0;
	OID temp;
	int modi;
	char buf2[50];
	Event *evt2 = NEW Event(Event::GET_RANGE, m_def);
	evt2->param<0>(0);
	evt2->param<1>(m_size);
	evt2->send();
	OID boid = evt2->result();
	OID ifobj = Null;
	Buffer *def = Buffer::lookup(boid);
	delete evt2;
	if (def == 0) {
		buf[0] = 0;
		return;
	}
	
	for (int i=0; i<indent; i++) strcat(buf, "\t");
	
	while (index < m_size) {
		temp = def->get(index++);
		
		if (temp.isModifier()) {
			modi = temp.d();
		
			switch (modi) {
			case modifiers::ENDSUB:
				strcat(buf, ")");
				break;
			case modifiers::BEGINSUB:
				strcat(buf, "(");
				break;
			case modifiers::UNION:
				strcat(buf, "union ");
				break;
			case modifiers::COMPARE:
				strcat(buf, "== ");
				break;
			default: break;
			}
		} else {
			if (temp == This) {
				strcat(buf, ".");
			} else if (index == 1 && temp.get("type") == OID("if")) {
				ifobj = temp;
				strcat(buf, "if ");
				//buildif(buf, temp);
			} else {
				temp.toString(buf2, 50);
				strcat(buf, buf2);
				strcat(buf, " ");
			}
		}
	}
	
	if (ifobj != Null) buildif(buf, ifobj, indent);

	Buffer::free(boid);
}
开发者ID:knicos,项目名称:Cadence,代码行数:60,代码来源:definition.cpp

示例3: onExecute

void SoftAgent::onExecute() {
	//Loop through code
	std::cout << "EXECUTE\n";
	
	OID c = code();
	int size = c.get(Size);
	int t1,t2,t3;
	
	OID reg[MAX_REGISTERS];
	
	for (int i=0; i<size; i++) {
		switch ((int)c.get(i)) {
		case SSET:	t1 = (int)c.get(++i);
				t2 = (int)c.get(++i);
				t3 = (int)c.get(++i);
				reg[t1].set(reg[t2], reg[t3]); break;
				
		case ASET:	t1 = (int)c.get(++i);
				t2 = (int)c.get(++i);
				t3 = (int)c.get(++i);
				reg[t1].set(reg[t2], reg[t3], true); break;

		case SGET:	t1 = (int)c.get(++i);
				t2 = (int)c.get(++i);
				t3 = (int)c.get(++i);
				reg[t1] = reg[t2].get(reg[t3]); break;

		case SDEF:	t1 = (int)c.get(++i);
				t2 = (int)c.get(++i);
				t3 = (int)c.get(++i);
				reg[t1].definefuture(reg[t2], reg[t3]); break;

		case ADEF:	t1 = (int)c.get(++i);
				t2 = (int)c.get(++i);
				t3 = (int)c.get(++i);
				reg[t1].definefuture(reg[t2], reg[t3], true); break;

		case GDEF:	break; //reg[c.get(++i)] = reg[c.get(++i)].get(reg[c.get(++i)]); break;
		case GFUN:	break; //reg[c.get(++i)] = reg[c.get(++i)].get(reg[c.get(++i)]); break;

		case SFUN:	t1 = (int)c.get(++i);
				t2 = (int)c.get(++i);
				t3 = (int)c.get(++i);
				reg[t1].define(reg[t2], reg[t3]); break;

		case AFUN:	t1 = (int)c.get(++i);
				t2 = (int)c.get(++i);
				t3 = (int)c.get(++i);
				reg[t1].define(reg[t2], reg[t3], true); break;

		case CREA:	t1 = (int)c.get(++i);
				reg[t1] = OID::create(); break;
		
		case ISET:	t1 = (int)c.get(++i);
				reg[t1] = c.get(++i); break;
				
		default:	Error(0, "An invalid agent instruction was encountered");
		}
	}
}
开发者ID:knicos,项目名称:Cadence,代码行数:60,代码来源:softagent.cpp


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