]> AND Private Git Repository - blast.git/blobdiff - AbstractBlock.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
added source items
[blast.git] / AbstractBlock.cpp
index 6e9cc86a9c764f014aa3695b023e6111f5e515b8..ba1c17915444b5a30cc5a99808ae33d761ea3ddf 100644 (file)
@@ -16,18 +16,8 @@ AbstractBlock::AbstractBlock(const QString& _name) {
 \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
@@ -90,6 +80,23 @@ void AbstractBlock::removeInterface(AbstractInterface *inter) {
   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
@@ -112,6 +119,16 @@ QList<AbstractInterface *> AbstractBlock::getInterfaces() {
   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
 AbstractInterface* AbstractBlock::getIfaceFromName(QString name) {\r
 \r
   foreach(AbstractInterface* iface, inputs) {\r