修正Kernel拼写错误
This commit is contained in:
parent
17d44f1002
commit
23a7ba1d4a
|
@ -50,52 +50,52 @@ QString BehaviorPerformPlugin::name() const
|
|||
}
|
||||
|
||||
#include <MessageLoader.h>
|
||||
MapKernal::MapKernal(std::shared_ptr<MessageLoader> ins)
|
||||
MapKernel::MapKernel(std::shared_ptr<MessageLoader> ins)
|
||||
:_bind_loader(ins) {
|
||||
}
|
||||
|
||||
QList<QString> MapKernal::compareTypes() const
|
||||
QList<QString> MapKernel::compareTypes() const
|
||||
{
|
||||
return _compare_types.keys();
|
||||
}
|
||||
|
||||
void MapKernal::registCompare(std::shared_ptr<CompareDelegate> ins)
|
||||
void MapKernel::registCompare(std::shared_ptr<CompareDelegate> ins)
|
||||
{
|
||||
_compare_types[ins->name()] = ins;
|
||||
emit this->compareTypeListChanged();
|
||||
}
|
||||
|
||||
std::shared_ptr<CompareDelegate> MapKernal::getCompare(const QString& name) const
|
||||
std::shared_ptr<CompareDelegate> MapKernel::getCompare(const QString& name) const
|
||||
{
|
||||
if (!_compare_types.contains(name))
|
||||
return nullptr;
|
||||
return _compare_types[name];
|
||||
}
|
||||
|
||||
void MapKernal::registConvert(std::shared_ptr<ConvertDelegate> ins)
|
||||
void MapKernel::registConvert(std::shared_ptr<ConvertDelegate> ins)
|
||||
{
|
||||
_convert_types[ins->name()] = ins;
|
||||
emit this->convertTypeListChanged();
|
||||
}
|
||||
|
||||
QList<QString> MapKernal::convertTypes() const
|
||||
QList<QString> MapKernel::convertTypes() const
|
||||
{
|
||||
return _convert_types.keys();
|
||||
}
|
||||
|
||||
std::shared_ptr<ConvertDelegate> MapKernal::getConvert(const QString& name) const
|
||||
std::shared_ptr<ConvertDelegate> MapKernel::getConvert(const QString& name) const
|
||||
{
|
||||
if (!_convert_types.contains(name))
|
||||
return nullptr;
|
||||
return _convert_types[name];
|
||||
}
|
||||
|
||||
void MapKernal::registExecute(std::shared_ptr<ExecuteDelegate> ins)
|
||||
void MapKernel::registExecute(std::shared_ptr<ExecuteDelegate> ins)
|
||||
{
|
||||
_execute_types[ins->typeName()] = ins;
|
||||
}
|
||||
|
||||
void MapKernal::initial()
|
||||
void MapKernel::initial()
|
||||
{
|
||||
// 注册基础数据类型
|
||||
registData(std::make_shared<GeneralData>());
|
||||
|
@ -112,12 +112,12 @@ void MapKernal::initial()
|
|||
registNode(std::make_shared<BehaviorMapNode>(this->shared_from_this()));
|
||||
}
|
||||
|
||||
QJSEngine& MapKernal::bindEngine()
|
||||
QJSEngine& MapKernel::bindEngine()
|
||||
{
|
||||
return this->_core_engine;
|
||||
}
|
||||
|
||||
void MapKernal::registData(std::shared_ptr<TopicData> init)
|
||||
void MapKernel::registData(std::shared_ptr<TopicData> init)
|
||||
{
|
||||
if (_variable_types.contains(init->topicString()))
|
||||
throw new UniException(QString(u8"重复注册类型数据{%1}").arg(init->topicString()));
|
||||
|
@ -125,42 +125,42 @@ void MapKernal::registData(std::shared_ptr<TopicData> init)
|
|||
_variable_types[init->topicString()] = init;
|
||||
}
|
||||
|
||||
QList<QString> MapKernal::dataTypes() const
|
||||
QList<QString> MapKernel::dataTypes() const
|
||||
{
|
||||
return _variable_types.keys();
|
||||
}
|
||||
|
||||
std::shared_ptr<TopicData> MapKernal::getData(const QString& topic) const
|
||||
std::shared_ptr<TopicData> MapKernel::getData(const QString& topic) const
|
||||
{
|
||||
return _variable_types[topic];
|
||||
}
|
||||
|
||||
QList<QString> MapKernal::executeTypes() const
|
||||
QList<QString> MapKernel::executeTypes() const
|
||||
{
|
||||
return _execute_types.keys();
|
||||
}
|
||||
|
||||
std::shared_ptr<ExecuteDelegate> MapKernal::getExecute(const QString& name) const
|
||||
std::shared_ptr<ExecuteDelegate> MapKernel::getExecute(const QString& name) const
|
||||
{
|
||||
return _execute_types[name];
|
||||
}
|
||||
|
||||
void MapKernal::registNode(std::shared_ptr<LogicalNode> ins)
|
||||
void MapKernel::registNode(std::shared_ptr<LogicalNode> ins)
|
||||
{
|
||||
_logicalnode_types[ins->typeName()] = ins;
|
||||
}
|
||||
|
||||
QList<QString> MapKernal::nodeTypes() const
|
||||
QList<QString> MapKernel::nodeTypes() const
|
||||
{
|
||||
return _logicalnode_types.keys();
|
||||
}
|
||||
|
||||
std::shared_ptr<LogicalNode> MapKernal::getNode(const QString& name) const
|
||||
std::shared_ptr<LogicalNode> MapKernel::getNode(const QString& name) const
|
||||
{
|
||||
return _logicalnode_types[name];
|
||||
}
|
||||
|
||||
std::shared_ptr<Serializable> MapKernal::newDefault() const
|
||||
std::shared_ptr<Serializable> MapKernel::newDefault() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ std::shared_ptr<Serializable> MapKernal::newDefault() const
|
|||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
void MapKernal::recoveryFrom(const QJsonObject& obj)
|
||||
void MapKernel::recoveryFrom(const QJsonObject& obj)
|
||||
{
|
||||
QStringList compares, converts, executes, variable_keys;
|
||||
STRLIST_PEAK(executes);
|
||||
|
@ -220,7 +220,7 @@ void MapKernal::recoveryFrom(const QJsonObject& obj)
|
|||
}
|
||||
|
||||
|
||||
void MapKernal::saveTo(QJsonObject& obj) const
|
||||
void MapKernel::saveTo(QJsonObject& obj) const
|
||||
{
|
||||
// 保存比较器代码
|
||||
QStringList compares = this->compareTypes();
|
||||
|
@ -263,7 +263,7 @@ void MapKernal::saveTo(QJsonObject& obj) const
|
|||
STRLIST_SAVE(variable_keys);
|
||||
}
|
||||
|
||||
LogicalNode::LogicalNode(NodeKind t, std::shared_ptr<MapKernal> kernal)
|
||||
LogicalNode::LogicalNode(NodeKind t, std::shared_ptr<MapKernel> kernal)
|
||||
:_node_type(t), _bind_kernal(kernal) {
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ std::shared_ptr<BehaviorMapNode> LogicalNode::bindMap() const
|
|||
return std::dynamic_pointer_cast<BehaviorMapNode>(node_temp);
|
||||
}
|
||||
|
||||
std::shared_ptr<MapKernal> LogicalNode::getKernal() const
|
||||
std::shared_ptr<MapKernel> LogicalNode::getKernal() const
|
||||
{
|
||||
return _bind_kernal;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ std::weak_ptr<LogicalNode> LogicalNode::parent() const
|
|||
return this->_parent_bind;
|
||||
}
|
||||
|
||||
BehaviorMapNode::BehaviorMapNode(std::shared_ptr<MapKernal> core)
|
||||
BehaviorMapNode::BehaviorMapNode(std::shared_ptr<MapKernel> core)
|
||||
:LogicalNode(NodeKind::MAPNODE, core) {
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ QHash<QString, std::shared_ptr<TopicData>> BehaviorMapNode::outputList() const
|
|||
}
|
||||
|
||||
|
||||
SequenceNode::SequenceNode(std::shared_ptr<MapKernal> kernal)
|
||||
SequenceNode::SequenceNode(std::shared_ptr<MapKernel> kernal)
|
||||
: LogicalNode(NodeKind::SEQUENCENODE, kernal) {
|
||||
}
|
||||
|
||||
|
@ -548,7 +548,7 @@ void LogicalNode::remove(std::shared_ptr<LogicalNode> node)
|
|||
_child_list.removeAll(node);
|
||||
}
|
||||
|
||||
SelectorNode::SelectorNode(std::shared_ptr<MapKernal> kernal)
|
||||
SelectorNode::SelectorNode(std::shared_ptr<MapKernel> kernal)
|
||||
: LogicalNode(NodeKind::SEQUENCENODE, kernal) {
|
||||
}
|
||||
|
||||
|
@ -667,7 +667,7 @@ std::shared_ptr<Serializable> ParallelNode::newDefault() const
|
|||
return std::make_shared<ParallelNode>(this->getKernal());
|
||||
}
|
||||
|
||||
ParallelNode::ParallelNode(std::shared_ptr<MapKernal> kernal)
|
||||
ParallelNode::ParallelNode(std::shared_ptr<MapKernel> kernal)
|
||||
: LogicalNode(NodeKind::PARALLELNODE, kernal) {
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ std::shared_ptr<Serializable> CompareNode::newDefault() const
|
|||
return std::make_shared<CompareNode>(getKernal());
|
||||
}
|
||||
|
||||
CompareNode::CompareNode(std::shared_ptr<MapKernal> ins)
|
||||
CompareNode::CompareNode(std::shared_ptr<MapKernel> ins)
|
||||
: LogicalNode(NodeKind::COMPARENODE, ins) {
|
||||
_data_map[u8"左值"] = std::make_shared<GeneralData>();
|
||||
_data_map[u8"右值"] = std::make_shared<GeneralData>();
|
||||
|
@ -848,7 +848,7 @@ void CompareDelegate::saveTo(QJsonObject& obj) const
|
|||
{
|
||||
}
|
||||
|
||||
ConvertDelegate::ConvertDelegate(std::shared_ptr<MapKernal> host, QJSEngine& bind_engine, const QString& func)
|
||||
ConvertDelegate::ConvertDelegate(std::shared_ptr<MapKernel> host, QJSEngine& bind_engine, const QString& func)
|
||||
: _host_bind(host), _script_engine(bind_engine), _function_name(func) {
|
||||
}
|
||||
|
||||
|
@ -897,7 +897,7 @@ void ConvertDelegate::saveTo(QJsonObject& obj) const
|
|||
|
||||
}
|
||||
|
||||
ExecuteNode::ExecuteNode(std::shared_ptr<MapKernal> ins)
|
||||
ExecuteNode::ExecuteNode(std::shared_ptr<MapKernel> ins)
|
||||
: LogicalNode(NodeKind::ACTIONNODE, ins) {
|
||||
}
|
||||
|
||||
|
@ -993,7 +993,7 @@ void ExecuteNode::saveTo(QJsonObject& obj) const
|
|||
}
|
||||
}
|
||||
|
||||
ModifiedNode::ModifiedNode(std::shared_ptr<MapKernal> kernal)
|
||||
ModifiedNode::ModifiedNode(std::shared_ptr<MapKernel> kernal)
|
||||
: LogicalNode(NodeKind::MODIFYNODE, kernal) {
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ struct COMPONENTBASIC_EXPORT GeneralData : public TopicData {
|
|||
/// <summary>
|
||||
/// 行为树实例化节点
|
||||
/// </summary>
|
||||
class COMPONENTBASIC_EXPORT MapKernal :
|
||||
class COMPONENTBASIC_EXPORT MapKernel :
|
||||
public QObject, virtual public Serializable,
|
||||
public std::enable_shared_from_this<MapKernal> {
|
||||
public std::enable_shared_from_this<MapKernel> {
|
||||
Q_OBJECT
|
||||
private:
|
||||
/// <summary>
|
||||
|
@ -74,8 +74,8 @@ signals:
|
|||
|
||||
|
||||
public:
|
||||
MapKernal(std::shared_ptr<MessageLoader> ins);
|
||||
virtual ~MapKernal() = default;
|
||||
MapKernel(std::shared_ptr<MessageLoader> ins);
|
||||
virtual ~MapKernel() = default;
|
||||
|
||||
void initial();
|
||||
QJSEngine& bindEngine();
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
/// <param name="host">数据类型管理核心</param>
|
||||
/// <param name="bind_engine"></param>
|
||||
/// <param name="func"></param>
|
||||
ConvertDelegate(std::shared_ptr<MapKernal> host, QJSEngine& bind_engine, const QString& func);
|
||||
ConvertDelegate(std::shared_ptr<MapKernel> host, QJSEngine& bind_engine, const QString& func);
|
||||
/// <summary>
|
||||
/// 转换器名称:JS函数名
|
||||
/// </summary>
|
||||
|
@ -261,7 +261,7 @@ public:
|
|||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
private:
|
||||
std::shared_ptr<MapKernal> _host_bind;
|
||||
std::shared_ptr<MapKernel> _host_bind;
|
||||
|
||||
QJSEngine& _script_engine;
|
||||
QString _function_name;
|
||||
|
@ -333,7 +333,7 @@ class COMPONENTBASIC_EXPORT LogicalNode : virtual public Serializable, public st
|
|||
private:
|
||||
int _node_id = 0;
|
||||
NodeKind _node_type = NodeKind::ACTIONNODE;
|
||||
std::shared_ptr<MapKernal> _bind_kernal;
|
||||
std::shared_ptr<MapKernel> _bind_kernal;
|
||||
|
||||
std::weak_ptr<LogicalNode> _parent_bind;
|
||||
QList<std::shared_ptr<LogicalNode>> _child_list;
|
||||
|
@ -345,7 +345,7 @@ private:
|
|||
void _set_parent_node(std::weak_ptr<LogicalNode> pnode);
|
||||
|
||||
public:
|
||||
LogicalNode(NodeKind t, std::shared_ptr<MapKernal> kernal);
|
||||
LogicalNode(NodeKind t, std::shared_ptr<MapKernel> kernal);
|
||||
virtual ~LogicalNode() = default;
|
||||
|
||||
/// <summary>
|
||||
|
@ -364,7 +364,7 @@ public:
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
std::shared_ptr<BehaviorMapNode> bindMap() const;
|
||||
std::shared_ptr<MapKernal> getKernal() const;
|
||||
std::shared_ptr<MapKernel> getKernal() const;
|
||||
|
||||
/// <summary>
|
||||
/// 回退节点
|
||||
|
@ -476,7 +476,7 @@ private:
|
|||
ExecuteResult _state_value = ExecuteResult::FAILURE;
|
||||
|
||||
public:
|
||||
BehaviorMapNode(std::shared_ptr<MapKernal> kernal);
|
||||
BehaviorMapNode(std::shared_ptr<MapKernel> kernal);
|
||||
|
||||
/// <summary>
|
||||
/// 设置变量,如果类型错误会抛出UniException异常
|
||||
|
@ -559,7 +559,7 @@ private:
|
|||
QHash<int, ExecuteResult> _state_map;
|
||||
|
||||
public:
|
||||
SequenceNode(std::shared_ptr<MapKernal> kernal);
|
||||
SequenceNode(std::shared_ptr<MapKernel> kernal);
|
||||
|
||||
QList<std::shared_ptr<LogicalNode>> getForwards() const override;
|
||||
QString typeName() const override;
|
||||
|
@ -584,7 +584,7 @@ private:
|
|||
QHash<int, ExecuteResult> _state_map;
|
||||
|
||||
public:
|
||||
SelectorNode(std::shared_ptr<MapKernal> kernal);
|
||||
SelectorNode(std::shared_ptr<MapKernel> kernal);
|
||||
|
||||
QList<std::shared_ptr<LogicalNode>> getForwards() const override;
|
||||
QString typeName() const override;
|
||||
|
@ -609,7 +609,7 @@ private:
|
|||
QHash<int, ExecuteResult> _state_map;
|
||||
|
||||
public:
|
||||
ParallelNode(std::shared_ptr<MapKernal> kernal);
|
||||
ParallelNode(std::shared_ptr<MapKernel> kernal);
|
||||
|
||||
QList<std::shared_ptr<LogicalNode>> getForwards() const override;
|
||||
QString typeName() const override;
|
||||
|
@ -635,7 +635,7 @@ private:
|
|||
QHash<QString, std::shared_ptr<TopicData>> _data_map;
|
||||
|
||||
public:
|
||||
CompareNode(std::shared_ptr<MapKernal> kernal);
|
||||
CompareNode(std::shared_ptr<MapKernel> kernal);
|
||||
|
||||
QString delegateName() const;
|
||||
void bindDelegate(std::shared_ptr<CompareDelegate> ins);
|
||||
|
@ -665,7 +665,7 @@ private:
|
|||
std::shared_ptr<ExecuteDelegate> _bind_delegate;
|
||||
|
||||
public:
|
||||
ExecuteNode(std::shared_ptr<MapKernal> kernal);
|
||||
ExecuteNode(std::shared_ptr<MapKernel> kernal);
|
||||
|
||||
QString delegateName() const;
|
||||
void bindDelegate(std::shared_ptr<ExecuteDelegate> ins);
|
||||
|
@ -702,7 +702,7 @@ private:
|
|||
ExecuteResult _result_store = ExecuteResult::UNDEFINED;
|
||||
|
||||
public:
|
||||
ModifiedNode(std::shared_ptr<MapKernal> kernal);
|
||||
ModifiedNode(std::shared_ptr<MapKernel> kernal);
|
||||
|
||||
ModifyType modifyType() const;
|
||||
void resetModify(ModifyType t);
|
||||
|
|
|
@ -458,7 +458,7 @@ BehaviorEditor::BehaviorEditor(QWidget* parent /*= nullptr*/)
|
|||
_logs_present(new QTextBrowser(this))
|
||||
{
|
||||
_global_loader = std::make_shared<MessageLoader>();
|
||||
_global_kernal = std::make_shared<MapKernal>(_global_loader);
|
||||
_global_kernal = std::make_shared<MapKernel>(_global_loader);
|
||||
_global_kernal->initial();
|
||||
|
||||
this->_map_root = std::make_shared<BehaviorMapNode>(_global_kernal);
|
||||
|
|
|
@ -151,7 +151,7 @@ protected:
|
|||
class BehaviorEditor : public QMainWindow {
|
||||
private:
|
||||
std::shared_ptr<MessageLoader> _global_loader;
|
||||
std::shared_ptr<MapKernal> _global_kernal;
|
||||
std::shared_ptr<MapKernel> _global_kernal;
|
||||
|
||||
NodeTypesView* const _type_view;
|
||||
QStandardItemModel* const _type_model;
|
||||
|
|
Loading…
Reference in New Issue