int AbstractInterface::typeFromString(const QString &_type) {
- int ret;
+ int ret = Expression; // default type
if (_type == "expression") {
ret = Expression;
}
}
break;
}
+ case Title:
+ cout << "abnormal case while resizing block" << endl;
+ break;
+ case BorderWest:
+ cout << "abnormal case while resizing block" << endl;
+ break;
+ case BorderNorth:
+ cout << "abnormal case while resizing block" << endl;
+ break;
case NoBorder:
cout << "abnormal case while resizing block" << endl;
break;
bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2) {
ConnectedInterface* ref1 = iface1->refInter;
- ConnectedInterface* ref2 = iface2->refInter;
- ConnectedInterface* asso1 = (ConnectedInterface*)(iface1->refInter->getAssociatedIface());
- ConnectedInterface* asso2 = (ConnectedInterface*)(iface2->refInter->getAssociatedIface());
+ ConnectedInterface* ref2 = iface2->refInter;
// connect both interface
bool ok1 = false;
removeAllBlockConnections(item);
if (item->getRefBlock()->isFunctionalBlock()) {
- FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());
- GroupBlock* group = AB_TO_GRP(block->getParent());
+ FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());
item->getScene()->removeBoxItem(item);
params->getGraph()->removeFunctionalBlock(block);
}
\r
cout << "create patterns for block " << qPrintable(name) << endl;\r
if (evaluator == NULL) evaluator = new ArithmeticEvaluator();\r
- bool ok = true; \r
if (! isGeneratorBlock()) {\r
try {\r
createDelta();\r
return;\r
}\r
\r
- // look for parameter names\r
- bool ok = true;\r
+ // look for parameter names \r
double result = 0;\r
try {\r
result = evaluateExpression(deltaStr);\r
cout << "call to " << qPrintable(fctName) << endl;\r
#endif\r
\r
- lengthCP = -1;\r
- bool ok = true; \r
+ lengthCP = -1; \r
QHash<QString,QString> consPattern = implementation->getConsumptionPattern(); \r
\r
foreach(AbstractInterface* iface, getControlInputs()) { \r
static QString fctName = "FunctionalBlock::createAdmittance()";\r
#ifdef DEBUG_FCTNAME\r
cout << "call to " << qPrintable(fctName) << endl;\r
-#endif\r
- bool ok = true;\r
+#endif \r
// firstly, copy CP in AP\r
QMapIterator<AbstractInterface*,QList<char>* > iterC(consumptionPattern);\r
while (iterC.hasNext()) {\r
#ifdef DEBUG_FCTNAME\r
cout << "call to " << qPrintable(fctName) << endl;\r
#endif\r
- \r
- bool ok = true;\r
+ \r
// firstly, create input pattern\r
try {\r
createInputPattern();\r
#include "GroupBlock.h"
#include "ReferenceBlock.h"
#include "FunctionalBlock.h"
-#include "Exception.h"
Graph::Graph() {
topGroup = new GroupBlock(NULL);
return b;
}
-bool Graph::removeGroupBlock(GroupBlock *group) {
+void Graph::removeGroupBlock(GroupBlock *group) {
group->removeAllBlocks();
GroupBlock* parent = AB_TO_GRP(group->getParent());
parent->removeBlock(group);
FunctionalBlock* Graph::duplicateSourceBlock(FunctionalBlock *block) {
- ReferenceBlock* ref = block->getReference();
- GroupBlock* group = AB_TO_GRP(block->getParent());
+ ReferenceBlock* ref = block->getReference();
// adding to the graph
FunctionalBlock* newBlock = createSourceBlock(ref);
}
void Graph::createPatterns() throw(Exception) {
- bool ok = true;
+
foreach(AbstractBlock* block, sources) {
FunctionalBlock* funBlock = AB_TO_FUN(block);
try {
}
}
-bool Graph::computeOutputPatterns(int nbExec) {
+void Graph::computeOutputPatterns(int nbExec) throw(Exception) {
try {
createPatterns();
}
catch(Exception e) {
- cerr << qPrintable(e.getMessage()) << endl;
- return false;
+ throw(e);
}
resetPatternComputed();
topGroup->computeOutputPattern();
}
catch(Exception e) {
- cerr << qPrintable(e.getMessage()) << endl;
- return false;
+ throw(e);
}
}
class ReferenceBlock;
class FunctionalBlock;
class AbstractInterface;
+#include "Exception.h"
class Exception;
using namespace std;
using namespace Qt;
// methods for group blocks
GroupBlock* createChildGroupBlock(GroupBlock* parent);
- bool removeGroupBlock(GroupBlock *group);
+ void removeGroupBlock(GroupBlock *group);
GroupBlock* getGroupBlockByName(QString name);
// methods for functional blocks
*/
void createPatterns() throw(Exception);
void resetPatternComputed();
- bool computeOutputPatterns(int nbExec);
+ void computeOutputPatterns(int nbExec) throw(Exception);
private:
cout << "computing output pattern of group " << qPrintable(name) << endl;
- bool canCompute = false;
- bool compatible = false;
+ bool canCompute = false;
// get the input pattern on each inputs
createInputPattern();
catch(Exception e) {
cout << qPrintable(block->getName()) << " is not compatible with his input pattern" << endl;
throw(e);
- }
- compatible = true;
+ }
try {
block->computeOutputPattern();
msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
- int ret = msgBox.exec();
+ msgBox.exec();
}
}
}
void MainWindow::slotGraphValidation() {
- params->getGraph()->computeOutputPatterns(5);
- //params->parametersValidation();
+ try {
+ params->getGraph()->computeOutputPatterns(5);
+ }
+ catch(Exception e) {
+ cerr << qPrintable(e.getMessage()) << endl;
+ }
}
void MainWindow::addTopGroup(GroupWidget *_topGroup) {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.2.1, 2017-05-22T16:26:54. -->
+<!-- Written by QtCreator 3.2.1, 2017-05-23T17:26:50. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
- <value type="QByteArray">{eddbf04f-e5ee-4f36-bc65-6ab7f2b6d4ec}</value>
+ <value type="QByteArray">{3701e197-5b6c-48ea-9e98-a6cf6de18672}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{72d0832a-d73b-473a-b29c-d1c0737451fe}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ed04208c-8774-456b-99b9-4a02094ca7a4}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>