From: stephane Domas Date: Tue, 23 May 2017 15:27:17 +0000 (+0200) Subject: corrected some warnings X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/cf93fd850a8b6e9a6f40faed9f796a0e2fb0cedb?ds=inline;hp=7b1c7e44123b9b2626205a89e27b2a4712ea30c6 corrected some warnings --- diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index 49a937c..bdf342d 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -169,7 +169,7 @@ QString AbstractInterface::getTypeString() { int AbstractInterface::typeFromString(const QString &_type) { - int ret; + int ret = Expression; // default type if (_type == "expression") { ret = Expression; } diff --git a/BoxItem.cpp b/BoxItem.cpp index c473e6f..53d56ec 100644 --- a/BoxItem.cpp +++ b/BoxItem.cpp @@ -280,6 +280,15 @@ void BoxItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { } 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; diff --git a/Dispatcher.cpp b/Dispatcher.cpp index ee72743..1df7ded 100644 --- a/Dispatcher.cpp +++ b/Dispatcher.cpp @@ -84,9 +84,7 @@ void Dispatcher::closeCurrentProject() { 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; @@ -833,8 +831,7 @@ void Dispatcher::removeBoxItem(BoxItem *item) { 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); } diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index e7239e0..534625d 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -127,7 +127,6 @@ void FunctionalBlock::createPatterns() throw(Exception) { cout << "create patterns for block " << qPrintable(name) << endl; if (evaluator == NULL) evaluator = new ArithmeticEvaluator(); - bool ok = true; if (! isGeneratorBlock()) { try { createDelta(); @@ -159,8 +158,7 @@ void FunctionalBlock::createDelta() throw(Exception) { return; } - // look for parameter names - bool ok = true; + // look for parameter names double result = 0; try { result = evaluateExpression(deltaStr); @@ -178,8 +176,7 @@ void FunctionalBlock::createConsumptionPattern() throw(Exception) { cout << "call to " << qPrintable(fctName) << endl; #endif - lengthCP = -1; - bool ok = true; + lengthCP = -1; QHash consPattern = implementation->getConsumptionPattern(); foreach(AbstractInterface* iface, getControlInputs()) { @@ -476,8 +473,7 @@ void FunctionalBlock::createAdmittance(int nbExec) throw(Exception) { static QString fctName = "FunctionalBlock::createAdmittance()"; #ifdef DEBUG_FCTNAME cout << "call to " << qPrintable(fctName) << endl; -#endif - bool ok = true; +#endif // firstly, copy CP in AP QMapIterator* > iterC(consumptionPattern); while (iterC.hasNext()) { @@ -553,8 +549,7 @@ void FunctionalBlock::checkInputPatternCompatibility() throw(Exception) { #ifdef DEBUG_FCTNAME cout << "call to " << qPrintable(fctName) << endl; #endif - - bool ok = true; + // firstly, create input pattern try { createInputPattern(); diff --git a/Graph.cpp b/Graph.cpp index 0fb4fcb..4b24181 100644 --- a/Graph.cpp +++ b/Graph.cpp @@ -2,7 +2,6 @@ #include "GroupBlock.h" #include "ReferenceBlock.h" #include "FunctionalBlock.h" -#include "Exception.h" Graph::Graph() { topGroup = new GroupBlock(NULL); @@ -25,7 +24,7 @@ GroupBlock* Graph::createChildGroupBlock(GroupBlock* parent) { return b; } -bool Graph::removeGroupBlock(GroupBlock *group) { +void Graph::removeGroupBlock(GroupBlock *group) { group->removeAllBlocks(); GroupBlock* parent = AB_TO_GRP(group->getParent()); parent->removeBlock(group); @@ -89,8 +88,7 @@ FunctionalBlock* Graph::createSourceBlock(ReferenceBlock* ref) { 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); @@ -110,7 +108,7 @@ bool Graph::removeSourceBlock(FunctionalBlock *block) { } void Graph::createPatterns() throw(Exception) { - bool ok = true; + foreach(AbstractBlock* block, sources) { FunctionalBlock* funBlock = AB_TO_FUN(block); try { @@ -150,14 +148,13 @@ void Graph::resetPatternComputed() { } } -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(); @@ -189,7 +186,6 @@ bool Graph::computeOutputPatterns(int nbExec) { topGroup->computeOutputPattern(); } catch(Exception e) { - cerr << qPrintable(e.getMessage()) << endl; - return false; + throw(e); } } diff --git a/Graph.h b/Graph.h index 03d1882..b9c598a 100644 --- a/Graph.h +++ b/Graph.h @@ -10,6 +10,7 @@ class GroupBlock; class ReferenceBlock; class FunctionalBlock; class AbstractInterface; +#include "Exception.h" class Exception; using namespace std; using namespace Qt; @@ -27,7 +28,7 @@ public: // methods for group blocks GroupBlock* createChildGroupBlock(GroupBlock* parent); - bool removeGroupBlock(GroupBlock *group); + void removeGroupBlock(GroupBlock *group); GroupBlock* getGroupBlockByName(QString name); // methods for functional blocks @@ -52,7 +53,7 @@ public: */ void createPatterns() throw(Exception); void resetPatternComputed(); - bool computeOutputPatterns(int nbExec); + void computeOutputPatterns(int nbExec) throw(Exception); private: diff --git a/GroupBlock.cpp b/GroupBlock.cpp index b6fc702..62fd6ec 100644 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@ -125,8 +125,7 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { 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(); @@ -170,8 +169,7 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { catch(Exception e) { cout << qPrintable(block->getName()) << " is not compatible with his input pattern" << endl; throw(e); - } - compatible = true; + } try { block->computeOutputPattern(); diff --git a/MainWindow.cpp b/MainWindow.cpp index 877e9ac..e772425 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -280,7 +280,7 @@ void MainWindow::slotLoadProject(){ msgBox.setStandardButtons(QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); - int ret = msgBox.exec(); + msgBox.exec(); } } } @@ -373,8 +373,12 @@ void MainWindow::slotOpenBlockLibrary() { 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) { diff --git a/blast.creator.user b/blast.creator.user index aea89f7..0f7c253 100755 --- a/blast.creator.user +++ b/blast.creator.user @@ -1,10 +1,10 @@ - + EnvironmentId - {eddbf04f-e5ee-4f36-bc65-6ab7f2b6d4ec} + {3701e197-5b6c-48ea-9e98-a6cf6de18672} ProjectExplorer.Project.ActiveTarget @@ -60,7 +60,7 @@ Desktop Desktop - {72d0832a-d73b-473a-b29c-d1c0737451fe} + {ed04208c-8774-456b-99b9-4a02094ca7a4} 0 0 0