重构重命名
This commit is contained in:
parent
58b34911a9
commit
10b5bb706a
|
@ -4,7 +4,7 @@
|
|||
QList<std::shared_ptr<WsMessage>> deduct_each(std::shared_ptr<WsEntity> item)
|
||||
{
|
||||
QList<std::shared_ptr<WsMessage>> rets;
|
||||
auto immediate = std::make_shared<ImmediateCore>(item);
|
||||
auto immediate = std::make_shared<ImmediateKernel>(item);
|
||||
|
||||
for (auto msg : DeduceFramework::_accept_stack) {
|
||||
if (msg->targetEntity() == item->entityID()) {
|
||||
|
@ -51,7 +51,7 @@ DeduceFramework::DeduceFramework()
|
|||
|
||||
void DeduceFramework::init_backend()
|
||||
{
|
||||
auto mgr_e = std::make_shared<EntitiesManager>();
|
||||
auto mgr_e = std::make_shared<RtEntityManager>();
|
||||
mgr_e->append(this->shared_from_this());
|
||||
|
||||
this->_entity_map_over_0xffff[mgr_e->entityID()] = mgr_e;
|
||||
|
@ -82,7 +82,7 @@ void DeduceFramework::saveTo(QJsonObject& obj) const
|
|||
throw std::logic_error("The method or operation is not implemented.");
|
||||
}
|
||||
|
||||
void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
||||
void DeduceFramework::execute(std::shared_ptr<Immediate> map,
|
||||
std::shared_ptr<const EntityOperate> in, QList<std::shared_ptr<RespondDefault>>& out)
|
||||
{
|
||||
auto dt = QTime::currentTime();
|
||||
|
@ -100,7 +100,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
result->_success_mark = true;
|
||||
|
||||
auto ins_t = this->_templets_within_0x2ff_0xffff[in->_template_name];
|
||||
auto new_copy = std::static_pointer_cast<RtEntity>(ins_t->defaultNew());
|
||||
auto new_copy = std::static_pointer_cast<RtWsEntity>(ins_t->defaultNew());
|
||||
new_copy->resetID(0xffff);
|
||||
auto desc_p = std::make_shared<ComponentsInfoPull>();
|
||||
new_copy->append(desc_p);
|
||||
|
@ -129,7 +129,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
else {
|
||||
result->_success_mark = true;
|
||||
|
||||
auto target_ins = std::static_pointer_cast<RtEntity>(
|
||||
auto target_ins = std::static_pointer_cast<RtWsEntity>(
|
||||
this->_entity_map_over_0xffff[in->_entity_id_over_0xffff]
|
||||
);
|
||||
target_ins->resetName(in->_entity_name);
|
||||
|
@ -145,7 +145,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
out << result;
|
||||
}
|
||||
|
||||
void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
||||
void DeduceFramework::execute(std::shared_ptr<Immediate> map,
|
||||
std::shared_ptr<const EntityTotalGet> in, QList<std::shared_ptr<EntityTotalList>>& out)
|
||||
{
|
||||
auto rst = std::make_shared<EntityTotalList>();
|
||||
|
@ -154,7 +154,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
out << rst;
|
||||
}
|
||||
|
||||
void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
||||
void DeduceFramework::execute(std::shared_ptr<Immediate> map,
|
||||
std::shared_ptr<const TypesQuery> in, QList<std::shared_ptr<TypesQueryResult>>& out)
|
||||
{
|
||||
auto ins = std::make_shared<TypesQueryResult>();
|
||||
|
@ -166,7 +166,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
out << ins;
|
||||
}
|
||||
|
||||
void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
||||
void DeduceFramework::execute(std::shared_ptr<Immediate> map,
|
||||
std::shared_ptr<const TempletOperate> in, QList<std::shared_ptr<RespondDefault>>& out)
|
||||
{
|
||||
auto dt = QTime::currentTime();
|
||||
|
@ -177,7 +177,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
switch ((EntityOperateType)in->_operate_code) {
|
||||
case EntityOperateType::NEW: {
|
||||
nins->_success_mark = true;
|
||||
auto ent_t = std::make_shared<RtEntity>();
|
||||
auto ent_t = std::make_shared<RtWsEntity>();
|
||||
ent_t->resetTemplet(in->_template_name);
|
||||
auto desc_p = std::make_shared<ComponentsInfoPull>();
|
||||
ent_t->append(desc_p);
|
||||
|
@ -188,7 +188,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
std::transform(_templets_within_0x2ff_0xffff.begin(),
|
||||
_templets_within_0x2ff_0xffff.end(),
|
||||
std::back_inserter(allids),
|
||||
[](std::shared_ptr<RtEntity> i) { return i->entityID(); });
|
||||
[](std::shared_ptr<RtWsEntity> i) { return i->entityID(); });
|
||||
|
||||
// ÖØÖÃÄ£°åid
|
||||
while (allids.contains(ent_t->entityID())) {
|
||||
|
@ -236,7 +236,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
out << nins;
|
||||
}
|
||||
|
||||
void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
||||
void DeduceFramework::execute(std::shared_ptr<Immediate> map,
|
||||
std::shared_ptr<const ComponentOperate> in, QList<std::shared_ptr<RespondDefault>>& out)
|
||||
{
|
||||
auto dt = QTime::currentTime();
|
||||
|
@ -245,7 +245,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
result->reset(in->targetEntity(), in->sourceEntity());
|
||||
|
||||
// ÌáȡĿ±êʵÀý ====================================================
|
||||
std::shared_ptr<RtEntity> target_ins = nullptr;
|
||||
std::shared_ptr<RtWsEntity> target_ins = nullptr;
|
||||
if (in->_entity_id_within_0x2ff_0xffffffffffffffff < 0xffff) {
|
||||
for (auto info_t : this->_templets_within_0x2ff_0xffff) {
|
||||
if (info_t->entityID() == in->_entity_id_within_0x2ff_0xffffffffffffffff) {
|
||||
|
@ -256,7 +256,7 @@ void DeduceFramework::execute(std::shared_ptr<ImmediateMap> map,
|
|||
}
|
||||
else {
|
||||
if (this->_entity_map_over_0xffff.contains(in->_entity_id_within_0x2ff_0xffffffffffffffff)) {
|
||||
target_ins = std::static_pointer_cast<RtEntity>(
|
||||
target_ins = std::static_pointer_cast<RtWsEntity>(
|
||||
this->_entity_map_over_0xffff[in->_entity_id_within_0x2ff_0xffffffffffffffff]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ private:
|
|||
std::weak_ptr<WsEntity> _bind_entity;
|
||||
std::shared_ptr<ComponentFactory> _factory_ins;
|
||||
|
||||
QHash<QString, std::shared_ptr<RtEntity>> _templets_within_0x2ff_0xffff;
|
||||
QHash<QString, std::shared_ptr<RtWsEntity>> _templets_within_0x2ff_0xffff;
|
||||
QHash<uint64_t, std::shared_ptr<WsEntity>> _entity_map_over_0xffff;
|
||||
|
||||
signals:
|
||||
|
@ -74,10 +74,10 @@ public:
|
|||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
|
||||
void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const TypesQuery> in, QList<std::shared_ptr<TypesQueryResult>>& out) override;
|
||||
void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const TempletOperate> in, QList<std::shared_ptr<RespondDefault>>& out) override;
|
||||
void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const EntityOperate> in, QList<std::shared_ptr<RespondDefault>>& out) override;
|
||||
void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const ComponentOperate> in, QList<std::shared_ptr<RespondDefault>>& out) override;
|
||||
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const TypesQuery> in, QList<std::shared_ptr<TypesQueryResult>>& out) override;
|
||||
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const TempletOperate> in, QList<std::shared_ptr<RespondDefault>>& out) override;
|
||||
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const EntityOperate> in, QList<std::shared_ptr<RespondDefault>>& out) override;
|
||||
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const ComponentOperate> in, QList<std::shared_ptr<RespondDefault>>& out) override;
|
||||
|
||||
void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const EntityTotalGet> in, QList<std::shared_ptr<EntityTotalList>>& out) override;
|
||||
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const EntityTotalGet> in, QList<std::shared_ptr<EntityTotalList>>& out) override;
|
||||
};
|
|
@ -49,7 +49,7 @@ QString VisibleCubePlugin::name() const {
|
|||
return NAME(VisibleCubePlugin);
|
||||
}
|
||||
|
||||
void VisibleCubePlugin::execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const Get3DBox> in, QList<std::shared_ptr<Box3DDesc>>& out)
|
||||
void VisibleCubePlugin::execute(std::shared_ptr<Immediate> map, std::shared_ptr<const Get3DBox> in, QList<std::shared_ptr<Box3DDesc>>& out)
|
||||
{
|
||||
auto ins = std::make_shared<Box3DDesc>();
|
||||
ins->_lla_pos = _self_lla;
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void bindEntity(std::weak_ptr<WsEntity> ins) override;
|
||||
QString name() const override;
|
||||
|
||||
void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const Get3DBox> in, QList<std::shared_ptr<Box3DDesc>>& out) override;
|
||||
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const Get3DBox> in, QList<std::shared_ptr<Box3DDesc>>& out) override;
|
||||
|
||||
std::shared_ptr<WsComponent> defaultNew() const override;
|
||||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
|
|
|
@ -28,13 +28,13 @@ public:
|
|||
/// </summary>
|
||||
/// <param name="in"></param>
|
||||
/// <param name="out"></param>
|
||||
virtual void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const MsgA> in, QList<std::shared_ptr<MsgB>>& out) = 0;
|
||||
virtual void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const MsgA> in, QList<std::shared_ptr<MsgB>>& out) = 0;
|
||||
/// <summary>
|
||||
/// WsRespond构造函数
|
||||
/// </summary>
|
||||
/// <param name="map">注册函数</param>
|
||||
explicit WsRespond(QHash<WsRespondSignatureType, WsRespondEntry>& map) {
|
||||
WsRespondEntry ins = [=](std::shared_ptr<ImmediateMap> map, std::shared_ptr<const WsMessage> in, QList<std::shared_ptr<WsMessage>>& out) {
|
||||
WsRespondEntry ins = [=](std::shared_ptr<Immediate> map, std::shared_ptr<const WsMessage> in, QList<std::shared_ptr<WsMessage>>& out) {
|
||||
QList<std::shared_ptr<MsgB>> o_ptrs;
|
||||
this->execute(map, std::static_pointer_cast<const MsgA>(in), o_ptrs);
|
||||
std::transform(o_ptrs.begin(), o_ptrs.end(), std::back_inserter(out),
|
||||
|
|
|
@ -14,7 +14,7 @@ QString ComponentsInfoPull::name() const
|
|||
|
||||
#include <QVariant>
|
||||
#include <QJsonArray>
|
||||
void ComponentsInfoPull::execute(std::shared_ptr<ImmediateMap> map,
|
||||
void ComponentsInfoPull::execute(std::shared_ptr<Immediate> map,
|
||||
std::shared_ptr<const ComponentInfosQuery> in, QList<std::shared_ptr<ComponentInfoQueryResult>>& out)
|
||||
{
|
||||
auto rst = std::make_shared<ComponentInfoQueryResult>();
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
void bindEntity(std::weak_ptr<WsEntity> ins) override;
|
||||
QString name() const override;
|
||||
|
||||
void execute(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const ComponentInfosQuery> in, QList<std::shared_ptr<ComponentInfoQueryResult>>& out) override;
|
||||
void execute(std::shared_ptr<Immediate> map, std::shared_ptr<const ComponentInfosQuery> in, QList<std::shared_ptr<ComponentInfoQueryResult>>& out) override;
|
||||
|
||||
std::shared_ptr<WsComponent> defaultNew() const override;
|
||||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
|
|
|
@ -10,33 +10,33 @@ QString UniException::content() const noexcept
|
|||
return _error_store;
|
||||
}
|
||||
|
||||
RtEntity::RtEntity() {}
|
||||
RtWsEntity::RtWsEntity() {}
|
||||
|
||||
void RtEntity::resetTemplet(const QString& name) {
|
||||
void RtWsEntity::resetTemplet(const QString& name) {
|
||||
this->_templet_name = name;
|
||||
}
|
||||
|
||||
QString RtEntity::templetName() const {
|
||||
QString RtWsEntity::templetName() const {
|
||||
return this->_templet_name;
|
||||
}
|
||||
|
||||
void RtEntity::resetID(uint64_t id) {
|
||||
void RtWsEntity::resetID(uint64_t id) {
|
||||
this->_entity_id = id;
|
||||
}
|
||||
|
||||
uint64_t RtEntity::entityID() const {
|
||||
uint64_t RtWsEntity::entityID() const {
|
||||
return this->_entity_id;
|
||||
}
|
||||
|
||||
void RtEntity::resetName(const QString& name) {
|
||||
void RtWsEntity::resetName(const QString& name) {
|
||||
this->_runtime_name = name;
|
||||
}
|
||||
|
||||
QString RtEntity::name() const {
|
||||
QString RtWsEntity::name() const {
|
||||
return this->_runtime_name;
|
||||
}
|
||||
|
||||
void RtEntity::append(std::shared_ptr<WsComponent> ins) {
|
||||
void RtWsEntity::append(std::shared_ptr<WsComponent> ins) {
|
||||
if (this->_comps_list.contains(ins->name()))
|
||||
return;
|
||||
|
||||
|
@ -44,16 +44,16 @@ void RtEntity::append(std::shared_ptr<WsComponent> ins) {
|
|||
this->_comps_list[ins->name()] = ins;
|
||||
}
|
||||
|
||||
void RtEntity::remove(const QString& component_type) {
|
||||
void RtWsEntity::remove(const QString& component_type) {
|
||||
this->_comps_list.remove(component_type);
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<WsComponent>> RtEntity::components() const {
|
||||
QList<std::shared_ptr<WsComponent>> RtWsEntity::components() const {
|
||||
return _comps_list.values();
|
||||
}
|
||||
|
||||
std::shared_ptr<WsEntity> RtEntity::defaultNew() const {
|
||||
auto newx = std::make_shared<RtEntity>();
|
||||
std::shared_ptr<WsEntity> RtWsEntity::defaultNew() const {
|
||||
auto newx = std::make_shared<RtWsEntity>();
|
||||
newx->_entity_id = this->_entity_id;
|
||||
newx->_templet_name = this->_templet_name;
|
||||
newx->_runtime_name = this->_runtime_name;
|
||||
|
@ -64,7 +64,7 @@ std::shared_ptr<WsEntity> RtEntity::defaultNew() const {
|
|||
}
|
||||
|
||||
#include <QSet>
|
||||
QList<QString> RtEntity::inputTypes() const
|
||||
QList<QString> RtWsEntity::inputTypes() const
|
||||
{
|
||||
QList<QString> types;
|
||||
for (auto c : this->_comps_list)
|
||||
|
@ -74,7 +74,7 @@ QList<QString> RtEntity::inputTypes() const
|
|||
|
||||
#include <QVariant>
|
||||
#include <QJsonArray>
|
||||
QList<WsRespondEntry> RtEntity::getEntryWithSignature(const WsRespondSignatureType& t) const
|
||||
QList<WsRespondEntry> RtWsEntity::getEntryWithSignature(const WsRespondSignatureType& t) const
|
||||
{
|
||||
QList<WsRespondEntry> list;
|
||||
for (auto c : this->_comps_list)
|
||||
|
@ -82,14 +82,14 @@ QList<WsRespondEntry> RtEntity::getEntryWithSignature(const WsRespondSignatureTy
|
|||
return list;
|
||||
}
|
||||
|
||||
QList<WsRespondEntry> RtEntity::getEntryWithInType(const QString& msg_type) const
|
||||
QList<WsRespondEntry> RtWsEntity::getEntryWithInType(const QString& msg_type) const
|
||||
{
|
||||
QList<WsRespondEntry> list;
|
||||
for (auto c : this->_comps_list)
|
||||
list.append(c->getEntrysWithInType(msg_type));
|
||||
return list;
|
||||
}
|
||||
void RtEntity::recoveryFrom(const QJsonObject& obj)
|
||||
void RtWsEntity::recoveryFrom(const QJsonObject& obj)
|
||||
{
|
||||
this->_entity_id = obj["entity_id"].toVariant().toULongLong();
|
||||
this->_runtime_name = obj["entity_name"].toString();
|
||||
|
@ -108,7 +108,7 @@ void RtEntity::recoveryFrom(const QJsonObject& obj)
|
|||
}
|
||||
}
|
||||
|
||||
void RtEntity::saveTo(QJsonObject& obj) const
|
||||
void RtWsEntity::saveTo(QJsonObject& obj) const
|
||||
{
|
||||
obj["entity_id"] = QJsonValue::fromVariant(QVariant::fromValue(this->_entity_id));
|
||||
obj["entity_name"] = this->_runtime_name;
|
||||
|
@ -125,31 +125,31 @@ void RtEntity::saveTo(QJsonObject& obj) const
|
|||
obj["component_array"] = array;
|
||||
}
|
||||
|
||||
QString EntitiesManager::templetName() const
|
||||
QString RtEntityManager::templetName() const
|
||||
{
|
||||
return "实体管理器";
|
||||
}
|
||||
|
||||
uint64_t EntitiesManager::entityID() const
|
||||
uint64_t RtEntityManager::entityID() const
|
||||
{
|
||||
return const_id;
|
||||
}
|
||||
|
||||
QString EntitiesManager::name() const
|
||||
QString RtEntityManager::name() const
|
||||
{
|
||||
return "实体管理器唯一实例";
|
||||
}
|
||||
|
||||
void EntitiesManager::append(std::shared_ptr<WsComponent> ins) {
|
||||
void RtEntityManager::append(std::shared_ptr<WsComponent> ins) {
|
||||
_comps_list[ins->name()] = ins;
|
||||
}
|
||||
|
||||
std::shared_ptr<WsEntity> EntitiesManager::defaultNew() const
|
||||
std::shared_ptr<WsEntity> RtEntityManager::defaultNew() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QList<WsRespondEntry> EntitiesManager::getEntryWithSignature(const WsRespondSignatureType& t) const
|
||||
QList<WsRespondEntry> RtEntityManager::getEntryWithSignature(const WsRespondSignatureType& t) const
|
||||
{
|
||||
QList<WsRespondEntry> list;
|
||||
for (auto c : this->_comps_list)
|
||||
|
@ -157,7 +157,7 @@ QList<WsRespondEntry> EntitiesManager::getEntryWithSignature(const WsRespondSign
|
|||
return list;
|
||||
}
|
||||
|
||||
QList<WsRespondEntry> EntitiesManager::getEntryWithInType(const QString& msg_type) const
|
||||
QList<WsRespondEntry> RtEntityManager::getEntryWithInType(const QString& msg_type) const
|
||||
{
|
||||
QList<WsRespondEntry> list;
|
||||
for (auto c : this->_comps_list)
|
||||
|
@ -165,7 +165,7 @@ QList<WsRespondEntry> EntitiesManager::getEntryWithInType(const QString& msg_typ
|
|||
return list;
|
||||
}
|
||||
|
||||
void EntitiesManager::recoveryFrom(const QJsonObject& obj)
|
||||
void RtEntityManager::recoveryFrom(const QJsonObject& obj)
|
||||
{
|
||||
auto array = obj["component_array"].toArray();
|
||||
for (auto idx = 0; idx < array.size(); ++idx) {
|
||||
|
@ -180,7 +180,7 @@ void EntitiesManager::recoveryFrom(const QJsonObject& obj)
|
|||
}
|
||||
}
|
||||
|
||||
void EntitiesManager::saveTo(QJsonObject& obj) const
|
||||
void RtEntityManager::saveTo(QJsonObject& obj) const
|
||||
{
|
||||
QJsonArray array;
|
||||
for (auto c : this->_comps_list)
|
||||
|
@ -193,24 +193,24 @@ void EntitiesManager::saveTo(QJsonObject& obj) const
|
|||
obj["component_array"] = array;
|
||||
}
|
||||
|
||||
void EntitiesManager::remove(const QString& component_type)
|
||||
void RtEntityManager::remove(const QString& component_type)
|
||||
{
|
||||
this->_comps_list.remove(component_type);
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<WsComponent>> EntitiesManager::components() const
|
||||
QList<std::shared_ptr<WsComponent>> RtEntityManager::components() const
|
||||
{
|
||||
return this->_comps_list.values();
|
||||
}
|
||||
|
||||
ImmediateCore::ImmediateCore(std::shared_ptr<WsEntity> bind) :_bind_entity(bind) {}
|
||||
ImmediateKernel::ImmediateKernel(std::shared_ptr<WsEntity> bind) :_bind_entity(bind) {}
|
||||
|
||||
uint64_t ImmediateCore::entityManagerID() const
|
||||
uint64_t ImmediateKernel::entityManagerID() const
|
||||
{
|
||||
return EntitiesManager::const_id;
|
||||
return RtEntityManager::const_id;
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<WsMessage>> ImmediateCore::execute(const WsRespondSignatureType& resp_signature, std::shared_ptr<const WsMessage> in)
|
||||
QList<std::shared_ptr<WsMessage>> ImmediateKernel::execute(const WsRespondSignatureType& resp_signature, std::shared_ptr<const WsMessage> in)
|
||||
{
|
||||
QList<std::shared_ptr<WsMessage>> rets;
|
||||
auto list = this->_bind_entity->getEntryWithSignature(resp_signature);
|
||||
|
@ -220,7 +220,7 @@ QList<std::shared_ptr<WsMessage>> ImmediateCore::execute(const WsRespondSignatur
|
|||
return rets;
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<WsMessage>> ImmediateCore::execute(std::shared_ptr<const WsMessage> in)
|
||||
QList<std::shared_ptr<WsMessage>> ImmediateKernel::execute(std::shared_ptr<const WsMessage> in)
|
||||
{
|
||||
QList<std::shared_ptr<WsMessage>> rets;
|
||||
auto list = this->_bind_entity->getEntryWithInType(in->topicString());
|
||||
|
|
|
@ -68,9 +68,9 @@ using WsRespondSignatureType = std::pair<QString, QString>;
|
|||
/// <summary>
|
||||
/// 实体内立即执行入口
|
||||
/// </summary>
|
||||
class ImmediateMap {
|
||||
class Immediate {
|
||||
public:
|
||||
virtual ~ImmediateMap() = default;
|
||||
virtual ~Immediate() = default;
|
||||
/// <summary>
|
||||
/// 获取实体管理器id
|
||||
/// </summary>
|
||||
|
@ -93,8 +93,11 @@ public:
|
|||
/// <summary>
|
||||
/// 所有消息处理单元通用接口
|
||||
/// </summary>
|
||||
using WsRespondEntry = std::function<void(std::shared_ptr<ImmediateMap> map, std::shared_ptr<const WsMessage>, QList<std::shared_ptr<WsMessage>>&)>;
|
||||
using WsRespondEntry = std::function<void(std::shared_ptr<Immediate> map, std::shared_ptr<const WsMessage>, QList<std::shared_ptr<WsMessage>>&)>;
|
||||
|
||||
/// <summary>
|
||||
/// 实体抽象接口
|
||||
/// </summary>
|
||||
class WsEntity : public Serializable {
|
||||
public:
|
||||
virtual ~WsEntity() = default;
|
||||
|
@ -179,6 +182,9 @@ public:
|
|||
virtual QList<WsRespondEntry> getEntrysWithInType(const QString& msg_type) const = 0;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 组件管理接口
|
||||
/// </summary>
|
||||
class ComponentSet {
|
||||
public:
|
||||
/// <summary>
|
||||
|
@ -202,15 +208,15 @@ public:
|
|||
/// <summary>
|
||||
/// 内存实体实例类型
|
||||
/// </summary>
|
||||
class SIMSBASIC_EXPORT RtEntity : public WsEntity, public ComponentSet, public std::enable_shared_from_this<RtEntity> {
|
||||
class SIMSBASIC_EXPORT RtWsEntity : public WsEntity, public ComponentSet, public std::enable_shared_from_this<RtWsEntity> {
|
||||
private:
|
||||
uint64_t _entity_id = 0;
|
||||
QString _templet_name, _runtime_name;
|
||||
QHash<QString, std::shared_ptr<WsComponent>> _comps_list;
|
||||
|
||||
public:
|
||||
explicit RtEntity();
|
||||
virtual ~RtEntity() = default;
|
||||
explicit RtWsEntity();
|
||||
virtual ~RtWsEntity() = default;
|
||||
|
||||
/// <summary>
|
||||
/// 重置本实例模板名
|
||||
|
@ -290,8 +296,8 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class SIMSBASIC_EXPORT EntitiesManager : public WsEntity, public ComponentSet,
|
||||
public std::enable_shared_from_this<EntitiesManager>
|
||||
class SIMSBASIC_EXPORT RtEntityManager : public WsEntity, public ComponentSet,
|
||||
public std::enable_shared_from_this<RtEntityManager>
|
||||
{
|
||||
public:
|
||||
static const uint64_t const_id = 0x01ff;
|
||||
|
@ -300,7 +306,7 @@ public:
|
|||
QString templetName() const override;
|
||||
uint64_t entityID() const override;
|
||||
QString name() const override;
|
||||
void append(std::shared_ptr<WsComponent> ins);
|
||||
void append(std::shared_ptr<WsComponent> ins) override;
|
||||
void remove(const QString& component_type) override;
|
||||
QList<std::shared_ptr<WsComponent>> components() const override;
|
||||
|
||||
|
@ -313,12 +319,12 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class SIMSBASIC_EXPORT ImmediateCore : public ImmediateMap, public std::enable_shared_from_this<ImmediateCore> {
|
||||
class SIMSBASIC_EXPORT ImmediateKernel : public Immediate, public std::enable_shared_from_this<ImmediateKernel> {
|
||||
private:
|
||||
std::shared_ptr<WsEntity> _bind_entity = nullptr;
|
||||
|
||||
public:
|
||||
ImmediateCore(std::shared_ptr<WsEntity> bind);
|
||||
ImmediateKernel(std::shared_ptr<WsEntity> bind);
|
||||
/// <summary>
|
||||
/// 获取实体管理器id
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue