CyPy_MemEntity::CyPy_MemEntity(Py::PythonClassInstanceWeak* self, Py::Tuple& args, Py::Dict& kwds) : CyPy_LocatedEntityBase(self, args, kwds) { args.verify_length(1); auto arg = args.front(); if (arg.isString()) { auto id = verifyString(args.front()); long intId = integerId(id); if (intId == -1L) { throw Py::TypeError("MemEntity() requires string/int ID"); } m_value = new MemEntity(id, intId); } else if (CyPy_MemEntity::check(arg)) { m_value = CyPy_MemEntity::value(arg); } else { throw Py::TypeError("MemEntity() requires string ID or MemEntity"); } }
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(); }
Py::Object add_properties(const Py::Tuple& args) { auto ent = CyPy_Entity::value(args.front()); PropertyBase * p = ent->setProperty("statistics", new StatisticsProperty); p->install(ent.get(), "statistics"); p->apply(ent.get()); ent->propertyApplied("statistics", *p); p = ent->setProperty("terrain", new TerrainProperty); p->install(ent.get(), "terrain"); p->apply(ent.get()); ent->propertyApplied("terrain", *p); p = ent->setProperty("line", new LineProperty); p->install(ent.get(), "line"); p->apply(ent.get()); ent->propertyApplied("line", *p); return Py::None(); }
CyPy_Task::CyPy_Task(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kwds) : WrapperBase(self, args, kwds) { args.verify_length(1); auto arg = args.front(); if (CyPy_Task::check(arg)) { m_value = CyPy_Task::value(arg); } else if (CyPy_UsageInstance::check(arg)) { m_value = new Task(CyPy_UsageInstance::value(arg), this->self()); } else { throw Py::TypeError("Task requires a Task, or UsageInstance"); } for (auto entry : kwds) { if (entry.first.isString()) { setattro(entry.first.as_string(), entry.second); } } }
Py::Object CyPy_WorldTime::is_now(const Py::Tuple& args) { args.verify_length(1); return Py::Boolean(get_value() == verifyString(args.front())); }
CyPy_WorldTime::CyPy_WorldTime(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kwds) : WrapperBase(self, args, kwds) { args.verify_length(1); m_value = std::make_shared<WorldTime>(verifyLong(args.front())); }