reference = _reference;\r
parent = _parent;\r
name = reference->getName();\r
- consumptionPattern = NULL;\r
- lengthCP = 0;\r
- nbConsumingPorts = 0;\r
- productionPattern = NULL;\r
- lengthPP = 0;\r
- nbProducingPorts = 0;\r
+\r
if (reference->getImplementations().isEmpty()) {\r
implementation = NULL;\r
cout << "block has no implementation" << endl;\r
cerr << "no consumption pattern for reference interface " << qPrintable(refName) << endl;\r
return false;\r
}\r
- QList<char> pattern = expandPattern(consPattern.value(refName),&ok); \r
+ QList<char>* pattern = expandPattern(consPattern.value(refName),&ok); \r
\r
if (!ok) return false;\r
- connIface->setConsumptionPattern(pattern);\r
- cout << qPrintable(refName) << " consumption pattern = ";\r
- foreach(char c, pattern) {\r
- cout << (int)c << " ";\r
- }\r
- cout << endl;\r
- \r
+ consumptionPattern.insert(connIface,pattern); \r
} \r
return true;\r
}\r
cerr << "no production pattern for reference interface " << qPrintable(refName) << endl;\r
return false;\r
}\r
- QList<char> pattern = expandPattern(prodPattern.value(refName),&ok);\r
+ QList<char>* pattern = expandPattern(prodPattern.value(refName),&ok);\r
if (!ok) return false;\r
- connIface->setProductionPattern(pattern);\r
- cout << qPrintable(refName) << " production pattern = ";\r
- foreach(char c, pattern) {\r
- cout << (int)c << " ";\r
- }\r
- cout << endl;\r
- \r
+ productionPattern.insert(connIface,pattern); \r
} \r
return true;\r
}\r
return true;\r
}\r
\r
-QList<char> FunctionalBlock::expandPattern(const QString& pattern, bool* ok) {\r
+QList<char>* FunctionalBlock::expandPattern(const QString& patternIn, bool* ok) {\r
static QString fctName = "FunctionalBlock::expandPattern()";\r
#ifdef DEBUG_FCTNAME\r
cout << "call to " << qPrintable(fctName) << endl;\r
#endif\r
\r
QList<char> lst;\r
- QString p = pattern;\r
+ QString p = patternIn;\r
p.append(')');\r
int offset = 0;\r
- lst = expandPatternRecur(p,&offset,ok); \r
- return lst;\r
+ QList<char>* patternOut = new QList<char>();\r
+ expandPatternRecur(p,&offset,ok,patternOut); \r
+ return patternOut;\r
}\r
\r
-QList<char> FunctionalBlock::expandPatternRecur(const QString& pattern, int *offset, bool *ok) {\r
- \r
- QList<char> currentGroup; \r
+void FunctionalBlock::expandPatternRecur(const QString& patternIn, int *offset, bool *ok, QList<char>* patternOut) { \r
\r
- while ((*offset < pattern.size()) && (pattern.at(*offset) != ')')) {\r
+ while ((*offset < patternIn.size()) && (patternIn.at(*offset) != ')')) {\r
\r
- QChar c = pattern.at(*offset);\r
+ QChar c = patternIn.at(*offset);\r
if (c == '(') {\r
*offset += 1;\r
- currentGroup += expandPatternRecur(pattern,offset, ok);\r
+ expandPatternRecur(patternIn,offset, ok, patternOut);\r
if (!ok) {\r
- return currentGroup;\r
+ return;\r
}\r
}\r
else if (c == '0') {\r
- currentGroup.append(0);\r
+ patternOut->append(0);\r
}\r
else if (c == '1') {\r
- currentGroup.append(1);\r
+ patternOut->append(1);\r
}\r
else if (c == 'X') {\r
- currentGroup.append(-1);\r
+ patternOut->append(-1);\r
}\r
else if (c == '{') {\r
*offset += 1;\r
QString expr = ""; \r
- while ((*offset < pattern.size()) && (pattern.at(*offset) != '}')) {\r
- expr += pattern.at(*offset); \r
+ while ((*offset < patternIn.size()) && (patternIn.at(*offset) != '}')) {\r
+ expr += patternIn.at(*offset); \r
*offset += 1;\r
}\r
- if (*offset == pattern.size()) {\r
+ if (*offset == patternIn.size()) {\r
*ok = false;\r
- return currentGroup;\r
+ return;\r
}\r
double repeat = evaluateExpression(expr,ok);\r
if (!ok) {\r
- return currentGroup; \r
+ return; \r
} \r
// repeat just the last value in currentGroup\r
- char last = currentGroup.last(); \r
+ char last = patternOut->last(); \r
//cout << "repeat last char " << repeat << " times : " << (int)last << endl;\r
\r
for(int i=1;i<(int)repeat;i++) {\r
- currentGroup += last;\r
+ patternOut->append(last);\r
}\r
} \r
*offset += 1;\r
}\r
\r
// must check if after ), there is a {\r
- if ((*offset < pattern.size()-1) && (pattern.at(*offset+1) == '{')) {\r
+ if ((*offset < patternIn.size()-1) && (patternIn.at(*offset+1) == '{')) {\r
*offset += 2;\r
QString expr = ""; \r
- while ((*offset < pattern.size()) && (pattern.at(*offset) != '}')) {\r
- expr += pattern.at(*offset); \r
+ while ((*offset < patternIn.size()) && (patternIn.at(*offset) != '}')) {\r
+ expr += patternIn.at(*offset); \r
*offset += 1;\r
}\r
- if (*offset == pattern.size()) {\r
+ if (*offset == patternIn.size()) {\r
*ok = false;\r
- return currentGroup;\r
+ return;\r
}\r
double repeat = evaluateExpression(expr,ok);\r
if (!ok) {\r
- return currentGroup; \r
+ return; \r
}\r
/*\r
cout << "repeat last group " << repeat << " times : ";\r
foreach (char c, currentGroup) cout <<(int)c;\r
cout << endl; \r
*/\r
- QList<char> single = currentGroup;\r
+ QList<char> single = *patternOut;\r
for(int i=1;i<(int)repeat;i++) {\r
- currentGroup += single;\r
+ patternOut->append(single);\r
} \r
}\r
//*offset += 1;\r
- return currentGroup;\r
+ return;\r
}\r
\r
double FunctionalBlock::evaluateExpression(const QString& expression, bool* ok) {\r
return 0.0;\r
}\r
vars.insert(name,(double)val); \r
- } \r
+ }\r
+ \r
evaluator->setVariablesValue(vars);\r
double result;\r
try {\r
cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl;\r
foreach(AbstractInterface* iface, getControlOutputs()) {\r
FunctionalInterface* connIface = AI_TO_FUN(iface);\r
- QList<char> pattern;\r
- for(int i=0;i<nbExec;i++) pattern += connIface->getProductionPattern();\r
+ // create output pattern\r
+ QList<char>* pp = productionPattern.value(connIface);\r
+ QList<char>* pattern = new QList<char>(*pp);\r
+ for(int i=1;i<nbExec;i++) pattern->append(*pp);\r
+ // assign pattern to interface\r
connIface->setOutputPattern(pattern);\r
- } \r
+ // store it in QMap\r
+ outputPattern.insert(connIface,pattern); \r
+ }\r
}\r
else {\r
cout << "computing output pattern of " << qPrintable(name) << endl;\r
\r
- // initialize consumption and production patterns \r
- initConsumptionPattern();\r
- initProductionPattern();\r
- \r
- // collect the input patterns for each input \r
- char** inputPattern = NULL;\r
- int idIface = 0;\r
- inputPattern = new char*[nbConsumingPorts];\r
+ // collect the input patterns for each input \r
+ QMap<AbstractInterface*,QList<char>* > inputPattern; \r
int minLen = -1;\r
foreach(AbstractInterface* iface, getControlInputs()) { \r
ConnectedInterface* connIface = AI_TO_CON(iface);\r
- QList<char> in = connIface->getConnectedFrom()->getOutputPattern();\r
+ QList<char>* out = connIface->getConnectedFrom()->getOutputPattern();\r
if (minLen == -1) {\r
- minLen = in.size();\r
+ minLen = out->size();\r
}\r
else {\r
- if (in.size() < minLen) minLen = in.size();\r
+ if (out->size() < minLen) minLen = out->size();\r
}\r
- if (in.size() > 0) {\r
- inputPattern[idIface] = new char[in.size()];\r
- int i = 0;\r
- foreach(char c, in) inputPattern[idIface][i++] = c;\r
+ if (out->size() > 0) {\r
+ QList<char>* in = new QList<char>(*out);\r
+ foreach(char c, *in) {\r
+ cout << (int)c;\r
+ }\r
+ cout << endl;\r
+\r
+ inputPattern.insert(connIface,in);\r
}\r
else {\r
- inputPattern[idIface] = NULL;\r
- }\r
- idIface += 1; \r
+ inputPattern.insert(connIface,NULL);\r
+ } \r
}\r
- // if some patterns are not available, ens now, returning false\r
+ // if some patterns are not available, end now, returning false\r
if (minLen == 0) {\r
- for(int i=0;i<nbConsumingPorts; i++) {\r
- if (inputPattern[i] != NULL) delete [] inputPattern[i];\r
- }\r
- delete [] inputPattern;\r
+ QMapIterator<AbstractInterface*,QList<char>* > iterI(inputPattern);\r
+ while (iterI.hasNext()) {\r
+ iterI.next();\r
+ QList<char>* pattern = iterI.value(); \r
+ if (pattern != NULL) delete pattern;\r
+ } \r
return false;\r
}\r
cout << "input pattern array initialized with min. len " << minLen << endl;\r
+ \r
// initialize the output pattern \r
- char** outputPattern = NULL;\r
- outputPattern = new char*[nbProducingPorts];\r
int lengthOP = 0;\r
- idIface = 0;\r
foreach(AbstractInterface* iface, getControlOutputs()) {\r
- FunctionalInterface* connIface = AI_TO_FUN(iface);\r
- lengthOP = minLen+connIface->getProductionPattern().size();\r
- outputPattern[idIface] = new char[lengthOP];\r
- memset(outputPattern[idIface],0,lengthOP);\r
- idIface += 1;\r
+ FunctionalInterface* connIface = AI_TO_FUN(iface); \r
+ lengthOP = minLen+productionPattern.value(connIface)->size();\r
+ QList<char>* pattern = new QList<char>();\r
+ for(int i=0;i<lengthOP;i++) pattern->append(0);\r
+ connIface->setOutputPattern(pattern);\r
+ outputPattern.insert(connIface,pattern);\r
}\r
cout << "output pattern array initialized" << endl;\r
\r
int clock = 0;\r
nbExec = 0;\r
// search for the beginning of the first execution.\r
- while ((clock < minLen) && (! isValidDataGroup(inputPattern,nbConsumingPorts,clock))) clock++;\r
+ while ((clock < minLen) && (! isValidDataGroup(inputPattern,clock))) clock++;\r
cout << "found 1st exec clock: " << clock << endl;\r
\r
while (clock < minLen) {\r
bool cannotCompleteExec = false;\r
for(int m=0;m<productionCounter.size();m++) {\r
// search for the first production in PP\r
- while (!isValidDataGroup(productionPattern,nbProducingPorts,p)) {\r
+ while (!isValidDataGroup(productionPattern,p)) {\r
p += 1;\r
o += 1;\r
}\r
// search for PC(m) valid input group in IP\r
while (nip < productionCounter.at(m)) {\r
if (clock+cip < minLen) {\r
- if (isValidDataGroup(inputPattern,nbConsumingPorts,clock+cip)) nip += 1;\r
+ if (isValidDataGroup(inputPattern,clock+cip)) nip += 1;\r
cip += 1;\r
gap += 1;\r
}\r
cannotCompleteExec = true;\r
break;\r
} \r
- }\r
+ } \r
\r
if (cannotCompleteExec) break; // no need to go further since the next search of input data group will lead to go outside inputPattern\r
\r
// search for PC(m) valid input group in IP\r
while (ncp < productionCounter.at(m)) {\r
- if (isValidDataGroup(consumptionPattern,nbConsumingPorts,ccp)) ncp += 1;\r
+ if (isValidDataGroup(consumptionPattern,ccp)) ncp += 1;\r
ccp += 1;\r
gap -= 1;\r
}\r
o += gap; // to take into acocunt of extra null columns\r
- combinePatterns(productionPattern,p,outputPattern,clock+o,1,nbProducingPorts);\r
+ combinePatterns(productionPattern,p,outputPattern,clock+o);\r
p += 1;\r
o += 1;\r
}\r
clock += 1; \r
nip = 0;\r
while ((clock < minLen) && (nip < delta)) {\r
- if (isValidDataGroup(inputPattern,nbConsumingPorts,clock)) nip += 1;\r
+ if (isValidDataGroup(inputPattern,clock)) nip += 1;\r
if (nip < delta) clock += 1;\r
}\r
+ cout << "found exec " << nbExec << " at clock: " << clock << endl;\r
}\r
// find the last valid output data group\r
- while(! isValidDataGroup(outputPattern,nbProducingPorts,lengthOP-1)) lengthOP -= 1;\r
- \r
- //for(int i=0;i<lengthOP;i++) cout << (int)(outputPattern[0][i]);\r
- //cout << endl;\r
- // copy back outputPattern info each interface\r
- idIface = 0;\r
- foreach(AbstractInterface* iface, getControlOutputs()) {\r
- ConnectedInterface* connIface = AI_TO_CON(iface);\r
- QList<char> pattern;\r
- for(int i=0;i<lengthOP;i++) pattern.append(outputPattern[idIface][i]);\r
- connIface->setOutputPattern(pattern); \r
- idIface += 1;\r
- }\r
- \r
- // clear inputPattern and outputPattern\r
- for(int i=0;i<nbConsumingPorts; i++) {\r
- delete [] inputPattern[i];\r
- }\r
- delete [] inputPattern;\r
- for(int i=0;i<nbProducingPorts; i++) {\r
- delete [] outputPattern[i];\r
+ while(! isValidDataGroup(outputPattern,lengthOP-1)) {\r
+ removeDataGroup(outputPattern,lengthOP-1);\r
+ lengthOP -= 1;\r
}\r
- delete [] outputPattern;\r
+\r
+ // clear input pattern \r
+ QMapIterator<AbstractInterface*,QList<char>* > iterI(inputPattern);\r
+ while (iterI.hasNext()) {\r
+ iterI.next();\r
+ QList<char>* pattern = iterI.value(); \r
+ if (pattern != NULL) delete pattern;\r
+ } \r
}\r
return true;\r
}\r
\r
-bool FunctionalBlock::isValidDataGroup(char** pattern, int nbPorts, int clock) {\r
- \r
- for(int i=0;i<nbPorts;i++) {\r
- if (pattern[i][clock] == 1) return true;\r
+bool FunctionalBlock::canCombinePatterns(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, QMap<AbstractInterface*, QList<char>* > patternDest, int destCol) {\r
+ if (patternSrc.size() != patternDest.size()) return false;\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterSrc(patternSrc);\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterDest(patternDest);\r
+ while (iterSrc.hasNext()) {\r
+ iterSrc.next();\r
+ iterDest.next(); \r
+ QList<char>* srcPat = iterSrc.value();\r
+ QList<char>* destPat = iterDest.value();\r
+ if (srcCol >= srcPat->size()) return false;\r
+ if (destCol >= destPat->size()) return false;\r
+ if ((srcPat->at(srcCol) == -1) && (destPat->at(destCol) == 1)) return false;\r
+ if ((srcPat->at(srcCol) == 1) && (destPat->at(destCol) == -1)) return false;\r
}\r
- return false; \r
+ return true;\r
}\r
\r
-void FunctionalBlock::combinePatterns(char** patternSrc, int srcCol, char** patternDest, int destCol, int nbCols, int nbPorts ) {\r
- \r
- for (int i=0;i<nbCols;i++) {\r
- for(int j=0;j<nbPorts;j++) {\r
- patternDest[j][destCol+i] = patternDest[j][destCol+i] | patternSrc[j][srcCol+i];\r
+void FunctionalBlock::combinePatterns(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, QMap<AbstractInterface*, QList<char>* > patternDest, int destCol) {\r
+ if (patternSrc.size() != patternDest.size()) return;\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterSrc(patternSrc);\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterDest(patternDest);\r
+ while (iterSrc.hasNext()) {\r
+ iterSrc.next();\r
+ iterDest.next(); \r
+ QList<char>* srcPat = iterSrc.value();\r
+ QList<char>* destPat = iterDest.value();\r
+ if (srcCol >= srcPat->size()) return;\r
+ if (destCol >= destPat->size()) return;\r
+ if ((srcPat->at(srcCol) == -1) && (destPat->at(destCol) == 1)) return;\r
+ if ((srcPat->at(srcCol) == 1) && (destPat->at(destCol) == -1)) return; \r
+ destPat->replace(destCol,destPat->at(destCol) | srcPat->at(srcCol));\r
+ } \r
+}\r
+\r
+void FunctionalBlock::appendToPattern(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, QMap<AbstractInterface*, QList<char>* > patternDest, int nbCols) {\r
+ if (patternSrc.size() != patternDest.size()) return;\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterSrc(patternSrc);\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterDest(patternDest);\r
+ while (iterSrc.hasNext()) {\r
+ iterSrc.next();\r
+ iterDest.next(); \r
+ QList<char>* srcPat = iterSrc.value();\r
+ QList<char>* destPat = iterDest.value(); \r
+ int i=0;\r
+ while ((srcCol+i < srcPat->size()) && (i<nbCols)) {\r
+ destPat->append(srcPat->at(srcCol+i));\r
+ i++;\r
}\r
- }\r
- \r
+ } \r
}\r
\r
-void FunctionalBlock::clearConsumptionPattern() {\r
- if (consumptionPattern == NULL) return;\r
- \r
- for(int i=0;i<nbConsumingPorts; i++) {\r
- delete [] consumptionPattern[i];\r
+void FunctionalBlock::removeDataGroup(QMap<AbstractInterface *, QList<char> *> &pattern, int offset) {\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterSrc(pattern); \r
+ while (iterSrc.hasNext()) {\r
+ iterSrc.next(); \r
+ QList<char>* srcPat = iterSrc.value();\r
+ if (offset < srcPat->size()) {\r
+ srcPat->removeAt(offset);\r
+ }\r
}\r
- delete [] consumptionPattern; \r
}\r
\r
-void FunctionalBlock::clearProductionPattern() {\r
- if (productionPattern == NULL) return;\r
- for(int i=0;i<nbProducingPorts;i++) {\r
- delete [] productionPattern[i];\r
+bool FunctionalBlock::isValidDataGroup(const QMap<AbstractInterface *, QList<char> *> &pattern, int offset) {\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterSrc(pattern); \r
+ while (iterSrc.hasNext()) {\r
+ iterSrc.next(); \r
+ QList<char>* srcPat = iterSrc.value();\r
+ if (offset >= srcPat->size()) return false;\r
+ if (srcPat->at(offset) == 1) return true;\r
}\r
- delete [] productionPattern;\r
+ return false;\r
}\r
\r
-void FunctionalBlock::initConsumptionPattern() {\r
- static QString fctName = "FunctionalBlock::initConsumptionPattern()";\r
-#ifdef DEBUG_FCTNAME\r
- cout << "call to " << qPrintable(fctName) << endl;\r
-#endif\r
- \r
- if (consumptionPattern != NULL) clearConsumptionPattern();\r
- \r
- nbConsumingPorts = getControlInputs().size(); \r
- int idIface = 0;\r
- consumptionPattern = new char*[nbConsumingPorts]; \r
- foreach(AbstractInterface* iface, getControlInputs()) {\r
- FunctionalInterface* connIface = AI_TO_FUN(iface);\r
- QList<char> in = connIface->getConsumptionPattern();\r
- lengthCP = in.size(); // normally, all inputs have the same lenght for CP\r
- consumptionPattern[idIface] = new char[lengthCP];\r
- int i = 0;\r
- foreach(char c, in) consumptionPattern[idIface][i++] = c;\r
- idIface += 1; \r
+bool FunctionalBlock::isOnlyXDataGroup(const QMap<AbstractInterface *, QList<char> *> &pattern, int offset) {\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterSrc(pattern); \r
+ while (iterSrc.hasNext()) {\r
+ iterSrc.next(); \r
+ QList<char>* srcPat = iterSrc.value();\r
+ if (offset >= srcPat->size()) return false;\r
+ if (srcPat->at(offset) != -1) return false;\r
}\r
+ return true; \r
}\r
\r
-void FunctionalBlock::initProductionPattern() {\r
- static QString fctName = "FunctionalBlock::initProductionPattern()";\r
-#ifdef DEBUG_FCTNAME\r
- cout << "call to " << qPrintable(fctName) << endl;\r
-#endif\r
- \r
- if (productionPattern != NULL) clearProductionPattern();\r
- \r
- nbProducingPorts = getControlOutputs().size(); \r
- int idIface = 0;\r
- productionPattern = new char*[nbProducingPorts]; \r
- foreach(AbstractInterface* iface, getControlOutputs()) {\r
- FunctionalInterface* connIface = AI_TO_FUN(iface);\r
- QList<char> in = connIface->getProductionPattern();\r
- lengthPP = in.size(); // normally, all inputs have the same lenght for PP\r
- productionPattern[idIface] = new char[lengthPP];\r
- int i = 0;\r
- foreach(char c, in) productionPattern[idIface][i++] = c;\r
- idIface += 1; \r
+void FunctionalBlock::clearConsumptionPattern() {\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterP(consumptionPattern); \r
+ while (iterP.hasNext()) {\r
+ iterP.next();\r
+ QList<char>* pattern = iterP.value();\r
+ if (pattern != NULL) delete pattern;\r
}\r
-}\r
+} \r
+\r
+void FunctionalBlock::clearProductionPattern() {\r
+ QMapIterator<AbstractInterface*, QList<char>* > iterP(productionPattern); \r
+ while (iterP.hasNext()) {\r
+ iterP.next();\r
+ QList<char>* pattern = iterP.value();\r
+ if (pattern != NULL) delete pattern;\r
+ }\r
+} \r
bool createConsumptionPattern(); // initialize a QList<char> for each interface from patterns defined in implementation\r
bool createProductionPattern(); // initialize a QList<char> for each interface from patterns defined in implementation\r
bool createProductionCounter(); // initialize a QList<int> from counter defined in implementation\r
- void initConsumptionPattern(); // initialize a char** from patterns defined for each interface\r
- void initProductionPattern(); // initialize a char** from patterns defined for each interface\r
void clearConsumptionPattern();\r
void clearProductionPattern();\r
bool computeOutputPattern(int nbExec = -1);\r
\r
private: \r
- // patterns \r
- bool isValidDataGroup(char** pattern, int nbPorts, int clock);\r
+ // patterns \r
double evaluateExpression(const QString& expression, bool* ok);\r
- QList<char> expandPattern(const QString& pattern, bool* ok);\r
- QList<char> expandPatternRecur(const QString& pattern, int* offset, bool* ok);\r
+ QList<char>* expandPattern(const QString& patternIn, bool* ok);\r
+ void expandPatternRecur(const QString& patternIn, int* offset, bool* ok, QList<char> *patternOut);\r
+ /*!\r
+ * \brief canCombinePatterns\r
+ * \param patternSrc the pattern that must be combined with patternDest (patternDest = patternDest OR patternSrc) \r
+ * \param srcCol the column index within patternSrc\r
+ * \param patternDest the pattern that is modified by the combination (patternDest = patternDest OR patternSrc)\r
+ * \param destCol the column index within patternDest \r
+ * \return true if the combination is possible, and false else (e.g. when X1 must be combined with 11)\r
+ * NB: if src/destCol are outside the range of the list, false is returned. \r
+ */\r
+ bool canCombinePatterns(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, QMap<AbstractInterface*, QList<char>* > patternDest, int destCol);\r
/*!\r
* \brief combinePatterns\r
* \param patternSrc the pattern that must be combined with patternDest (patternDest = patternDest OR patternSrc) \r
* \param srcCol the column index within patternSrc\r
* \param patternDest the pattern that is modified by the combination (patternDest = patternDest OR patternSrc)\r
- * \param destClock the column index within patternDest\r
- * \param nbCols the numer of columns to combine\r
- * \param nbPorts the number of rows in both patterns\r
- * BEWARE: no check is done if nbCols is consistent with the real length of both patterns, thus an access outside\r
- * the patterns is possible.\r
+ * \param destCol the column index within patternDest \r
+ * BEWARE: this method returns as soons as there is an acces problem (i.e. out of list range, impossible combine, ...)\r
+ leaving the dest pattern in an inconsistent state. Thus, it is a good idea to call canCombine before.\r
*/\r
- void combinePatterns(char** patternSrc, int srcCol, char** patternDest, int destCol, int nbCols, int nbPorts );\r
-\r
- QList<int> productionCounter; //! only usefull for output interfaces\r
- int delta;\r
+ void combinePatterns(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, QMap<AbstractInterface*, QList<char>* > patternDest, int destCol);\r
+ /*!\r
+ * \brief appendToPattern\r
+ * \param patternSrc the pattern that must be appended to patternDest\r
+ * \param srcCol the column index within patternSrc\r
+ * \param patternDest the pattern that is modified by the append \r
+ * \param nbCols the numer of columns to append \r
+ * BEWARE: if nbCols is not consistent with the real length of src pattern, there may be less that nbCols\r
+ * that will be appended\r
+ */\r
+ void appendToPattern(const QMap<AbstractInterface*, QList<char>* >& patternSrc, int srcCol, QMap<AbstractInterface*, QList<char>* > patternDest, int nbCols);\r
+ /*!\r
+ * \brief removeDataGroup\r
+ * \param pattern the pattern for which a column is removed\r
+ * \param offset the index of the column to remove \r
+ */\r
+ void removeDataGroup(QMap<AbstractInterface*, QList<char>* >& pattern, int offset);\r
+ /*!\r
+ * \brief isValidGroup\r
+ * \param pattern the pattern to test\r
+ * \param offset the column to test\r
+ * isValidGroup checks if there is at least one 1 in the column offset of pattern.\r
+ */\r
+ bool isValidDataGroup(const QMap<AbstractInterface*, QList<char>* >& pattern, int offset);\r
+ /*!\r
+ * \brief isOnlyXGroup\r
+ * \param pattern the pattern to test\r
+ * \param offset the column to test\r
+ * isOnlyXGroup checks if there is only X in the column offset of pattern.\r
+ */\r
+ bool isOnlyXDataGroup(const QMap<AbstractInterface*, QList<char>* >& pattern, int offset);\r
+ /*!\r
+ * \brief shifRightPattern\r
+ * \param pattern the pattern to shift\r
+ * \param offset the column where to shift\r
+ * shiftRightPattern insert a null colmun in pattern, which leads to shift right the pattern at offset.\r
+ * this method is used during admittance generation\r
+ */\r
+ void shiftRightPattern(const QMap<AbstractInterface*, QList<char>* >& pattern, int offset);\r
+\r
+ QMap<AbstractInterface*, QList<char>* > consumptionPattern;\r
+ QMap<AbstractInterface*, QString > admittance; // the admittance expressed as prologue-cyclic part-eppilogue\r
+ QMap<AbstractInterface*, QList<char>* > admittanceExpanded; // the admittance expanded by taking into account nb exec.\r
+ QMap<AbstractInterface*, QList<char>* > productionPattern;\r
+ QMap<AbstractInterface*, QList<char>* > outputPattern; // CAUTION: the QList<char>* must also be stored in the outputPattern attributes of AbstractInterface\r
+ QList<int> productionCounter; //! only usefull for control output interfaces\r
\r
- char** consumptionPattern;\r
- int nbConsumingPorts;\r
- int lengthCP;\r
- char** productionPattern;\r
- int nbProducingPorts;\r
- int lengthPP;\r
+ int delta;\r
+ \r
ArithmeticEvaluator* evaluator;\r
\r
ReferenceBlock* reference;\r