|
@@ -86,10 +86,7 @@ namespace mdd {
|
|
|
in_ptr->connect(out_ptr);
|
|
|
jargs["object"] = obj;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
else if (obj["type"] == "input")
|
|
|
{
|
|
@@ -111,8 +108,32 @@ namespace mdd {
|
|
|
}
|
|
|
|
|
|
json Connector::remove(const json& args) {
|
|
|
-
|
|
|
- return args;
|
|
|
+ json ret;
|
|
|
+ if (!contains_subj_obj_structure(args))
|
|
|
+ {
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ json sub = args["subject"];
|
|
|
+ if (!sub.contains("type"))
|
|
|
+ {
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ json obj = args["object"];
|
|
|
+ ret["operation"] = "remove";
|
|
|
+ json jargs;
|
|
|
+ if (sub["type"] == "processor")
|
|
|
+ {
|
|
|
+ if (sub == _root->getIdentifier())
|
|
|
+ {
|
|
|
+ jargs["subject"] = _root->getIdentifier();
|
|
|
+ json jobj = obj["object"];
|
|
|
+ auto module_ptr = _root->getModule(obj["name"].get<std::string>() + std::to_string(obj["appendix"].get<int>()));
|
|
|
+ jargs["object"] = module_ptr->getIdentifier();
|
|
|
+ _root->removeModule(module_ptr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ret["args"] = jargs;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
json Connector::change(const json& args) {
|
|
@@ -131,7 +152,7 @@ namespace mdd {
|
|
|
json jargs;
|
|
|
if (sub["type"] == "processor")
|
|
|
{
|
|
|
- if (jargs["subject"] == _root->getIdentifier())
|
|
|
+ if (sub["subject"] == _root->getIdentifier())
|
|
|
{
|
|
|
jargs["subject"] = _root->getIdentifier();
|
|
|
if (_root->configure(obj.dump()))
|
|
@@ -155,7 +176,6 @@ namespace mdd {
|
|
|
else {
|
|
|
jargs["object"] = obj;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
else if (sub["type"] == "module")
|