update
This commit is contained in:
parent
5c0a48b3f4
commit
c76bff7a50
|
@ -36,7 +36,7 @@
|
|||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.9_msvc2017_64</QtInstall>
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;xml;gui;qml;concurrent</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -25,7 +25,7 @@ void ComponentsInfoPull::execute(
|
|||
rst->_entity_json["entity_id"] = QJsonValue::fromVariant(QVariant::fromValue(bind_e->entityID()));
|
||||
rst->_entity_json["entity_name"] = bind_e->name();
|
||||
|
||||
QList<std::shared_ptr<WsComponent>> comp_list;
|
||||
QList<std::shared_ptr<WsSpecializedSystem>> comp_list;
|
||||
auto host_conv = std::dynamic_pointer_cast<ComponentSet>(bind_e);
|
||||
comp_list = host_conv->components();
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ void DeduceFramework::execute(
|
|||
QStringList exists_component_types;
|
||||
std::transform(comps_list.begin(), comps_list.end(),
|
||||
std::back_inserter(exists_component_types),
|
||||
[](std::shared_ptr<WsComponent> c) { return c->name(); });
|
||||
[](std::shared_ptr<WsSpecializedSystem> c) { return c->name(); });
|
||||
|
||||
for (auto comp : in->_component_types) {
|
||||
if (!exists_component_types.contains(comp)) {
|
||||
|
@ -333,13 +333,13 @@ ComponentFactory::ComponentFactory()
|
|||
_comp_types[ins1->name()] = ins1;
|
||||
}
|
||||
|
||||
std::shared_ptr<WsComponent> ComponentFactory::makeNew(const QString& type)
|
||||
std::shared_ptr<WsSpecializedSystem> ComponentFactory::makeNew(const QString& type)
|
||||
{
|
||||
if (!this->_comp_types.contains(type))
|
||||
return NULL;
|
||||
|
||||
auto ntype = _comp_types[type];
|
||||
return std::static_pointer_cast<WsComponent>(ntype->newDefault());
|
||||
return std::static_pointer_cast<WsSpecializedSystem>(ntype->newDefault());
|
||||
}
|
||||
|
||||
QList<QString> ComponentFactory::allComponentTypes() const
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
class COMPONENTBASIC_EXPORT ComponentFactory : public Serializable {
|
||||
private:
|
||||
QHash<QString, std::shared_ptr<WsComponent>> _comp_types;
|
||||
QHash<QString, std::shared_ptr<WsSpecializedSystem>> _comp_types;
|
||||
|
||||
public:
|
||||
ComponentFactory();
|
||||
|
||||
std::shared_ptr<WsComponent> makeNew(const QString &type);
|
||||
std::shared_ptr<WsSpecializedSystem> makeNew(const QString &type);
|
||||
QList<QString> allComponentTypes() const;
|
||||
|
||||
// 通过 Serializable 继承
|
||||
|
|
|
@ -40,6 +40,11 @@ std::shared_ptr<Serializable> VisibleCubePlugin::newDefault() const {
|
|||
return copy;
|
||||
}
|
||||
|
||||
QString VisibleCubePlugin::bindDataTopic() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void VisibleCubePlugin::bindEntity(std::weak_ptr<WsEntity> ins)
|
||||
{
|
||||
this->_bind_entity = ins;
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
explicit VisibleCubePlugin() = default;
|
||||
|
||||
// 通过 ProcList 继承
|
||||
QString bindDataTopic() const override;
|
||||
void bindEntity(std::weak_ptr<WsEntity> ins) override;
|
||||
QString name() const override;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ struct _RespondRoute<RespSig, RespSigs...> : public _RespondRoute<RespSigs...>,
|
|||
/// </summary>
|
||||
/// <typeparam name="...Resp"></typeparam>
|
||||
template <typename... Resp>
|
||||
struct RespondRoute : virtual public WsComponent, public _RespondRoute<Resp...> {
|
||||
struct RespondRoute : virtual public WsSpecializedSystem, public _RespondRoute<Resp...> {
|
||||
RespondRoute() : _RespondRoute<Resp...>() {}
|
||||
|
||||
// ͨ¹ý WsComponent ¼Ì³Ð
|
||||
|
@ -194,7 +194,7 @@ struct _RequestRoute<ReqsSig, ReqsSigs...> : public _RequestRoute<ReqsSigs...>,
|
|||
/// </summary>
|
||||
/// <typeparam name="...Reqs"></typeparam>
|
||||
template<typename... Reqs>
|
||||
struct RequestRoute : virtual public WsComponent, public _RequestRoute<Reqs...> {
|
||||
struct RequestRoute : virtual public WsSpecializedSystem, public _RequestRoute<Reqs...> {
|
||||
RequestRoute() : _RequestRoute<Reqs...>() {}
|
||||
virtual QList<WsRequestSignatureType> requestSignatures() const {
|
||||
return _RequestRoute<>::_request_list;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.9_msvc2017_64</QtInstall>
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;gui</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.9_msvc2017_64</QtInstall>
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -27,7 +27,7 @@ QString RtWsEntity::name() const {
|
|||
return this->_runtime_name;
|
||||
}
|
||||
|
||||
void RtWsEntity::append(std::shared_ptr<WsComponent> ins) {
|
||||
void RtWsEntity::append(std::shared_ptr<WsSpecializedSystem> ins) {
|
||||
if (this->_comps_list.contains(ins->name()))
|
||||
return;
|
||||
|
||||
|
@ -39,7 +39,7 @@ void RtWsEntity::remove(const QString& component_type) {
|
|||
this->_comps_list.remove(component_type);
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<WsComponent>> RtWsEntity::components() const {
|
||||
QList<std::shared_ptr<WsSpecializedSystem>> RtWsEntity::components() const {
|
||||
return _comps_list.values();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ std::shared_ptr<Serializable> RtWsEntity::newDefault() const {
|
|||
newx->_runtime_name = this->_runtime_name;
|
||||
|
||||
for (auto c : this->_comps_list)
|
||||
newx->append(std::static_pointer_cast<WsComponent>(c->newDefault()));
|
||||
newx->append(std::static_pointer_cast<WsSpecializedSystem>(c->newDefault()));
|
||||
return newx;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ QString RtEntityManager::name() const
|
|||
return "ʵÌå¹ÜÀíÆ÷ΨһʵÀý";
|
||||
}
|
||||
|
||||
void RtEntityManager::append(std::shared_ptr<WsComponent> ins) {
|
||||
void RtEntityManager::append(std::shared_ptr<WsSpecializedSystem> ins) {
|
||||
ins->bindEntity(this->shared_from_this());
|
||||
_comps_list[ins->name()] = ins;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ void RtEntityManager::remove(const QString& component_type)
|
|||
this->_comps_list.remove(component_type);
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<WsComponent>> RtEntityManager::components() const
|
||||
QList<std::shared_ptr<WsSpecializedSystem>> RtEntityManager::components() const
|
||||
{
|
||||
return this->_comps_list.values();
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ void RtResourceManager::saveTo(QJsonObject& obj) const
|
|||
obj["component_array"] = array;
|
||||
}
|
||||
|
||||
void RtResourceManager::append(std::shared_ptr<WsComponent> ins)
|
||||
void RtResourceManager::append(std::shared_ptr<WsSpecializedSystem> ins)
|
||||
{
|
||||
ins->bindEntity(this->shared_from_this());
|
||||
this->_comps_list[ins->name()] = ins;
|
||||
|
@ -273,7 +273,7 @@ void RtResourceManager::remove(const QString& component_type)
|
|||
this->_comps_list.remove(component_type);
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<WsComponent>> RtResourceManager::components() const
|
||||
QList<std::shared_ptr<WsSpecializedSystem>> RtResourceManager::components() const
|
||||
{
|
||||
return this->_comps_list.values();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class SIMSBASIC_EXPORT RtWsEntity : public WsEntity, public ComponentSet, public
|
|||
private:
|
||||
uint64_t _entity_id = 0;
|
||||
QString _templet_name, _runtime_name;
|
||||
QHash<QString, std::shared_ptr<WsComponent>> _comps_list;
|
||||
QHash<QString, std::shared_ptr<WsSpecializedSystem>> _comps_list;
|
||||
|
||||
public:
|
||||
explicit RtWsEntity();
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
/// 为本实例添加指定类型的插件
|
||||
/// </summary>
|
||||
/// <param name="ins"></param>
|
||||
virtual void append(std::shared_ptr<WsComponent> ins) override;
|
||||
virtual void append(std::shared_ptr<WsSpecializedSystem> ins) override;
|
||||
/// <summary>
|
||||
/// 移除指定类型的插件实例
|
||||
/// </summary>
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
/// 获取本实例内包含的所有插件实例
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QList<std::shared_ptr<WsComponent>> components() const override;
|
||||
virtual QList<std::shared_ptr<WsSpecializedSystem>> components() const override;
|
||||
|
||||
/// <summary>
|
||||
/// 深度克隆本实例,插件和数据一致
|
||||
|
@ -101,14 +101,14 @@ class SIMSBASIC_EXPORT RtEntityManager : public WsEntity, public ComponentSet,
|
|||
{
|
||||
public:
|
||||
static const uint64_t const_id = 0x01ff;
|
||||
QHash<QString, std::shared_ptr<WsComponent>> _comps_list;
|
||||
QHash<QString, std::shared_ptr<WsSpecializedSystem>> _comps_list;
|
||||
|
||||
QString templetName() const override;
|
||||
uint64_t entityID() const override;
|
||||
QString name() const override;
|
||||
void append(std::shared_ptr<WsComponent> ins) override;
|
||||
void append(std::shared_ptr<WsSpecializedSystem> ins) override;
|
||||
void remove(const QString& component_type) override;
|
||||
QList<std::shared_ptr<WsComponent>> components() const override;
|
||||
QList<std::shared_ptr<WsSpecializedSystem>> components() const override;
|
||||
|
||||
std::shared_ptr<Serializable> newDefault() const override;
|
||||
QList<WsRespondEntry> getRespondWithSignature(const WsRespondSignatureType& t) const override;
|
||||
|
@ -123,7 +123,7 @@ class SIMSBASIC_EXPORT RtResourceManager : public WsEntity, public ComponentSet,
|
|||
{
|
||||
public:
|
||||
static const uint64_t const_id = 0x01f0;
|
||||
QHash<QString, std::shared_ptr<WsComponent>> _comps_list;
|
||||
QHash<QString, std::shared_ptr<WsSpecializedSystem>> _comps_list;
|
||||
|
||||
QString templetName() const override;
|
||||
uint64_t entityID() const override;
|
||||
|
@ -136,8 +136,8 @@ public:
|
|||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
|
||||
void append(std::shared_ptr<WsComponent> ins) override;
|
||||
void append(std::shared_ptr<WsSpecializedSystem> ins) override;
|
||||
void remove(const QString& component_type) override;
|
||||
QList<std::shared_ptr<WsComponent>> components() const override;
|
||||
QList<std::shared_ptr<WsSpecializedSystem>> components() const override;
|
||||
|
||||
};
|
||||
|
|
|
@ -54,6 +54,18 @@ public:
|
|||
virtual QString topicString() const = 0;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 特殊用途的数据
|
||||
/// </summary>
|
||||
class WsSpecializedData : public TopicData {
|
||||
public:
|
||||
/// <summary>
|
||||
/// 内存尺寸
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual uint32_t inMemSize() const = 0;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 通用消息基类
|
||||
/// </summary>
|
||||
|
@ -126,8 +138,13 @@ public:
|
|||
/// <summary>
|
||||
/// 功能插件的基类
|
||||
/// </summary>
|
||||
class WsComponent : public Serializable, public std::enable_shared_from_this<WsComponent> {
|
||||
class WsSpecializedSystem : public Serializable, public std::enable_shared_from_this<WsSpecializedSystem> {
|
||||
public:
|
||||
/// <summary>
|
||||
/// 针对指定数据Topic
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QString bindDataTopic() const = 0;
|
||||
/// <summary>
|
||||
/// 插件唯一命名
|
||||
/// </summary>
|
||||
|
@ -174,7 +191,7 @@ public:
|
|||
/// 为本实例添加指定类型的插件
|
||||
/// </summary>
|
||||
/// <param name="ins"></param>
|
||||
virtual void append(std::shared_ptr<WsComponent> ins) = 0;
|
||||
virtual void append(std::shared_ptr<WsSpecializedSystem> ins) = 0;
|
||||
/// <summary>
|
||||
/// 移除指定类型的插件实例
|
||||
/// </summary>
|
||||
|
@ -184,5 +201,5 @@ public:
|
|||
/// 获取本实例内包含的所有插件实例
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual QList<std::shared_ptr<WsComponent>> components() const = 0;
|
||||
virtual QList<std::shared_ptr<WsSpecializedSystem>> components() const = 0;
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.9_msvc2017_64</QtInstall>
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;gui;widgets;qml</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.9_msvc2017_64</QtInstall>
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;gui</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.9_msvc2017_64</QtInstall>
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;gui</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
|
|
Loading…
Reference in New Issue