\r
AbstractBlock::~AbstractBlock() {\r
\r
- foreach(AbstractInterface* iface, inputs) {\r
- delete iface;\r
- }\r
- foreach(AbstractInterface* iface, outputs) {\r
- delete iface;\r
- }\r
- foreach(AbstractInterface* iface, bidirs) {\r
- delete iface;\r
- }\r
- inputs.clear();\r
- outputs.clear();\r
- bidirs.clear();\r
+ removeAllInterfaces();\r
+\r
foreach(BlockParameter* p, params) {\r
delete p;\r
}\r
return false;\r
}\r
\r
+bool AbstractBlock::isTopGroupBlock() { \r
+ return false;\r
+}\r
+\r
+bool AbstractBlock::isSourceBlock() {\r
+ return false;\r
+}\r
+\r
+bool AbstractBlock::isGeneratorBlock() {\r
+ foreach(AbstractInterface* iface, inputs) {\r
+ if (iface->getPurpose() == AbstractInterface::Data) return false;\r
+ }\r
+ return true;\r
+}\r
+\r
void AbstractBlock::addParameter(BlockParameter *param) {\r
params.append(param);\r
}\r
delete inter;\r
}\r
\r
+void AbstractBlock::removeAllInterfaces() {\r
+\r
+ foreach(AbstractInterface* iface, inputs) {\r
+ delete iface;\r
+ }\r
+ foreach(AbstractInterface* iface, outputs) {\r
+ delete iface;\r
+ }\r
+ foreach(AbstractInterface* iface, bidirs) {\r
+ delete iface;\r
+ }\r
+ inputs.clear();\r
+ outputs.clear();\r
+ bidirs.clear();\r
+\r
+}\r
+\r
void AbstractBlock::defineBlockParam(BlockParameter *param)\r
{\r
cout << "definition of param : " << param->getName().toStdString() << endl;\r
return list;\r
}\r
\r
+QList<AbstractInterface *> AbstractBlock::getDataInputs() {\r
+ QList<AbstractInterface *> list;\r
+ foreach(AbstractInterface* iface, inputs) {\r
+ if (iface->getPurpose() == AbstractInterface::Data) {\r
+ list.append(iface);\r
+ }\r
+ }\r
+ return list;\r
+}\r
+\r
+QList<AbstractInterface *> AbstractBlock::getControlInputs() {\r
+ QList<AbstractInterface *> list;\r
+ foreach(AbstractInterface* iface, inputs) {\r
+ if (iface->getPurpose() == AbstractInterface::Control) {\r
+ list.append(iface);\r
+ }\r
+ }\r
+ return list;\r
+}\r
+\r
+QList<AbstractInterface *> AbstractBlock::getControlOutputs() {\r
+ QList<AbstractInterface *> list;\r
+ foreach(AbstractInterface* iface, outputs) {\r
+ if (iface->getPurpose() == AbstractInterface::Control) {\r
+ list.append(iface);\r
+ }\r
+ }\r
+ return list;\r
+}\r
+\r
AbstractInterface* AbstractBlock::getIfaceFromName(QString name) {\r
\r
foreach(AbstractInterface* iface, inputs) {\r