本文整理汇总了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
}
示例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);
}
示例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");
}
}
}