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

Private GIT Repository
patter compat continued
[blast.git] / GroupBlock.cpp
index 2fc3012e62de0bf99d6dbec772df571170df530d..1560d98ce27c34998c3a49f6145062565641c6e2 100644 (file)
@@ -105,7 +105,7 @@ void GroupBlock::removeGenericParameter(QString name) {
   if (p != NULL) params.removeAll(p);
 }
 
-void GroupBlock::initInputPattern() {
+void GroupBlock::createInputPattern() {
   foreach(AbstractInterface* iface, getControlInputs()) {
     ConnectedInterface* connIface = AI_TO_CON(iface);
     QList<char>* pattern = new QList<char>(*(connIface->getConnectedFrom()->getOutputPattern()));    
@@ -113,6 +113,10 @@ void GroupBlock::initInputPattern() {
   }  
 }
 
+bool GroupBlock::checkInputPatternCompatibility() {
+  return true;
+}
+
 bool GroupBlock::computeOutputPattern(int nbExec) {
 
   static QString fctName = "GroupBlock::computeOutputPattern()";
@@ -123,8 +127,9 @@ bool GroupBlock::computeOutputPattern(int nbExec) {
   cout << "computing output pattern of group " << qPrintable(name) << endl;
   
   bool canCompute = true;
+  bool compatible = true;
   // get the input pattern on each inputs
-  initInputPattern();
+  createInputPattern();
   
   cout << "Input pattern OK" << endl;
   // find blocks that are connected to that inputs and generators
@@ -158,8 +163,13 @@ bool GroupBlock::computeOutputPattern(int nbExec) {
   while (!fifo.isEmpty()) {
     AbstractBlock* block = fifo.takeFirst();
     
-    if (block->getPatternComputed()) continue; // block has laready been processed
-        
+    if (block->getPatternComputed()) continue; // block has already been processed
+    
+    compatible = block->checkInputPatternCompatibility();
+    if (!compatible) {
+      cout << qPrintable(block->getName()) << " is not compatible with his input pattern" << endl;
+      break;
+    }
     canCompute = block->computeOutputPattern();
     if (!canCompute) {
       cout << "cannot finalize output pattern computation of " << qPrintable(block->getName()) << endl;