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

Private GIT Repository
finished compat. computation
[blast.git] / GroupBlock.cpp
index 2fc3012e62de0bf99d6dbec772df571170df530d..1b307da2445350211fc6ad5f85b4cdf106144571 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,11 @@ void GroupBlock::initInputPattern() {
   }  
 }
 
+bool GroupBlock::checkInputPatternCompatibility() {
+  return true;
+}
+
 bool GroupBlock::computeOutputPattern(int nbExec) {
 
   static QString fctName = "GroupBlock::computeOutputPattern()";
@@ -122,9 +127,10 @@ bool GroupBlock::computeOutputPattern(int nbExec) {
 
   cout << "computing output pattern of group " << qPrintable(name) << endl;
   
-  bool canCompute = true;
+  bool canCompute = false;
+  bool compatible = false;
   // 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 +164,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;