本文整理汇总了C++中atlas::objects::Root类的典型用法代码示例。如果您正苦于以下问题:C++ Root类的具体用法?C++ Root怎么用?C++ Root使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Root类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: check
int EntityRuleHandler::check(const Atlas::Objects::Root & desc)
{
if (desc->getObjtype() != "class") {
return -1;
}
return m_builder->isTask(desc->getParents().front()) ? -1 : 0;
}
开发者ID:alriddoch,项目名称:cyphesis,代码行数:7,代码来源:Rulesettest.cpp
示例2: main
int main()
{
ClientConnection * cc = new ClientConnection();
delete cc;
// Try all the method calls when not connected
cc = new ClientConnection();
cc->login("username", "password");
cc->create("player", "username", "password");
cc->wait();
{
Atlas::Objects::Operation::RootOperation op;
cc->send(op);
}
cc->pop();
cc->pending();
delete cc;
TestClientConnection * tcc = new TestClientConnection();
{
Atlas::Objects::Root obj;
Atlas::Objects::Operation::RootOperation op;
tcc->test_operation(op);
tcc->test_errorArrived(op);
tcc->test_infoArrived(op);
tcc->test_objectArrived(op);
Anonymous op_arg;
op->setArgs1(op_arg);
tcc->test_infoArrived(op);
op->setFrom("1");
tcc->test_infoArrived(op);
op->setParents(std::list<std::string>());
tcc->test_operation(op);
tcc->test_objectArrived(op);
Info i;
tcc->test_objectArrived(i);
Error e;
tcc->test_objectArrived(e);
tcc->test_objectArrived(obj);
obj->setParents(std::list<std::string>());
tcc->test_objectArrived(obj);
}
return 0;
}
开发者ID:anthonypesce,项目名称:cyphesis,代码行数:58,代码来源:ClientConnectiontest.cpp
示例3: check
int ArchetypeRuleHandler::check(const Atlas::Objects::Root & desc)
{
if (desc->getObjtype() != "archetype") {
return -1;
}
return 0;
}
开发者ID:worldforge,项目名称:cyphesis,代码行数:7,代码来源:RulesetTest.cpp
示例4: createRule
void EntityImporterBase::createRule(const Atlas::Objects::Root & obj, OpVector & res)
{
m_state = RULE_CREATING;
Atlas::Objects::Operation::Create createOp;
createOp->setFrom(mAccountId);
createOp->setArgs1(obj);
createOp->setSerialno(newSerialNumber());
S_LOG_INFO("Creating new rule '" << obj->getId() << "' on server.");
res.push_back(createOp);
}
开发者ID:worldforge,项目名称:cyphesis,代码行数:11,代码来源:EntityImporterBase.cpp
示例5: switch
const Atlas::Objects::Root & Inheritance::getClass(const std::string & parent)
{
switch (stub_getclass_returns) {
case NULLCLASS:
return *new Atlas::Objects::Root(0);;
break;
case OAKCLASS:
{
Atlas::Objects::Root oak;
oak->setId("oak");
oak->setParents(std::list<std::string>(1, "game_entity"));
return *new Atlas::Objects::Root(oak);
}
break;
case NOCLASS:
default:
return noClass;
break;
}
}
开发者ID:erikogenvik,项目名称:cyphesis,代码行数:20,代码来源:UpdateTestertest.cpp
示例6: installOpDefinition
int OpRuleHandler::installOpDefinition(const std::string & class_name,
const std::string & parent,
const Atlas::Objects::Root & class_desc,
std::string & dependent,
std::string & reason)
{
assert(class_name == class_desc->getId());
Inheritance & i = Inheritance::instance();
if (!i.hasClass(parent)) {
debug(std::cout << "op_definition \"" << class_name
<< "\" has non existant parent \"" << parent
<< "\". Waiting." << std::endl << std::flush;);
开发者ID:alriddoch,项目名称:cyphesis,代码行数:14,代码来源:OpRuleHandler.cpp
示例7: onImaginary
void EmberEntity::onImaginary(const Atlas::Objects::Root& act)
{
Atlas::Message::Element attr;
if (act->copyAttr("description", attr) && attr.isString()) {
std::string message = getName() + " " + attr.asString() + ".";
ConsoleBackend::getSingletonPtr()->pushMessage(message, "info");
S_LOG_VERBOSE("Entity: " << this->getId() << " (" << this->getName() << ") imaginary: " << attr.String());
}
Entity::onImaginary(act);
}
开发者ID:junrw,项目名称:ember-gsoc2012,代码行数:14,代码来源:EmberEntity.cpp
示例8: main
int main()
{
{
AtlasStreamClient * asc = new AtlasStreamClient;
delete asc;
}
TestAtlasStreamClient * asc = new TestAtlasStreamClient;
{
Atlas::Objects::Root obj;
asc->test_objectArrived(obj);
obj->setParents(std::list<std::string>());
asc->test_objectArrived(obj);
obj->setParents(std::list<std::string>(1, "foo"));
asc->test_objectArrived(obj);
obj->setObjtype("foo");
asc->test_objectArrived(obj);
}
Operation op;
asc->test_objectArrived(op);
asc->test_operation(op);
TestClientTask * tct = new TestClientTask();
// Test starting a task
asc->runTask(tct, "foo");
assert(asc->test_currentTask() == tct);
// Try and start it again will busy, as one is running
asc->runTask(new TestClientTask(), "foo");
assert(asc->test_currentTask() == tct);
asc->endTask();
assert(asc->test_currentTask() == 0);
asc->endTask();
assert(asc->test_currentTask() == 0);
tct = new TestClientTask();
asc->runTask(tct, "foo");
// Pass in an operation while a task is running.
asc->test_operation(op);
assert(asc->test_currentTask() == tct);
tct->make_complete();
asc->test_operation(op);
assert(asc->test_currentTask() == 0);
tct = new TestClientTask();
asc->runTask(tct, "foo");
assert(asc->test_currentTask() == tct);
// Pass in an operation while a task is running.
asc->test_operation(op);
assert(asc->test_currentTask() == tct);
{
Atlas::Objects::Operation::Info op;
asc->test_operation(op);
Atlas::Objects::Entity::Anonymous arg;
op->setArgs1(arg);
asc->test_operation(op);
op->setRefno(23);
asc->test_operation(op);
op->setRefno(asc->newSerialNo());
asc->test_operation(op);
op->setFrom("1");
asc->test_operation(op);
}
{
Atlas::Objects::Operation::Error op;
asc->test_operation(op);
Atlas::Objects::Entity::Anonymous arg;
op->setArgs1(arg);
asc->test_operation(op);
arg->setAttr("message", 1);
asc->test_operation(op);
arg->setAttr("message", "Real message");
asc->test_operation(op);
}
{
Atlas::Objects::Operation::Appearance op;
asc->test_operation(op);
}
{
Atlas::Objects::Operation::Disappearance op;
asc->test_operation(op);
}
{
Atlas::Objects::Operation::Sight op;
asc->test_operation(op);
}
//.........这里部分代码省略.........
开发者ID:erikogenvik,项目名称:cyphesis,代码行数:101,代码来源:AtlasStreamClienttest.cpp
示例9: send
virtual void send(const Atlas::Objects::Root &obj) {
std::cout << "Sending " << obj->getParents().front()
<< std::endl << std::flush;
}
开发者ID:danniellecandys,项目名称:eris,代码行数:4,代码来源:TerrainMod_unittest.cpp
示例10: main
int main()
{
{
Juncture * j = new Juncture(0, "1", 1);
delete j;
}
{
Juncture * j = new Juncture(0, "1", 1);
OpVector res;
Operation op;
j->operation(op, res);
delete j;
}
{
Juncture * j = new Juncture(0, "1", 1);
OpVector res;
Atlas::Objects::Operation::Login op;
j->operation(op, res);
delete j;
}
// Login op, no args
{
Juncture * j = new Juncture(0, "1", 1);
OpVector res;
Operation op;
j->LoginOperation(op, res);
delete j;
}
// Login op, empty arg
{
Juncture * j = new Juncture(0, "1", 1);
OpVector res;
Operation op;
Atlas::Objects::Root arg;
op->setArgs1(arg);
j->LoginOperation(op, res);
delete j;
}
// Login op, username in arg
{
Juncture * j = new Juncture(0, "1", 1);
OpVector res;
Operation op;
Atlas::Objects::Root arg;
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
op->setArgs1(arg);
j->LoginOperation(op, res);
delete j;
}
// Login op, bad username in arg
{
Juncture * j = new Juncture(0, "1", 1);
OpVector res;
Operation op;
Atlas::Objects::Root arg;
arg->setAttr("username", 0x69e362c6);
op->setArgs1(arg);
j->LoginOperation(op, res);
delete j;
}
// Login op, username & password in arg
{
Juncture * j = new Juncture(0, "1", 1);
OpVector res;
Operation op;
Atlas::Objects::Root arg;
arg->setAttr("username", "69e362c6-03a4-11e0-9608-001ec93e7c08");
arg->setAttr("password", "a12a2f3a-03a4-11e0-8379-001ec93e7c08");
op->setArgs1(arg);
j->LoginOperation(op, res);
//.........这里部分代码省略.........
开发者ID:anthonypesce,项目名称:cyphesis,代码行数:101,代码来源:Juncturetest.cpp
示例11: main
int main()
{
TestWorld world;
{
Entity e("2", 2);
ExternalMind em(e);
}
{
Entity e("2", 2);
TestExternalMind em(e);
em.test_deleteEntity("3");
}
// Purge with empty contains
{
Entity e("2", 2);
e.m_contains = new LocatedEntitySet;
TestExternalMind em(e);
em.test_purgeEntity(e);
}
// Purge with populated contains
{
Entity e("2", 2);
e.m_contains = new LocatedEntitySet;
e.m_contains->insert(new Entity("3", 3));
TestExternalMind em(e);
em.test_purgeEntity(e);
}
// Connect to nothing
{
Entity e("2", 2);
ExternalMind em(e);
em.linkUp(0);
}
// Connect to something
{
Entity e("2", 2);
ExternalMind em(e);
em.linkUp(new Connection(*(CommSocket*)0,
*(ServerRouting*)0,
"addr", "4", 4));
}
// Connect to something, then disconnect
{
Entity e("2", 2);
ExternalMind em(e);
em.linkUp(new Connection(*(CommSocket*)0,
*(ServerRouting*)0,
"addr", "4", 4));
em.linkUp(0);
}
// Connect to something, then check connection ID
{
Entity e("2", 2);
ExternalMind em(e);
em.linkUp(new Connection(*(CommSocket*)0,
*(ServerRouting*)0,
"addr", "4", 4));
const std::string & id = em.connectionId();
assert(id == "4");
}
// Send a random operation
{
Entity e("2", 2);
TestExternalMind em(e);
em.test_setLossTime(BaseWorld::instance().getTime());
stub_baseworld_receieved_op = -1;
OpVector res;
em.operation(Atlas::Objects::Operation::RootOperation(), res);
assert(stub_baseworld_receieved_op == -1);
}
// Send a Delete operation
{
Entity e("2", 2);
//.........这里部分代码省略.........
开发者ID:anthonypesce,项目名称:cyphesis,代码行数:101,代码来源:ExternalMindtest.cpp
示例12: main
int main()
{
TestWorld world;
CommServer server;
{
Peer * p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
delete p;
}
{
Peer * p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
Atlas::Objects::Operation::RootOperation op;
OpVector res;
p->operation(op, res);
delete p;
}
{
// Test the setting of authentiaction states
Peer * p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
assert(p->getAuthState() == PEER_INIT);
p->setAuthState(PEER_AUTHENTICATED);
assert(p->getAuthState() == PEER_AUTHENTICATED);
delete p;
}
{
Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
Atlas::Objects::Operation::Info op;
OpVector res;
p->operation(op, res);
}
// Authenticating (no args)
{
Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
p->setAuthState(PEER_AUTHENTICATING);
Atlas::Objects::Operation::Info op;
OpVector res;
p->operation(op, res);
}
// Authenticating (empty arg)
{
Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
p->setAuthState(PEER_AUTHENTICATING);
Atlas::Objects::Operation::Info op;
Atlas::Objects::Root arg;
op->setArgs1(arg);
OpVector res;
p->operation(op, res);
}
// Authenticating (full arg)
{
TestPeer *p = new TestPeer(*(CommSocket*)0, *(ServerRouting*)0, "addr", "1", 1);
p->setAuthState(PEER_AUTHENTICATING);
Atlas::Objects::Operation::Info op;
Atlas::Objects::Root arg;
arg->setId("2");
std::list<std::string> parents;
parents.push_back("server");
arg->setParents(parents);
op->setArgs1(arg);
OpVector res;
p->operation(op, res);
assert(p->getAccountType() == "server");
}
// Authenticated (no args)
{
Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
p->setAuthState(PEER_AUTHENTICATED);
Atlas::Objects::Operation::Info op;
OpVector res;
p->operation(op, res);
}
{
Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
Atlas::Objects::Operation::Error op;
OpVector res;
p->operation(op, res);
}
//.........这里部分代码省略.........
开发者ID:anthonypesce,项目名称:cyphesis,代码行数:101,代码来源:Peertest.cpp
注:本文中的atlas::objects::Root类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论