From 48b0e4c3c638284389828f9f9050fe83aa0ba10d Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 7 Oct 2008 15:01:32 +0000 Subject: [PATCH] * ./hurricane/src/hurricane/ExtensionSlice.h ./hurricane/src/hurricane/ExtensionSlice.cpp ./hurricane/src/hurricane/ExtensionGo.h ./hurricane/src/hurricane/ExtensionGo.cpp : - New : support for user-based Gos & Slices. A normal slice is a couple (Layer,QuadTree) while a ExtensionSlice is a couple (Name,Quadtree). Note that for efficiency ExtensionSlices also uses a mask bitmap. This new feature implies modifications of the Cell QuadTrees and the Query callback/class. CellWidget & Palette also updated to allow the drawing of thoses new slices. * ./coriolis/src/crlcore/src/cyclop/DemoGo.{h,cpp} : - Example : how to construct & uses an ExtensionGo (draw a thick red box around the Cell's abutment box). --- hurricane/src/hurricane/CMakeLists.txt | 8 +- hurricane/src/hurricane/Cell.cpp | 54 +- hurricane/src/hurricane/CellCollections.cpp | 630 +++++++++++++++++- hurricane/src/hurricane/ExtensionGo.cpp | 100 +++ hurricane/src/hurricane/ExtensionSlice.cpp | 122 ++++ hurricane/src/hurricane/Query.cpp | 24 +- hurricane/src/hurricane/UserGo.cpp | 294 -------- hurricane/src/hurricane/hurricane/Cell.h | 15 + hurricane/src/hurricane/hurricane/Commons.h | 28 +- .../src/hurricane/hurricane/ExtensionGo.h | 65 ++ .../src/hurricane/hurricane/ExtensionGos.h | 47 ++ .../src/hurricane/hurricane/ExtensionSlice.h | 94 +++ .../src/hurricane/hurricane/ExtensionSlices.h | 47 ++ .../src/hurricane/hurricane/MapCollection.h | 30 +- hurricane/src/hurricane/hurricane/Query.h | 66 +- hurricane/src/hurricane/hurricane/UserGo.h | 59 -- hurricane/src/hurricane/hurricane/UserGos.h | 61 -- hurricane/src/hviewer/CMakeLists.txt | 2 + hurricane/src/hviewer/CellWidget.cpp | 76 ++- hurricane/src/hviewer/GroupPaletteEntry.cpp | 16 +- .../src/hviewer/HExtensionPaletteEntry.cpp | 119 ++++ hurricane/src/hviewer/HPalette.cpp | 120 ++-- hurricane/src/hviewer/LayerPaletteEntry.cpp | 6 + hurricane/src/hviewer/ViewerPaletteEntry.cpp | 6 + .../src/hviewer/hurricane/viewer/CellWidget.h | 100 ++- .../hurricane/viewer/GroupPaletteEntry.h | 12 +- .../hurricane/viewer/HExtensionPaletteEntry.h | 77 +++ .../src/hviewer/hurricane/viewer/HPalette.h | 20 +- .../hviewer/hurricane/viewer/HPaletteEntry.h | 15 +- .../hurricane/viewer/LayerPaletteEntry.h | 9 +- .../hurricane/viewer/ViewerPaletteEntry.h | 1 + 31 files changed, 1731 insertions(+), 592 deletions(-) create mode 100644 hurricane/src/hurricane/ExtensionGo.cpp create mode 100644 hurricane/src/hurricane/ExtensionSlice.cpp delete mode 100644 hurricane/src/hurricane/UserGo.cpp create mode 100644 hurricane/src/hurricane/hurricane/ExtensionGo.h create mode 100644 hurricane/src/hurricane/hurricane/ExtensionGos.h create mode 100644 hurricane/src/hurricane/hurricane/ExtensionSlice.h create mode 100644 hurricane/src/hurricane/hurricane/ExtensionSlices.h delete mode 100644 hurricane/src/hurricane/hurricane/UserGo.h delete mode 100644 hurricane/src/hurricane/hurricane/UserGos.h create mode 100644 hurricane/src/hviewer/HExtensionPaletteEntry.cpp create mode 100644 hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h diff --git a/hurricane/src/hurricane/CMakeLists.txt b/hurricane/src/hurricane/CMakeLists.txt index c7d32d07..20798e15 100644 --- a/hurricane/src/hurricane/CMakeLists.txt +++ b/hurricane/src/hurricane/CMakeLists.txt @@ -16,13 +16,13 @@ hurricane/DataBase.h hurricane/DBo.h hurricane/DBos.h hurricane/DeepNet.h - hurricane/DisplaySlot.h hurricane/DisplaySlots.h hurricane/DRCError.h hurricane/Entities.h hurricane/Entity.h hurricane/Error.h hurricane/Exception.h hurricane/Filter.h hurricane/Go.h hurricane/Gos.h + hurricane/ExtensionGo.h hurricane/ExtensionGos.h hurricane/Hook.h hurricane/Hooks.h hurricane/Horizontal.h hurricane/Horizontals.h hurricane/HyperNet.h @@ -64,6 +64,7 @@ hurricane/SharedName.h hurricane/SharedPathes.h hurricane/SharedPath.h hurricane/Slice.h hurricane/Slices.h + hurricane/ExtensionSlice.h hurricane/ExtensionSlices.h hurricane/SlotAdapter.h hurricane/Slot.h hurricane/Symbols.h @@ -73,7 +74,6 @@ hurricane/Transformation.h hurricane/DbU.h hurricane/UpdateSession.h - hurricane/UserGo.h hurricane/UserGos.h hurricane/VectorCollection.h hurricane/Vertical.h hurricane/Verticals.h hurricane/Views.h @@ -112,7 +112,7 @@ DeepNet.cpp HyperNet.cpp Go.cpp - UserGo.cpp + ExtensionGo.cpp Hook.cpp Instance.cpp Component.cpp @@ -136,10 +136,10 @@ Occurrence.cpp QuadTree.cpp Slice.cpp + ExtensionSlice.cpp UpdateSession.cpp Region.cpp Query.cpp - DisplaySlot.cpp Marker.cpp Timer.cpp ) diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 75748a03..59704c1b 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -21,6 +21,50 @@ namespace Hurricane { + + void Cell::_insertSlice ( ExtensionSlice* slice ) + { + ExtensionSliceMap::iterator islice = _extensionSlices.find ( slice->getName() ); + if ( islice != _extensionSlices.end() ) + throw Error ( "Attempt to re-create ExtensionSlice %s in Cell %s." + , getString(slice->getName()).c_str() + , getString(slice->getCell()->getName()).c_str() + ); + + _extensionSlices.insert ( pair(slice->getName(),slice) ); + } + + + void Cell::_removeSlice ( ExtensionSlice* slice ) + { + ExtensionSliceMap::iterator islice = _extensionSlices.find ( slice->getName() ); + if ( islice != _extensionSlices.end() ) { + islice->second->_destroy (); + _extensionSlices.erase ( islice ); + } + } + + + ExtensionSlice* Cell::getExtensionSlice ( const Name& name ) const + { + ExtensionSliceMap::const_iterator islice = _extensionSlices.find ( name ); + if ( islice != _extensionSlices.end() ) + return islice->second; + + return NULL; + } + + + ExtensionSlice::Mask Cell::getExtensionSliceMask ( const Name& name ) const + { + ExtensionSliceMap::const_iterator islice = _extensionSlices.find ( name ); + if ( islice != _extensionSlices.end() ) + return islice->second->getMask(); + + return 0; + } + + // **************************************************************************************************** // Cell implementation // **************************************************************************************************** @@ -35,6 +79,7 @@ Cell::Cell(Library* library, const Name& name) _slaveInstanceSet(), _netMap(), _sliceMap(), + _extensionSlices(), _markerSet(), //_viewSet(), _abutmentBox(), @@ -215,16 +260,14 @@ void Cell::unmaterialize() void Cell::_postCreate() // ********************* { - _library->_getCellMap()._insert(this); - Inherit::_postCreate(); + + _library->_getCellMap()._insert(this); } void Cell::_preDestroy() // ******************** { - Inherit::_preDestroy(); - while(_slaveEntityMap.size()) { _slaveEntityMap.begin()->second->destroy(); } @@ -235,8 +278,11 @@ void Cell::_preDestroy() for_each_instance(instance, getInstances()) instance->destroy(); end_for; for_each_net(net, getNets()) net->destroy(); end_for; for_each_slice(slice, getSlices()) slice->_destroy(); end_for; + while(!_extensionSlices.empty()) _removeSlice(_extensionSlices.begin()->second); _library->_getCellMap()._remove(this); + + Inherit::_preDestroy(); } string Cell::_getString() const diff --git a/hurricane/src/hurricane/CellCollections.cpp b/hurricane/src/hurricane/CellCollections.cpp index d777a4d0..c67c541f 100644 --- a/hurricane/src/hurricane/CellCollections.cpp +++ b/hurricane/src/hurricane/CellCollections.cpp @@ -229,6 +229,604 @@ class Cell_ComponentsUnder : public Collection { }; +// ------------------------------------------------------------------- +// Class : "Hurricane::Cell::Cell_ExtensionSlices". + + + class Cell_ExtensionSlices : public Collection { + + public: + class Locator : public Hurricane::Locator { + public: + Locator (); + Locator ( const Cell* , ExtensionSlice::Mask mask=~0 ); + Locator ( const Locator& ); + Locator& operator= ( const Locator& ); + virtual ExtensionSlice* getElement () const; + virtual Hurricane::Locator* + getClone () const; + virtual bool isValid () const; + virtual void progress (); + virtual string _getString () const; + private: + const Cell* _cell; + ExtensionSlice::Mask _mask; + ExtensionSliceLocator _sliceLocator; + + }; + + private: + const Cell* _cell; + ExtensionSlice::Mask _mask; + + public: + Cell_ExtensionSlices (); + Cell_ExtensionSlices ( const Cell* , ExtensionSlice::Mask mask=~0 ); + Cell_ExtensionSlices ( const Cell_ExtensionSlices& ); + Cell_ExtensionSlices& operator= ( const Cell_ExtensionSlices& ); + virtual Collection* getClone () const; + virtual Hurricane::Locator* getLocator() const; + virtual string _getString () const; + + }; + + + Cell_ExtensionSlices::Cell_ExtensionSlices () + : Collection() + , _cell(NULL) + , _mask(0) + { } + + + Cell_ExtensionSlices::Cell_ExtensionSlices ( const Cell* cell, ExtensionSlice::Mask mask ) + : Collection() + , _cell(cell) + , _mask(mask) + { } + + + Cell_ExtensionSlices::Cell_ExtensionSlices ( const Cell_ExtensionSlices& slices ) + : Collection() + , _cell(slices._cell) + , _mask(slices._mask) + { } + + + Cell_ExtensionSlices& Cell_ExtensionSlices::operator= ( const Cell_ExtensionSlices& slices ) + { + _cell = slices._cell; + _mask = slices._mask; + return *this; + } + + + Collection* Cell_ExtensionSlices::getClone () const + { + return new Cell_ExtensionSlices(*this); + } + + + Locator* Cell_ExtensionSlices::getLocator () const + { + return new Locator(_cell,_mask); + } + + + string Cell_ExtensionSlices::_getString () const + { + string s = "<" + _TName("Cell::ExtensionSlices"); + if (_cell) { + s += " " + getString(_cell); + //s += " " + getString(_mask); + } + s += ">"; + return s; + } + + + Cell_ExtensionSlices::Locator::Locator() + : Hurricane::Locator() + , _cell(NULL) + , _mask(0) + , _sliceLocator() + { } + + + Cell_ExtensionSlices::Locator::Locator ( const Cell* cell, ExtensionSlice::Mask mask ) + : Hurricane::Locator() + , _cell(cell) + , _mask(mask) + , _sliceLocator() + { + if (_cell && (_mask != 0)) { + _sliceLocator = getCollection(_cell->getExtensionSliceMap()).getLocator(); + while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask() & _mask)) + _sliceLocator.progress(); + } + } + + + Cell_ExtensionSlices::Locator::Locator ( const Locator& locator ) + : Hurricane::Locator() + , _cell(locator._cell) + , _mask(locator._mask) + , _sliceLocator(locator._sliceLocator) + { } + + + Cell_ExtensionSlices::Locator& Cell_ExtensionSlices::Locator::operator= ( const Locator& locator ) + { + _cell = locator._cell; + _mask = locator._mask; + _sliceLocator = locator._sliceLocator; + return *this; + } + + + ExtensionSlice* Cell_ExtensionSlices::Locator::getElement () const + { + return _sliceLocator.getElement(); + } + + + Locator* Cell_ExtensionSlices::Locator::getClone () const + { + return new Locator(*this); + } + + + bool Cell_ExtensionSlices::Locator::isValid () const + { + return _sliceLocator.isValid(); + } + + + void Cell_ExtensionSlices::Locator::progress () + { + if (_sliceLocator.isValid()) { + do { + _sliceLocator.progress(); + } + while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask() & _mask)); + } + } + + + string Cell_ExtensionSlices::Locator::_getString () const + { + string s = "<" + _TName("Cell::ExtensionSlices::Locator"); + if (_cell) { + s += " " + getString(_cell); + //s += " " + getString(_mask); + } + s += ">"; + return s; + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::Cell::Cell_ExtensionGos". + + + class Cell_ExtensionGos : public Collection { + + public: + class Locator : public Hurricane::Locator { + + public: + Locator (); + Locator ( const Cell* , ExtensionSlice::Mask mask=~0 ); + Locator ( const Locator& ); + Locator& operator= ( const Locator& ); + virtual Go* getElement () const; + virtual Hurricane::Locator* getClone () const; + virtual bool isValid () const; + virtual void progress (); + virtual string _getString () const; + private: + const Cell* _cell; + ExtensionSlice::Mask _mask; + ExtensionSliceLocator _sliceLocator; + GoLocator _goLocator; + Go* _go; + }; + + public: + Cell_ExtensionGos (); + Cell_ExtensionGos ( const Cell* , ExtensionSlice::Mask mask=~0 ); + Cell_ExtensionGos ( const Cell_ExtensionGos& ); + Cell_ExtensionGos& operator= ( const Cell_ExtensionGos& ); + virtual Collection* getClone () const; + virtual Hurricane::Locator* getLocator () const; + virtual string _getString () const; + private: + const Cell* _cell; + ExtensionSlice::Mask _mask; + }; + + + Cell_ExtensionGos::Cell_ExtensionGos () + : Collection() + , _cell(NULL) + , _mask(0) + { } + + + Cell_ExtensionGos::Cell_ExtensionGos ( const Cell* cell + , ExtensionSlice::Mask mask + ) + : Collection() + , _cell(cell) + , _mask(mask) + { } + + + Cell_ExtensionGos::Cell_ExtensionGos ( const Cell_ExtensionGos& gos ) + : Collection() + , _cell(gos._cell) + , _mask(gos._mask) + { } + + + Cell_ExtensionGos& Cell_ExtensionGos::operator= ( const Cell_ExtensionGos& gos ) + { + _cell = gos._cell; + _mask = gos._mask; + return *this; + } + + + Collection* Cell_ExtensionGos::getClone () const + { + return new Cell_ExtensionGos(*this); + } + + + Locator* Cell_ExtensionGos::getLocator () const + { + return new Locator(_cell,_mask); + } + + + string Cell_ExtensionGos::_getString () const + { + string s = "<" + _TName("Cell::ExtensionGos"); + if (_cell) { + s += " " + getString(_cell); + //s += " " + getString(_mask); + } + s += ">"; + return s; + } + + + Cell_ExtensionGos::Locator::Locator() + : Hurricane::Locator() + , _cell(NULL) + , _mask(0) + , _sliceLocator() + , _goLocator() + , _go(NULL) + { } + + + Cell_ExtensionGos::Locator::Locator ( const Cell* cell + , ExtensionSlice::Mask mask + ) + : Hurricane::Locator() + , _cell(cell) + , _mask(mask) + , _sliceLocator() + , _goLocator() + , _go(NULL) + { + if (_cell) { + _sliceLocator = _cell->getExtensionSlices(_mask).getLocator(); + while (!_go && _sliceLocator.isValid()) { + ExtensionSlice* slice = _sliceLocator.getElement(); + if (slice) { + _goLocator = slice->getGos().getLocator(); + if (_goLocator.isValid()) + _go = _goLocator.getElement(); + } + if (!_go) _sliceLocator.progress(); + } + } + } + + + Cell_ExtensionGos::Locator::Locator ( const Locator& locator ) + : Hurricane::Locator() + , _cell(locator._cell) + , _mask(locator._mask) + , _sliceLocator(locator._sliceLocator) + , _goLocator(locator._goLocator) + , _go(locator._go) + { } + + + Cell_ExtensionGos::Locator& Cell_ExtensionGos::Locator::operator= ( const Locator& locator ) + { + _cell = locator._cell; + _mask = locator._mask; + _sliceLocator = locator._sliceLocator; + _goLocator = locator._goLocator; + _go = locator._go; + return *this; + } + + + Go* Cell_ExtensionGos::Locator::getElement () const + { + return _go; + } + + + Locator* Cell_ExtensionGos::Locator::getClone () const + { + return new Locator(*this); + } + + + bool Cell_ExtensionGos::Locator::isValid () const + { + return (_go != NULL); + } + + + + void Cell_ExtensionGos::Locator::progress() + { + if (_go) { + _go = NULL; + _goLocator.progress(); + if (_goLocator.isValid()) + _go = _goLocator.getElement(); + else { + do { + _sliceLocator.progress(); + ExtensionSlice* slice = _sliceLocator.getElement(); + if (slice) { + _goLocator = slice->getGos().getLocator(); + if (_goLocator.isValid()) + _go = _goLocator.getElement(); + } + } while (!_go && _sliceLocator.isValid()); + } + } + } + + + string Cell_ExtensionGos::Locator::_getString () const + { + string s = "<" + _TName("Cell::ExtensionGos::Locator"); + if (_cell) { + s += " " + getString(_cell); + //s += " " + getString(_mask); + } + s += ">"; + return s; + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::Cell::Cell_ExtensionGosUnder". + + + class Cell_ExtensionGosUnder : public Collection { + + public: + class Locator : public Hurricane::Locator { + + public: + Locator (); + Locator ( const Cell* , const Box& , ExtensionSlice::Mask mask=~0 ); + Locator ( const Locator& ); + Locator& operator= ( const Locator& ); + virtual Go* getElement () const; + virtual Hurricane::Locator* getClone () const; + virtual bool isValid () const; + virtual void progress (); + virtual string _getString () const; + private: + const Cell* _cell; + Box _area; + ExtensionSlice::Mask _mask; + ExtensionSliceLocator _sliceLocator; + GoLocator _goLocator; + Go* _go; + }; + + public: + Cell_ExtensionGosUnder (); + Cell_ExtensionGosUnder ( const Cell* , const Box& , ExtensionSlice::Mask mask=~0 ); + Cell_ExtensionGosUnder ( const Cell_ExtensionGosUnder& ); + Cell_ExtensionGosUnder& operator= ( const Cell_ExtensionGosUnder& ); + virtual Collection* getClone () const; + virtual Hurricane::Locator* getLocator () const; + virtual string _getString () const; + private: + const Cell* _cell; + Box _area; + ExtensionSlice::Mask _mask; + }; + + + Cell_ExtensionGosUnder::Cell_ExtensionGosUnder () + : Collection() + , _cell(NULL) + , _area() + , _mask(0) + { } + + + Cell_ExtensionGosUnder::Cell_ExtensionGosUnder ( const Cell* cell + , const Box& area + , ExtensionSlice::Mask mask + ) + : Collection() + , _cell(cell) + , _area(area) + , _mask(mask) + { } + + + Cell_ExtensionGosUnder::Cell_ExtensionGosUnder ( const Cell_ExtensionGosUnder& gos ) + : Collection() + , _cell(gos._cell) + , _area(gos._area) + , _mask(gos._mask) + { } + + + Cell_ExtensionGosUnder& Cell_ExtensionGosUnder::operator= ( const Cell_ExtensionGosUnder& gos ) + { + _cell = gos._cell; + _area = gos._area; + _mask = gos._mask; + return *this; + } + + + Collection* Cell_ExtensionGosUnder::getClone () const + { + return new Cell_ExtensionGosUnder(*this); + } + + + Locator* Cell_ExtensionGosUnder::getLocator () const + { + return new Locator(_cell,_area,_mask); + } + + + string Cell_ExtensionGosUnder::_getString () const + { + string s = "<" + _TName("Cell::ExtensionGosUnder"); + if (_cell) { + s += " " + getString(_cell); + s += " " + getString(_area); + //s += " " + getString(_mask); + } + s += ">"; + return s; + } + + + Cell_ExtensionGosUnder::Locator::Locator() + : Hurricane::Locator() + , _cell(NULL) + , _area() + , _mask(0) + , _sliceLocator() + , _goLocator() + , _go(NULL) + { } + + + Cell_ExtensionGosUnder::Locator::Locator ( const Cell* cell + , const Box& area + , ExtensionSlice::Mask mask + ) + : Hurricane::Locator() + , _cell(cell) + , _area(area) + , _mask(mask) + , _sliceLocator() + , _goLocator() + , _go(NULL) + { + if (_cell && !_area.isEmpty()) { + _sliceLocator = _cell->getExtensionSlices(_mask).getLocator(); + while (!_go && _sliceLocator.isValid()) { + ExtensionSlice* slice = _sliceLocator.getElement(); + if (slice) { + _goLocator = slice->getGosUnder(_area).getLocator(); + if (_goLocator.isValid()) + _go = _goLocator.getElement(); + } + if (!_go) _sliceLocator.progress(); + } + } + } + + + Cell_ExtensionGosUnder::Locator::Locator ( const Locator& locator ) + : Hurricane::Locator() + , _cell(locator._cell) + , _area(locator._area) + , _mask(locator._mask) + , _sliceLocator(locator._sliceLocator) + , _goLocator(locator._goLocator) + , _go(locator._go) + { } + + + Cell_ExtensionGosUnder::Locator& Cell_ExtensionGosUnder::Locator::operator= ( const Locator& locator ) + { + _cell = locator._cell; + _area = locator._area; + _mask = locator._mask; + _sliceLocator = locator._sliceLocator; + _goLocator = locator._goLocator; + _go = locator._go; + return *this; + } + + + Go* Cell_ExtensionGosUnder::Locator::getElement () const + { + return _go; + } + + + Locator* Cell_ExtensionGosUnder::Locator::getClone () const + { + return new Locator(*this); + } + + + bool Cell_ExtensionGosUnder::Locator::isValid () const + { + return (_go != NULL); + } + + + + void Cell_ExtensionGosUnder::Locator::progress() + { + if (_go) { + _go = NULL; + _goLocator.progress(); + if (_goLocator.isValid()) + _go = _goLocator.getElement(); + else { + do { + _sliceLocator.progress(); + ExtensionSlice* slice = _sliceLocator.getElement(); + if (slice) { + _goLocator = slice->getGosUnder(_area).getLocator(); + if (_goLocator.isValid()) + _go = _goLocator.getElement(); + } + } while (!_go && _sliceLocator.isValid()); + } + } + } + + + string Cell_ExtensionGosUnder::Locator::_getString () const + { + string s = "<" + _TName("Cell::ExtensionGosUnder::Locator"); + if (_cell) { + s += " " + getString(_cell); + s += " " + getString(_area); + //s += " " + getString(_mask); + } + s += ">"; + return s; + } + // **************************************************************************************************** // Cell_Occurrences implementation @@ -1249,6 +1847,12 @@ Slices Cell::getSlices(const Layer::Mask& mask) const return Cell_Slices(this, mask); } +ExtensionSlices Cell::getExtensionSlices(ExtensionSlice::Mask mask) const +// ************************************************************* +{ + return Cell_ExtensionSlices(this,mask); +} + //MainViews Cell::getMainViews() const //// ********************************* //{ @@ -1362,11 +1966,35 @@ Pathes Cell::getRecursiveSlavePathes() const } Occurrences Cell::getHyperNetRootNetOccurrences() const -// ********************************* +// **************************************************** { return Cell_HyperNetRootNetOccurrences(this,Path()); } +Gos Cell::getExtensionGos ( const Name& name ) const +// ********************************************************** +{ + return Cell_ExtensionGos(this,getExtensionSliceMask(name)); +} + +Gos Cell::getExtensionGos ( ExtensionSlice::Mask mask ) const +// **************************************************************** +{ + return Cell_ExtensionGos(this,mask); +} + +Gos Cell::getExtensionGosUnder ( const Box& area, const Name& name ) const +// ******************************************************************************** +{ + return Cell_ExtensionGosUnder(this,area,getExtensionSliceMask(name)); +} + +Gos Cell::getExtensionGosUnder ( const Box& area, ExtensionSlice::Mask mask ) const +// ************************************************************************************** +{ + return Cell_ExtensionGosUnder(this,area,mask); +} + // **************************************************************************************************** // Cell_Slices implementation // **************************************************************************************************** diff --git a/hurricane/src/hurricane/ExtensionGo.cpp b/hurricane/src/hurricane/ExtensionGo.cpp new file mode 100644 index 00000000..cb3c77d0 --- /dev/null +++ b/hurricane/src/hurricane/ExtensionGo.cpp @@ -0,0 +1,100 @@ + +// -*- C++ -*- +// +// This file is part of the Hurricane Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./ExtensionGo.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include "hurricane/Error.h" +#include "hurricane/Warning.h" +#include "hurricane/Cell.h" +#include "hurricane/ExtensionGo.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "Hurricane::ExtensionGo". + + + ExtensionGo::ExtensionGo ( Cell* cell ) + : Go() + , _cell(cell) + { } + + + void ExtensionGo::materialize () + { + if ( !isMaterialized() ) { + if ( _cell ) { + ExtensionSlice* slice = _cell->getExtensionSlice ( getName() ); + if ( !slice ) slice = ExtensionSlice::_create ( _cell, getName() ); + QuadTree* quadTree = slice->_getQuadTree (); + quadTree->insert ( this ); + _cell->_fit ( quadTree->getBoundingBox() ); + } else { + cerr << Warning("%s not inserted into QuadTree.",getString(this).c_str()) << endl; + } + } + } + + + void ExtensionGo::unmaterialize () + { + if ( isMaterialized() ) { + ExtensionSlice* slice = _cell->getExtensionSlice ( getName() ); + if ( slice ) { + _cell->_unfit ( getBoundingBox() ); + slice->_getQuadTree()->remove ( this ); + if ( slice->isEmpty() ) slice->_destroy (); + } + } + } + + + Cell* ExtensionGo::getCell () const + { + return _cell; + } + + + string ExtensionGo::_getTypeName () const + { + return "ExtensionGo"; + } + + + string ExtensionGo::_getString () const + { + string s = Go::_getString(); + s.insert ( s.length() - 1, " " + getString(getName()) ); + return s; + } + + + Record* ExtensionGo::_getRecord () const + { + return Go::_getRecord(); + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/ExtensionSlice.cpp b/hurricane/src/hurricane/ExtensionSlice.cpp new file mode 100644 index 00000000..265c0d38 --- /dev/null +++ b/hurricane/src/hurricane/ExtensionSlice.cpp @@ -0,0 +1,122 @@ + +// -*- C++ -*- +// +// This file is part of the Hurricane Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./ExtensionSlice.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include "hurricane/Error.h" +#include "hurricane/Cell.h" +#include "hurricane/ExtensionSlice.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "Hurricane::ExtensionSlice". + + + unsigned int ExtensionSlice::_masks = 0; + + + ExtensionSlice::ExtensionSlice ( Cell* cell, const Name& name, ExtensionSlice::Mask mask ) + : _cell(cell) + , _name(name) + , _mask(mask) + , _quadTree() + { + _cell->_insertSlice ( this ); + } + + + ExtensionSlice::~ExtensionSlice () + { + _cell->_removeSlice ( this ); + } + + + ExtensionSlice* ExtensionSlice::_create ( Cell* cell, const Name& name ) + { + if ( !cell ) + throw Error ( "ExtensionSlice::_create(): Cannot create, NULL cell argument." ); + + if ( name.isEmpty() ) + throw Error ( "ExtensionSlice::_create():\n" + " In %s, cannot create, empty name argument." + , getString(cell->getName()).c_str() + ); + + if ( cell->getExtensionSlice(name) ) + throw Error ( "ExtensionSlice::_create():\n" + " In %s, cannot create, %s already exists." + , getString(cell->getName()).c_str() + , getString(name).c_str() + ); + + if ( _masks >= sizeof(unsigned long long) ) + throw Error ( "ExtensionSlice::_create():\n" + " In %s, cannot create %s, no more free masks." + , getString(cell->getName()).c_str() + , getString(name).c_str() + ); + + ExtensionSlice* slice = new ExtensionSlice(cell,name,(1<<++_masks)); + + return slice; + } + + + void ExtensionSlice::_destroy () + { + delete this; + } + + + string ExtensionSlice::_getTypeName () const + { + return _TName("ExtensionSlice"); + } + + + string ExtensionSlice::_getString () const + { + string s = "<" + _getTypeName(); + s += " " + getString(_name); + s += ">"; + return s; + } + + + Record* ExtensionSlice::_getRecord () const + { + Record* record = new Record(getString(this)); + if (record) { + record->add(getSlot("Cell" , _cell )); + record->add(getSlot("Name" , _name )); + record->add(getSlot("Mask" , _mask )); + record->add(getSlot("QuadTree",&_quadTree)); + } + return record; + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/Query.cpp b/hurricane/src/hurricane/Query.cpp index 0d531381..e632c4d4 100644 --- a/hurricane/src/hurricane/Query.cpp +++ b/hurricane/src/hurricane/Query.cpp @@ -105,11 +105,13 @@ namespace Hurricane { , const Box& area , const Transformation& transformation , const BasicLayer* basicLayer + , ExtensionSlice::Mask mask , unsigned int filter ) { - _basicLayer = basicLayer; - _filter = filter; + _basicLayer = basicLayer; + _filter = filter; + _extensionMask = mask; _stack.setTopCell ( cell ); _stack.setTopArea ( area ); @@ -144,6 +146,18 @@ namespace Hurricane { } } + if ( hasExtensionGoCallback() && (_filter & DoExtensionGos) ) { + if ( !getMasterCell()->isTerminal() || (_filter & DoTerminalCells) ) { + forEach ( ExtensionSlice*, islice, getMasterCell()->getExtensionSlices() ) { + if ( !( (*islice)->getMask() & _extensionMask ) ) continue; + if ( !(*islice)->getBoundingBox().intersect(getArea()) ) continue; + + forEach ( Go*, igo, (*islice)->getGosUnder(_stack.getArea()) ) + extensionGoCallback ( *igo ); + } + } + } + if ( (_filter & DoMasterCells) && hasMasterCellCallback() ) masterCellCallback (); @@ -158,6 +172,12 @@ namespace Hurricane { } + bool Query::hasExtensionGoCallback () const + { + return false; + } + + bool Query::hasMasterCellCallback () const { return false; diff --git a/hurricane/src/hurricane/UserGo.cpp b/hurricane/src/hurricane/UserGo.cpp deleted file mode 100644 index e776d09f..00000000 --- a/hurricane/src/hurricane/UserGo.cpp +++ /dev/null @@ -1,294 +0,0 @@ -// **************************************************************************************************** -// -// This file is part of the Tsunami Project. -// Copyright (c) 2001-2004 Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie. -// -// File: UserGo.cpp -// Authors: C. Alexandre -// **************************************************************************************************** - -#include "hurricane/Cell.h" -#include "hurricane/UserGo.h" - -namespace Hurricane { - - -// **************************************************************************************************** -// UserGo_CellUserGos implementation -// **************************************************************************************************** - -class UserGo_CellUserGos : public Collection { -// ************************************************** - -// Types -// ***** - - public: typedef Collection Inherit; - - public: class Locator : public Hurricane::Locator { - // ******************************************************* - - public: typedef Hurricane::Locator Inherit; - - private: const Cell* _cell; - private: DisplaySlotLocator _displaySlotLocator; - private: UserGoLocator _userGoLocator; - - public: Locator(); - public: Locator(const Cell* cell); - public: Locator(const Locator& locator); - - public: Locator& operator=(const Locator& locator); - - public: virtual UserGo* getElement() const; - public: virtual Hurricane::Locator* getClone() const; - - public: virtual bool isValid() const; - - public: virtual void progress(); - - public: virtual string _getString() const; - - }; - -// Attributes -// ********** - - private: const Cell* _cell; - -// Constructors -// ************ - - public: UserGo_CellUserGos(); - public: UserGo_CellUserGos(const Cell* cell); - public: UserGo_CellUserGos(const UserGo_CellUserGos& cellusergos); - -// Operators -// ********* - - public: UserGo_CellUserGos& operator=(const UserGo_CellUserGos& usergos); - -// Accessors -// ********* - - public: virtual Collection* getClone() const; - public: virtual Hurricane::Locator* getLocator() const; - -// Others -// ****** - - public: virtual string _getString() const; - -}; - -// **************************************************************************************************** -// UserGo implementation -// **************************************************************************************************** - -UserGo::UserGo(DisplaySlot* displaySlot) -// ************************************* - : Inherit() - , _displaySlot(displaySlot) -{ - if (!_displaySlot) - throw Error("Can't Create " + _TName("UserGo") + " null displaySlot"); -} - -void UserGo::materialize() -// *********************** -{ - if (!isMaterialized()) { - QuadTree& quadTree = _displaySlot->_getQuadTree(); - quadTree.insert(this); - getCell()->_fit(quadTree.getBoundingBox()); - } -} - -void UserGo::unmaterialize() -// ************************* -{ - if (isMaterialized()) { - QuadTree& quadTree = _displaySlot->_getQuadTree(); - getCell()->_unfit(getBoundingBox()); - quadTree.remove(this); - } -} - -string UserGo::_getString() const -// ****************************** -{ - string s = Inherit::_getString(); - s.insert(s.length() - 1, " " + getString(_displaySlot->getName())); - return s; -} - -Record* UserGo::_getRecord() const -// ************************* -{ - Record* record = Inherit::_getRecord(); - if (record) { - record->add(getSlot("DisplaySlot", _displaySlot)); - } - return record; -} - -UserGos getUserGos(const Cell* cell) -// ********************************* -{ - if (!cell) - throw Error("Null pointer on cell while getting usergos"); - return UserGo_CellUserGos(cell); -} - -// **************************************************************************************************** -// UserGo_CellUserGos implementation -// **************************************************************************************************** - -UserGo_CellUserGos::UserGo_CellUserGos() -// ************************************* -: Inherit(), - _cell(NULL) -{ -} - -UserGo_CellUserGos::UserGo_CellUserGos(const Cell* cell) -// ***************************************************** -: Inherit(), - _cell(cell) -{ -} - -UserGo_CellUserGos::UserGo_CellUserGos(const UserGo_CellUserGos& usergos) -// ********************************************************************** -: Inherit(), - _cell(usergos._cell) -{ -} - -UserGo_CellUserGos& UserGo_CellUserGos::operator=(const UserGo_CellUserGos& usergos) -// ********************************************************************************* -{ - _cell = usergos._cell; - return *this; -} - -Collection* UserGo_CellUserGos::getClone() const -// ****************************************************** -{ - return new UserGo_CellUserGos(*this); -} - -Locator* UserGo_CellUserGos::getLocator() const -// ***************************************************** -{ - return new Locator(_cell); -} - -string UserGo_CellUserGos::_getString() const -// ****************************************** -{ - string s = "<" + _TName("Cell::UserGos"); - if (_cell) { - s += " " + getString(_cell); - } - s += ">"; - return s; -} - - - -// **************************************************************************************************** -// UserGo_CellUserGos::Locator implementation -// **************************************************************************************************** - -UserGo_CellUserGos::Locator::Locator() -// **************************** -: Inherit(), - _cell(NULL), - _displaySlotLocator(), - _userGoLocator() -{ -} - -UserGo_CellUserGos::Locator::Locator(const Cell* cell) -// *************************************************** -: Inherit(), - _cell(cell), - _displaySlotLocator(), - _userGoLocator() -{ - if (_cell) { - _displaySlotLocator = getDisplaySlots(cell).getLocator(); - if (_displaySlotLocator.isValid()) - { - DisplaySlot* displaySlot = _displaySlotLocator.getElement(); - _userGoLocator = displaySlot->getUserGos().getLocator(); - } - } -} - -UserGo_CellUserGos::Locator::Locator(const Locator& locator) -// ************************************************** -: Inherit(), - _cell(locator._cell), - _displaySlotLocator(locator._displaySlotLocator), - _userGoLocator(locator._userGoLocator) -{ -} - -UserGo_CellUserGos::Locator& UserGo_CellUserGos::Locator::operator=(const Locator& locator) -// **************************************************************************************** -{ - _cell = locator._cell; - _displaySlotLocator = locator._displaySlotLocator; - _userGoLocator =locator._userGoLocator; - return *this; -} - -UserGo* UserGo_CellUserGos::Locator::getElement() const -// ******************************************** -{ - return _userGoLocator.getElement(); -} - -Locator* UserGo_CellUserGos::Locator::getClone() const -// ************************************************************ -{ - return new Locator(*this); -} - -bool UserGo_CellUserGos::Locator::isValid() const -// *************************************** -{ - return _userGoLocator.isValid(); -} - -void UserGo_CellUserGos::Locator::progress() -// ***************************************** -{ - if (_userGoLocator.isValid()) { - _userGoLocator.progress(); - } - else if (_displaySlotLocator.isValid()) { - _displaySlotLocator.progress(); - if (_displaySlotLocator.isValid()) - { - DisplaySlot* displaySlot = _displaySlotLocator.getElement(); - _userGoLocator = displaySlot->getUserGos().getLocator(); - } - } -} - -string UserGo_CellUserGos::Locator::_getString() const -// ******************************************** -{ - string s = "<" + _TName("Cell::UserGos::Locator"); - if (_cell) { - s += " " + getString(_cell); - } - s += ">"; - return s; -} - -} // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/Cell.h b/hurricane/src/hurricane/hurricane/Cell.h index 162ae2bf..8efe78fc 100644 --- a/hurricane/src/hurricane/hurricane/Cell.h +++ b/hurricane/src/hurricane/hurricane/Cell.h @@ -15,6 +15,7 @@ #include "hurricane/Pin.h" #include "hurricane/Pins.h" #include "hurricane/Slices.h" +#include "hurricane/ExtensionSlice.h" #include "hurricane/Rubbers.h" #include "hurricane/Markers.h" #include "hurricane/Marker.h" @@ -26,6 +27,7 @@ #include "hurricane/QuadTree.h" #include "hurricane/IntrusiveMap.h" #include "hurricane/IntrusiveSet.h" +#include "hurricane/MapCollection.h" namespace Hurricane { @@ -51,6 +53,7 @@ class Cell : public Entity { // ***** public: typedef Entity Inherit; + public: typedef map ExtensionSliceMap; class InstanceMap : public IntrusiveMap { // **************************************************** @@ -145,6 +148,7 @@ class Cell : public Entity { private: NetMap _netMap; private: PinMap _pinMap; private: SliceMap _sliceMap; + private: ExtensionSliceMap _extensionSlices; private: MarkerSet _markerSet; private: Box _abutmentBox; private: Box _boundingBox; @@ -177,6 +181,7 @@ class Cell : public Entity { public: NetMap& _getNetMap() {return _netMap;}; public: PinMap& _getPinMap() {return _pinMap;}; public: SliceMap& _getSliceMap() {return _sliceMap;}; + public: ExtensionSliceMap& _getExtensionSliceMap() {return _extensionSlices;}; public: MarkerSet& _getMarkerSet() {return _markerSet;}; public: Cell* _getNextOfLibraryCellMap() const {return _nextOfLibraryCellMap;}; public: Cell* _getNextOfSymbolCellSet() const {return _nextOfSymbolCellSet;}; @@ -191,6 +196,8 @@ class Cell : public Entity { public: void _removeSlaveEntity(Entity* entity, Entity* slaveEntity); public: void _getSlaveEntities(SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end); public: void _getSlaveEntities(Entity* entity, SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end); + public: void _insertSlice ( ExtensionSlice* ); + public: void _removeSlice ( ExtensionSlice* ); #endif @@ -239,6 +246,9 @@ class Cell : public Entity { public: Pins getPins() const {return _pinMap.getElements();}; public: Slice* getSlice(const Layer* layer) const {return _sliceMap.getElement(layer);}; public: Slices getSlices(const Layer::Mask& mask = ~0) const; + public: const ExtensionSliceMap& getExtensionSliceMap() const { return _extensionSlices; }; + public: ExtensionSlice* getExtensionSlice(const Name& name) const; + public: ExtensionSlices getExtensionSlices(ExtensionSlice::Mask mask=~0) const; public: Rubbers getRubbers() const; public: Rubbers getRubbersUnder(const Box& area) const; public: Markers getMarkers() const {return _markerSet.getElements();}; @@ -255,6 +265,11 @@ class Cell : public Entity { public: Occurrences getComponentOccurrences(const Layer::Mask& mask = ~0) const; public: Occurrences getComponentOccurrencesUnder(const Box& area, const Layer::Mask& mask = ~0) const; public: Occurrences getHyperNetRootNetOccurrences() const; + public: ExtensionSlice::Mask getExtensionSliceMask ( const Name& name ) const; + public: Gos getExtensionGos ( const Name& name ) const; + public: Gos getExtensionGos ( ExtensionSlice::Mask mask = ~0 ) const; + public: Gos getExtensionGosUnder ( const Box& area, const Name& name ) const; + public: Gos getExtensionGosUnder ( const Box& area, ExtensionSlice::Mask mask = ~0 ) const; public: Cells getSubCells() const; public: Pathes getRecursiveSlavePathes() const; public: const Box& getAbutmentBox() const {return _abutmentBox;}; diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 245d26b7..db9bbead 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -533,24 +533,24 @@ inline Hurricane::Record* getRecord ( const std::multiset* s ) # define IOSTREAM_POINTER_SUPPORT(Data) \ - inline std::ostream& operator<< ( std::ostream& o, Data* d ) \ - { \ - if (!d) return o << "NULL"; \ - return o << "&" << getString(d); \ - } \ - inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \ - { \ - if (!d) return o << "NULL"; \ - return o << "&" << getString(d); \ + inline std::ostream& operator<< ( std::ostream& o, Data* d ) \ + { \ + if (!d) return o << "NULL"; \ + return o << "&" << getString(d); \ + } \ + inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \ + { \ + if (!d) return o << "NULL"; \ + return o << "&" << getString(d); \ } # define GETRECORD_POINTER_SUPPORT(Data) \ - template<> inline Hurricane::Record* getRecord( Data* data ) \ - { if (!data) return NULL; return data->_getRecord(); } \ - \ - template<> inline Hurricane::Record* getRecord( const Data* data ) \ - { if (!data) return NULL; return data->_getRecord(); } \ + template<> inline Hurricane::Record* getRecord( Data* data ) \ + { if (!data) return NULL; return data->_getRecord(); } \ + \ + template<> inline Hurricane::Record* getRecord( const Data* data ) \ + { if (!data) return NULL; return data->_getRecord(); } # define GETSTRING_REFERENCE_SUPPORT(Data) \ diff --git a/hurricane/src/hurricane/hurricane/ExtensionGo.h b/hurricane/src/hurricane/hurricane/ExtensionGo.h new file mode 100644 index 00000000..afb61bd3 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/ExtensionGo.h @@ -0,0 +1,65 @@ + +// -*- C++ -*- +// +// This file is part of the Hurricane Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./ExtensionGo.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_EXTENSION_GO__ +#define __HURRICANE_EXTENSION_GO__ + +#include "hurricane/Name.h" +#include "hurricane/Go.h" +#include "hurricane/ExtensionGos.h" + + +namespace Hurricane { + + + class ExtensionGo : public Go { + + public: + // Methods. + virtual void materialize (); + virtual void unmaterialize (); + virtual const Name& getName () const = 0; + virtual Cell* getCell () const; + // Hurricane Managment. + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; + + protected: + // Internal: Attributes. + Cell* _cell; + + protected: + // Internal: Constructor. + ExtensionGo ( Cell* ); + }; + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_EXTENSION_GO__ + + diff --git a/hurricane/src/hurricane/hurricane/ExtensionGos.h b/hurricane/src/hurricane/hurricane/ExtensionGos.h new file mode 100644 index 00000000..35fd6a3d --- /dev/null +++ b/hurricane/src/hurricane/hurricane/ExtensionGos.h @@ -0,0 +1,47 @@ + +// -*- C++ -*- +// +// This file is part of the Hurricane Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./ExtensionGos.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_EXTENSION_GOS__ +#define __HURRICANE_EXTENSION_GOS__ + + +#include "hurricane/Collection.h" + + +namespace Hurricane { + + + class ExtensionGo; + + + typedef GenericCollection ExtensionGos; + typedef GenericLocator ExtensionGoLocator; + typedef GenericFilter ExtensionGoFilter; + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_EXTENSION_GOS__ diff --git a/hurricane/src/hurricane/hurricane/ExtensionSlice.h b/hurricane/src/hurricane/hurricane/ExtensionSlice.h new file mode 100644 index 00000000..7000daae --- /dev/null +++ b/hurricane/src/hurricane/hurricane/ExtensionSlice.h @@ -0,0 +1,94 @@ + +// -*- C++ -*- +// +// This file is part of the Hurricane Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./ExtensionSlice.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_EXTENSION_SLICE__ +#define __HURRICANE_EXTENSION_SLICE__ + +#include "hurricane/Name.h" +#include "hurricane/ExtensionSlices.h" +#include "hurricane/QuadTree.h" + + +namespace Hurricane { + + + class Cell; + + + class ExtensionSlice { + + public: + typedef unsigned long long Mask; + public: + // Constructor & Destructor. + static ExtensionSlice* _create ( Cell* , const Name& ); + void _destroy (); + // Methods. + inline bool isEmpty () const; + inline Cell* getCell () const; + inline const Name& getName () const; + inline Mask getMask () const; + inline const Box& getBoundingBox () const; + inline Gos getGos () const; + inline Gos getGosUnder ( const Box& area ) const; + inline QuadTree* _getQuadTree (); + // Hurricane Managment. + string _getTypeName () const; + string _getString () const; + Record* _getRecord () const; + + private: + // Internal: Attributes. + static unsigned int _masks; + Cell* _cell; + Name _name; + Mask _mask; + QuadTree _quadTree; + + protected: + // Internal: Constructors & Destructors. + ExtensionSlice ( Cell* , const Name&, Mask ); + ~ExtensionSlice (); + private: + ExtensionSlice ( const ExtensionSlice& ); + ExtensionSlice& operator= ( const ExtensionSlice& ); +}; + + +// Inline Functions. + inline bool ExtensionSlice::isEmpty () const { return _quadTree.isEmpty(); } + inline Cell* ExtensionSlice::getCell () const { return _cell; } + inline const Name& ExtensionSlice::getName () const { return _name; } + inline ExtensionSlice::Mask ExtensionSlice::getMask () const { return _mask; } + inline const Box& ExtensionSlice::getBoundingBox () const { return _quadTree.getBoundingBox(); } + inline Gos ExtensionSlice::getGos () const { return _quadTree.getGos(); } + inline Gos ExtensionSlice::getGosUnder ( const Box& area ) const {return _quadTree.getGosUnder(area); } + inline QuadTree* ExtensionSlice::_getQuadTree () { return &_quadTree; } + + +} // End of Hurricane namespace. + + +# endif // __HURRICANE_EXTENSION_SLICE__ diff --git a/hurricane/src/hurricane/hurricane/ExtensionSlices.h b/hurricane/src/hurricane/hurricane/ExtensionSlices.h new file mode 100644 index 00000000..cfb49828 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/ExtensionSlices.h @@ -0,0 +1,47 @@ + +// -*- C++ -*- +// +// This file is part of the Hurricane Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./ExtensionSlices.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_EXTENSION_SLICES__ +#define __HURRICANE_EXTENSION_SLICES__ + + +#include "hurricane/Collection.h" + + +namespace Hurricane { + + + class ExtensionSlice; + + + typedef GenericCollection ExtensionSlices; + typedef GenericLocator ExtensionSliceLocator; + typedef GenericFilter ExtensionSliceFilter; + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_EXTENSION_SLICES__ diff --git a/hurricane/src/hurricane/hurricane/MapCollection.h b/hurricane/src/hurricane/hurricane/MapCollection.h index 87d32407..7045b206 100644 --- a/hurricane/src/hurricane/hurricane/MapCollection.h +++ b/hurricane/src/hurricane/hurricane/MapCollection.h @@ -45,13 +45,13 @@ template > if (_elementMap) _iterator = _elementMap->begin(); }; - public: virtual Element GetElement() const + public: virtual Element getElement() const // *************************************** { return (isValid()) ? (*_iterator).second : Element(); }; - public: virtual Hurricane::Locator* GetClone() const + public: virtual Hurricane::Locator* getClone() const // ********************************************************** { return new Locator(_elementMap); @@ -113,13 +113,13 @@ template > // Accessors // ********* - public: virtual Collection* GetClone() const + public: virtual Collection* getClone() const // ************************************************** { return new MapCollection(*this); } - public: virtual Hurricane::Locator* GetLocator() const + public: virtual Hurricane::Locator* getLocator() const // ************************************************************ { // return (_elementMap) ? new Locator(_elementMap) : NULL; @@ -127,7 +127,7 @@ template > return (_elementMap) ? new Locator(_elementMap) : NULL; } - public: virtual unsigned GetSize() const + public: virtual unsigned getSize() const // ************************************* { return (_elementMap) ? _elementMap->size() : 0; @@ -136,34 +136,34 @@ template > // Others // ****** - public: virtual string _GetTypeName() const + public: virtual string _getTypeName() const // ************************************** { return _TName("MapCollection"); }; - public: virtual string _GetString() const + public: virtual string _getString() const // ************************************** { if (!_elementMap) - return "<" + _GetTypeName() + " unbound>"; + return "<" + _getTypeName() + " unbound>"; else { if (_elementMap->empty()) - return "<" + _GetTypeName() + " empty>"; + return "<" + _getTypeName() + " empty>"; else - return "<" + _GetTypeName() + " " + GetString(_elementMap->size()) + ">"; + return "<" + _getTypeName() + " " + getString(_elementMap->size()) + ">"; } }; - Record* _GetRecord() const + Record* _getRecord() const // ******************** { Record* record = NULL; if (!_elementMap->empty()) { - record = new Record(_GetString()); + record = new Record(_getString()); typename map::const_iterator iterator = _elementMap->begin(); // AD while (iterator != _elementMap->end()) { - record->add(getSlot(GetString((*iterator).first), (*iterator).second)); + record->add(getSlot(getString((*iterator).first), (*iterator).second)); ++iterator; } } @@ -179,14 +179,14 @@ template > // **************************************************************************************************** template - inline GenericCollection GetCollection(const map& elementMap) + inline GenericCollection getCollection(const map& elementMap) // ********************************************************************************************* { return MapCollection(elementMap); } template - inline GenericCollection GetCollection(const map* elementMap) + inline GenericCollection getCollection(const map* elementMap) // ********************************************************************************************* { return MapCollection(elementMap); diff --git a/hurricane/src/hurricane/hurricane/Query.h b/hurricane/src/hurricane/hurricane/Query.h index 1c567748..35576a99 100644 --- a/hurricane/src/hurricane/hurricane/Query.h +++ b/hurricane/src/hurricane/hurricane/Query.h @@ -307,48 +307,55 @@ namespace Hurricane { enum QueryFilter { DoMasterCells = 1 , DoTerminalCells = 2 , DoComponents = 4 + , DoExtensionGos = 8 , DoAll = DoMasterCells | DoTerminalCells | DoComponents + | DoExtensionGos }; public: // Constructors & Destructors. - Query (); - virtual ~Query (); + Query (); + virtual ~Query (); // Accessors. - inline unsigned int getStartLevel () const; - inline unsigned int getStopLevel () const; - inline size_t getDepth () const; - inline const Transformation& getTransformation () const; - inline const Box& getArea () const; - inline const BasicLayer* getBasicLayer () const; - inline Cell* getMasterCell (); - inline Instance* getInstance (); - //inline const Tabulation& getTab () const; - virtual bool hasGoCallback () const; - virtual bool hasMasterCellCallback () const; - virtual void goCallback ( Go* go ) = 0; - virtual void masterCellCallback () = 0; + inline unsigned int getStartLevel () const; + inline unsigned int getStopLevel () const; + inline size_t getDepth () const; + inline const Transformation& getTransformation () const; + inline const Box& getArea () const; + inline const BasicLayer* getBasicLayer () const; + inline Cell* getMasterCell (); + inline Instance* getInstance (); + //inline const Tabulation& getTab () const; + virtual bool hasGoCallback () const; + virtual bool hasExtensionGoCallback () const; + virtual bool hasMasterCellCallback () const; + virtual void goCallback ( Go* go ) = 0; + virtual void extensionGoCallback ( Go* go ) = 0; + virtual void masterCellCallback () = 0; // Modifiers. - void setQuery ( Cell* cell - , const Box& area - , const Transformation& transformation - , const BasicLayer* basicLayer - , unsigned int filter - ); - inline void setCell ( Cell* cell ); - inline void setArea ( const Box& area ); - inline void setTransformation ( const Transformation& transformation ); - inline void setBasicLayer ( const BasicLayer* basicLayer ); - inline void setFilter ( unsigned int mode ); - inline void setStartLevel ( unsigned int level ); - inline void setStopLevel ( unsigned int level ); - void doQuery (); + void setQuery ( Cell* cell + , const Box& area + , const Transformation& transformation + , const BasicLayer* basicLayer + , ExtensionSlice::Mask extensionMask + , unsigned int filter + ); + inline void setCell ( Cell* cell ); + inline void setArea ( const Box& area ); + inline void setTransformation ( const Transformation& transformation ); + inline void setBasicLayer ( const BasicLayer* basicLayer ); + inline void setExtensionMask ( ExtensionSlice::Mask mode ); + inline void setFilter ( unsigned int mode ); + inline void setStartLevel ( unsigned int level ); + inline void setStopLevel ( unsigned int level ); + void doQuery (); protected: // Internal: Attributes. QueryStack _stack; const BasicLayer* _basicLayer; + ExtensionSlice::Mask _extensionMask; unsigned int _filter; }; @@ -360,6 +367,7 @@ namespace Hurricane { inline void Query::setTransformation ( const Transformation& transformation ) { _stack.setTopTransformation(transformation); } inline void Query::setBasicLayer ( const BasicLayer* basicLayer ) { _basicLayer = basicLayer; } inline void Query::setFilter ( unsigned int filter ) { _filter = filter; } + inline void Query::setExtensionMask ( ExtensionSlice::Mask mask ) { _extensionMask = mask; } inline void Query::setStartLevel ( unsigned int level ) { _stack.setStartLevel(level); } inline void Query::setStopLevel ( unsigned int level ) { _stack.setStopLevel(level); } diff --git a/hurricane/src/hurricane/hurricane/UserGo.h b/hurricane/src/hurricane/hurricane/UserGo.h deleted file mode 100644 index 8b9f3165..00000000 --- a/hurricane/src/hurricane/hurricane/UserGo.h +++ /dev/null @@ -1,59 +0,0 @@ -// **************************************************************************************************** -// -// This file is part of the Tsunami Project. -// Copyright (c) 2001-2004 Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie. -// -// File: UserGo.h -// Authors: C. Alexandre -// **************************************************************************************************** - -#ifndef HURRICANE_USER_GO -#define HURRICANE_USER_GO - -#include "hurricane/Go.h" -#include "hurricane/UserGos.h" -#include "hurricane/DisplaySlot.h" - -namespace Hurricane { - -// **************************************************************************************************** -// UserGo declaration -// **************************************************************************************************** - -class UserGo : public Go { -// ********************* - -// Types -// ***** - - public: typedef Go Inherit; - -// Attributes -// ********** - protected: DisplaySlot* _displaySlot; - -// Constructors -// ************ - - protected: UserGo(DisplaySlot* displaySlot); - -// Updators -// ******** - - public: virtual void materialize(); - public: virtual void unmaterialize(); - -// Others -// ****** - - public: virtual string _getTypeName() const {return _TName("UserGo");}; - public: virtual string _getString() const; - public: virtual Record* _getRecord() const; -}; - -UserGos getUserGos(const Cell* cell); - -} // End of Hurricane namespace. - -#endif // HURRICANE_USER_GO diff --git a/hurricane/src/hurricane/hurricane/UserGos.h b/hurricane/src/hurricane/hurricane/UserGos.h deleted file mode 100644 index 6729835d..00000000 --- a/hurricane/src/hurricane/hurricane/UserGos.h +++ /dev/null @@ -1,61 +0,0 @@ -// **************************************************************************************************** -// -// This file is part of the Tsunami Project. -// Copyright (c) 2001-2004 Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie. -// -// File: UserGos.h -// Authors: C. Alexandre -// **************************************************************************************************** - -#ifndef HURRICANE_USER_GOS -#define HURRICANE_USER_GOS - -#include "hurricane/Collection.h" - -namespace Hurricane { - -class UserGo; - - - -// **************************************************************************************************** -// UserGosdeclaration -// **************************************************************************************************** - -typedef GenericCollection UserGos; - - - -// **************************************************************************************************** -// UserGoLocator declaration -// **************************************************************************************************** - -typedef GenericLocator UserGoLocator; - - - -// **************************************************************************************************** -// UserGoFilter declaration -// **************************************************************************************************** - -typedef GenericFilter UserGoFilter; - - - -// **************************************************************************************************** -// for_each_usergo declaration -// **************************************************************************************************** - -#define for_each_user_go(userGo, userGos)\ -/***************************************/\ -{\ - UserGoLocator _locator = userGos.getLocator();\ - while (_locator.isValid()) {\ - UserGo* userGo = _locator.getElement();\ - _locator.progress(); - - -} // End of Hurricane namespace. - -#endif // HURRICANE_USER_GOS diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index c8869489..fcad0097 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -6,6 +6,7 @@ set ( mocincludes hurricane/viewer/HPaletteEntry.h hurricane/viewer/LayerPaletteEntry.h + hurricane/viewer/HExtensionPaletteEntry.h hurricane/viewer/GroupPaletteEntry.h hurricane/viewer/ViewerPaletteEntry.h hurricane/viewer/HPalette.h @@ -57,6 +58,7 @@ HGraphics.cpp HPaletteEntry.cpp LayerPaletteEntry.cpp + HExtensionPaletteEntry.cpp GroupPaletteEntry.cpp ViewerPaletteEntry.cpp HPalette.cpp diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index ccd76357..e409c778 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -284,10 +284,25 @@ namespace Hurricane { CellWidget::DrawingQuery::DrawingQuery ( CellWidget* widget ) : Query() - ,_cellWidget(widget) + , _cellWidget(widget) + , _drawExtensionGo(NULL) { } + void CellWidget::DrawingQuery::setDrawExtensionGo ( const Name& name ) + { + map >::iterator idraw + = _drawExtensionGos.find ( name ); + + if ( idraw != _drawExtensionGos.end() ) { + _drawExtensionGo = idraw->second.second; + if ( idraw->second.first ) + idraw->second.first ( _cellWidget ); + } else + _drawExtensionGo = NULL; + } + + bool CellWidget::DrawingQuery::hasMasterCellCallback () const { return true; @@ -344,6 +359,19 @@ namespace Hurricane { } + bool CellWidget::DrawingQuery::hasExtensionGoCallback () const + { + return true; + } + + + void CellWidget::DrawingQuery::extensionGoCallback ( Go* go ) + { + if ( _drawExtensionGo ) + _drawExtensionGo ( _cellWidget, go, getBasicLayer(), getArea(), getTransformation() ); + } + + // ------------------------------------------------------------------- // Class : "Hurricane::CellWidget::TextDrawingQuery". @@ -383,6 +411,14 @@ namespace Hurricane { { } + bool CellWidget::TextDrawingQuery::hasExtensionGoCallback () const + { return false; } + + + void CellWidget::TextDrawingQuery::extensionGoCallback ( Go* go ) + { } + + // ------------------------------------------------------------------- // Class : "Hurricane::CellWidget". @@ -449,7 +485,8 @@ namespace Hurricane { detachFromPalette (); _palette = palette; - connect ( _palette, SIGNAL(paletteChanged()), this, SLOT(redraw()) ); + connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(redraw()) ); + connect ( this , SIGNAL(cellChanged(Cell*)), _palette, SLOT(updateExtensions(Cell*))); } @@ -550,6 +587,7 @@ namespace Hurricane { Box redrawBox = displayToDbuBox ( redrawArea ); + _drawingQuery.setExtensionMask ( 0 ); _drawingQuery.setArea ( redrawBox ); _drawingQuery.setTransformation ( Transformation() ); @@ -557,13 +595,13 @@ namespace Hurricane { _drawingPlanes.setPen ( Graphics::getPen ((*iLayer)->getName(),darkening) ); _drawingPlanes.setBrush ( Graphics::getBrush((*iLayer)->getName(),darkening) ); - if ( isDrawable((*iLayer)->getName()) ) { + if ( isDrawableLayer((*iLayer)->getName()) ) { _drawingQuery.setBasicLayer ( *iLayer ); _drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells ); _drawingQuery.doQuery (); } } - if ( isDrawable("boundaries") ) { + if ( isDrawableLayer("boundaries") ) { _drawingPlanes.setPen ( Graphics::getPen ("boundaries",darkening) ); _drawingPlanes.setBrush ( Graphics::getBrush("boundaries",darkening) ); @@ -572,7 +610,7 @@ namespace Hurricane { _drawingQuery.doQuery (); } - if ( isDrawable("text.instance") ) { + if ( isDrawableLayer("text.instance") ) { _drawingPlanes.setPen ( Graphics::getPen ("text.instance",darkening) ); _drawingPlanes.setBrush ( Graphics::getBrush("text.instance",darkening) ); _drawingPlanes.setBackground ( Graphics::getBrush("boundaries" ,darkening) ); @@ -580,6 +618,16 @@ namespace Hurricane { _textDrawingQuery.setTransformation ( Transformation() ); _textDrawingQuery.doQuery (); } + + _drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells ); + + forEach ( ExtensionSlice*, islice, _cell->getExtensionSlices() ) { + if ( isDrawableLayer((*islice)->getName()) ) { + _drawingQuery.setExtensionMask ( (*islice)->getMask() ); + _drawingQuery.setDrawExtensionGo ( (*islice)->getName() ); + _drawingQuery.doQuery (); + } + } } _drawingPlanes.painterEnd (); @@ -615,7 +663,7 @@ namespace Hurricane { Box redrawBox = displayToDbuBox ( redrawArea ); for_each_basic_layer ( basicLayer, _technology->getBasicLayers() ) { - //if ( !isDrawable(basicLayer->getName()) ) continue; + //if ( !isDrawableLayer(basicLayer->getName()) ) continue; _drawingPlanes.setPen ( Graphics::getPen (basicLayer->getName()) ); _drawingPlanes.setBrush ( Graphics::getBrush(basicLayer->getName()) ); @@ -652,7 +700,7 @@ namespace Hurricane { } - bool CellWidget::isDrawable ( const Name& entryName ) + bool CellWidget::isDrawableLayer ( const Name& entryName ) { HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL; @@ -661,6 +709,14 @@ namespace Hurricane { } + bool CellWidget::isDrawableExtension ( const Name& entryName ) + { + HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL; + + return (!entry || entry->isChecked()); + } + + void CellWidget::drawBox ( const Box& box ) { _redrawRectCount++; @@ -975,8 +1031,8 @@ namespace Hurricane { for ( size_t i=0 ; i<_commands.size() ; i++ ) _commands[i]->draw ( this ); - if ( isDrawable("grid") ) drawGrid (); - if ( isDrawable("spot") ) _spot.moveTo ( _mousePosition ); + if ( isDrawableLayer("grid") ) drawGrid (); + if ( isDrawableLayer("spot") ) _spot.moveTo ( _mousePosition ); _drawingPlanes.painterEnd ( 2 ); } @@ -1115,6 +1171,8 @@ namespace Hurricane { _drawingQuery.setCell ( cell ); _textDrawingQuery.setCell ( cell ); + emit cellChanged ( cell ); + fitToContents (); } diff --git a/hurricane/src/hviewer/GroupPaletteEntry.cpp b/hurricane/src/hviewer/GroupPaletteEntry.cpp index 35bf4d12..206b26a4 100644 --- a/hurricane/src/hviewer/GroupPaletteEntry.cpp +++ b/hurricane/src/hviewer/GroupPaletteEntry.cpp @@ -50,12 +50,12 @@ // x-----------------------------------------------------------------x -# include -# include +#include +#include -# include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/GroupPaletteEntry.h" -# include "hurricane/viewer/HPalette.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/GroupPaletteEntry.h" +#include "hurricane/viewer/HPalette.h" namespace Hurricane { @@ -115,6 +115,12 @@ namespace Hurricane { } + bool GroupPaletteEntry::isExtension () const + { + return false; + } + + const Name& GroupPaletteEntry::getName () const { return _name; diff --git a/hurricane/src/hviewer/HExtensionPaletteEntry.cpp b/hurricane/src/hviewer/HExtensionPaletteEntry.cpp new file mode 100644 index 00000000..1bd4aa50 --- /dev/null +++ b/hurricane/src/hviewer/HExtensionPaletteEntry.cpp @@ -0,0 +1,119 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./HExtensionPaletteEntry.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include + +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/HExtensionPaletteEntry.h" +#include "hurricane/viewer/HPalette.h" + + +namespace Hurricane { + + + HExtensionPaletteEntry::HExtensionPaletteEntry ( HPalette* entry, const Name& name ) + : HPaletteEntry(entry) + , _name(name) + { + } + + + HExtensionPaletteEntry* HExtensionPaletteEntry::create ( HPalette* palette, const Name& name ) + { + HExtensionPaletteEntry* entry = new HExtensionPaletteEntry ( palette, name ); + + entry->_postCreate (); + + return entry; + } + + + void HExtensionPaletteEntry::_postCreate () + { + QHBoxLayout* layout = new QHBoxLayout (); + layout->setContentsMargins ( 0, 0, 0, 0 ); + + _checkBox = new QCheckBox ( this ); + _checkBox->setChecked ( true ); + _checkBox->setText ( getString(getName()).c_str() ); + _checkBox->setFont ( Graphics::getFixedFont() ); + layout->addWidget ( _checkBox ); + + setLayout ( layout ); + + connect ( _checkBox, SIGNAL(clicked()), this, SLOT(toggle()) ); + } + + + bool HExtensionPaletteEntry::isGroup () const + { + return false; + } + + + bool HExtensionPaletteEntry::isBasicLayer () const + { + return false; + } + + + bool HExtensionPaletteEntry::isExtension () const + { + return true; + } + + + const Name& HExtensionPaletteEntry::getName () const + { + return _name; + } + + + BasicLayer* HExtensionPaletteEntry::getBasicLayer () + { + return NULL; + } + + + bool HExtensionPaletteEntry::isChecked () const + { + return _checkBox->isChecked (); + } + + + void HExtensionPaletteEntry::setChecked ( bool state ) + { + _checkBox->setChecked ( state ); + } + + + void HExtensionPaletteEntry::toggle () + { + _palette->redrawCellWidget(); + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HPalette.cpp b/hurricane/src/hviewer/HPalette.cpp index bfbb418f..791e8ecb 100644 --- a/hurricane/src/hviewer/HPalette.cpp +++ b/hurricane/src/hviewer/HPalette.cpp @@ -50,26 +50,28 @@ // x-----------------------------------------------------------------x -# include +#include -# include -# include -# include -# include +#include +#include +#include +#include -# include "hurricane/Name.h" -# include "hurricane/DataBase.h" -# include "hurricane/Technology.h" -# include "hurricane/BasicLayer.h" -# include "hurricane/BasicLayers.h" +#include "hurricane/Name.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/BasicLayers.h" +#include "hurricane/ExtensionSlice.h" +#include "hurricane/Cell.h" -# include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/HPaletteEntry.h" -# include "hurricane/viewer/LayerPaletteEntry.h" -# include "hurricane/viewer/GroupPaletteEntry.h" -# include "hurricane/viewer/ViewerPaletteEntry.h" -# include "hurricane/viewer/HPalette.h" -# include "hurricane/viewer/CellWidget.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/HPaletteEntry.h" +#include "hurricane/viewer/LayerPaletteEntry.h" +#include "hurricane/viewer/HExtensionPaletteEntry.h" +#include "hurricane/viewer/GroupPaletteEntry.h" +#include "hurricane/viewer/ViewerPaletteEntry.h" +#include "hurricane/viewer/HPalette.h" namespace Hurricane { @@ -77,15 +79,32 @@ namespace Hurricane { HPalette::HPalette ( QWidget* parent ) : QScrollArea(parent) - , _entries() - , _showAll(NULL) - , _hideAll(NULL) + , _entries() + , _showAll(NULL) + , _hideAll(NULL) { setWidgetResizable ( true ); QWidget* adaptator = new QWidget (); QVBoxLayout* layout = new QVBoxLayout (); + _showAll = new QPushButton ( this ); + _showAll->setIcon ( QIcon(":/images/palette_show_all.png") ); + _showAll->setFlat ( true ); + + _hideAll = new QPushButton ( this ); + _hideAll->setIcon ( QIcon(":/images/palette_hide_all.png") ); + _hideAll->setFlat ( true ); + + connect ( _showAll, SIGNAL(clicked()), this, SLOT(showAll()) ); + connect ( _hideAll, SIGNAL(clicked()), this, SLOT(hideAll()) ); + + QHBoxLayout* topEntry = new QHBoxLayout (); + topEntry->setContentsMargins ( 0, 0, 0, 0 ); + topEntry->addWidget ( _showAll ); + topEntry->addWidget ( _hideAll ); + layout->addLayout ( topEntry ); + //layout->setContentsMargins ( 0, 0, 0, 0 ); vector groups = Graphics::getStyle()->getDrawingGroups(); @@ -133,8 +152,8 @@ namespace Hurricane { gentry->setChecked ( false ); } bool unmatched = false; - for_each_basic_layer ( basicLayer, technology->getBasicLayers() ) { - if ( !find(basicLayer->getName()) ) { + forEach ( BasicLayer*, basicLayer, technology->getBasicLayers() ) { + if ( !find((*basicLayer)->getName()) ) { if ( !unmatched ) { unmatched = true; gentry = GroupPaletteEntry::create ( this, "Unmatcheds" ); @@ -142,36 +161,19 @@ namespace Hurricane { layout->addSpacing ( -5 ); _entries.push_back ( gentry ); } - LayerPaletteEntry* entry = LayerPaletteEntry::create ( this, basicLayer ); + LayerPaletteEntry* entry = LayerPaletteEntry::create ( this, *basicLayer ); layout->addWidget ( entry, 0, Qt::AlignLeft ); _entries.push_back ( entry ); - cerr << "[WARNING] BasicLayer \"" << basicLayer->getName() + cerr << "[WARNING] BasicLayer \"" << (*basicLayer)->getName() << "\" has no associated DisplayStyle." << endl; } - end_for; } if ( unmatched ) gentry->setChecked ( false ); + } } - - _showAll = new QPushButton ( this ); - _showAll->setIcon ( QIcon(":/images/palette_show_all.png") ); - _showAll->setFlat ( true ); - - _hideAll = new QPushButton ( this ); - _hideAll->setIcon ( QIcon(":/images/palette_hide_all.png") ); - _hideAll->setFlat ( true ); - - connect ( _showAll, SIGNAL(clicked()), this, SLOT(showAll()) ); - connect ( _hideAll, SIGNAL(clicked()), this, SLOT(hideAll()) ); - - QHBoxLayout* bottomEntry = new QHBoxLayout (); - bottomEntry->setContentsMargins ( 0, 0, 0, 0 ); - bottomEntry->addWidget ( _showAll ); - bottomEntry->addWidget ( _hideAll ); - layout->addLayout ( bottomEntry ); layout->addStretch (); adaptator->setLayout ( layout ); @@ -182,6 +184,40 @@ namespace Hurricane { } + void HPalette::updateExtensions ( Cell* cell ) + { + QVBoxLayout* layout = qobject_cast ( widget()->layout() ); + const Name extensionName = "Extensions"; + + for ( size_t ientry=0 ; ientry<_entries.size() ; ) { + if ( ( _entries[ientry]->getName() == extensionName ) + || _entries[ientry]->isExtension() ) { + layout->removeWidget ( _entries[ientry] ); + _entries[ientry]->deleteLater (); + + for ( size_t j=ientry+1 ; j<_entries.size() ; j++ ) + _entries[j-1] = _entries[j]; + _entries.pop_back (); + } else + ientry++; + } + + if ( !cell ) return; + + GroupPaletteEntry* gentry = GroupPaletteEntry::create ( this, extensionName ); + layout->insertWidget ( -1, gentry, 0, Qt::AlignLeft ); + layout->addSpacing ( -5 ); + _entries.push_back ( gentry ); + + forEach ( ExtensionSlice*, extension, cell->getExtensionSlices() ) { + HExtensionPaletteEntry* entry = HExtensionPaletteEntry::create ( this, (*extension)->getName() ); + layout->insertWidget ( -1, entry, 0, Qt::AlignLeft ); + _entries.push_back ( entry ); + } + gentry->setChecked ( false ); + } + + bool HPalette::isDrawable ( size_t index ) { if ( index < _entries.size() ) diff --git a/hurricane/src/hviewer/LayerPaletteEntry.cpp b/hurricane/src/hviewer/LayerPaletteEntry.cpp index d12813a6..e903fce4 100644 --- a/hurricane/src/hviewer/LayerPaletteEntry.cpp +++ b/hurricane/src/hviewer/LayerPaletteEntry.cpp @@ -111,6 +111,12 @@ namespace Hurricane { } + bool LayerPaletteEntry::isExtension () const + { + return false; + } + + const Name& LayerPaletteEntry::getName () const { return _basicLayer->getName(); diff --git a/hurricane/src/hviewer/ViewerPaletteEntry.cpp b/hurricane/src/hviewer/ViewerPaletteEntry.cpp index d48c4bcb..0b7c14cc 100644 --- a/hurricane/src/hviewer/ViewerPaletteEntry.cpp +++ b/hurricane/src/hviewer/ViewerPaletteEntry.cpp @@ -110,6 +110,12 @@ namespace Hurricane { } + bool ViewerPaletteEntry::isExtension () const + { + return false; + } + + const Name& ViewerPaletteEntry::getName () const { return _name; diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index abae4b54..edff43e1 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -108,7 +108,14 @@ namespace Hurricane { private: class DrawingPlanes; - + public: + typedef void ( DrawExtensionGo_t ) ( CellWidget* + , const Go* + , const BasicLayer* + , const Box& + , const Transformation& + ); + typedef void ( InitDrawExtension_t )( CellWidget* ); public: // Constructor & Destructor. CellWidget ( QWidget* parent=NULL ); @@ -128,9 +135,11 @@ namespace Hurricane { inline void setStartLevel ( int level ); inline void setStopLevel ( int level ); inline void setQueryFilter ( int filter ); + inline void addDrawExtensionGo ( const Name&, InitDrawExtension_t*, DrawExtensionGo_t* ); // Painter control & Hurricane objects drawing primitives. inline float getScale () const; - bool isDrawable ( const Name& entryName ); + bool isDrawableLayer ( const Name& ); + bool isDrawableExtension ( const Name& ); void drawBox ( const Box& ); void drawLine ( const Point&, const Point& ); void drawText ( const Point&, const Name&, int angle=0, bool reverse=false ); @@ -169,6 +178,7 @@ namespace Hurricane { void mousePressEvent ( QMouseEvent* ); void mouseReleaseEvent ( QMouseEvent* ); signals: + void cellChanged ( Cell* ); void mousePositionChanged ( const Point& position ); void selectionChanged ( const set&, Cell* ); void occurrenceToggled ( Occurrence ); @@ -267,37 +277,50 @@ namespace Hurricane { private: class DrawingQuery : public Query { public: - DrawingQuery ( CellWidget* widget ); - inline void setQuery ( const Box& area - , const Transformation& transformation - , const BasicLayer* basicLayer - , unsigned int filter - ); - virtual bool hasMasterCellCallback () const; - virtual bool hasGoCallback () const; - virtual void masterCellCallback (); - virtual void goCallback ( Go* go ); - void drawGo ( const Go* go - , const BasicLayer* basicLayer - , const Box& area - , const Transformation& transformation - ); + DrawingQuery ( CellWidget* widget ); + inline void setQuery ( const Box& area + , const Transformation& transformation + , const BasicLayer* basicLayer + , ExtensionSlice::Mask extensionMask + , unsigned int filter + ); + inline void addDrawExtensionGo ( const Name& + , InitDrawExtension_t* + , DrawExtensionGo_t* + ); + void setDrawExtensionGo ( const Name& ); + virtual bool hasMasterCellCallback () const; + virtual bool hasGoCallback () const; + virtual bool hasExtensionGoCallback () const; + virtual void masterCellCallback (); + virtual void goCallback ( Go* go ); + virtual void extensionGoCallback ( Go* go ); + void drawGo ( const Go* go + , const BasicLayer* basicLayer + , const Box& area + , const Transformation& transformation + ); protected: - CellWidget* _cellWidget; + CellWidget* _cellWidget; + DrawExtensionGo_t* _drawExtensionGo; + map > + _drawExtensionGos; }; private: class TextDrawingQuery : public Query { public: - TextDrawingQuery ( CellWidget* widget ); - inline void setQuery ( const Box& area - , const Transformation& transformation - ); - virtual bool hasMasterCellCallback () const; - virtual bool hasGoCallback () const; - virtual void masterCellCallback (); - virtual void goCallback ( Go* go ); + TextDrawingQuery ( CellWidget* widget ); + inline void setQuery ( const Box& area + , const Transformation& transformation + ); + virtual bool hasMasterCellCallback () const; + virtual bool hasGoCallback () const; + virtual bool hasExtensionGoCallback () const; + virtual void masterCellCallback (); + virtual void extensionGoCallback ( Go* go ); + virtual void goCallback ( Go* go ); protected: CellWidget* _cellWidget; @@ -339,9 +362,25 @@ namespace Hurricane { inline void CellWidget::DrawingQuery::setQuery ( const Box& area , const Transformation& transformation , const BasicLayer* basicLayer + , ExtensionSlice::Mask extensionMask , unsigned int filter ) - { Query::setQuery ( _cellWidget->getCell(), area, transformation, basicLayer, filter ); } + { + Query::setQuery ( _cellWidget->getCell() + , area + , transformation + , basicLayer + , extensionMask + , filter + ); + } + + + inline void CellWidget::DrawingQuery::addDrawExtensionGo ( const Name& name + , InitDrawExtension_t* initDrawExtension + , DrawExtensionGo_t* drawExtensionGo + ) + { _drawExtensionGos[name] = make_pair(initDrawExtension,drawExtensionGo); } inline bool CellWidget::DrawingPlanes::getLineMode () const @@ -421,6 +460,13 @@ namespace Hurricane { { copyToScreen ( 0, 0, width(), height() ); } + inline void CellWidget::addDrawExtensionGo ( const Name& name + , InitDrawExtension_t* initDrawExtension + , DrawExtensionGo_t* drawExtensionGo + ) + { _drawingQuery.addDrawExtensionGo ( name, initDrawExtension, drawExtensionGo ); } + + inline void CellWidget::setStartLevel ( int level ) { _drawingQuery.setStartLevel ( level ); } diff --git a/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h index 66ae366f..c51a1735 100644 --- a/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h @@ -50,15 +50,14 @@ // x-----------------------------------------------------------------x -# ifndef __GROUP_HPALETTE_ENTRY_H__ -# define __GROUP_HPALETTE_ENTRY_H__ +#ifndef __GROUP_HPALETTE_ENTRY__ +#define __GROUP_HPALETTE_ENTRY__ class QPushButton; -# include "hurricane/Name.h" - -# include "hurricane/viewer/HPaletteEntry.h" +#include "hurricane/Name.h" +#include "hurricane/viewer/HPaletteEntry.h" namespace Hurricane { @@ -75,6 +74,7 @@ namespace Hurricane { public: virtual bool isGroup () const; virtual bool isBasicLayer () const; + virtual bool isExtension () const; virtual const Name& getName () const; virtual BasicLayer* getBasicLayer (); virtual bool isChecked () const; @@ -106,4 +106,4 @@ namespace Hurricane { } // End of Hurricane namespace. -# endif +#endif // __GROUP_HPALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h new file mode 100644 index 00000000..26831efe --- /dev/null +++ b/hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h @@ -0,0 +1,77 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./HExtensionPaletteEntry.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_EXTENSION_PALETTE_ENTRY__ +#define __HURRICANE_EXTENSION_PALETTE_ENTRY__ + + +class QCheckBox; + +#include "hurricane/Name.h" +#include "hurricane/viewer/HPaletteEntry.h" + + +namespace Hurricane { + + + class HExtensionPaletteEntry : public HPaletteEntry { + Q_OBJECT; + + // Constructor. + public: + static HExtensionPaletteEntry* create ( HPalette* , const Name& ); + + // Methods. + public: + virtual bool isGroup () const; + virtual bool isBasicLayer () const; + virtual bool isExtension () const; + virtual const Name& getName () const; + virtual BasicLayer* getBasicLayer (); + virtual bool isChecked () const; + virtual void setChecked ( bool ); + + // Slots. + public slots: + virtual void toggle (); + + // Internal - Attributes. + protected: + QCheckBox* _checkBox; + Name _name; + + // Internal - Constructor. + HExtensionPaletteEntry ( HPalette* , const Name& ); + HExtensionPaletteEntry ( const HExtensionPaletteEntry& ); + HExtensionPaletteEntry& operator= ( const HExtensionPaletteEntry& ); + virtual void _postCreate (); + + }; + + +} // End of Hurricane namespace. + + +#endif // __LAYER_PALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HPalette.h b/hurricane/src/hviewer/hurricane/viewer/HPalette.h index 771ecbd3..86f6ea5f 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HPalette.h +++ b/hurricane/src/hviewer/hurricane/viewer/HPalette.h @@ -50,15 +50,15 @@ // x-----------------------------------------------------------------x -# ifndef __HPALETTE__ -# define __HPALETTE__ +#ifndef __HURRICANE_PALETTE__ +#define __HURRICANE_PALETTE__ -# include -# include -# include -# include +#include +#include +#include +#include -# include "hurricane/Commons.h" +#include "hurricane/Commons.h" class QCheckBox; @@ -73,8 +73,9 @@ namespace Hurricane { class Name; class BasicLayer; - class HPaletteEntry; + class Cell; class CellWidget; + class HPaletteEntry; class HPalette : public QScrollArea { @@ -94,6 +95,7 @@ namespace Hurricane { void paletteChanged (); public slots: // Slots. + void updateExtensions ( Cell* cell ); void showAll (); void hideAll (); @@ -116,4 +118,4 @@ namespace Hurricane { } // End of Hurricane namespace. -# endif +#endif // __HURRICANE_PALETTE__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h index 88b9d8a8..f846d1f0 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h @@ -50,17 +50,17 @@ // x-----------------------------------------------------------------x -# ifndef __PALETTE_ENTRY_H__ -# define __PALETTE_ENTRY_H__ +#ifndef __HURRICANE_PALETTE_ENTRY__ +#define __HURRICANE_PALETTE_ENTRY__ -# include -# include -# include +#include +#include +#include class QPaintEvent; class QCheckBox; -# include "hurricane/Commons.h" +#include "hurricane/Commons.h" namespace Hurricane { @@ -99,6 +99,7 @@ namespace Hurricane { virtual const Name& getName () const = 0; virtual bool isGroup () const = 0; virtual bool isBasicLayer () const = 0; + virtual bool isExtension () const = 0; virtual BasicLayer* getBasicLayer () = 0; virtual bool isChecked () const = 0; virtual void setChecked ( bool state ) = 0; @@ -123,4 +124,4 @@ namespace Hurricane { } // End of Hurricane namespace. -# endif +# endif // __HURRICANE_PALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h index 2e1cccb9..7d3d4829 100644 --- a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h @@ -50,13 +50,13 @@ // x-----------------------------------------------------------------x -# ifndef __LAYER_PALETTE_ENTRY_H__ -# define __LAYER_PALETTE_ENTRY_H__ +#ifndef __LAYER_PALETTE_ENTRY__ +#define __LAYER_PALETTE_ENTRY__ class QCheckBox; -# include "hurricane/viewer/HPaletteEntry.h" +#include "hurricane/viewer/HPaletteEntry.h" namespace Hurricane { @@ -73,6 +73,7 @@ namespace Hurricane { public: virtual bool isGroup () const; virtual bool isBasicLayer () const; + virtual bool isExtension () const; virtual const Name& getName () const; virtual BasicLayer* getBasicLayer (); virtual bool isChecked () const; @@ -99,4 +100,4 @@ namespace Hurricane { } // End of Hurricane namespace. -# endif +#endif // __LAYER_PALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h index 57defe46..dc3eb0d1 100644 --- a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h @@ -74,6 +74,7 @@ namespace Hurricane { public: virtual bool isGroup () const; virtual bool isBasicLayer () const; + virtual bool isExtension () const; virtual const Name& getName () const; virtual BasicLayer* getBasicLayer (); virtual bool isChecked () const;