710 lines
15 KiB
C++
710 lines
15 KiB
C++
#include "BehaviorPerform.h"
|
||
|
||
|
||
void BehaviorPerformPlugin::mapReset(const QString& path)
|
||
{
|
||
|
||
}
|
||
|
||
void BehaviorPerformPlugin::execute(std::shared_ptr<const EntityInitialRequest> in, QList<std::shared_ptr<RespondDefault>>& out)
|
||
{
|
||
|
||
}
|
||
|
||
void BehaviorPerformPlugin::execute(std::shared_ptr<const EntityPreparedRequest> in, QList<std::shared_ptr<RespondDefault>>& out)
|
||
{
|
||
|
||
}
|
||
|
||
void BehaviorPerformPlugin::execute(std::shared_ptr<const SyncRequest> in, QList<std::shared_ptr<RespondDefault>>& out)
|
||
{
|
||
|
||
}
|
||
|
||
void BehaviorPerformPlugin::execute(std::shared_ptr<const DeduceRequest> in, QList<std::shared_ptr<RespondDefault>>& out)
|
||
{
|
||
|
||
}
|
||
|
||
void BehaviorPerformPlugin::recoveryFrom(const QJsonObject& obj)
|
||
{
|
||
}
|
||
|
||
void BehaviorPerformPlugin::saveTo(QJsonObject& obj) const
|
||
{
|
||
}
|
||
|
||
std::shared_ptr<Serializable> BehaviorPerformPlugin::newDefault() const
|
||
{
|
||
return std::make_shared<BehaviorPerformPlugin>();
|
||
}
|
||
|
||
void BehaviorPerformPlugin::bindEntity(std::weak_ptr<WsEntity> host)
|
||
{
|
||
this->_bind_entity = host;
|
||
}
|
||
|
||
QString BehaviorPerformPlugin::name() const
|
||
{
|
||
return NAME(BehaviorPerformPlugin);
|
||
}
|
||
|
||
#include <MessageLoader.h>
|
||
MapKernal::MapKernal(std::shared_ptr<MessageLoader> ins)
|
||
: _bind_loader(ins) {
|
||
for (auto key : ins->allType())
|
||
registData(ins->makeDefault(key));
|
||
}
|
||
|
||
QList<QString> MapKernal::compareTypes() const
|
||
{
|
||
return _compare_types.keys();
|
||
}
|
||
|
||
void MapKernal::registCompare(std::shared_ptr<CompareDelegate> ins)
|
||
{
|
||
_compare_types[ins->name()] = ins;
|
||
}
|
||
|
||
std::shared_ptr<CompareDelegate> MapKernal::getCompare(const QString& name)
|
||
{
|
||
if (!_compare_types.contains(name))
|
||
return nullptr;
|
||
return _compare_types[name];
|
||
}
|
||
|
||
void MapKernal::registConvert(std::shared_ptr<ConvertDelegate> ins)
|
||
{
|
||
_convert_types[ins->name()] = ins;
|
||
}
|
||
|
||
QList<QString> MapKernal::convertTypes() const
|
||
{
|
||
return _convert_types.keys();
|
||
}
|
||
|
||
std::shared_ptr<ConvertDelegate> MapKernal::getConvert(const QString& name)
|
||
{
|
||
if (!_convert_types.contains(name))
|
||
return nullptr;
|
||
return _convert_types[name];
|
||
}
|
||
|
||
void MapKernal::registExecute(std::shared_ptr<ExecuteDelegate> ins)
|
||
{
|
||
_execute_types[ins->typeName()] = ins;
|
||
}
|
||
|
||
std::shared_ptr<MessageLoader> MapKernal::messageLoader() const
|
||
{
|
||
return this->_bind_loader;
|
||
}
|
||
|
||
void MapKernal::registData(std::shared_ptr<TopicData> init)
|
||
{
|
||
if (_variable_types.contains(init->topicString()))
|
||
throw new UniException(QString(u8"<EFBFBD>ظ<EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{%1}").arg(init->topicString()));
|
||
|
||
_variable_types[init->topicString()] = init;
|
||
}
|
||
|
||
QList<QString> MapKernal::dataTypes() const
|
||
{
|
||
return _variable_types.keys();
|
||
}
|
||
|
||
std::shared_ptr<TopicData> MapKernal::getData(const QString& topic)
|
||
{
|
||
return _variable_types[topic];
|
||
}
|
||
|
||
QList<QString> MapKernal::executeTypes() const
|
||
{
|
||
return _execute_types.keys();
|
||
}
|
||
|
||
std::shared_ptr<ExecuteDelegate> MapKernal::getExecute(const QString& name)
|
||
{
|
||
return _execute_types[name];
|
||
}
|
||
|
||
void MapKernal::registNode(std::shared_ptr<LogicalNode> ins)
|
||
{
|
||
_logicalnode_types[ins->typeName()] = ins;
|
||
}
|
||
|
||
QList<QString> MapKernal::nodeTypes() const
|
||
{
|
||
return _logicalnode_types.keys();
|
||
}
|
||
|
||
std::shared_ptr<LogicalNode> MapKernal::getNode(const QString& name)
|
||
{
|
||
return _logicalnode_types[name];
|
||
}
|
||
|
||
std::shared_ptr<Serializable> MapKernal::newDefault() const
|
||
{
|
||
return nullptr;
|
||
}
|
||
|
||
LogicalNode::LogicalNode(NodeKind t /*= NodeKind::ACTIONNODE*/)
|
||
:_node_type(t) {
|
||
}
|
||
|
||
void LogicalNode::_set_parent_node(std::weak_ptr<LogicalNode> pnode)
|
||
{
|
||
this->_parent_bind = pnode;
|
||
}
|
||
|
||
NodeKind LogicalNode::nodeKind() const
|
||
{
|
||
return _node_type;
|
||
}
|
||
|
||
int LogicalNode::depth() const
|
||
{
|
||
auto node_temp = this->parent().lock();
|
||
if (!node_temp) return 0;
|
||
|
||
return this->parent().lock()->depth() + 1;
|
||
}
|
||
|
||
std::shared_ptr<LogicalNode> LogicalNode::bindMap() const
|
||
{
|
||
auto node_temp = this->parent().lock();
|
||
if (!node_temp) return nullptr;
|
||
|
||
while (node_temp->nodeKind() != NodeKind::MAPNODE) {
|
||
node_temp = node_temp->parent().lock();
|
||
}
|
||
return node_temp;
|
||
}
|
||
|
||
void LogicalNode::setID(int unique_id)
|
||
{
|
||
this->_node_id = unique_id;
|
||
}
|
||
|
||
int LogicalNode::getID() const
|
||
{
|
||
return this->_node_id;
|
||
}
|
||
|
||
QString LogicalNode::rtName() const
|
||
{
|
||
return QString(u8"%1(%2)").arg(this->typeName()).arg(getID());
|
||
}
|
||
|
||
std::weak_ptr<LogicalNode> LogicalNode::parent() const
|
||
{
|
||
return this->_parent_bind;
|
||
}
|
||
|
||
BehaviorMapNode::BehaviorMapNode(std::shared_ptr<MapKernal> core)
|
||
:LogicalNode(NodeKind::MAPNODE), _bind_kernal(core) {
|
||
}
|
||
|
||
void BehaviorMapNode::setVariable(const QString& key, IO_TYPE t, std::shared_ptr<TopicData> ins)
|
||
{
|
||
if (_variables.contains(key))
|
||
if (_variables[key].second->topicString() != ins->topicString())
|
||
throw new UniException(u8"<EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><EFBFBD><EFBFBD>ͬһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>");
|
||
_variables[key] = std::make_pair(t, ins);
|
||
}
|
||
|
||
std::shared_ptr<TopicData> BehaviorMapNode::getVariable(const QString& key) const
|
||
{
|
||
if (!_variables.contains(key))
|
||
return nullptr;
|
||
|
||
return _variables[key].second;
|
||
}
|
||
|
||
void BehaviorMapNode::resetName(const QString& val)
|
||
{
|
||
this->_map_name = val;
|
||
}
|
||
|
||
std::shared_ptr<Serializable> BehaviorMapNode::newDefault() const
|
||
{
|
||
return std::make_shared<BehaviorMapNode>(this->_bind_kernal);
|
||
}
|
||
|
||
void BehaviorMapNode::recoveryFrom(const QJsonObject& obj)
|
||
{
|
||
|
||
}
|
||
|
||
void BehaviorMapNode::saveTo(QJsonObject& obj) const
|
||
{
|
||
|
||
}
|
||
|
||
QList<std::shared_ptr<LogicalNode>> BehaviorMapNode::getForwards() const
|
||
{
|
||
return children();
|
||
}
|
||
|
||
bool BehaviorMapNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
||
{
|
||
this->_state_value = ste;
|
||
return true;
|
||
}
|
||
|
||
void BehaviorMapNode::reset()
|
||
{
|
||
this->_state_value = LogicalResult::UNDEFINED;
|
||
}
|
||
|
||
QString BehaviorMapNode::typeName() const
|
||
{
|
||
return _map_name;
|
||
}
|
||
|
||
LogicalResult BehaviorMapNode::execute()
|
||
{
|
||
return _state_value;
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> BehaviorMapNode::inputList() const
|
||
{
|
||
QHash<QString, std::shared_ptr<TopicData>> list;
|
||
for (auto key : this->_variables.keys()) {
|
||
if (this->_variables[key].first == IO_TYPE::INPUT && key.contains(u8"::"))
|
||
list[key] = _variables[key].second;
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> BehaviorMapNode::outputList() const
|
||
{
|
||
QHash<QString, std::shared_ptr<TopicData>> list;
|
||
for (auto key : this->_variables.keys()) {
|
||
if (this->_variables[key].first == IO_TYPE::OUTPUT && key.contains(u8"::"))
|
||
list[key] = _variables[key].second;
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
SequenceNode::SequenceNode()
|
||
: LogicalNode(NodeKind::SEQUENCENODE) {
|
||
}
|
||
|
||
QList<std::shared_ptr<LogicalNode>> SequenceNode::getForwards() const
|
||
{
|
||
for (auto item : children()) {
|
||
// <20>ӽڵ<D3BD>ִ<EFBFBD><D6B4>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||
if (_state_map.contains(item->getID())) {
|
||
if (_state_map[item->getID()] != LogicalResult::SUCCESS)
|
||
return QList<std::shared_ptr<LogicalNode>>();
|
||
}
|
||
|
||
// <20><>ȡ<EFBFBD>½ڵ<C2BD>
|
||
if (!_state_map.contains(item->getID()))
|
||
return QList<std::shared_ptr<LogicalNode>>() << item;
|
||
}
|
||
|
||
// ȫ<><C8AB><EFBFBD>ɹ<EFBFBD>
|
||
return QList<std::shared_ptr<LogicalNode>>();
|
||
}
|
||
|
||
QString SequenceNode::typeName() const
|
||
{
|
||
return u8"˳<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>";
|
||
}
|
||
|
||
LogicalResult SequenceNode::execute() {
|
||
if (children().size() >= _state_map.size())
|
||
return LogicalResult::FAILURE;
|
||
|
||
for (auto ste : this->_state_map) {
|
||
switch (ste) {
|
||
case LogicalResult::SUCCESS:
|
||
break;
|
||
default:
|
||
return LogicalResult::FAILURE;
|
||
}
|
||
}
|
||
|
||
return LogicalResult::SUCCESS;
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> SequenceNode::inputList() const
|
||
{
|
||
return QHash<QString, std::shared_ptr<TopicData>>();
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> SequenceNode::outputList() const
|
||
{
|
||
return QHash<QString, std::shared_ptr<TopicData>>();
|
||
}
|
||
|
||
void SequenceNode::recoveryFrom(const QJsonObject& obj)
|
||
{
|
||
QStringList state_items;
|
||
STRLIST_PEAK(state_items);
|
||
for (auto kv : state_items) {
|
||
auto kv_pair = kv.split(u8":");
|
||
_state_map[kv_pair[0].toInt()] = (LogicalResult)kv_pair[1].toInt();
|
||
}
|
||
}
|
||
|
||
void SequenceNode::saveTo(QJsonObject& obj) const
|
||
{
|
||
QStringList state_items;
|
||
for (auto inv : _state_map.keys()) {
|
||
state_items << QString(u8"%1:%2").arg(inv).arg((int)_state_map[inv]);
|
||
}
|
||
|
||
STRLIST_SAVE(state_items);
|
||
}
|
||
|
||
bool SequenceNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
||
{
|
||
this->_state_map[node->getID()] = ste;
|
||
return true;
|
||
}
|
||
|
||
std::shared_ptr<Serializable> SequenceNode::newDefault() const
|
||
{
|
||
return std::make_shared<SequenceNode>();
|
||
}
|
||
|
||
void SequenceNode::reset()
|
||
{
|
||
this->_state_map.clear();
|
||
}
|
||
|
||
QList<std::shared_ptr<LogicalNode>> LogicalNode::children() const
|
||
{
|
||
return _child_list;
|
||
}
|
||
|
||
void LogicalNode::insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/)
|
||
{
|
||
for (auto it : _child_list)
|
||
if (it->getID() == node->getID())
|
||
return;
|
||
|
||
node->_set_parent_node(this->shared_from_this());
|
||
_child_list.insert(index, node);
|
||
}
|
||
|
||
void LogicalNode::remove(std::shared_ptr<LogicalNode> node)
|
||
{
|
||
_child_list.removeAll(node);
|
||
}
|
||
|
||
SelectorNode::SelectorNode()
|
||
: LogicalNode(NodeKind::SEQUENCENODE) {
|
||
}
|
||
|
||
QList<std::shared_ptr<LogicalNode>> SelectorNode::getForwards() const
|
||
{
|
||
for (auto item : children()) {
|
||
// <20>ӽڵ<D3BD>ִ<EFBFBD><D6B4>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||
if (_state_map.contains(item->getID())) {
|
||
if (_state_map[item->getID()] == LogicalResult::SUCCESS)
|
||
return QList<std::shared_ptr<LogicalNode>>();
|
||
}
|
||
|
||
// <20><>ȡ<EFBFBD>½ڵ<C2BD>
|
||
if (!_state_map.contains(item->getID()))
|
||
return QList<std::shared_ptr<LogicalNode>>() << item;
|
||
}
|
||
|
||
// ȫ<><C8AB><EFBFBD>ɹ<EFBFBD>
|
||
return QList<std::shared_ptr<LogicalNode>>();
|
||
}
|
||
|
||
bool SelectorNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
||
{
|
||
_state_map[node->getID()] = ste;
|
||
return true;
|
||
}
|
||
|
||
std::shared_ptr<Serializable> SelectorNode::newDefault() const
|
||
{
|
||
return std::make_shared<SelectorNode>();
|
||
}
|
||
|
||
void SelectorNode::recoveryFrom(const QJsonObject& obj)
|
||
{
|
||
QStringList state_items;
|
||
STRLIST_PEAK(state_items);
|
||
for (auto kv : state_items) {
|
||
auto kv_pair = kv.split(u8":");
|
||
_state_map[kv_pair[0].toInt()] = (LogicalResult)kv_pair[1].toInt();
|
||
}
|
||
}
|
||
|
||
void SelectorNode::saveTo(QJsonObject& obj) const
|
||
{
|
||
QStringList state_items;
|
||
for (auto inv : _state_map.keys()) {
|
||
state_items << QString(u8"%1:%2").arg(inv).arg((int)_state_map[inv]);
|
||
}
|
||
|
||
STRLIST_SAVE(state_items);
|
||
}
|
||
|
||
void SelectorNode::reset()
|
||
{
|
||
_state_map.clear();
|
||
}
|
||
|
||
QString SelectorNode::typeName() const
|
||
{
|
||
return u8"ѡ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>";
|
||
}
|
||
|
||
LogicalResult SelectorNode::execute()
|
||
{
|
||
for (auto value : _state_map) {
|
||
if (value == LogicalResult::SUCCESS)
|
||
return LogicalResult::SUCCESS;
|
||
}
|
||
return LogicalResult::FAILURE;
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> SelectorNode::inputList() const
|
||
{
|
||
return {};
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> SelectorNode::outputList() const
|
||
{
|
||
return {};
|
||
}
|
||
|
||
QList<std::shared_ptr<LogicalNode>> ParallelNode::getForwards() const
|
||
{
|
||
if (this->children().size() == _state_map.size())
|
||
return QList<std::shared_ptr<LogicalNode>>();
|
||
return this->children();
|
||
}
|
||
|
||
bool ParallelNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste)
|
||
{
|
||
_state_map[node->getID()] = ste;
|
||
return children().size() == _state_map.size();
|
||
}
|
||
|
||
void ParallelNode::reset()
|
||
{
|
||
_state_map.clear();
|
||
}
|
||
|
||
QString ParallelNode::typeName() const
|
||
{
|
||
return u8"<EFBFBD><EFBFBD><EFBFBD>нڵ<EFBFBD>";
|
||
}
|
||
|
||
LogicalResult ParallelNode::execute()
|
||
{
|
||
for (auto ste : this->_state_map)
|
||
if (ste != LogicalResult::SUCCESS)
|
||
return LogicalResult::FAILURE;
|
||
|
||
return LogicalResult::SUCCESS;
|
||
}
|
||
|
||
std::shared_ptr<Serializable> ParallelNode::newDefault() const
|
||
{
|
||
return std::make_shared<ParallelNode>();
|
||
}
|
||
|
||
ParallelNode::ParallelNode()
|
||
: LogicalNode(NodeKind::PARALLELNODE) {
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> ParallelNode::inputList() const
|
||
{
|
||
return QHash<QString, std::shared_ptr<TopicData>>();
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> ParallelNode::outputList() const
|
||
{
|
||
return QHash<QString, std::shared_ptr<TopicData>>();
|
||
}
|
||
|
||
void ParallelNode::recoveryFrom(const QJsonObject& obj)
|
||
{
|
||
QStringList state_items;
|
||
STRLIST_PEAK(state_items);
|
||
for (auto kv : state_items) {
|
||
auto kv_pair = kv.split(u8":");
|
||
_state_map[kv_pair[0].toInt()] = (LogicalResult)kv_pair[1].toInt();
|
||
}
|
||
}
|
||
|
||
void ParallelNode::saveTo(QJsonObject& obj) const
|
||
{
|
||
QStringList state_items;
|
||
for (auto inv : _state_map.keys()) {
|
||
state_items << QString(u8"%1:%2").arg(inv).arg((int)_state_map[inv]);
|
||
}
|
||
|
||
STRLIST_SAVE(state_items);
|
||
}
|
||
|
||
void CompareNode::reset() {
|
||
}
|
||
|
||
QString CompareNode::typeName() const
|
||
{
|
||
return QString(u8"%1<%2>").arg(u8"<EFBFBD>ȽϽڵ<EFBFBD>", delegateName());
|
||
}
|
||
|
||
LogicalResult CompareNode::execute()
|
||
{
|
||
if (this->_bind_delegate) {
|
||
auto vl = _data_map[u8"<EFBFBD><EFBFBD>ֵ"];
|
||
auto vb = _data_map[u8"<EFBFBD><EFBFBD>ֵ"];
|
||
if (this->_bind_delegate->compare(vl, vb))
|
||
return LogicalResult::SUCCESS;
|
||
}
|
||
return LogicalResult::FAILURE;
|
||
}
|
||
|
||
void CompareNode::insert(std::shared_ptr<LogicalNode> node, int index /*= -1*/)
|
||
{
|
||
if (this->children().size())
|
||
return;
|
||
|
||
LogicalNode::insert(node, index);
|
||
}
|
||
|
||
QList<std::shared_ptr<LogicalNode>> CompareNode::getForwards() const
|
||
{
|
||
return QList<std::shared_ptr<LogicalNode>>();
|
||
}
|
||
|
||
bool CompareNode::fallback(std::shared_ptr<LogicalNode> node, LogicalResult ste) {
|
||
return true;
|
||
}
|
||
|
||
std::shared_ptr<Serializable> CompareNode::newDefault() const
|
||
{
|
||
return std::make_shared<CompareNode>();
|
||
}
|
||
|
||
CompareNode::CompareNode()
|
||
: LogicalNode(NodeKind::COMPARENODE) {
|
||
_data_map[u8"<EFBFBD><EFBFBD>ֵ"] = std::make_shared<GeneralData>();
|
||
_data_map[u8"<EFBFBD><EFBFBD>ֵ"] = std::make_shared<GeneralData>();
|
||
}
|
||
|
||
QString CompareNode::delegateName() const
|
||
{
|
||
if (_bind_delegate)
|
||
return _bind_delegate->name();
|
||
return u8"";
|
||
}
|
||
|
||
void CompareNode::bindDelegate(std::shared_ptr<CompareDelegate> ins)
|
||
{
|
||
this->_bind_delegate = ins;
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> CompareNode::inputList() const
|
||
{
|
||
return _data_map;
|
||
}
|
||
|
||
QHash<QString, std::shared_ptr<TopicData>> CompareNode::outputList() const
|
||
{
|
||
return QHash<QString, std::shared_ptr<TopicData>>();
|
||
}
|
||
|
||
void CompareNode::recoveryFrom(const QJsonObject& obj)
|
||
{
|
||
auto vala = obj[u8"ValL"];
|
||
auto valb = obj[u8"ValR"];
|
||
|
||
_data_map[u8"<EFBFBD><EFBFBD>ֵ"]->recoveryFrom(vala.toObject());
|
||
_data_map[u8"<EFBFBD><EFBFBD>ֵ"]->recoveryFrom(valb.toObject());
|
||
}
|
||
|
||
void CompareNode::saveTo(QJsonObject& obj) const
|
||
{
|
||
QJsonObject vala, valb;
|
||
_data_map[u8"<EFBFBD><EFBFBD>ֵ"]->saveTo(vala);
|
||
_data_map[u8"<EFBFBD><EFBFBD>ֵ"]->saveTo(valb);
|
||
|
||
obj[u8"ValL"] = vala;
|
||
obj[u8"ValR"] = valb;
|
||
}
|
||
|
||
#include <QJsonDocument>
|
||
QString GeneralData::topicString() const
|
||
{
|
||
return u8"GeneralData";
|
||
}
|
||
|
||
std::shared_ptr<Serializable> GeneralData::newDefault() const
|
||
{
|
||
return std::make_shared<GeneralData>();
|
||
}
|
||
|
||
void GeneralData::recoveryFrom(const QJsonObject& obj)
|
||
{
|
||
_element_bind = obj;
|
||
}
|
||
|
||
void GeneralData::saveTo(QJsonObject& obj) const
|
||
{
|
||
obj = _element_bind;
|
||
}
|
||
|
||
CompareDelegate::CompareDelegate(QJSEngine& bind_engine, const QString& func)
|
||
:_script_engine(bind_engine), _function_name(func) {
|
||
}
|
||
|
||
QString CompareDelegate::name() const
|
||
{
|
||
return _function_name;
|
||
}
|
||
|
||
bool CompareDelegate::compare(std::shared_ptr<TopicData> vleft, std::shared_ptr<TopicData> vright)
|
||
{
|
||
return true;
|
||
}
|
||
|
||
ConvertDelegate::ConvertDelegate(std::shared_ptr<MapKernal> host, QJSEngine& bind_engine, const QString& func)
|
||
: _host_bind(host), _script_engine(bind_engine), _function_name(func) {
|
||
}
|
||
|
||
QString ConvertDelegate::name() const
|
||
{
|
||
return _function_name;
|
||
}
|
||
|
||
QList<std::pair<ConvertDelegate::DATA_TOPIC_STRING, QString>> ConvertDelegate::inputTable() const
|
||
{
|
||
return _input_table;
|
||
}
|
||
|
||
void ConvertDelegate::inputReset(const QList<std::pair<DATA_TOPIC_STRING, QString>>& table)
|
||
{
|
||
this->_input_table = table;
|
||
}
|
||
|
||
std::pair<ConvertDelegate::DATA_TOPIC_STRING, QString> ConvertDelegate::outputVariable() const
|
||
{
|
||
return _output_appoint;
|
||
}
|
||
|
||
void ConvertDelegate::outputReset(std::pair<DATA_TOPIC_STRING, QString> appoint)
|
||
{
|
||
this->_output_appoint = appoint;
|
||
}
|
||
|
||
std::shared_ptr<TopicData> ConvertDelegate::convert(const QList<std::shared_ptr<TopicData>>& input_variables)
|
||
{
|
||
return nullptr;
|
||
}
|