From fe7acbc38970c6e6f2de2383d48d706f736ce556 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 12 Apr 2010 11:21:41 +0000 Subject: [PATCH] * ./crlcore: - Change: In ToolEngine, adds a static method "destroyAll()" that must be called *before* the Hurricane database destruction. This is to avoid a mis-oredering in destruction. ToolEngines are stored in a property, property are part of the DBo base object so are destroyed *after* the Cell derived object has been. Thus ToolEngine are deleted *after* the Cell components and if they still refers to it, we are doomed. - Change: In display.xml, color support for displaying references. --- crlcore/etc/display.xml | 94 ++++++++++++++------------ crlcore/src/ccore/ToolEngine.cpp | 47 ++++++++++--- crlcore/src/ccore/crlcore/ToolEngine.h | 3 + 3 files changed, 90 insertions(+), 54 deletions(-) diff --git a/crlcore/etc/display.xml b/crlcore/etc/display.xml index 0bbef9a0..b93b5e41 100644 --- a/crlcore/etc/display.xml +++ b/crlcore/etc/display.xml @@ -25,21 +25,22 @@ 11110111 --> - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -109,21 +110,22 @@ Alliance Standard Look - black background 3.0 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -176,17 +178,18 @@ Alliance Standard Look - white background 3.0 - - - - - - - - - - - + + + + + + + + + + + + @@ -237,10 +240,11 @@ Useful for debugging layout - white background 3.0 - - - - + + + + + diff --git a/crlcore/src/ccore/ToolEngine.cpp b/crlcore/src/ccore/ToolEngine.cpp index a921ce62..a0f73d19 100644 --- a/crlcore/src/ccore/ToolEngine.cpp +++ b/crlcore/src/ccore/ToolEngine.cpp @@ -26,6 +26,8 @@ namespace { using std::cerr; using std::endl; using std::string; + using std::set; + using std::vector; using Hurricane::ForEachIterator; using Hurricane::_TName; using Hurricane::Error; @@ -47,6 +49,7 @@ namespace { public: // Static Methods. static ToolEnginesRelation* getToolEnginesRelation ( const Cell* cell ); + static void destroyAllToolEnginesRelations (); // Constructor. static ToolEnginesRelation* create ( Cell* masterOwner ); // Methods. @@ -57,19 +60,23 @@ namespace { inline unsigned int updateRoutingModificationFlag (); virtual string _getTypeName () const; virtual Record* _getRecord () const; - private: - // Internal: Attributes - unsigned int _placementModificationFlag; - unsigned int _routingModificationFlag; - // Internal: Constructor. ToolEnginesRelation ( Cell* masterOwner ); protected: virtual void _preDestroy (); + + private: + // Internal: Attributes + static set _toolEnginesRelations; + unsigned int _placementModificationFlag; + unsigned int _routingModificationFlag; }; + set ToolEnginesRelation::_toolEnginesRelations; + + ToolEnginesRelation::ToolEnginesRelation ( Cell* masterOwner ) : Relation (masterOwner) , _placementModificationFlag(0) @@ -82,6 +89,7 @@ namespace { ToolEnginesRelation* enginesRelation = new ToolEnginesRelation(masterOwner); enginesRelation->_postCreate(); + _toolEnginesRelations.insert ( enginesRelation ); return enginesRelation; } @@ -149,6 +157,22 @@ namespace { } + void ToolEnginesRelation::destroyAllToolEnginesRelations () + { + set::iterator irelation = _toolEnginesRelations.begin(); + for ( ; irelation != _toolEnginesRelations.end() ; ++irelation ) { + vector tools; + forEach ( ToolEngine*, itool, (*irelation)->getSlaveOwners().getSubSet() ) + tools.push_back ( *itool ); + + for ( size_t i=0 ; idestroy (); + } + } + _toolEnginesRelations.clear (); + } + + } // End of anonymous namespace. @@ -201,6 +225,12 @@ namespace CRL { } + void ToolEngine::destroyAll () + { + ToolEnginesRelation::destroyAllToolEnginesRelations (); + } + + string ToolEngine::_getTypeName () const { return _TName ( "ToolEngine" ); @@ -300,10 +330,9 @@ namespace CRL { return NULL; else { - for_each_toolengine(toolengine, relation->getSlaveOwners().getSubSet()) { - if (toolengine->getName() == name) - return toolengine; - end_for; + forEach ( ToolEngine*, itool, relation->getSlaveOwners().getSubSet()) { + if (itool->getName() == name) + return *itool; } return NULL; } diff --git a/crlcore/src/ccore/crlcore/ToolEngine.h b/crlcore/src/ccore/crlcore/ToolEngine.h index 6401e4c2..2ff76614 100644 --- a/crlcore/src/ccore/crlcore/ToolEngine.h +++ b/crlcore/src/ccore/crlcore/ToolEngine.h @@ -29,6 +29,7 @@ #include +#include #include "hurricane/Commons.h" #include "hurricane/DBo.h" @@ -46,6 +47,7 @@ namespace CRL { using std::string; + using std::vector; using Hurricane::Record; using Hurricane::Name; using Hurricane::DBo; @@ -61,6 +63,7 @@ namespace CRL { // Static Methods. static ToolEngines get ( const Cell* cell ); static ToolEngine* get ( const Cell* cell, const Name& name ); + static void destroyAll (); // Methods. virtual const Name& getName () const = 0; inline Cell* getCell () const;