本文整理汇总了C++中atlas::objects::entity::Anonymous类的典型用法代码示例。如果您正苦于以下问题:C++ Anonymous类的具体用法?C++ Anonymous怎么用?C++ Anonymous使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Anonymous类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getGoalInfo
void EntityEditor::getGoalInfo(const std::string& id)
{
Eris::Account* account = EmberServices::getSingleton().getServerService().getAccount();
Atlas::Objects::Operation::Generic get;
std::list<std::string> parents;
parents.emplace_back("commune");
get->setParents(parents);
get->setTo(mEntity.getId());
//By setting it TO an entity and FROM our avatar we'll make the server deliver it as
//if it came from the entity itself (the server rewrites the FROM to be of the entity).
get->setFrom(mWorld.getAvatar()->getEmberEntity().getId());
//By setting a serial number we tell the server to "relay" the operation. This means that any
//response operation from the target entity will be sent back to us.
get->setSerialno(Eris::getNewSerialno());
Atlas::Message::MapType goalMap;
goalMap["id"] = id;
Atlas::Objects::Entity::Anonymous getArg;
getArg->setAttr("goal_info", goalMap);
get->setArgs1(getArg);
Eris::Connection* connection = account->getConnection();
connection->getResponder()->await(get->getSerialno(), this, &EntityEditor::operationGetGoalInfoResult);
connection->send(get);
}
开发者ID:Laefy,项目名称:ember,代码行数:29,代码来源:EntityEditor.cpp
示例2: removeGoal
void EntityEditor::removeGoal(const std::string& id)
{
Eris::Account* account = EmberServices::getSingleton().getServerService().getAccount();
Atlas::Message::MapType goalElement;
goalElement["id"] = id;
//By not defining anything else than the id we're telling the server to remove it.
Atlas::Objects::Entity::Anonymous thought;
thought->setAttr("goal", goalElement);
Atlas::Objects::Operation::RootOperation thinkOp;
thinkOp->setArgs1(thought);
std::list<std::string> parents;
parents.emplace_back("think");
thinkOp->setParents(parents);
thinkOp->setTo(mEntity.getId());
//By setting it TO an entity and FROM our avatar we'll make the server deliver it as
//if it came from the entity itself (the server rewrites the FROM to be of the entity).
thinkOp->setFrom(mWorld.getAvatar()->getEmberEntity().getId());
Eris::Connection* connection = account->getConnection();
connection->send(thinkOp);
}
开发者ID:Laefy,项目名称:ember,代码行数:25,代码来源:EntityEditor.cpp
示例3: actuate
void ConnectedAdapter::actuate(Eris::Entity* entity, const std::string& action)
{
try {
Atlas::Objects::Entity::Anonymous what;
what->setId(entity->getId());
// what->setObjtype("obj");
Atlas::Objects::Operation::RootOperation actionOp;
actionOp->setObjtype("op");
actionOp->setArgs1(what);
std::list<std::string> actionParents;
actionParents.push_back(action);
actionOp->setParents(actionParents);
Atlas::Objects::Operation::RootOperation actuateOp;
actuateOp->setObjtype("op");
actuateOp->setArgs1(actionOp);
std::list<std::string> actuateParents;
actuateParents.push_back("actuate");
actuateOp->setParents(actuateParents);
actuateOp->setFrom(mAvatar.getEntity()->getId());
S_LOG_INFO("Actuating entity with id " << entity->getId() << ", named " << entity->getName() << " with action '" << action << "'.");
mConnection.send(actuateOp);
} catch (const std::exception& ex) {
S_LOG_WARNING("Got error on actuating." << ex);
}
}
开发者ID:mpreisler,项目名称:ember,代码行数:29,代码来源:ConnectedAdapter.cpp
示例4: wield
void ConnectedAdapter::wield(Eris::Entity* entity, const std::string& outfitSlot)
{
try {
if (entity->getLocation() != mAvatar.getEntity()) {
S_LOG_WARNING("Can't wield an Entity which is not located in the avatar.");
return;
}
Atlas::Objects::Entity::Anonymous arguments;
arguments->setId(entity->getId());
if (outfitSlot != "") {
arguments->setAttr("outfit", outfitSlot);
}
Atlas::Objects::Operation::Wield wield;
wield->setFrom(mAvatar.getEntity()->getId());
wield->setArgs1(arguments);
mConnection.send(wield);
} catch (const std::exception& ex) {
S_LOG_WARNING("Got error on wielding." << ex);
}
}
开发者ID:mpreisler,项目名称:ember,代码行数:26,代码来源:ConnectedAdapter.cpp
示例5: atlasClass
Root atlasClass(const std::string & name, const std::string & parent)
{
Atlas::Objects::Entity::Anonymous r;
r->setParents(std::list<std::string>(1, parent));
r->setObjtype("class");
r->setId(name);
return r;
}
开发者ID:Arsakes,项目名称:cyphesis,代码行数:8,代码来源:EntityBuildertest.cpp
示例6: atlasOpDefinition
Root atlasOpDefinition(const std::string & name, const std::string & parent)
{
Atlas::Objects::Entity::Anonymous r;
r->setParents(std::list<std::string>(1, parent));
r->setObjtype("op_definition");
r->setId(name);
return r;
}
开发者ID:9cat,项目名称:cyphesis,代码行数:10,代码来源:Inheritance.cpp
示例7: atlasType
Root atlasType(const std::string & name,
const std::string & parent,
bool abstract)
{
Atlas::Objects::Entity::Anonymous r;
r->setParents(std::list<std::string>(1, parent));
r->setObjtype(abstract ? "data_type" : "type");
r->setId(name);
return r;
}
开发者ID:9cat,项目名称:cyphesis,代码行数:12,代码来源:Inheritance.cpp
示例8: test_unseenOperation
void BaseMindtest::test_unseenOperation()
{
OpVector res;
Atlas::Objects::Operation::Unseen op;
bm->operation(op, res);
Atlas::Objects::Entity::Anonymous arg;
op->setArgs1(arg);
bm->operation(op, res);
arg->setId("2");
bm->operation(op, res);
}
开发者ID:9cat,项目名称:cyphesis,代码行数:13,代码来源:BaseMindtest.cpp
示例9: test_disappearanceOperation
void BaseMindtest::test_disappearanceOperation()
{
OpVector res;
Atlas::Objects::Operation::Disappearance op;
bm->operation(op, res);
Atlas::Objects::Entity::Anonymous arg;
op->setArgs1(arg);
bm->operation(op, res);
arg->setId("2");
bm->operation(op, res);
}
开发者ID:9cat,项目名称:cyphesis,代码行数:13,代码来源:BaseMindtest.cpp
示例10: irrelevant
Py::Object CyPy_Task::irrelevant(const Py::Tuple& args)
{
m_value->irrelevant();
if (args.size() > 0) {
args.verify_length(1);
Atlas::Objects::Operation::Error e;
Atlas::Objects::Entity::Anonymous arg;
arg->setAttr("message", verifyString(args.front()));
e->modifyArgs().push_back(arg);
e->setTo(m_value->m_usageInstance.actor->getId());
return CyPy_Operation::wrap(e);
}
return Py::None();
}
开发者ID:worldforge,项目名称:cyphesis,代码行数:14,代码来源:CyPy_Task.cpp
示例11: eat
void ConnectedAdapter::eat(Eris::Entity* entity)
{
try {
Atlas::Objects::Entity::Anonymous what;
what->setId(entity->getId());
Atlas::Objects::Operation::Generic op;
op->setType("eat", -1);
op->setFrom(mAvatar.getEntity()->getId());
op->setArgs1(what);
S_LOG_INFO("Eating entity with id " << entity->getId() << ", named " << entity->getName());
mConnection.send(op);
} catch (const std::exception& ex) {
S_LOG_WARNING("Got error on eating entity." << ex);
}
}
开发者ID:mpreisler,项目名称:ember,代码行数:17,代码来源:ConnectedAdapter.cpp
示例12: deleteEntity
void ConnectedAdapter::deleteEntity(Eris::Entity* entity)
{
try {
Atlas::Objects::Entity::Anonymous what;
what->setId(entity->getId());
Atlas::Objects::Operation::Delete deleteOp;
deleteOp->setFrom(mAvatar.getEntity()->getId());
deleteOp->setTo(entity->getId());
deleteOp->setArgs1(what);
S_LOG_INFO("Deleting entity with id " << entity->getId() << ", named " << entity->getName());
mConnection.send(deleteOp);
} catch (const std::exception& ex) {
S_LOG_WARNING("Got error on deleting entity." << ex);
}
}
开发者ID:mpreisler,项目名称:ember,代码行数:17,代码来源:ConnectedAdapter.cpp
示例13: test_sightSetOperation
void BaseMindtest::test_sightSetOperation()
{
Atlas::Objects::Operation::Set sub_op;
Atlas::Objects::Operation::Sight op;
op->setArgs1(sub_op);
OpVector res;
bm->operation(op, res);
sub_op->setArgs1(Atlas::Objects::Entity::Anonymous());
bm->operation(op, res);
sub_op->setArgs1(Atlas::Objects::Entity::Anonymous(0));
bm->operation(op, res);
Atlas::Objects::Entity::Anonymous arg;
arg->setId("2");
sub_op->setArgs1(arg);
bm->operation(op, res);
}
开发者ID:9cat,项目名称:cyphesis,代码行数:19,代码来源:BaseMindtest.cpp
示例14: test_MemMap_updateAdd_location_properties_have_effect
void BaseMindMapEntityintegration::test_MemMap_updateAdd_location_properties_have_effect()
{
MemEntity * tlve = new MemEntity("0", 0);
Location location(tlve);
BBox bbox(WFMath::Point<3>(1,2,3), WFMath::Point<3>(4,5,6));
location.setBBox(bbox);
{
Atlas::Objects::Entity::Anonymous args;
location.addToEntity(args);
args->setAttr("id", "0");
m_mind->m_map.updateAdd(args, 1.0f);
}
MemEntity* ent = m_mind->m_map.get("0");
ASSERT_EQUAL("0", ent->getId());
ASSERT_EQUAL(bbox, ent->m_location.m_bBox);
ASSERT_TRUE(ent->m_location.isSolid());
ASSERT_TRUE(ent->m_location.isSimple());
BBox bbox2(WFMath::Point<3>(10,20,30), WFMath::Point<3>(40,50,60));
location.setBBox(bbox2);
{
Atlas::Objects::Entity::Anonymous args;
location.addToEntity(args);
args->setAttr("id", "0");
args->setAttr("solid", 0);
args->setAttr("simple", 0);
m_mind->m_map.updateAdd(args, 2.0f);
}
ent = m_mind->m_map.get("0");
ASSERT_EQUAL(bbox2, ent->m_location.m_bBox);
ASSERT_TRUE(!ent->m_location.isSolid());
ASSERT_TRUE(!ent->m_location.isSimple());
}
开发者ID:9cat,项目名称:cyphesis,代码行数:41,代码来源:BaseMindMapEntityintegration.cpp
示例15: adminTell
void ConnectedAdapter::adminTell(const std::string& entityId, const std::string& attribute, const std::string &value)
{
try {
Atlas::Objects::Entity::Anonymous what;
what->setAttr(attribute, value);
Atlas::Objects::Operation::Talk talk;
talk->setFrom(entityId);
talk->setTo(entityId);
talk->setArgs1(what);
Atlas::Objects::Operation::Sound sound;
sound->setFrom(mAvatar.getEntity()->getId());
sound->setTo(entityId);
sound->setArgs1(talk);
mConnection.send(sound);
} catch (const std::exception& ex) {
S_LOG_WARNING("Got error on admin_tell." << ex);
}
}
开发者ID:mpreisler,项目名称:ember,代码行数:22,代码来源:ConnectedAdapter.cpp
示例16: addKnowledge
void EntityEditor::addKnowledge(const std::string& predicate, const std::string& subject, const std::string& knowledge)
{
Eris::Account* account = EmberServices::getSingleton().getServerService().getAccount();
Atlas::Objects::Entity::Anonymous thought;
thought->setAttr("predicate", predicate);
thought->setAttr("subject", subject);
thought->setAttr("object", knowledge);
Atlas::Objects::Operation::RootOperation thinkOp;
thinkOp->setArgs1(thought);
std::list<std::string> parents;
parents.emplace_back("think");
thinkOp->setParents(parents);
thinkOp->setTo(mEntity.getId());
//By setting it TO an entity and FROM our avatar we'll make the server deliver it as
//if it came from the entity itself (the server rewrites the FROM to be of the entity).
thinkOp->setFrom(mWorld.getAvatar()->getEmberEntity().getId());
Eris::Connection* connection = account->getConnection();
connection->send(thinkOp);
}
开发者ID:Laefy,项目名称:ember,代码行数:24,代码来源:EntityEditor.cpp
示例17: 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
示例18: main
int main(int argc, char** argv)
{
std::string atlas_xml_path;
char * srcdir_env = getenv("srcdir");
if (srcdir_env != 0) {
atlas_xml_path = srcdir_env;
atlas_xml_path += "/";
}
atlas_xml_path += "../../protocol/spec/atlas.xml";
try {
Atlas::Objects::loadDefaults(atlas_xml_path);
} catch(Atlas::Objects::DefaultLoadingException e) {
std::cout << "DefaultLoadingException: "
<< e.getDescription() << std::endl;
}
Root root = Atlas::Objects::objectDefinitions.find("root")->second;
Root root_inst;
root_inst->setAttr("id", std::string("root_instantiation"));
assert(root->getAttr("id").asString() == "root");
assert(root_inst->getAttr("id").asString() == "root_instantiation");
assert(root->getAttr("parents").asList().size() == 0);
assert(root_inst->getAttr("parents").asList().size() == 1);
assert((*root_inst->getAttr("parents").asList().begin()).asString() ==
"root");
Look look = smart_dynamic_cast<Look>(objectDefinitions.find("look")->second);
Look look_inst;
look_inst->setAttr("id", std::string("look_instantiation"));
assert(look->getAttr("id").asString() == "look");
assert(look_inst->getAttr("id").asString() == "look_instantiation");
assert(look->getAttr("parents").asList().size() == 1);
assert((*look->getAttr("parents").asList().begin()).asString() ==
"perceive");
assert(look_inst->getAttr("parents").asList().size() == 1);
assert((*look_inst->getAttr("parents").asList().begin()).asString() ==
"look");
Account acct = smart_dynamic_cast<Account>(objectDefinitions.find("account")->second);
Account acct_inst;
acct_inst->setAttr("id", std::string("account_instantiation"));
assert(acct->getAttr("id").asString() == "account");
assert(acct_inst->getAttr("id").asString() == "account_instantiation");
assert(acct->getAttr("parents").asList().size() == 1);
assert((*acct->getAttr("parents").asList().begin()).asString() ==
"admin_entity");
assert(acct_inst->getAttr("parents").asList().size() == 1);
assert((*acct_inst->getAttr("parents").asList().begin()).asString() ==
"account");
{
Atlas::Objects::Entity::Anonymous anon;
anon->setLoc("12345");
ListType velocity;
velocity.push_back(1.4);
velocity.push_back(2.4);
velocity.push_back(3.4);
anon->setVelocityAsList(velocity);
ListType bbox;
bbox.push_back(1.4);
bbox.push_back(2.4);
bbox.push_back(3.4);
bbox.push_back(2.4);
anon->setAttr("bbox", bbox);
Atlas::Objects::Operation::Move move;
move->setFrom("123456");
move->setTo("123456");
move->setSeconds(12345678);
move->setId("123456");
move->setArgs1(anon);
Atlas::Objects::Operation::Sight sight;
sight->setFrom("123456");
sight->setTo("123456");
sight->setSeconds(12345678);
sight->setId("123456");
sight->setArgs1(move);
Atlas::Message::MapType map;
sight->addToMessage(map);
std::cout << map.size() << std::flush;
assert(map.size() == 7);
assert(map["objtype"].String() == "op");
assert(map["from"].String() == "123456");
assert(map["to"].String() == "123456");
assert(map["seconds"].Float() == 12345678);
assert(map["id"].String() == "123456");
assert(map["args"].List().size() == 1);
}
}
开发者ID:bsmr-worldforge,项目名称:atlas-cpp,代码行数:96,代码来源:objects1.cpp
注:本文中的atlas::objects::entity::Anonymous类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论