X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/3fb762e7042d9b4a1cf78556ad9ed7f117cc53ba..4327c2b8817b627249d98d889835726217c81a4e:/Parameters.cpp?ds=inline diff --git a/Parameters.cpp b/Parameters.cpp index d7621d2..23b798f 100644 --- a/Parameters.cpp +++ b/Parameters.cpp @@ -78,6 +78,7 @@ Graph* Parameters::initGraph(bool createTopGroupIfaces) { void Parameters::destroyGraph() { delete graph; + graph = new Graph(); } ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) { @@ -97,71 +98,6 @@ ReferenceBlock* Parameters::getHiddenReferenceBlock(QString blockName) { return ref; } -double Parameters::getFeedingClockFrequency(AbstractInterface *iface) { - - int idClock = 0; - - if (iface->isReferenceInterface()) return 0.0; - - if (iface->getClockIfaceType() == AbstractInterface::ParameterName) { - BlockParameter* param = iface->getOwner()->getParameterFromName(iface->getClockIfaceString()); - if (!param->isUserParameter()) return 0.0; - bool ok; - double freq = param->getDoubleValue(&ok); - if (!ok) { - cerr << "Abnormal case: cannot retrieve clock id from parameter " << qPrintable(param->getName()) << endl; - } - return freq; - } - else if ( (iface->getClockIfaceType() == AbstractInterface::ClockName) || ((iface->getDirection() == AbstractInterface::Input) && (iface->getPurpose() == AbstractInterface::Clock))) { - - // if iface is not clock, retrieve the clock related to it - if (iface->getClockIfaceType() == AbstractInterface::ClockName) { - iface = iface->getClockIface(); - } - // if iface is a group interface, then iface name is ext_clk_X, thus extract the X - if (iface->isGroupInterface()) { - QString name = iface->getName(); - name.remove(0,8); - bool ok; - idClock = name.toInt(&ok); - if (!ok) { - cerr << "Abnormal case: cannot retrieve clock id from iface name " << qPrintable(iface->getName()) << endl; - return 0.0; - } - } - // if iface is a functional interface, it is connected to clkrstgen_X (in top group) or to ext_clk_X (in subgroup) - else if (iface->isFunctionalInterface()) { - FunctionalInterface* funIface = AI_TO_FUN(iface); - ConnectedInterface* connFrom = funIface->getConnectedFrom(); - if (connFrom == NULL) { - cerr << "Abnormal case: input clock " << qPrintable(iface->getName()) << " is not connected" << endl; - return 0.0; - } - if (iface->getOwner()->isTopGroupBlock()) { - QString name = connFrom->getOwner()->getName(); - name.remove(0,10); - bool ok; - idClock = name.toInt(&ok); - if (!ok) { - cerr << "Abnormal case: cannot retrieve clock id for " << qPrintable(iface->getName()) << endl; - return 0.0; - } - } - else { - QString name = connFrom->getName(); - name.remove(0,8); - bool ok; - idClock = name.toInt(&ok); - if (!ok) { - cerr << "Abnormal case: cannot retrieve clock id for " << qPrintable(iface->getName()) << endl; - return 0.0; - } - } - } - } - return graph->getClock(idClock); -} void Parameters::createDelayBlock() { delayRef = new ReferenceBlock("no.xml"); @@ -340,6 +276,14 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); if (idUpperScene == -1) { + QString clkList = currentSceneNode.attribute("clklist","none"); + if (clkList == "none") throw(Exception(PROJECTFILE_CORRUPTED)); + QStringList clks = clkList.split(","); + for(int j=0;jaddClock(freq); + } topGroup = dispatcher->createTopScene(Dispatcher::Load); topScene->setId(idScene); groupItem = topScene->getGroupItem(); @@ -525,12 +469,16 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { int to = currentConnectionNode.attribute("to","none").toInt(&ok); if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); - + bool showConn = true; + QString visStr = currentConnectionNode.attribute("visible","none"); + if (visStr == "false") { + showConn = false; + } InterfaceItem *iface1 = searchInterfaceItemById(from,topScene); InterfaceItem *iface2 = searchInterfaceItemById(to,topScene); if(iface1 != NULL && iface2 != NULL){ - dispatcher->createConnection(Dispatcher::Load, iface1,iface2); + dispatcher->createConnection(Dispatcher::Load, iface1,iface2,showConn); } else { cout << "interfaces not found, connect canceled!" << endl; } @@ -1238,7 +1186,9 @@ void Parameters::save(QString confFile) { writer.writeAttribute("from",QString::number(item->getFromInterfaceItem()->getId())); writer.writeAttribute("to", QString::number(item->getToInterfaceItem()->getId())); - + if (!item->isVisible()) { + writer.writeAttribute("visible","false"); + } writer.writeEndElement(); }