From: Stéphane Domas Date: Wed, 3 May 2017 09:18:41 +0000 (+0200) Subject: removed leve attr. from interfaces X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/43fd94117de66d533ef9e58b2de85daa244da309?ds=sidebyside;hp=d43174d0eb3d293b3bb5fbe76662241134e74d0d removed leve attr. from interfaces --- diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index 25cd2d3..e651f58 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -8,23 +8,18 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) { name = ""; width = "1"; direction = Input; - purpose = Data; - level = Basic; + purpose = Data; type = Boolean; } -AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level) { +AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose) { owner = _owner; name = _name; width = _width; direction = _direction; purpose = _purpose; - level = _level; - if (direction == InOut) { - level = Top; - } type = typeFromString(_type); } @@ -35,7 +30,6 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) { width = other->width; direction = other->direction; purpose = other->purpose; - level = other->level; } AbstractInterface::~AbstractInterface() { @@ -89,19 +83,6 @@ QString AbstractInterface::getDirectionString() { return str; } -QString AbstractInterface::getLevelString() { - QString str; - switch(level){ - case AbstractInterface::Basic: - str = QString("basic"); - break; - case AbstractInterface::Top: - str = QString("top"); - break; - } - return str; -} - double AbstractInterface::getDoubleWidth() throw(QException) { static QString fctName = "AbstractInterface::getDoubleWidth()"; @@ -143,36 +124,16 @@ void AbstractInterface::setDirection(int _direction) { if ((_direction > Input) && (_direction <= InOut)) { direction = _direction; } - if (direction == InOut) { - level = Top; - } -} - -void AbstractInterface::setLevel(int _level) { - if ((_level >= Basic) << (_level < Top)) { - level = _level; - } - if (direction == InOut) { - level = Top; - } } - -int AbstractInterface::getIntDirection(QString str) -{ +int AbstractInterface::getIntDirection(QString str) { if(str == "input") return Input; if(str == "output") return Output; if(str == "inOut") return InOut; return -1; } -int AbstractInterface::getIntLevel(QString str) -{ - if(str == "basic") return Basic; - if(str == "top") return Top; - return -1; -} QString AbstractInterface::getTypeString() { diff --git a/AbstractInterface.h b/AbstractInterface.h index 78414c3..608d04c 100644 --- a/AbstractInterface.h +++ b/AbstractInterface.h @@ -25,16 +25,14 @@ public : enum IfaceWidthType { Expression = 1, Boolean, Natural}; enum IfacePurpose { Data = 1, Clock = 2, Reset = 3, Wishbone = 4 }; - enum IfaceDirection { Input = 1, Output = 2, InOut = 3 }; - enum IfaceLevel { Basic = 1, Top = 2 }; + enum IfaceDirection { Input = 1, Output = 2, InOut = 3 }; enum IfaceVHDLContext { Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface enum IfaceVHDLFlags { NoComma = 1 }; - static int getIntDirection(QString str); - static int getIntLevel(QString str); + static int getIntDirection(QString str); AbstractInterface(AbstractBlock* _owner); - AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level); + AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose); AbstractInterface(AbstractInterface* other); virtual ~AbstractInterface(); @@ -46,9 +44,7 @@ public : inline int getPurpose() { return purpose;} QString getPurposeString(); inline int getDirection() { return direction;} - QString getDirectionString(); - inline int getLevel() { return level;} - QString getLevelString(); + QString getDirectionString(); inline AbstractBlock *getOwner() { return owner;} double getDoubleWidth() throw(QException); @@ -67,8 +63,7 @@ public : inline void setType(int _type) { type = _type;} inline void setType(const QString& _type) { type = typeFromString(_type);} void setPurpose(int _purpose); - void setDirection(int _direction); - void setLevel(int _level); + void setDirection(int _direction); // testers virtual bool isReferenceInterface(); @@ -98,7 +93,6 @@ protected: QString width; int purpose; int direction; - int level; AbstractBlock* owner; }; diff --git a/ConnectedInterface.cpp b/ConnectedInterface.cpp index fbfa785..69a484b 100644 --- a/ConnectedInterface.cpp +++ b/ConnectedInterface.cpp @@ -8,7 +8,7 @@ ConnectedInterface::ConnectedInterface(AbstractBlock* _owner) : AbstractInterfac connectedFrom = NULL; } -ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose, _level) { +ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose) { connectedFrom = NULL; } diff --git a/ConnectedInterface.h b/ConnectedInterface.h index 968a00a..a8ce4de 100644 --- a/ConnectedInterface.h +++ b/ConnectedInterface.h @@ -20,7 +20,7 @@ class ConnectedInterface : public AbstractInterface { public : ConnectedInterface(AbstractBlock* _owner); - ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level); + ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose); // getters inline QList getConnectedTo() { return connectedTo;} inline ConnectedInterface* getConnectedFrom() { return connectedFrom;} diff --git a/Dispatcher.cpp b/Dispatcher.cpp index bbeb841..73577b2 100644 --- a/Dispatcher.cpp +++ b/Dispatcher.cpp @@ -807,7 +807,7 @@ void Dispatcher::connectInterToGroup(InterfaceItem *item){ GroupItem *parentItem = item->getOwner()->getScene()->getGroupItem(); // creating/adding the group interface in the graph model - GroupInterface *groupInter = new GroupInterface(parentBlock,refInter->getName()+"_group",refInter->getDirection(),refInter->getLevel()); + GroupInterface *groupInter = new GroupInterface(parentBlock,refInter->getName()+"_group",refInter->getDirection()); groupInter->setType(refInter->getType()); groupInter->setWidth(refInter->getWidth()); groupInter->setPurpose(refInter->getPurpose()); diff --git a/FunctionalInterface.cpp b/FunctionalInterface.cpp index bce7ca1..1b8ff07 100644 --- a/FunctionalInterface.cpp +++ b/FunctionalInterface.cpp @@ -19,8 +19,7 @@ FunctionalInterface::FunctionalInterface(AbstractBlock* _owner, ReferenceInterfa name = reference->getName(); width = reference->getWidth(); direction = reference->getDirection(); - purpose = reference->getPurpose(); - level = reference->getLevel(); + purpose = reference->getPurpose(); connectedFrom = NULL; } @@ -79,8 +78,7 @@ AbstractInterface *FunctionalInterface::clone() { FunctionalInterface *inter = new FunctionalInterface(owner, reference); inter->setWidth(width); inter->setDirection(direction); - inter->setPurpose(purpose); - inter->setLevel(level); + inter->setPurpose(purpose); inter->connectFrom(NULL); inter->setName(reference->getName()+"_"+QString::number(id+1)); return inter; diff --git a/GroupInterface.cpp b/GroupInterface.cpp index 14f8b43..1c10bff 100644 --- a/GroupInterface.cpp +++ b/GroupInterface.cpp @@ -2,18 +2,9 @@ #include "FunctionalInterface.h" #include "GroupBlock.h" -GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _level) throw(Exception) : ConnectedInterface(_owner,_name,"expression","",_direction,AbstractInterface::Data,_level) { +GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction) throw(Exception) : ConnectedInterface(_owner,_name,"expression","",_direction,AbstractInterface::Data) { if (! _owner->isGroupBlock()) throw(Exception(BLOCK_INVALID_TYPE)); - /* If the owner group is the top group, then all its interfaces are at top level => force them to be top. - If not, force them to be basic - */ - if (((GroupBlock*)_owner)->isTop()) { - level = AbstractInterface::Top; - } - else { - level = AbstractInterface::Basic; - } connectedFrom = NULL; } @@ -22,11 +13,10 @@ bool GroupInterface::isGroupInterface() { } AbstractInterface *GroupInterface::clone() { - GroupInterface *inter = new GroupInterface(owner,name,direction,level); + GroupInterface *inter = new GroupInterface(owner,name,direction); inter->setWidth(width); inter->setDirection(direction); - inter->setPurpose(purpose); - inter->setLevel(level); + inter->setPurpose(purpose); inter->connectFrom(NULL); return inter; diff --git a/GroupInterface.h b/GroupInterface.h index 2a22dc7..d487ebc 100644 --- a/GroupInterface.h +++ b/GroupInterface.h @@ -34,7 +34,7 @@ using namespace Qt; class GroupInterface : public ConnectedInterface { public : - GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _level = AbstractInterface::Basic) throw (Exception); + GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction) throw (Exception); // getters diff --git a/GroupItem.cpp b/GroupItem.cpp index 69b5e04..679cc5e 100644 --- a/GroupItem.cpp +++ b/GroupItem.cpp @@ -636,10 +636,6 @@ void GroupItem::load(QDomElement groupElement) throw(Exception) { QString name = currentInterfaceNode.attribute("name","none"); if(name == "none") throw(Exception(PROJECTFILE_CORRUPTED)); - QString levelStr = currentInterfaceNode.attribute("level","none"); - int level = AbstractInterface::getIntLevel(levelStr); - if(level == -1) throw(Exception(PROJECTFILE_CORRUPTED)); - QString directionStr = currentInterfaceNode.attribute("direction","none"); int direction = AbstractInterface::getIntDirection(directionStr); if(direction == -1) throw(Exception(PROJECTFILE_CORRUPTED)); @@ -651,7 +647,7 @@ void GroupItem::load(QDomElement groupElement) throw(Exception) { double position = currentInterfaceNode.attribute("position","none").toDouble(&ok); if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); - GroupInterface *groupInterface = new GroupInterface(groupBlock,name,direction,level); + GroupInterface *groupInterface = new GroupInterface(groupBlock,name,direction); InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupInterface,this,params); interfaceItem->setId(id); @@ -691,8 +687,7 @@ void GroupItem::save(QXmlStreamWriter &writer) { writer.writeStartElement("group_iface"); writer.writeAttribute("id",QString::number(item->getId())); - writer.writeAttribute("name",item->getName()); - writer.writeAttribute("level",QString(item->refInter->getLevelString())); + writer.writeAttribute("name",item->getName()); writer.writeAttribute("direction",QString(item->refInter->getDirectionString())); writer.writeAttribute("orientation",item->getStrOrientation()); writer.writeAttribute("position",QString::number(item->getPositionRatio())); diff --git a/InterfaceItem.cpp b/InterfaceItem.cpp index 0e87a19..7c384d2 100644 --- a/InterfaceItem.cpp +++ b/InterfaceItem.cpp @@ -85,11 +85,8 @@ void InterfaceItem::paint(QPainter *painter) { if(selected) { painter->setPen(QPen(Qt::red,2)); - } - else if(refInter->getLevel() == AbstractInterface::Basic) { - painter->setPen(QPen(Qt::darkCyan,1)); - } - else if(refInter->getLevel() == AbstractInterface::Top) { + } + else { painter->setPen(QPen(Qt::black,1)); } diff --git a/InterfacePropertiesWindow.cpp b/InterfacePropertiesWindow.cpp index 2200bf6..419b33e 100644 --- a/InterfacePropertiesWindow.cpp +++ b/InterfacePropertiesWindow.cpp @@ -20,10 +20,7 @@ InterfacePropertiesWindow::InterfacePropertiesWindow(InterfaceItem *_inter, QWid layout->addWidget(new QLabel("Direction :"), 4, 0); layout->addWidget(new QLabel(inter->refInter->getDirectionString()), 4, 1); layout->addWidget(new QLabel("Purpose :"), 5, 0); - layout->addWidget(new QLabel(inter->refInter->getPurposeString()), 5, 1); - layout->addWidget(new QLabel("Level :"), 6, 0); - layout->addWidget(new QLabel(inter->refInter->getLevelString()), 6, 1); - + layout->addWidget(new QLabel(inter->refInter->getPurposeString()), 5, 1); this->setLayout(layout); show(); diff --git a/ReferenceBlock.cpp b/ReferenceBlock.cpp index 8b50bfa..93f7c41 100644 --- a/ReferenceBlock.cpp +++ b/ReferenceBlock.cpp @@ -204,8 +204,6 @@ void ReferenceBlock::loadInterfaces(QDomElement &elt) throw(Exception) { QString widthStr; QString purposeStr; int purpose; - QString levelStr; - int level; QString multStr; int mult; AbstractInterface* inter; @@ -225,12 +223,10 @@ void ReferenceBlock::loadInterfaces(QDomElement &elt) throw(Exception) { cout << "purpose for " << nameStr.toStdString() << " : " << purposeStr.toStdString() << endl; purpose = ReferenceInterface::translatePurpose(purposeStr); cout << "translated purpose : " << purpose << endl; - levelStr = eltInput.attribute("level","none"); - level = ReferenceInterface::translateLevel(levelStr); multStr = eltInput.attribute("multiplicity","none"); mult = ReferenceInterface::translateMultiplicity(multStr); - inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Input, purpose, level, mult); + inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Input, purpose, mult); inputs.append(inter); } @@ -244,12 +240,10 @@ void ReferenceBlock::loadInterfaces(QDomElement &elt) throw(Exception) { widthStr = eltOutput.attribute("width","none"); purposeStr = eltOutput.attribute("type","none"); purpose = ReferenceInterface::translatePurpose(purposeStr); - levelStr = eltOutput.attribute("level","none"); - level = ReferenceInterface::translateLevel(levelStr); multStr = eltOutput.attribute("multiplicity","none"); mult = ReferenceInterface::translateMultiplicity(multStr); - inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Output, purpose, level, mult); + inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Output, purpose, mult); outputs.append(inter); } @@ -263,12 +257,10 @@ void ReferenceBlock::loadInterfaces(QDomElement &elt) throw(Exception) { widthStr = eltBidir.attribute("width","none"); purposeStr = eltBidir.attribute("type","none"); purpose = ReferenceInterface::translatePurpose(purposeStr); - levelStr = eltBidir.attribute("level","none"); - level = ReferenceInterface::translateLevel(levelStr); multStr = eltBidir.attribute("multiplicity","none"); mult = ReferenceInterface::translateMultiplicity(multStr); - inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::InOut, purpose, level, mult); + inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::InOut, purpose, mult); bidirs.append(inter); } } @@ -323,8 +315,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getName(); toWrite << iface->getWidth(); toWrite << iface->getPurpose(); - toWrite << iface->getDirection(); - toWrite << iface->getLevel(); + toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); } toWrite << b.outputs.size(); @@ -333,8 +324,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getName(); toWrite << iface->getWidth(); toWrite << iface->getPurpose(); - toWrite << iface->getDirection(); - toWrite << iface->getLevel(); + toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); } toWrite << b.bidirs.size(); @@ -343,8 +333,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getName(); toWrite << iface->getWidth(); toWrite << iface->getPurpose(); - toWrite << iface->getDirection(); - toWrite << iface->getLevel(); + toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); } @@ -421,9 +410,7 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) { in >> val; iface->setPurpose(val); in >> val; - iface->setDirection(val); - in >> val; - iface->setLevel(val); + iface->setDirection(val); in >> val; iface->setMultiplicity(val); b.inputs.append(iface); @@ -441,9 +428,7 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) { iface->setPurpose(val); in >> val; iface->setDirection(val); - in >> val; - iface->setLevel(val); - in >> val; + in >> val; iface->setMultiplicity(val); b.outputs.append(iface); } @@ -460,9 +445,7 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) { iface->setPurpose(val); in >> val; iface->setDirection(val); - in >> val; - iface->setLevel(val); - in >> val; + in >> val; iface->setMultiplicity(val); b.bidirs.append(iface); } diff --git a/ReferenceInterface.cpp b/ReferenceInterface.cpp index 8aca132..faa51e8 100644 --- a/ReferenceInterface.cpp +++ b/ReferenceInterface.cpp @@ -11,9 +11,8 @@ ReferenceInterface::ReferenceInterface(AbstractBlock* _owner, const QString& _width, int _direction, int _purpose, - int _level, int _multiplicity) -throw (Exception) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose, _level) { +throw (Exception) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose) { if (_owner->isReferenceBlock()) throw(Exception(BLOCK_INVALID_TYPE)); @@ -49,14 +48,6 @@ int ReferenceInterface::translatePurpose(const QString& txt) { return Data; } -int ReferenceInterface::translateLevel(const QString& txt) { - - if (txt == "top") { - return Top; - } - return Basic; -} - int ReferenceInterface::translateMultiplicity(const QString& txt) { bool ok; int mult; diff --git a/ReferenceInterface.h b/ReferenceInterface.h index cd5bd0f..9ea4b23 100644 --- a/ReferenceInterface.h +++ b/ReferenceInterface.h @@ -19,7 +19,7 @@ class ReferenceInterface : public AbstractInterface { public : ReferenceInterface(AbstractBlock *_owner) throw(Exception); - ReferenceInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level, int _multiplicity=1) throw (Exception); + ReferenceInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _multiplicity=1) throw (Exception); // getters inline int getMultiplicity() { return multiplicity; } @@ -32,8 +32,7 @@ public : // others - static int translatePurpose(const QString& txt); - static int translateLevel(const QString& txt); + static int translatePurpose(const QString& txt); static int translateMultiplicity(const QString& txt); inline AbstractInterface *clone(){ return NULL; } diff --git a/blastconfig.xml b/blastconfig.xml index a8184b8..43677e4 100644 --- a/blastconfig.xml +++ b/blastconfig.xml @@ -9,13 +9,13 @@ - - - + + + - - + + diff --git a/block.xsd b/block.xsd index 42c82ef..a5c2c2d 100644 --- a/block.xsd +++ b/block.xsd @@ -18,7 +18,6 @@ - @@ -32,7 +31,6 @@ - diff --git a/lib/README.txt b/lib/README.txt index 9ca12b8..225b83e 100644 --- a/lib/README.txt +++ b/lib/README.txt @@ -14,14 +14,12 @@ XML description of a block model : - name : required - width : required - purpose : optional. Possible values : clock, reset, wb, data, ... Default value is data - - level : optional. Possible values : basic, top, ... Default value is basic - multiplicity : optional. Possible values : *, a number. Default value is 1. attributes : - name : required - width : required - purpose : optional but forced to data - - level : optional but forced to top - multiplicity : optional. Possible values : *, a number. Default value is 1. If an interface has a multiplicity > 1, the user will be able to create several instances of that interface. Their default name will be the reference name diff --git a/lib/implementations/impls.bmf b/lib/implementations/impls.bmf index b544d25..b447cd0 100644 Binary files a/lib/implementations/impls.bmf and b/lib/implementations/impls.bmf differ diff --git a/lib/references/apf27-wb-master.xml b/lib/references/apf27-wb-master.xml index 82ee08a..97300cd 100644 --- a/lib/references/apf27-wb-master.xml +++ b/lib/references/apf27-wb-master.xml @@ -23,10 +23,10 @@ - - - - + + + + @@ -39,7 +39,7 @@ - + diff --git a/lib/references/demux.xml b/lib/references/demux.xml index cd66442..ec2e982 100644 --- a/lib/references/demux.xml +++ b/lib/references/demux.xml @@ -25,7 +25,7 @@ - + diff --git a/lib/references/references.bmf b/lib/references/references.bmf index 6685627..4f6c352 100644 Binary files a/lib/references/references.bmf and b/lib/references/references.bmf differ diff --git a/projectfile.xsd b/projectfile.xsd index e5693dc..f898ca2 100644 --- a/projectfile.xsd +++ b/projectfile.xsd @@ -16,7 +16,6 @@ - @@ -164,7 +163,6 @@ - diff --git a/testproject.xml b/testproject.xml index f482cfd..fbff37b 100644 --- a/testproject.xml +++ b/testproject.xml @@ -6,10 +6,10 @@ - - - - + + + + @@ -42,10 +42,10 @@ - - - - + + + +