From b8e5f9073a351e70a548dc90c742ee52898f1661 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 23 Feb 2009 16:07:09 +0000 Subject: [PATCH] * ./hurricane : - Bug: destructor of Technology was destroying some Layers twice. Destruction of Layer was done by a loop over a multimap<> that could contains more than one entry of a Layer... Now using a loop over the IntrusiveMap. - Change: Reorganization of NetExternalComponents property, all functions are now static functions members as the property name. --- hurricane/src/hurricane/DataBase.cpp | 2 ++ hurricane/src/hurricane/Layer.cpp | 4 ++-- hurricane/src/hurricane/NetExternalComponents.cpp | 13 ++++++------- hurricane/src/hurricane/Technology.cpp | 7 +++++-- .../src/hurricane/hurricane/NetExternalComponents.h | 13 +++++++++---- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/hurricane/src/hurricane/DataBase.cpp b/hurricane/src/hurricane/DataBase.cpp index abbbadde..64e9c818 100644 --- a/hurricane/src/hurricane/DataBase.cpp +++ b/hurricane/src/hurricane/DataBase.cpp @@ -53,6 +53,8 @@ void DataBase::_postCreate() void DataBase::_preDestroy() // ************************ { + cerr << "DataBase::_preDestroy()" << endl; + UpdateSession::open(); Inherit::_preDestroy(); diff --git a/hurricane/src/hurricane/Layer.cpp b/hurricane/src/hurricane/Layer.cpp index b348c771..62712475 100644 --- a/hurricane/src/hurricane/Layer.cpp +++ b/hurricane/src/hurricane/Layer.cpp @@ -202,10 +202,10 @@ namespace Hurricane { void Layer::_preDestroy () { - DBo::_preDestroy(); - _technology->_getLayerMaskMap().erase(_mask); _technology->_getLayerMap()._remove(this); + + DBo::_preDestroy (); } diff --git a/hurricane/src/hurricane/NetExternalComponents.cpp b/hurricane/src/hurricane/NetExternalComponents.cpp index 2c00288e..5657019f 100644 --- a/hurricane/src/hurricane/NetExternalComponents.cpp +++ b/hurricane/src/hurricane/NetExternalComponents.cpp @@ -9,17 +9,16 @@ // **************************************************************************************************** #include "hurricane/Error.h" -#include "hurricane/Relation.h" #include "hurricane/Net.h" #include "hurricane/NetExternalComponents.h" namespace Hurricane { -static Name ExternalComponentsRelationName("ExternalComponentsRelation"); + const Name NetExternalComponents::_name = "ExternalComponentsRelation"; -static StandardRelation* getExternalComponentsRelation(const Net* net) { - Property* property = net->getProperty(ExternalComponentsRelationName); + StandardRelation* NetExternalComponents::getRelation(const Net* net) { + Property* property = net->getProperty(_name); if (!property) { return NULL; } else { @@ -35,7 +34,7 @@ Components NetExternalComponents::get(const Net* net) { throw Error("Impossible to retrieve external components on non external net " + net->getName()._getString()); - StandardRelation* externalComponentsRelation = getExternalComponentsRelation(net); + StandardRelation* externalComponentsRelation = getRelation(net); if (!externalComponentsRelation) return Components(); return externalComponentsRelation->getSlaveOwners().getSubSet(); @@ -46,9 +45,9 @@ void NetExternalComponents::setExternal(Component* component) { if (!net->isExternal()) throw Error("Impossible to set as external a component member of non external net " + net->getName()._getString()); - StandardRelation* externalComponentsRelation = getExternalComponentsRelation(net); + StandardRelation* externalComponentsRelation = getRelation(net); if (!externalComponentsRelation) - externalComponentsRelation = StandardRelation::create(net, ExternalComponentsRelationName); + externalComponentsRelation = StandardRelation::create(net, _name); component->put(externalComponentsRelation); } diff --git a/hurricane/src/hurricane/Technology.cpp b/hurricane/src/hurricane/Technology.cpp index 4835b235..ebbab660 100644 --- a/hurricane/src/hurricane/Technology.cpp +++ b/hurricane/src/hurricane/Technology.cpp @@ -311,11 +311,14 @@ void Technology::_postCreate() void Technology::_preDestroy() // ************************** { - Inherit::_preDestroy(); - for_each_layer(layer, getLayers()) layer->destroy(); end_for; + while ( !_layerMap.isEmpty() ) { + _layerMap.getElements().getFirst()->destroy(); + } + //for_each_layer(layer, getLayers()) layer->destroy(); end_for; _dataBase->_setTechnology(NULL); + DBo::_preDestroy(); } void Technology::_insertInLayerMaskMap ( Layer* layer ) diff --git a/hurricane/src/hurricane/hurricane/NetExternalComponents.h b/hurricane/src/hurricane/hurricane/NetExternalComponents.h index 7dc8435d..63e5197b 100644 --- a/hurricane/src/hurricane/hurricane/NetExternalComponents.h +++ b/hurricane/src/hurricane/hurricane/NetExternalComponents.h @@ -12,14 +12,19 @@ #define HURRICANE_NET_EXTERNAL_COMPONENTS #include "hurricane/Component.h" +#include "hurricane/Relation.h" namespace Hurricane { -class NetExternalComponents { + class NetExternalComponents { public: - static Components get(const Net* net); - static void setExternal(Component* component); -}; + static Components get ( const Net* ); + static void setExternal ( Component* ); + protected: + static StandardRelation* getRelation ( const Net* ); + private: + static const Name _name; + }; } // End of Hurricane namespace.