X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..dd3fe103df79a5a4c2962e2f05fec9a9ed58580d:/AbstractInterface.cpp diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index 25cd2d3..dde5930 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -8,24 +8,21 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) { name = ""; width = "1"; direction = Input; - purpose = Data; - level = Basic; + purpose = Data; type = Boolean; + associatedIface = NULL; } -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); + associatedIface = NULL; } AbstractInterface::AbstractInterface(AbstractInterface* other) { @@ -35,7 +32,7 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) { width = other->width; direction = other->direction; purpose = other->purpose; - level = other->level; + associatedIface = NULL; } AbstractInterface::~AbstractInterface() { @@ -89,19 +86,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 +127,24 @@ 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; - } +bool AbstractInterface::setAssociatedIface(AbstractInterface* iface) { + if (purpose != Control) return false; + if (iface->purpose != Data) return false; + associatedIface = iface; + iface->associatedIface = this; + return true; } - -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() {