* ./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.
This commit is contained in:
Jean-Paul Chaput 2009-02-23 16:07:09 +00:00
parent d877893e75
commit b8e5f9073a
5 changed files with 24 additions and 15 deletions

View File

@ -53,6 +53,8 @@ void DataBase::_postCreate()
void DataBase::_preDestroy() void DataBase::_preDestroy()
// ************************ // ************************
{ {
cerr << "DataBase::_preDestroy()" << endl;
UpdateSession::open(); UpdateSession::open();
Inherit::_preDestroy(); Inherit::_preDestroy();

View File

@ -202,10 +202,10 @@ namespace Hurricane {
void Layer::_preDestroy () void Layer::_preDestroy ()
{ {
DBo::_preDestroy();
_technology->_getLayerMaskMap().erase(_mask); _technology->_getLayerMaskMap().erase(_mask);
_technology->_getLayerMap()._remove(this); _technology->_getLayerMap()._remove(this);
DBo::_preDestroy ();
} }

View File

@ -9,17 +9,16 @@
// **************************************************************************************************** // ****************************************************************************************************
#include "hurricane/Error.h" #include "hurricane/Error.h"
#include "hurricane/Relation.h"
#include "hurricane/Net.h" #include "hurricane/Net.h"
#include "hurricane/NetExternalComponents.h" #include "hurricane/NetExternalComponents.h"
namespace Hurricane { namespace Hurricane {
static Name ExternalComponentsRelationName("ExternalComponentsRelation"); const Name NetExternalComponents::_name = "ExternalComponentsRelation";
static StandardRelation* getExternalComponentsRelation(const Net* net) { StandardRelation* NetExternalComponents::getRelation(const Net* net) {
Property* property = net->getProperty(ExternalComponentsRelationName); Property* property = net->getProperty(_name);
if (!property) { if (!property) {
return NULL; return NULL;
} else { } else {
@ -35,7 +34,7 @@ Components NetExternalComponents::get(const Net* net) {
throw Error("Impossible to retrieve external components on non external net " throw Error("Impossible to retrieve external components on non external net "
+ net->getName()._getString()); + net->getName()._getString());
StandardRelation* externalComponentsRelation = getExternalComponentsRelation(net); StandardRelation* externalComponentsRelation = getRelation(net);
if (!externalComponentsRelation) if (!externalComponentsRelation)
return Components(); return Components();
return externalComponentsRelation->getSlaveOwners().getSubSet<Component*>(); return externalComponentsRelation->getSlaveOwners().getSubSet<Component*>();
@ -46,9 +45,9 @@ void NetExternalComponents::setExternal(Component* component) {
if (!net->isExternal()) if (!net->isExternal())
throw Error("Impossible to set as external a component member of non external net " throw Error("Impossible to set as external a component member of non external net "
+ net->getName()._getString()); + net->getName()._getString());
StandardRelation* externalComponentsRelation = getExternalComponentsRelation(net); StandardRelation* externalComponentsRelation = getRelation(net);
if (!externalComponentsRelation) if (!externalComponentsRelation)
externalComponentsRelation = StandardRelation::create(net, ExternalComponentsRelationName); externalComponentsRelation = StandardRelation::create(net, _name);
component->put(externalComponentsRelation); component->put(externalComponentsRelation);
} }

View File

@ -311,11 +311,14 @@ void Technology::_postCreate()
void Technology::_preDestroy() 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); _dataBase->_setTechnology(NULL);
DBo::_preDestroy();
} }
void Technology::_insertInLayerMaskMap ( Layer* layer ) void Technology::_insertInLayerMaskMap ( Layer* layer )

View File

@ -12,13 +12,18 @@
#define HURRICANE_NET_EXTERNAL_COMPONENTS #define HURRICANE_NET_EXTERNAL_COMPONENTS
#include "hurricane/Component.h" #include "hurricane/Component.h"
#include "hurricane/Relation.h"
namespace Hurricane { namespace Hurricane {
class NetExternalComponents { class NetExternalComponents {
public: public:
static Components get(const Net* net); static Components get ( const Net* );
static void setExternal(Component* component); static void setExternal ( Component* );
protected:
static StandardRelation* getRelation ( const Net* );
private:
static const Name _name;
}; };
} // End of Hurricane namespace. } // End of Hurricane namespace.