From 26d07794cac91782473cb165354ee3c877f005e0 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 21 Oct 2008 13:49:48 +0000 Subject: [PATCH] * ./hurricane/src/hurricane : - New : Mask object to manage masks. - New : BasicLayer ordering & connectivity is managed. --- hurricane/src/hurricane/BasicLayer.cpp | 13 +- hurricane/src/hurricane/CMakeLists.txt | 6 +- hurricane/src/hurricane/CellCollections.cpp | 18 +- hurricane/src/hurricane/ExtensionSlice.cpp | 2 +- hurricane/src/hurricane/HyperNet.cpp | 2 +- hurricane/src/hurricane/Layer.cpp | 47 +- hurricane/src/hurricane/RegularLayer.cpp | 18 +- hurricane/src/hurricane/Technology.cpp | 162 ++++++- hurricane/src/hurricane/ViaLayer.cpp | 20 +- .../src/hurricane/hurricane/Collection.h | 1 + hurricane/src/hurricane/hurricane/Commons.h | 11 +- .../src/hurricane/hurricane/ExtensionGo.h | 2 +- .../src/hurricane/hurricane/ExtensionSlice.h | 3 +- hurricane/src/hurricane/hurricane/HyperNet.h | 2 +- hurricane/src/hurricane/hurricane/Layer.h | 29 +- hurricane/src/hurricane/hurricane/Mask.h | 184 ++++++++ .../hurricane/hurricane/MultimapCollection.h | 440 ++++++++++++++++++ hurricane/src/hurricane/hurricane/Property.h | 158 ++++--- .../src/hurricane/hurricane/RegularLayer.h | 55 +-- .../src/hurricane/hurricane/Technology.h | 213 +++++---- hurricane/src/hurricane/hurricane/ViaLayer.h | 11 +- hurricane/src/hviewer/CMakeLists.txt | 2 + hurricane/src/hviewer/CellViewer.cpp | 110 ++--- hurricane/src/hviewer/CellWidget.cpp | 68 ++- hurricane/src/hviewer/ColorScale.cpp | 106 +++++ hurricane/src/hviewer/Graphics.cpp | 9 + .../src/hviewer/hurricane/viewer/CellViewer.h | 36 +- .../src/hviewer/hurricane/viewer/CellWidget.h | 120 ++--- .../src/hviewer/hurricane/viewer/ColorScale.h | 94 ++++ .../hviewer/hurricane/viewer/DisplayStyle.h | 55 +-- .../src/hviewer/hurricane/viewer/Graphics.h | 60 +-- 31 files changed, 1543 insertions(+), 514 deletions(-) create mode 100644 hurricane/src/hurricane/hurricane/Mask.h create mode 100644 hurricane/src/hurricane/hurricane/MultimapCollection.h create mode 100644 hurricane/src/hviewer/ColorScale.cpp create mode 100644 hurricane/src/hviewer/hurricane/viewer/ColorScale.h diff --git a/hurricane/src/hurricane/BasicLayer.cpp b/hurricane/src/hurricane/BasicLayer.cpp index d01e3615..09482b78 100644 --- a/hurricane/src/hurricane/BasicLayer.cpp +++ b/hurricane/src/hurricane/BasicLayer.cpp @@ -206,18 +206,19 @@ namespace Hurricane { void BasicLayer::_postCreate () { Mask basicLayersMask = 0; - for_each_basic_layer(basicLayer, getTechnology()->getBasicLayers()) { - basicLayersMask |= basicLayer->getMask(); - end_for; + forEach ( BasicLayer*, basicLayer, getTechnology()->getBasicLayers() ) { + basicLayersMask |= (*basicLayer)->getMask(); } Mask mask = 1; - while (mask && (mask & basicLayersMask)) mask = mask<<1; + while (mask && (mask & basicLayersMask)) mask = mask.lshift(1); if (!mask) throw Error("Can't create " + _TName("BasicLayer") + " : mask capacity overflow"); _setMask(mask); + if ( _material == Material::metal ) getTechnology()->_getMetalMask().set(getMask()); + if ( _material == Material::cut ) getTechnology()->_getCutMask ().set(getMask()); if (_extractNumber) { Mask extractMask = (1 << _extractNumber); @@ -234,6 +235,8 @@ namespace Hurricane { void BasicLayer::_preDestroy () { + if ( _material == Material::metal ) getTechnology()->_getMetalMask().unset(getMask()); + if ( _material == Material::cut ) getTechnology()->_getCutMask ().unset(getMask()); Layer::_preDestroy(); } @@ -287,7 +290,7 @@ namespace Hurricane { string BasicLayer::Material::_getString () const - { return getString(_code); } + { return getString(&_code); } Record* BasicLayer::Material::_getRecord () const diff --git a/hurricane/src/hurricane/CMakeLists.txt b/hurricane/src/hurricane/CMakeLists.txt index 20798e15..634c971e 100644 --- a/hurricane/src/hurricane/CMakeLists.txt +++ b/hurricane/src/hurricane/CMakeLists.txt @@ -1,7 +1,8 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ) - set ( includes hurricane/BasicLayer.h hurricane/BasicLayers.h + set ( includes hurricane/Mask.h + hurricane/BasicLayer.h hurricane/BasicLayers.h hurricane/RegularLayer.h hurricane/RegularLayers.h hurricane/ViaLayer.h hurricane/ViaLayers.h hurricane/ContactLayer.h @@ -36,8 +37,9 @@ hurricane/ListCollection.h hurricane/Locator.h hurricane/MapCollection.h - hurricane/Marker.h hurricane/Markers.h + hurricane/MultimapCollection.h hurricane/MultisetCollection.h + hurricane/Marker.h hurricane/Markers.h hurricane/Name.h hurricane/Names.h hurricane/NetExternalComponents.h hurricane/Net.h hurricane/Nets.h diff --git a/hurricane/src/hurricane/CellCollections.cpp b/hurricane/src/hurricane/CellCollections.cpp index c67c541f..ba108dc4 100644 --- a/hurricane/src/hurricane/CellCollections.cpp +++ b/hurricane/src/hurricane/CellCollections.cpp @@ -338,9 +338,9 @@ class Cell_ComponentsUnder : public Collection { , _mask(mask) , _sliceLocator() { - if (_cell && (_mask != 0)) { + if (_cell && !_mask.zero()) { _sliceLocator = getCollection(_cell->getExtensionSliceMap()).getLocator(); - while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask() & _mask)) + while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask().intersect(_mask))) _sliceLocator.progress(); } } @@ -387,7 +387,7 @@ class Cell_ComponentsUnder : public Collection { do { _sliceLocator.progress(); } - while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask() & _mask)); + while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask().intersect(_mask))); } } @@ -2077,7 +2077,7 @@ Cell_Slices::Locator::Locator(const Cell* cell, const Layer::Mask& mask) _mask(mask), _sliceLocator() { - if (_cell && (_mask != 0)) { + if (_cell && !_mask.zero()) { _sliceLocator = ((Cell*)_cell)->_getSliceMap().getElements().getLocator(); while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getLayer()->getMask() & _mask)) _sliceLocator.progress(); @@ -2231,7 +2231,7 @@ Cell_Components::Locator::Locator(const Cell* cell, const Layer::Mask& mask) _componentLocator(), _component(NULL) { - if (_cell && (_mask != 0)) { + if (_cell && !_mask.zero() ) { _sliceLocator = _cell->getSlices(_mask).getLocator(); while (!_component && _sliceLocator.isValid()) { Slice* slice = _sliceLocator.getElement(); @@ -3981,7 +3981,7 @@ Cell_ComponentOccurrences::Locator::Locator(const Cell* cell, const Layer::Mask& _instanceLocator(), _occurrenceLocator() { - if (_cell && (_mask != 0)) { + if (_cell && !_mask.zero() ) { _componentLocator = _cell->getComponents(_mask).getLocator(); if (_componentLocator.isValid()) _state = 1; @@ -4202,7 +4202,7 @@ Cell_ComponentOccurrencesUnder::Locator::Locator(const Cell* cell, const Box& ar _instanceLocator(), _occurrenceLocator() { - if (_cell && !_area.isEmpty() && (_mask != 0)) { + if (_cell && !_area.isEmpty() && !_mask.zero() ) { _componentLocator = _cell->getComponentsUnder(_area, _mask).getLocator(); if (_componentLocator.isValid()) _state = 1; @@ -4429,7 +4429,7 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path) _instanceLocator=cell->getInstances().getLocator(); - while (_netLocator.isValid() && !IsHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) + while (_netLocator.isValid() && !isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) _netLocator.progress(); if (!_netLocator.isValid()) @@ -4493,7 +4493,7 @@ void Cell_HyperNetRootNetOccurrences::Locator::progress() do { _netLocator.progress(); } - while (_netLocator.isValid() && !IsHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))); + while (_netLocator.isValid() && !isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))); } else if (_hyperNetRootNetOccurrenceLocator.isValid()) _hyperNetRootNetOccurrenceLocator.progress(); diff --git a/hurricane/src/hurricane/ExtensionSlice.cpp b/hurricane/src/hurricane/ExtensionSlice.cpp index 265c0d38..e21a4e9a 100644 --- a/hurricane/src/hurricane/ExtensionSlice.cpp +++ b/hurricane/src/hurricane/ExtensionSlice.cpp @@ -112,7 +112,7 @@ namespace Hurricane { if (record) { record->add(getSlot("Cell" , _cell )); record->add(getSlot("Name" , _name )); - record->add(getSlot("Mask" , _mask )); + record->add(getSlot("Mask" ,&_mask )); record->add(getSlot("QuadTree",&_quadTree)); } return record; diff --git a/hurricane/src/hurricane/HyperNet.cpp b/hurricane/src/hurricane/HyperNet.cpp index 3500b525..87577a2b 100644 --- a/hurricane/src/hurricane/HyperNet.cpp +++ b/hurricane/src/hurricane/HyperNet.cpp @@ -339,7 +339,7 @@ Occurrence getHyperNetRootNetOccurrence(const Occurrence& netoccurrence) } -bool IsHyperNetRootNetOccurrence(Occurrence netoccurrence) +bool isHyperNetRootNetOccurrence(Occurrence netoccurrence) // ******************************************************* { Net* net=dynamic_cast(netoccurrence.getEntity()); diff --git a/hurricane/src/hurricane/Layer.cpp b/hurricane/src/hurricane/Layer.cpp index 398c8386..b348c771 100644 --- a/hurricane/src/hurricane/Layer.cpp +++ b/hurricane/src/hurricane/Layer.cpp @@ -51,6 +51,7 @@ namespace Hurricane { , _minimalSpacing(minimalSpacing) , _pitch(pitch) , _nextOfTechnologyLayerMap(NULL) + , _working(false) { if ( !_technology ) throw Error ( "Can't create " + _TName("Layer") + " : null technology" ); @@ -71,6 +72,34 @@ namespace Hurricane { { return NULL; } + const Layer* Layer::getTop () const + { return NULL; } + + + const Layer* Layer::getBottom () const + { return NULL; } + + + const Layer* Layer::getOpposite ( const Layer* ) const + { return NULL; } + + + Layer* Layer::getMetalAbove ( bool useWorking ) const + { return _technology->getMetalAbove(this,useWorking); } + + + Layer* Layer::getMetalBelow ( bool useWorking ) const + { return _technology->getMetalBelow(this,useWorking); } + + + Layer* Layer::getCutAbove ( bool useWorking ) const + { return _technology->getCutAbove(this,useWorking); } + + + Layer* Layer::getCutBelow ( bool useWorking ) const + { return _technology->getCutBelow(this,useWorking); } + + DbU::Unit Layer::getEnclosure () const { return 0; } @@ -103,7 +132,7 @@ namespace Hurricane { bool Layer::intersect ( const Layer* layer ) const { - return ( (_mask & layer->getMask()) != 0 ); + return ( layer->getMask().contains(_mask) ); } @@ -165,7 +194,7 @@ namespace Hurricane { void Layer::_postCreate () { _technology->_getLayerMap()._insert(this); - _technology->_getLayerList().push_back(this); + _technology->_insertInLayerMaskMap(this); DBo::_postCreate(); } @@ -175,7 +204,7 @@ namespace Hurricane { { DBo::_preDestroy(); - _technology->_getLayerList().remove(this); + _technology->_getLayerMaskMap().erase(_mask); _technology->_getLayerMap()._remove(this); } @@ -192,13 +221,13 @@ namespace Hurricane { { Record* record = DBo::_getRecord(); if (record) { - record->add(getSlot("Technology", _technology)); - record->add(getSlot("Name", &_name)); - record->add(getSlot("Mask", &_mask)); - record->add(getSlot("ExtractMask", &_extractMask)); - record->add(getSlot("MinimalSize", &_minimalSize)); + record->add(getSlot("Technology" , _technology )); + record->add(getSlot("Name" , &_name )); + record->add(getSlot("Mask" , &_mask )); + record->add(getSlot("ExtractMask" , &_extractMask )); + record->add(getSlot("MinimalSize" , &_minimalSize )); record->add(getSlot("MinimalSpacing", &_minimalSpacing)); - record->add(getSlot("Pitch", &_pitch)); + record->add(getSlot("Pitch" , &_pitch )); } return record; } diff --git a/hurricane/src/hurricane/RegularLayer.cpp b/hurricane/src/hurricane/RegularLayer.cpp index bdb5a030..a2affd07 100644 --- a/hurricane/src/hurricane/RegularLayer.cpp +++ b/hurricane/src/hurricane/RegularLayer.cpp @@ -231,6 +231,18 @@ namespace Hurricane { { return RegularLayer_RegularLayers(this); } + const Layer* RegularLayer::getTop () const + { return getTechnology()->getLayer(_basicLayer->getMask()); } + + + const Layer* RegularLayer::getBottom () const + { return getTechnology()->getLayer(_basicLayer->getMask()); } + + + const Layer* RegularLayer::getOpposite ( const Layer* ) const + { return getTechnology()->getLayer(_basicLayer->getMask()); } + + DbU::Unit RegularLayer::getEnclosure () const { return _enclosure; } @@ -269,10 +281,14 @@ namespace Hurricane { if ( _basicLayer ) throw Error ( resetLayer, getString(getName()).c_str() ); - _basicLayer = basicLayer; + getTechnology()->_removeFromLayerMaskMap ( this ); + + _basicLayer = basicLayer; _setMask ( _basicLayer->getMask() ); _setExtractMask ( _basicLayer->getExtractMask() ); + + getTechnology()->_insertInLayerMaskMap ( this ); } diff --git a/hurricane/src/hurricane/Technology.cpp b/hurricane/src/hurricane/Technology.cpp index 77838ffd..4835b235 100644 --- a/hurricane/src/hurricane/Technology.cpp +++ b/hurricane/src/hurricane/Technology.cpp @@ -97,7 +97,7 @@ Technology::Technology(DataBase* dataBase, const Name& name) _dataBase(dataBase), _name(name), _layerMap(), - _layerList() + _layerMaskMap() { if (!_dataBase) throw Error("Can't create " + _TName("Technology") + " : null data base"); @@ -119,6 +119,16 @@ Technology* Technology::create(DataBase* dataBase, const Name& name) return technology; } +// Layer* Technology::getLayer ( Layer::Mask mask ) const +// // *************************************************** +// { +// LayerMaskMap::const_iterator ilayer = _layerMaskMap.find(mask); +// if ( ilayer == _layerMaskMap.end() ) +// return NULL; + +// return ilayer->second; +// } + BasicLayer* Technology::getBasicLayer(const Name& name) const // ********************************************************** { @@ -165,6 +175,94 @@ ViaLayers Technology::getViaLayers() const return SubTypeCollection(getLayers()); } + +Layer* Technology::getLayer ( const Layer::Mask& mask, bool useWorking ) const +{ + LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( mask ); + LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( mask ); + for ( ; lb != ub ; lb++ ) { + if ( !useWorking || lb->second->isWorking() ) return lb->second; + } + return NULL; +} + + +Layer* Technology::getMetalAbove ( const Layer* layer, bool useWorking ) const +{ + if ( !layer ) return NULL; + + LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); + for ( ; ub != _layerMaskMap.end() ; ub++ ) { + if ( _metalMask.contains(ub->second->getMask()) + && ( !useWorking || ub->second->isWorking() ) ) + return ub->second; + } + return NULL; +} + + +Layer* Technology::getMetalBelow ( const Layer* layer, bool useWorking ) const +{ + if ( !layer ) return NULL; + + LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); + if ( lb->second == layer ) lb--; + for ( ; lb != _layerMaskMap.begin() ; lb-- ) { + if ( _metalMask.contains(lb->second->getMask()) + && ( !useWorking || lb->second->isWorking() ) ) + return lb->second; + } + return NULL; +} + + +Layer* Technology::getCutAbove ( const Layer* layer, bool useWorking ) const +{ + if ( !layer ) return NULL; + + LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); + for ( ; ub != _layerMaskMap.end() ; ub++ ) { + if ( _cutMask.contains(ub->second->getMask()) + && ( !useWorking || ub->second->isWorking() ) ) + return ub->second; + } + return NULL; +} + + +Layer* Technology::getCutBelow ( const Layer* layer, bool useWorking ) const +{ + if ( !layer ) return NULL; + + LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); + if ( lb->second == layer ) lb--; + for ( ; lb != _layerMaskMap.begin() ; lb-- ) { + if ( _cutMask.contains(lb->second->getMask()) + && ( !useWorking || lb->second->isWorking() ) ) + return lb->second; + } + return NULL; +} + + +Layer* Technology::getViaBetween ( const Layer* metal1, const Layer* metal2 ) const +{ + if ( !metal1 || !metal2 ) return NULL; + if ( metal1->above(metal2) ) swap ( metal1, metal2 ); + + Layer* cutLayer = getCutBelow ( metal2 ); + if ( !cutLayer ) return NULL; + + return getLayer ( metal1->getMask() | metal2->getMask() | cutLayer->getMask() ); +} + + +Layer* Technology::getNthMetal ( int nth ) const +{ + return getLayer ( _metalMask.nthbit(nth) ); +} + + void Technology::setName(const Name& name) // *************************************** { @@ -176,6 +274,32 @@ void Technology::setName(const Name& name) } } + +bool Technology::setWorkingLayer ( const Name& name ) +{ + Layer* layer = getLayer ( name ); + if ( !layer ) return false; + + return setWorkingLayer ( layer ); +} + + +bool Technology::setWorkingLayer ( const Layer* layer ) +{ + bool found = false; + LayerMaskMap::iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); + LayerMaskMap::iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); + for ( ; lb != ub ; lb++ ) { + if ( lb->second == layer ) { + lb->second->setWorking ( true ); + found = true; + } else + lb->second->setWorking ( false ); + } + return found; +} + + void Technology::_postCreate() // *************************** { @@ -194,6 +318,34 @@ void Technology::_preDestroy() _dataBase->_setTechnology(NULL); } +void Technology::_insertInLayerMaskMap ( Layer* layer ) +// **************************************************** +{ + _layerMaskMap.insert ( make_pair(layer->getMask(),layer) ); +} + +void Technology::_removeFromLayerMaskMap ( Layer* layer ) +// ****************************************************** +{ + LayerMaskMap::iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); + LayerMaskMap::iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); + + for ( ; lb != ub ; lb++ ) { + if ( lb->second == layer ) { + _layerMaskMap.erase ( lb ); + break; + } + } +} + + +string Technology::_getTypeName () const +{ + return _TName("Technology"); +} + + + string Technology::_getString() const // ********************************** { @@ -207,9 +359,11 @@ Record* Technology::_getRecord() const { Record* record = Inherit::_getRecord(); if (record) { - record->add(getSlot("DataBase", _dataBase)); - record->add(getSlot("Name", &_name)); - record->add(getSlot("Layers", &_layerList)); + record->add(getSlot("DataBase", _dataBase)); + record->add(getSlot("Name", &_name)); + record->add(getSlot("Layers", &_layerMaskMap)); + record->add(getSlot("cutMask", &_cutMask)); + record->add(getSlot("metalMask", &_metalMask)); } return record; } diff --git a/hurricane/src/hurricane/ViaLayer.cpp b/hurricane/src/hurricane/ViaLayer.cpp index 63d7890f..afbcf894 100644 --- a/hurricane/src/hurricane/ViaLayer.cpp +++ b/hurricane/src/hurricane/ViaLayer.cpp @@ -104,7 +104,9 @@ namespace Hurricane { _basicLayers.reserve ( 3 ); _enclosures .reserve ( 3 ); - // Have to check wich one is top layer & cutLayer of type cut. + if ( bottomLayer->getMask() > topLayer->getMask() ) + swap ( bottomLayer, topLayer ); + _basicLayers.push_back ( bottomLayer ); _basicLayers.push_back ( cutLayer ); _basicLayers.push_back ( topLayer ); @@ -146,6 +148,22 @@ namespace Hurricane { { return getCollection(_basicLayers); } + const Layer* ViaLayer::getTop () const + { return getTechnology()->getLayer(_basicLayers[2]->getMask()); } + + + const Layer* ViaLayer::getBottom () const + { return getTechnology()->getLayer(_basicLayers[0]->getMask()); } + + + const Layer* ViaLayer::getOpposite ( const Layer* layer ) const + { + if ( layer->getMask() == _basicLayers[0]->getMask() ) return getTop(); + if ( layer->getMask() == _basicLayers[2]->getMask() ) return getBottom(); + return NULL; + } + + DbU::Unit ViaLayer::getEnclosure () const { return _maximalEnclosure; diff --git a/hurricane/src/hurricane/hurricane/Collection.h b/hurricane/src/hurricane/hurricane/Collection.h index 45f9a49e..4a684405 100644 --- a/hurricane/src/hurricane/hurricane/Collection.h +++ b/hurricane/src/hurricane/hurricane/Collection.h @@ -894,6 +894,7 @@ template inline Hurricane::Record* getRecord ( const Hurricane::C #include "hurricane/MultisetCollection.h" #include "hurricane/SetCollection.h" #include "hurricane/MapCollection.h" +#include "hurricane/MultimapCollection.h" #include "hurricane/ListCollection.h" #include "hurricane/VectorCollection.h" diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index db9bbead..a3b79b95 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -51,9 +51,6 @@ // x-----------------------------------------------------------------x -//using namespace std; - - namespace Hurricane { @@ -526,21 +523,21 @@ inline Hurricane::Record* getRecord ( const std::multiset* s ) # define GETSTRING_POINTER_SUPPORT(Data) \ template<> inline std::string getString( Data* data ) \ - { if (!data) return "NULL " #Data; return data->_getString(); } \ + { if (!data) return "NULL [" #Data "]"; return data->_getString(); } \ \ template<> inline std::string getString( const Data* data ) \ - { if (!data) return "NULL const " #Data; return data->_getString(); } + { if (!data) return "NULL [const " #Data "]"; return data->_getString(); } # define IOSTREAM_POINTER_SUPPORT(Data) \ inline std::ostream& operator<< ( std::ostream& o, Data* d ) \ { \ - if (!d) return o << "NULL"; \ + if (!d) return o << "NULL [" #Data "]"; \ return o << "&" << getString(d); \ } \ inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \ { \ - if (!d) return o << "NULL"; \ + if (!d) return o << "NULL [const " #Data "]"; \ return o << "&" << getString(d); \ } diff --git a/hurricane/src/hurricane/hurricane/ExtensionGo.h b/hurricane/src/hurricane/hurricane/ExtensionGo.h index afb61bd3..01c57cc2 100644 --- a/hurricane/src/hurricane/hurricane/ExtensionGo.h +++ b/hurricane/src/hurricane/hurricane/ExtensionGo.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// This file is part of the Hurricane Software. +// This file is part of the Coriolis Software. // Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // // =================================================================== diff --git a/hurricane/src/hurricane/hurricane/ExtensionSlice.h b/hurricane/src/hurricane/hurricane/ExtensionSlice.h index 7000daae..7ddd55a1 100644 --- a/hurricane/src/hurricane/hurricane/ExtensionSlice.h +++ b/hurricane/src/hurricane/hurricane/ExtensionSlice.h @@ -26,6 +26,7 @@ #ifndef __HURRICANE_EXTENSION_SLICE__ #define __HURRICANE_EXTENSION_SLICE__ +#include "hurricane/Mask.h" #include "hurricane/Name.h" #include "hurricane/ExtensionSlices.h" #include "hurricane/QuadTree.h" @@ -40,7 +41,7 @@ namespace Hurricane { class ExtensionSlice { public: - typedef unsigned long long Mask; + typedef Hurricane::Mask Mask; public: // Constructor & Destructor. static ExtensionSlice* _create ( Cell* , const Name& ); diff --git a/hurricane/src/hurricane/hurricane/HyperNet.h b/hurricane/src/hurricane/hurricane/HyperNet.h index b0eec948..61c7656c 100644 --- a/hurricane/src/hurricane/hurricane/HyperNet.h +++ b/hurricane/src/hurricane/hurricane/HyperNet.h @@ -64,7 +64,7 @@ class HyperNet { Occurrence getHyperNetRootNetOccurrence(const Occurrence& netoccurrence); -bool IsHyperNetRootNetOccurrence(Occurrence netoccurrence); +bool isHyperNetRootNetOccurrence(Occurrence netoccurrence); diff --git a/hurricane/src/hurricane/hurricane/Layer.h b/hurricane/src/hurricane/hurricane/Layer.h index 12cdbd26..34173d80 100644 --- a/hurricane/src/hurricane/hurricane/Layer.h +++ b/hurricane/src/hurricane/hurricane/Layer.h @@ -1,5 +1,4 @@ - // -*- C++ -*- // // This file is part of the Hurricane Software. @@ -27,6 +26,7 @@ # ifndef __HURRICANE_LAYER__ # define __HURRICANE_LAYER__ +# include "hurricane/Mask.h" # include "hurricane/DBo.h" # include "hurricane/Layers.h" # include "hurricane/DbU.h" @@ -43,7 +43,7 @@ namespace Hurricane { public: // Types. - typedef unsigned long long Mask; + typedef Hurricane::Mask Mask; // Accessors. inline Technology* getTechnology () const; inline const Name& getName () const; @@ -54,6 +54,13 @@ namespace Hurricane { inline DbU::Unit getPitch () const; virtual BasicLayers getBasicLayers () const = 0; virtual Layer* getConnectorLayer () const; + virtual const Layer* getTop () const; + virtual const Layer* getBottom () const; + virtual const Layer* getOpposite ( const Layer* ) const; + Layer* getMetalAbove ( bool useWorking=true ) const; + Layer* getMetalBelow ( bool useWorking=true ) const; + Layer* getCutAbove ( bool useWorking=true ) const; + Layer* getCutBelow ( bool useWorking=true ) const; virtual Layer* getObstructionLayer () const; virtual DbU::Unit getEnclosure () const; virtual DbU::Unit getExtentionCap () const; @@ -62,10 +69,14 @@ namespace Hurricane { virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; // Predicates + inline bool above ( const Layer* layer ) const; + inline bool below ( const Layer* layer ) const; bool contains ( const Layer* layer ) const; bool intersect ( const Layer* layer ) const; + inline bool isWorking () const; // Updators void setName ( const Name& name ); + inline void setWorking ( bool ); void setMinimalSize ( const DbU::Unit& minimalSize ); void setMinimalSpacing ( const DbU::Unit& minimalSpacing ); void setPitch ( const DbU::Unit& pitch ); @@ -79,7 +90,10 @@ namespace Hurricane { inline void _setMask ( const Mask& mask ); inline void _setExtractMask ( const Mask& extractMask ); inline void _setNextOfTechnologyLayerMap ( Layer* layer ); - + public: + struct MaskCompare { + inline bool operator () ( const Layer*, const Layer* ) const; + }; private: // Internal: Attributes @@ -91,6 +105,7 @@ namespace Hurricane { DbU::Unit _minimalSpacing; DbU::Unit _pitch; Layer* _nextOfTechnologyLayerMap; + bool _working; protected: // Internal: Constructors & Destructors. @@ -106,6 +121,9 @@ namespace Hurricane { // Inline Functions. + inline bool Layer::isWorking () const { return _working; } + inline bool Layer::above ( const Layer* layer ) const { return _mask > layer->getMask(); } + inline bool Layer::below ( const Layer* layer ) const { return _mask < layer->getMask(); } inline Technology* Layer::getTechnology () const { return _technology; } inline const Name& Layer::getName () const { return _name; } inline const Layer::Mask& Layer::getMask () const { return _mask; } @@ -113,17 +131,22 @@ namespace Hurricane { inline const DbU::Unit& Layer::getMinimalSize () const { return _minimalSize; } inline const DbU::Unit& Layer::getMinimalSpacing () const { return _minimalSpacing; } inline DbU::Unit Layer::getPitch () const { return (!_pitch?(_minimalSize + _minimalSpacing):_pitch); } + inline void Layer::setWorking ( bool state ) { _working = state; } inline Layer* Layer::_getNextOfTechnologyLayerMap () const { return _nextOfTechnologyLayerMap; } inline void Layer::_setMask ( const Mask& mask ) { _mask = mask; } inline void Layer::_setExtractMask ( const Mask& extractMask ) { _extractMask = extractMask; } inline void Layer::_setNextOfTechnologyLayerMap ( Layer* layer ) { _nextOfTechnologyLayerMap = layer; } + inline bool Layer::MaskCompare::operator () ( const Layer* layer1, const Layer* layer2 ) const + { return layer1->getMask() < layer2->getMask(); } + } // End of Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::Layer); +INSPECTOR_PV_SUPPORT(Hurricane::Layer::Mask); # endif diff --git a/hurricane/src/hurricane/hurricane/Mask.h b/hurricane/src/hurricane/hurricane/Mask.h new file mode 100644 index 00000000..0e6c5253 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/Mask.h @@ -0,0 +1,184 @@ + +// -*- 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@lip6.fr | +// | =============================================================== | +// | C++ Header : "./Mask.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_MASK__ +#define __HURRICANE_MASK__ + +#include +#include "hurricane/Commons.h" + + +namespace Hurricane { + + + template + class Mask { + public: + // Methods. + inline Mask ( IntType mask=0 ); + inline bool zero () const; + inline Mask& set ( const Mask mask ); + inline Mask& unset ( const Mask mask ); + inline bool contains ( const Mask mask ) const; + inline bool intersect ( const Mask mask ) const; + inline Mask nthbit ( unsigned int ) const; + inline Mask operator compl () const; + inline Mask operator bitand ( const Mask mask ) const; + inline Mask operator bitor ( const Mask mask ) const; + inline Mask operator xor ( const Mask mask ) const; + inline Mask lshift ( unsigned int ) const; + inline Mask rshift ( unsigned int ) const; + inline Mask& operator |= ( const Mask mask ); + inline Mask& operator &= ( const Mask mask ); + inline bool operator == ( const Mask mask ) const; + inline bool operator != ( const Mask mask ) const; + inline bool operator < ( const Mask mask ) const; + inline bool operator > ( const Mask mask ) const; + inline operator IntType () const; + // Hurricane Managment. + inline string _getTypeName () const; + inline string _getString () const; + inline Record* _getRecord () const; + protected: + // Internal: Attributes. + static size_t _width; + IntType _mask; + }; + + +// Inline Functions. + template + inline Mask::Mask ( IntType mask ) : _mask(mask) { } + + template + inline bool Mask::zero () const + { return _mask == 0; } + + template + inline Mask& Mask::set ( const Mask mask ) + { _mask |= mask._mask; return *this; } + + template + inline Mask& Mask::unset ( const Mask mask ) + { _mask &= ~mask._mask; return *this; } + + template + inline bool Mask::contains ( const Mask mask ) const + { return (_mask & mask._mask) && !(~_mask & mask._mask); } + + template + inline bool Mask::intersect ( const Mask mask ) const + { return _mask & mask._mask; } + + template + inline Mask Mask::nthbit ( unsigned int nth ) const + { + IntType select = 1; + for ( ; select ; select=select<<1 ) { + if ( _mask & select ) nth--; + if ( !nth ) break; + } + return select; + } + + template + inline Mask Mask::operator compl () const + { return ~_mask; } + + template + inline Mask Mask::operator bitand ( const Mask mask ) const + { return _mask & mask._mask; } + + template + inline Mask Mask::operator bitor ( const Mask mask ) const + { return _mask | mask._mask; } + + template + inline Mask Mask::operator xor ( const Mask mask ) const + { return _mask ^ mask._mask; } + + template + inline Mask Mask::lshift ( unsigned int s ) const + { return _mask << s; } + + template + inline Mask Mask::rshift ( unsigned int s ) const + { return _mask >> s; } + + template + inline Mask& Mask::operator |= ( const Mask mask ) + { _mask |= mask._mask; return *this; } + + template + inline Mask& Mask::operator &= ( const Mask mask ) + { _mask &= mask._mask; return *this; } + + template + inline bool Mask::operator == ( const Mask mask ) const + { return _mask == mask._mask; } + + template + inline bool Mask::operator != ( const Mask mask ) const + { return _mask == mask._mask; } + + template + inline bool Mask::operator < ( const Mask mask ) const + { return _mask < mask._mask; } + + template + inline bool Mask::operator > ( const Mask mask ) const + { return _mask > mask._mask; } + + template + inline Mask::operator IntType () const { return _mask; } + + template + inline string Mask::_getTypeName () const { return _TName("Mask"); } + + template + inline string Mask::_getString () const + { + std::ostringstream formatted; + formatted << "0x" << std::hex << std::setw(_width) << std::setfill('0') << _mask; + return formatted.str(); + } + + template + inline Record* Mask::_getRecord () const + { + Record* record = new Record ( _getString() ); + record->add(getSlot("Mask", &_mask)); + return record; + } + + + template + size_t Mask::_width = sizeof(IntType)<<2; + + +} // End of Hurricane namespace. + + +# endif // __HURRICANE_MASK__ diff --git a/hurricane/src/hurricane/hurricane/MultimapCollection.h b/hurricane/src/hurricane/hurricane/MultimapCollection.h new file mode 100644 index 00000000..761dd850 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/MultimapCollection.h @@ -0,0 +1,440 @@ + +// -*- 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@lip6.fr | +// | =============================================================== | +// | C++ Header : "./MultimapCollection.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_MULTIMAP_COLLECTION__ +#define __HURRICANE_MULTIMAP_COLLECTION__ + +#include "hurricane/Commons.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class Template : "Hurricane::MultimapCollection". + + template > + class MultimapCollection : public Collection { + public: + // Types. + typedef std::multimap Multimap; + public: + // Locator sub-class. + class Locator : public Hurricane::Locator { + public: + Locator ( const Multimap* ); + virtual Element getElement () const; + virtual Hurricane::Locator* getClone () const; + virtual bool isValid () const; + virtual void progress (); + private: + const Multimap* _elements; + typename Multimap::const_iterator _iterator; + }; + + public: + // Methods. + MultimapCollection ( const Multimap* elements=NULL ); + MultimapCollection ( const Multimap& ); + MultimapCollection ( const MultimapCollection& ); + MultimapCollection& operator= ( const MultimapCollection& ); + virtual Collection* getClone () const; + virtual Hurricane::Locator* getLocator () const; + virtual unsigned getSize () const; + virtual string _getTypeName () const; + virtual string _getString () const; + Record* _getRecord () const; + + private: + // Internal: Attributes. + const Multimap* _elements; + }; + + +// ------------------------------------------------------------------- +// Class Definition : "Hurricane::MultimapCollection::Locator". + + + template + MultimapCollection::Locator::Locator ( const Multimap* elements ) + : Hurricane::Locator() + , _elements(elements) + , _iterator() + { if (_elements) _iterator = _elements->begin(); }; + + + template + Element MultimapCollection::Locator::getElement () const + { + return (isValid()) ? (*_iterator).second : Element(); + } + + + template + Hurricane::Locator* MultimapCollection::Locator::getClone () const + { + return new Locator(_elements); + } + + + template + bool MultimapCollection::Locator::isValid () const + { + return (_elements && (_iterator != _elements->end())); + } + + + template + void MultimapCollection::Locator::progress () + { + ++_iterator; + } + + +// ------------------------------------------------------------------- +// Class Definition : "Hurricane::MultimapCollection::Locator". + + + template + MultimapCollection::MultimapCollection ( const Multimap* elements ) + : Collection() + , _elements(elements) + { } + + + template + MultimapCollection::MultimapCollection ( const Multimap& elements ) + : Collection() + , _elements(&elements) + { } + + + template + MultimapCollection::MultimapCollection ( const MultimapCollection& collection ) + : Collection() + , _elements(collection._elements) + { } + + + template + MultimapCollection& MultimapCollection::operator= ( const MultimapCollection& collection ) + { + _elements = collection._elements; + return *this; + } + + + template + Collection* MultimapCollection::getClone () const + { + return new MultimapCollection(*this); + } + + + template + Hurricane::Locator* MultimapCollection::getLocator () const + { + return (_elements) ? new Locator(_elements) : NULL; + } + + + template + unsigned MultimapCollection::getSize () const + { + return (_elements) ? _elements->size() : 0; + } + + + template + string MultimapCollection::_getTypeName () const + { + return _TName("MultimapCollection"); + } + + + template + string MultimapCollection::_getString () const + { + if (!_elements) + return "<" + _getTypeName() + " unbound>"; + else { + if (_elements->empty()) + return "<" + _getTypeName() + " empty>"; + else + return "<" + _getTypeName() + " " + getString(_elements->size()) + ">"; + } + } + + + template + Record* MultimapCollection::_getRecord () const + { + Record* record = NULL; + if (!_elements->empty()) { + record = new Record(_getString()); + typename map::const_iterator iterator = _elements->begin(); + while (iterator != _elements->end()) { + record->add(getSlot(getString((*iterator).first), (*iterator).second)); + ++iterator; + } + } + return record; + } + + +// ------------------------------------------------------------------- +// Functions Templates. + + +// template +// inline GenericCollection getCollection ( const std::multimap& elements ) +// { +// return MultimapCollection(elements); +// } + + + template + inline GenericCollection getCollection ( const std::multimap* elements ) + { + return MultimapCollection(elements); + } + + +// ------------------------------------------------------------------- +// Class Template : "Hurricane::MultimapRangeCollection". + + template > + class MultimapRangeCollection : public Collection { + public: + // Types. + typedef std::multimap Multimap; + public: + // Locator sub-class. + class Locator : public Hurricane::Locator { + public: + Locator ( const Multimap*, const Key& ); + virtual Element getElement () const; + virtual Hurricane::Locator* getClone () const; + virtual bool isValid () const; + virtual void progress (); + private: + const Multimap* _elements; + const Key _key; + typename Multimap::const_iterator _iterator; + typename Multimap::const_iterator _upperbound; + }; + + public: + // Methods. + MultimapRangeCollection ( const Multimap*, const Key& ); + MultimapRangeCollection ( const Multimap&, const Key& ); + MultimapRangeCollection ( const MultimapRangeCollection& ); + MultimapRangeCollection& operator= ( const MultimapRangeCollection& ); + virtual Collection* getClone () const; + virtual Hurricane::Locator* getLocator () const; + virtual unsigned getSize () const; + virtual string _getTypeName () const; + virtual string _getString () const; + Record* _getRecord () const; + + private: + // Internal: Attributes. + const Multimap* _elements; + const Key _key; + }; + + +// ------------------------------------------------------------------- +// Class Definition : "Hurricane::MultimapRangeCollection::Locator". + + + template + MultimapRangeCollection::Locator::Locator ( const Multimap* elements, const Key& key ) + : Hurricane::Locator() + , _elements(elements) + , _key(key) + , _iterator() + , _upperbound() + { + if (_elements) { + _iterator = _elements->lower_bound(key); + _upperbound = _elements->upper_bound(key); + } + }; + + + template + Element MultimapRangeCollection::Locator::getElement () const + { + return (isValid()) ? (*_iterator).second : Element(); + } + + + template + Hurricane::Locator* MultimapRangeCollection::Locator::getClone () const + { + return new Locator(_elements,_key); + } + + + template + bool MultimapRangeCollection::Locator::isValid () const + { + return (_elements && (_iterator != _upperbound)); + } + + + template + void MultimapRangeCollection::Locator::progress () + { + ++_iterator; + } + + +// ------------------------------------------------------------------- +// Class Definition : "Hurricane::MultimapRangeCollection::Locator". + + + template + MultimapRangeCollection::MultimapRangeCollection ( const Multimap* elements, const Key& key ) + : Collection() + , _elements(elements) + , _key(key) + { } + + + template + MultimapRangeCollection::MultimapRangeCollection ( const Multimap& elements, const Key& key ) + : Collection() + , _elements(&elements) + , _key(key) + { } + + + template + MultimapRangeCollection::MultimapRangeCollection ( const MultimapRangeCollection& collection ) + : Collection() + , _elements(collection._elements) + , _key(collection._key) + { } + + + template + MultimapRangeCollection& MultimapRangeCollection::operator= ( const MultimapRangeCollection& collection ) + { + _elements = collection._elements; + _key = collection._key; + return *this; + } + + + template + Collection* MultimapRangeCollection::getClone () const + { + return new MultimapRangeCollection(*this); + } + + + template + Hurricane::Locator* MultimapRangeCollection::getLocator () const + { + return (_elements) ? new Locator(_elements,_key) : NULL; + } + + + template + unsigned MultimapRangeCollection::getSize () const + { + if ( !_elements ) return 0; + + size_t size = 0; + typename Multimap::const_iterator lb = _elements->upper_bound(_key); + typename Multimap::const_iterator ub = _elements->upper_bound(_key); + for ( ; lb != ub ; lb++, size++ ); + + return size; + } + + + template + string MultimapRangeCollection::_getTypeName () const + { + return _TName("MultimapRangeCollection"); + } + + + template + string MultimapRangeCollection::_getString () const + { + if (!_elements) + return "<" + _getTypeName() + " unbound>"; + else { + if (_elements->empty()) + return "<" + _getTypeName() + " empty>"; + else + return "<" + _getTypeName() + " " + getString(_elements->size()) + ">"; + } + } + + + template + Record* MultimapRangeCollection::_getRecord () const + { + Record* record = NULL; + if (!_elements->empty()) { + typename Multimap::const_iterator upperbound = _elements->upper_bound(_key); + record = new Record(_getString()); + typename map::const_iterator iterator = _elements->lower_bound(_key); + while (iterator != upperbound) { + record->add(getSlot(getString((*iterator).first), (*iterator).second)); + ++iterator; + } + } + return record; + } + + +// ------------------------------------------------------------------- +// Functions Templates. + + +// template +// inline GenericCollection getRangeCollection ( const std::multimap& elements, Key& key ) +// { +// return MultimapRangeCollection(elements,key); +// } + + + template + inline GenericCollection getRangeCollection ( const std::multimap* elements, const Key& key ) + { + return MultimapRangeCollection(elements,key); + } + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_MULTIMAP_COLLECTION__ diff --git a/hurricane/src/hurricane/hurricane/Property.h b/hurricane/src/hurricane/hurricane/Property.h index da21fa11..8b3f48d8 100644 --- a/hurricane/src/hurricane/hurricane/Property.h +++ b/hurricane/src/hurricane/hurricane/Property.h @@ -148,23 +148,26 @@ namespace Hurricane { template class StandardPrivateProperty : public PrivateProperty { public: - static Name staticGetName (); - static StandardPrivateProperty* get ( const DBo* ); + static Name staticGetName (); + static Value* staticGetValue ( const DBo* ); + static StandardPrivateProperty* get ( const DBo*, bool create=false ); // Constructors. - static StandardPrivateProperty* create (); - static StandardPrivateProperty* create ( const Value& ); + static StandardPrivateProperty* create (); + static StandardPrivateProperty* create ( const Value& ); // Methods. - virtual Name getName () const; - Value& getValue () const; - void setValue ( const Value& ); - virtual string _getTypeName () const; - virtual string _getString () const; - virtual Record* _getRecord () const; + virtual Name getName () const; + Value& getValue () const; + void setValue ( const Value& ); + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; private: // Internal: Attributes. - static Name _name; - mutable Value _value; + static Name _name; + static DBo* _owner; + static StandardPrivateProperty* _cache; + mutable Value _value; protected: // Internal: Constructor. @@ -173,6 +176,14 @@ namespace Hurricane { }; + template + DBo* StandardPrivateProperty::_owner = NULL; + + + template + StandardPrivateProperty* StandardPrivateProperty::_cache = NULL; + + template Name StandardPrivateProperty::staticGetName () { @@ -180,36 +191,50 @@ namespace Hurricane { } + template + Value* StandardPrivateProperty::staticGetValue ( const DBo* object ) + { + if ( ( object == _owner ) || get(object) ) return _cache->getValue(); + return NULL; + } + + template StandardPrivateProperty* StandardPrivateProperty::create () { - StandardPrivateProperty* property = new StandardPrivateProperty(); - property->_postCreate(); - return property; + _cache = new StandardPrivateProperty(); + _cache->_postCreate(); + return _cache; } template StandardPrivateProperty* StandardPrivateProperty::create ( const Value& value ) { - StandardPrivateProperty* property = new StandardPrivateProperty(value); - property->_postCreate(); - return property; + _cache = new StandardPrivateProperty(value); + _cache->_postCreate(); + return _cache; } template - StandardPrivateProperty* StandardPrivateProperty::get ( const DBo* object ) + StandardPrivateProperty* StandardPrivateProperty::get ( const DBo* object, bool create ) { - Property* property1 = object->getProperty ( StandardPrivateProperty::staticGetName() ); - StandardPrivateProperty* property2 = dynamic_cast*> ( property1 ); - - if ( property1 && !property2 ) - throw Error ( propertyTypeNameError - , getString(StandardPrivateProperty::staticGetName()).c_str() - , getString(object).c_str() ); + if ( object == _owner ) return _cache; - return property2; + Property* property = object->getProperty ( StandardPrivateProperty::staticGetName() ); + _cache = dynamic_cast*> ( property ); + + if ( !_cache ) { + if ( property ) + throw Error ( propertyTypeNameError + , getString(StandardPrivateProperty::staticGetName()).c_str() + , getString(object).c_str() ); + else if ( create ) + const_cast(object)->put ( StandardPrivateProperty::create() ); + } + + return _cache; } @@ -313,23 +338,26 @@ namespace Hurricane { template class StandardSharedProperty : public SharedProperty { public: - static Name staticGetName (); - static StandardSharedProperty* get ( const DBo* ); + static Name staticGetName (); + static Value* staticGetValue ( const DBo* ); + static StandardSharedProperty* get ( const DBo*, bool create=false ); // Constructors. - static StandardSharedProperty* create (); - static StandardSharedProperty* create ( const Value& ); + static StandardSharedProperty* create (); + static StandardSharedProperty* create ( const Value& ); // Methods. - virtual Name getName () const; - Value& getValue () const; - void setValue ( const Value& ); - virtual string _getTypeName () const; - virtual string _getString () const; - virtual Record* _getRecord () const; + virtual Name getName () const; + Value& getValue () const; + void setValue ( const Value& ); + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; private: // Internal: Attributes. - static Name _name; - mutable Value _value; + static Name _name; + static DBo* _owner; + static StandardSharedProperty* _cache; + mutable Value _value; protected: // Internal: Constructor. @@ -339,6 +367,14 @@ namespace Hurricane { // Template function members. + template + DBo* StandardSharedProperty::_owner = NULL; + + + template + StandardSharedProperty* StandardSharedProperty::_cache = NULL; + + template Name StandardSharedProperty::staticGetName () { @@ -346,36 +382,50 @@ namespace Hurricane { } + template + Value* StandardSharedProperty::staticGetValue ( const DBo* object ) + { + if ( ( object == _owner ) || get(object) ) return _cache->getValue(); + return NULL; + } + + template StandardSharedProperty* StandardSharedProperty::create () { - StandardSharedProperty* property = new StandardSharedProperty(); - property->_postCreate(); - return property; + _cache = new StandardSharedProperty(); + _cache->_postCreate(); + return _cache; } template StandardSharedProperty* StandardSharedProperty::create ( const Value& value ) { - StandardSharedProperty* property = new StandardPrivateProperty(value); - property->_postCreate(); - return property; + _cache = new StandardPrivateProperty(value); + _cache->_postCreate(); + return _cache; } template - StandardSharedProperty* StandardSharedProperty::get ( const DBo* object ) + StandardSharedProperty* StandardSharedProperty::get ( const DBo* object, bool create ) { - Property* property1 = object->getProperty ( StandardSharedProperty::staticGetName() ); - StandardSharedProperty* property2 = dynamic_cast*> ( property1 ); - - if ( property1 && !property2 ) - throw Error ( propertyTypeNameError - , getString(StandardSharedProperty::staticGetName()).c_str() - , getString(object).c_str() ); + if ( _owner == object ) return _cache; - return property2; + Property* property = object->getProperty ( StandardSharedProperty::staticGetName() ); + _cache = dynamic_cast*> ( property ); + + if ( !_cache ) { + if ( property ) + throw Error ( propertyTypeNameError + , getString(StandardSharedProperty::staticGetName()).c_str() + , getString(object).c_str() ); + else if ( create ) + const_cast(object)->put ( StandardSharedProperty::create() ); + } + + return _cache; } diff --git a/hurricane/src/hurricane/hurricane/RegularLayer.h b/hurricane/src/hurricane/hurricane/RegularLayer.h index 4a2c9fe4..161fc40b 100644 --- a/hurricane/src/hurricane/hurricane/RegularLayer.h +++ b/hurricane/src/hurricane/hurricane/RegularLayer.h @@ -2,36 +2,8 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // // =================================================================== // @@ -42,7 +14,7 @@ // | 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 : Remy Escassut | +// | Author : Jean-Paul Chaput | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./RegularLayer.h" | @@ -72,12 +44,15 @@ namespace Hurricane { // Accessors. virtual BasicLayers getBasicLayers () const; inline BasicLayer* getBasicLayer () const; - virtual DbU::Unit getEnclosure () const; - virtual DbU::Unit getExtentionCap () const; - virtual DbU::Unit getExtentionWidth () const; - virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const; - virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; - virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; + virtual const Layer* getTop () const; + virtual const Layer* getBottom () const; + virtual const Layer* getOpposite ( const Layer* ) const; + virtual DbU::Unit getEnclosure () const; + virtual DbU::Unit getExtentionCap () const; + virtual DbU::Unit getExtentionWidth () const; + virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const; + virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; + virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; // Updators void setBasicLayer ( BasicLayer* layer ); virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure ); @@ -91,9 +66,9 @@ namespace Hurricane { private: // Internal: Attributes BasicLayer* _basicLayer; - DbU::Unit _enclosure; - DbU::Unit _extentionCap; - DbU::Unit _extentionWidth; + DbU::Unit _enclosure; + DbU::Unit _extentionCap; + DbU::Unit _extentionWidth; protected: // Internal: Constructors & Destructors. diff --git a/hurricane/src/hurricane/hurricane/Technology.h b/hurricane/src/hurricane/hurricane/Technology.h index ab1bae78..04e37105 100644 --- a/hurricane/src/hurricane/hurricane/Technology.h +++ b/hurricane/src/hurricane/hurricane/Technology.h @@ -1,105 +1,138 @@ -// **************************************************************************************************** -// File: Technology.h -// Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved -// **************************************************************************************************** -#ifndef HURRICANE_TECHNOLOGY -#define HURRICANE_TECHNOLOGY +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | 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 : "./Technology.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_TECHNOLOGY__ +#define __HURRICANE_TECHNOLOGY__ + +#include +#include "hurricane/Mask.h" +#include "hurricane/DBo.h" +#include "hurricane/Layer.h" +#include "hurricane/BasicLayers.h" +#include "hurricane/RegularLayers.h" +#include "hurricane/ViaLayers.h" +#include "hurricane/IntrusiveMap.h" -#include "hurricane/DBo.h" -#include "hurricane/Layer.h" -#include "hurricane/BasicLayers.h" -#include "hurricane/RegularLayers.h" -#include "hurricane/ViaLayers.h" -#include "hurricane/IntrusiveMap.h" namespace Hurricane { -class DataBase; -class BasicLayer; -class RegularLayer; -class ViaLayer; + using std::multimap; + + class DataBase; + class BasicLayer; + class RegularLayer; + class ViaLayer; +// ------------------------------------------------------------------- +// Class : "Hurricane::Technology". -// **************************************************************************************************** -// Technology declaration -// **************************************************************************************************** -class Technology : public DBo { -// ************************** + class Technology : public DBo { -// Types -// ***** + public: + typedef DBo Inherit; + typedef multimap LayerMaskMap; - public: typedef DBo Inherit; + public: + // Sub-class : LayerMap. + class LayerMap : public IntrusiveMap { + public: + typedef IntrusiveMap Inherit; + public: + LayerMap (); + virtual Name _getKey ( Layer* ) const; + virtual unsigned _getHashValue ( Name ) const; + virtual Layer* _getNextElement ( Layer* ) const; + virtual void _setNextElement ( Layer* , Layer* nextLayer) const; + }; - public: class LayerMap : public IntrusiveMap { - // ****************************************************** + public: + // Constructor. + static Technology* create ( DataBase* , const Name& ); + // Accessors. + inline DataBase* getDataBase () const; + inline const Name& getName () const; + inline Layer* getLayer ( const Name& ) const; + BasicLayer* getBasicLayer ( const Name& ) const; + RegularLayer* getRegularLayer ( const Name& ) const; + ViaLayer* getViaLayer ( const Name& ) const; + inline Layers getLayers () const; + BasicLayers getBasicLayers () const; + BasicLayers getBasicLayers ( const Layer::Mask& ) const; + RegularLayers getRegularLayers () const; + ViaLayers getViaLayers () const; + Layer* getLayer ( const Layer::Mask&, bool useWorking=true ) const; + Layer* getMetalAbove ( const Layer*, bool useWorking=true ) const; + Layer* getMetalBelow ( const Layer*, bool useWorking=true ) const; + Layer* getCutAbove ( const Layer*, bool useWorking=true ) const; + Layer* getCutBelow ( const Layer*, bool useWorking=true ) const; + Layer* getViaBetween ( const Layer*, const Layer* ) const; + Layer* getNthMetal ( int ) const; + // Updators. + void setName ( const Name& ); + bool setWorkingLayer ( const Name& ); + bool setWorkingLayer ( const Layer* ); + // Others. + inline LayerMap& _getLayerMap (); + inline LayerMaskMap& _getLayerMaskMap (); + void _insertInLayerMaskMap ( Layer* ); + void _removeFromLayerMaskMap ( Layer* ); + inline Layer::Mask& _getCutMask (); + inline Layer::Mask& _getMetalMask (); + // Hurricane Managment. + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; + + private: + // Internal: Attributes. + DataBase* _dataBase; + Name _name; + LayerMap _layerMap; + LayerMaskMap _layerMaskMap; + Layer::Mask _cutMask; + Layer::Mask _metalMask; - public: typedef IntrusiveMap Inherit; - - public: LayerMap(); + protected: + // Constructors & Destructors. + Technology ( DataBase* , const Name& ); + virtual void _postCreate (); + virtual void _preDestroy (); + }; - public: virtual Name _getKey(Layer* layer) const; - public: virtual unsigned _getHashValue(Name name) const; - public: virtual Layer* _getNextElement(Layer* layer) const; - public: virtual void _setNextElement(Layer* layer, Layer* nextLayer) const; - }; - - public: typedef list LayerList; - -// Attributes -// ********** - - private: DataBase* _dataBase; - private: Name _name; - private: LayerMap _layerMap; - private: LayerList _layerList; - -// Constructors -// ************ - - protected: Technology(DataBase* dataBase, const Name& name); - - public: static Technology* create(DataBase* dataBase, const Name& name); - -// Accessors -// ********* - - public: DataBase* getDataBase() const {return _dataBase;}; - public: const Name& getName() const {return _name;}; - public: Layer* getLayer(const Name& name) const {return _layerMap.getElement(name);}; - public: BasicLayer* getBasicLayer(const Name& name) const; - public: RegularLayer* getRegularLayer(const Name& name) const; - public: ViaLayer* getViaLayer(const Name& name) const; - public: Layers getLayers() const {return getCollection(_layerList);}; - public: BasicLayers getBasicLayers() const; - public: BasicLayers getBasicLayers(const Layer::Mask& mask) const; - public: RegularLayers getRegularLayers() const; - public: ViaLayers getViaLayers() const; - -// Updators -// ******** - - public: void setName(const Name& name); - -// Others -// ****** - - protected: virtual void _postCreate(); - - protected: virtual void _preDestroy(); - - public: virtual string _getTypeName() const {return _TName("Technology");}; - public: virtual string _getString() const; - public: virtual Record* _getRecord() const; - public: LayerMap& _getLayerMap() {return _layerMap;}; - public: LayerList& _getLayerList() {return _layerList;}; - -}; +// Inline Functions. + inline DataBase* Technology::getDataBase () const { return _dataBase; } + inline const Name& Technology::getName () const { return _name; } + inline Layer* Technology::getLayer ( const Name& name ) const { return _layerMap.getElement(name); } + inline Layers Technology::getLayers () const { return getCollection(&_layerMaskMap); } + inline Technology::LayerMap& Technology::_getLayerMap () { return _layerMap; } + inline Technology::LayerMaskMap& Technology::_getLayerMaskMap () { return _layerMaskMap; } + inline Layer::Mask& Technology::_getCutMask () { return _cutMask; } + inline Layer::Mask& Technology::_getMetalMask () { return _metalMask; } } // End of Hurricane namespace. @@ -108,8 +141,4 @@ class Technology : public DBo { INSPECTOR_P_SUPPORT(Hurricane::Technology); -#endif // HURRICANE_TECHNOLOGY - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved -// **************************************************************************************************** +#endif // __HURRICANE_TECHNOLOGY__ diff --git a/hurricane/src/hurricane/hurricane/ViaLayer.h b/hurricane/src/hurricane/hurricane/ViaLayer.h index e9e66338..6481af1c 100644 --- a/hurricane/src/hurricane/hurricane/ViaLayer.h +++ b/hurricane/src/hurricane/hurricane/ViaLayer.h @@ -76,8 +76,11 @@ namespace Hurricane { ); // Accessors. virtual BasicLayers getBasicLayers () const; - virtual DbU::Unit getEnclosure () const; - virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const; + virtual const Layer* getTop () const; + virtual const Layer* getBottom () const; + virtual const Layer* getOpposite ( const Layer* ) const; + virtual DbU::Unit getEnclosure () const; + virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const; // Updators. virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure ); // Hurricane Managment. @@ -88,8 +91,8 @@ namespace Hurricane { private: // Internal: Attributes vector _basicLayers; - vector _enclosures; - DbU::Unit _maximalEnclosure; + vector _enclosures; + DbU::Unit _maximalEnclosure; protected: // Internal: Constructors & Destructors. diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index fcad0097..99f2d041 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -32,6 +32,7 @@ hurricane/viewer/HPaletteEntry.h hurricane/viewer/HPalette.h hurricane/viewer/DisplayStyle.h + hurricane/viewer/ColorScale.h hurricane/viewer/Graphics.h hurricane/viewer/HGraphics.h hurricane/viewer/Selector.h @@ -54,6 +55,7 @@ ) set ( cpps ScreenUtilities.cpp DisplayStyle.cpp + ColorScale.cpp Graphics.cpp HGraphics.cpp HPaletteEntry.cpp diff --git a/hurricane/src/hviewer/CellViewer.cpp b/hurricane/src/hviewer/CellViewer.cpp index 2c7b0aad..24319f52 100644 --- a/hurricane/src/hviewer/CellViewer.cpp +++ b/hurricane/src/hviewer/CellViewer.cpp @@ -1,36 +1,9 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag // =================================================================== // // $Id$ @@ -123,17 +96,17 @@ namespace Hurricane { if ( _openAction ) return; _openAction = new QAction ( tr("&Open Cell"), this ); - _openAction->setObjectName ( "viewer.file.openCell" ); + _openAction->setObjectName ( "viewer.menuBar.file.openCell" ); _openAction->setIcon ( QIcon(":/images/stock_open.png") ); _openAction->setStatusTip ( tr("Open (load) a new Cell") ); _nextAction = new QAction ( tr("&Next Breakpoint"), this ); - _nextAction->setObjectName ( "viewer.file.nextBreakpoint" ); + _nextAction->setObjectName ( "viewer.menuBar.file.nextBreakpoint" ); _nextAction->setStatusTip ( tr("Proceed to the next breakpoint") ); for ( int i=0 ; isetObjectName ( QString("viewer.file.cellHistory[%1]").arg(i) ); + _cellHistoryAction[i]->setObjectName ( QString("viewer.menuBar.file.cellHistory[%1]").arg(i) ); _cellHistoryAction[i]->setVisible ( false ); _cellHistoryAction[i]->setData ( i ); _cellHistoryAction[i]->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); @@ -141,67 +114,67 @@ namespace Hurricane { } _saveAction = new QAction ( tr("&Save Cell"), this ); - _saveAction->setObjectName ( "viewer.file.saveCell" ); + _saveAction->setObjectName ( "viewer.menuBar.file.saveCell" ); _saveAction->setIcon ( QIcon(":/images/stock_save.png") ); _saveAction->setStatusTip ( tr("Save the current Cell") ); _saveAction->setVisible ( false ); _closeAction = new QAction ( tr("&Close"), this ); - _closeAction->setObjectName ( "viewer.file.close" ); + _closeAction->setObjectName ( "viewer.menuBar.file.close" ); _closeAction->setStatusTip ( tr("Close This Coriolis CellViewer") ); _closeAction->setShortcut ( QKeySequence(tr("CTRL+W")) ); connect ( _closeAction, SIGNAL(triggered()), this, SLOT(close()) ); _exitAction = new QAction ( tr("&Exit"), this ); - _exitAction->setObjectName ( "viewer.file.exit" ); + _exitAction->setObjectName ( "viewer.menuBar.file.exit" ); _exitAction->setStatusTip ( tr("Exit All Coriolis CellViewer") ); _exitAction->setShortcut ( QKeySequence(tr("CTRL+Q")) ); connect ( _exitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) ); _refreshAction = new QAction ( tr("&Refresh"), this ); - _refreshAction->setObjectName ( "viewer.view.refresh" ); + _refreshAction->setObjectName ( "viewer.menuBar.view.refresh" ); _refreshAction->setStatusTip ( tr("Force full redrawing of the display") ); _refreshAction->setShortcut ( QKeySequence(tr("CTRL+L")) ); _fitToContentsAction = new QAction ( tr("&Fit to Contents"), this ); - _fitToContentsAction->setObjectName ( "viewer.view.fit" ); + _fitToContentsAction->setObjectName ( "viewer.menuBar.view.fit" ); _fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") ); _fitToContentsAction->setShortcut ( Qt::Key_F ); _showSelectionAction = new QAction ( tr("&Show Selection"), this ); - _showSelectionAction->setObjectName ( "viewer.view.showSelection" ); + _showSelectionAction->setObjectName ( "viewer.menuBar.view.showSelection" ); _showSelectionAction->setStatusTip ( tr("Highlight the selected items (darken others)") ); _showSelectionAction->setShortcut ( Qt::Key_S ); _showSelectionAction->setCheckable ( true ); _showPaletteAction = new QAction ( tr("Show &Palette"), this ); - _showPaletteAction->setObjectName ( "viewer.view.showPalette" ); + _showPaletteAction->setObjectName ( "viewer.menuBar.view.showPalette" ); _showPaletteAction->setStatusTip ( tr("Hide/Show the Palette sub-window") ); _showPaletteAction->setCheckable ( true ); _showPaletteAction->setChecked ( true ); _graphicsSettingsAction = new QAction ( tr("Graphics Settings"), this ); - _graphicsSettingsAction->setObjectName ( "viewer.view.graphicsSettings" ); + _graphicsSettingsAction->setObjectName ( "viewer.menuBar.view.graphicsSettings" ); _graphicsSettingsAction->setStatusTip ( tr("Tune Graphics Settings") ); _displayFilterAction = new QAction ( tr("Display Filter"), this ); - _displayFilterAction->setObjectName ( "viewer.view.displayFilter" ); + _displayFilterAction->setObjectName ( "viewer.menuBar.view.displayFilter" ); _displayFilterAction->setStatusTip ( tr("Tune Cell Displaying") ); _runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this ); - _runInspectorOnDataBase->setObjectName ( "viewer.tools.inspectDb" ); + _runInspectorOnDataBase->setObjectName ( "viewer.menuBar.tools.inspectDb" ); _runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") ); _runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this ); - _runInspectorOnCell->setObjectName ( "viewer.tools.inspectCell" ); + _runInspectorOnCell->setObjectName ( "viewer.menuBar.tools.inspectCell" ); _runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") ); _browseSelection= new QAction ( tr("Browse &Selection"), this ); - _browseSelection->setObjectName ( "viewer.tools.browseSelection" ); + _browseSelection->setObjectName ( "viewer.menuBar.tools.browseSelection" ); _browseSelection->setStatusTip ( tr("Browse objects currently selecteds") ); _browseNetlist= new QAction ( tr("Browse &Netlist"), this ); - _browseNetlist->setObjectName ( "viewer.tools.browseNetlist" ); + _browseNetlist->setObjectName ( "viewer.menuBar.tools.browseNetlist" ); _browseNetlist->setStatusTip ( tr("Browse netlist from the current Cell") ); } @@ -211,8 +184,10 @@ namespace Hurricane { if ( _fileMenu ) return; if ( !_openAction ) createActions (); + menuBar()->setObjectName ( tr("viewer.menuBar") ); + _fileMenu = menuBar()->addMenu ( tr("File") ); - _fileMenu->setObjectName ( "viewer.file" ); + _fileMenu->setObjectName ( "viewer.menuBar.file" ); _fileMenu->addAction ( _openAction ); _fileMenu->addAction ( _nextAction ); _fileMenu->addSeparator (); @@ -225,7 +200,7 @@ namespace Hurricane { _fileMenu->addAction ( _exitAction ); _viewMenu = menuBar()->addMenu ( tr("View") ); - _viewMenu->setObjectName ( "viewer.view" ); + _viewMenu->setObjectName ( "viewer.menuBar.view" ); _viewMenu->addAction ( _refreshAction ); _viewMenu->addAction ( _fitToContentsAction ); _viewMenu->addAction ( _showSelectionAction ); @@ -234,15 +209,21 @@ namespace Hurricane { _viewMenu->addAction ( _graphicsSettingsAction ); _toolsMenu = menuBar()->addMenu ( tr("Tools") ); - _toolsMenu->setObjectName ( "viewer.tools" ); + _toolsMenu->setObjectName ( "viewer.menuBar.tools" ); _toolsMenu->addAction ( _runInspectorOnDataBase ); _toolsMenu->addAction ( _runInspectorOnCell ); _toolsMenu->addAction ( _browseSelection ); _toolsMenu->addAction ( _browseNetlist ); + } - _debugMenu = menuBar()->addMenu ( tr("Debug") ); - _debugMenu->setObjectName ( "viewer.debug" ); - _debugMenu->hide (); + + QMenu* CellViewer::createDebugMenu () + { + if ( !_debugMenu ) { + _debugMenu = menuBar()->addMenu ( tr("Debug") ); + _debugMenu->setObjectName ( "viewer.menuBar.debug" ); + } + return _debugMenu; } @@ -283,24 +264,25 @@ namespace Hurricane { | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); - layerMapDock->setObjectName ( "viewer.dock.paletteWindow" ); + layerMapDock->setObjectName ( "viewer.menuBar.dock.paletteWindow" ); layerMapDock->setWidget ( _palette ); layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); addDockWidget ( Qt::RightDockWidgetArea, layerMapDock ); setCentralWidget ( _cellWidget ); - connect ( _graphicsSettings , SIGNAL(styleChanged()), _cellWidget, SLOT(redraw()) ); - connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(redraw()) ); - connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents()) ); - connect ( _showSelectionAction , SIGNAL(toggled(bool)) , _cellWidget, SLOT(setShowSelection(bool)) ); - connect ( _showPaletteAction , SIGNAL(toggled(bool)) , this , SLOT(setShowPalette(bool)) ); - connect ( _graphicsSettingsAction, SIGNAL(triggered()) , this , SLOT(showGraphicsSettings()) ); - connect ( _displayFilterAction , SIGNAL(triggered()) , this , SLOT(showDisplayFilter()) ); - connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase())); - connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell()) ); - connect ( _browseSelection , SIGNAL(triggered()) , this , SLOT(browseSelection()) ); - connect ( _browseNetlist , SIGNAL(triggered()) , this , SLOT(browseNetlist()) ); + connect ( this , SIGNAL(redrawCellWidget()), _cellWidget, SLOT(redraw()) ); + connect ( _graphicsSettings , SIGNAL(styleChanged()) , _cellWidget, SLOT(redraw()) ); + connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(redraw()) ); + connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents()) ); + connect ( _showSelectionAction , SIGNAL(toggled(bool)) , _cellWidget, SLOT(setShowSelection(bool)) ); + connect ( _showPaletteAction , SIGNAL(toggled(bool)) , this , SLOT(setShowPalette(bool)) ); + connect ( _graphicsSettingsAction, SIGNAL(triggered()) , this , SLOT(showGraphicsSettings()) ); + connect ( _displayFilterAction , SIGNAL(triggered()) , this , SLOT(showDisplayFilter()) ); + connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase())); + connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell()) ); + connect ( _browseSelection , SIGNAL(triggered()) , this , SLOT(browseSelection()) ); + connect ( _browseNetlist , SIGNAL(triggered()) , this , SLOT(browseNetlist()) ); connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&)) , _mousePosition , SLOT(setPosition(const Point&)) ); @@ -380,7 +362,7 @@ namespace Hurricane { void CellViewer::setShowPalette ( bool show ) { - QDockWidget* paletteWindow = findChild("viewer.dock.paletteWindow"); + QDockWidget* paletteWindow = findChild("viewer.menuBar.dock.paletteWindow"); if ( !paletteWindow ) { cerr << "paletteWindow not found." << endl; diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index e409c778..65a1e2b7 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -1,43 +1,16 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag // =================================================================== // // $Id$ // // x-----------------------------------------------------------------x // | | -// | H U R R I C A N E | +// | C O R I O L I S | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | @@ -291,7 +264,7 @@ namespace Hurricane { void CellWidget::DrawingQuery::setDrawExtensionGo ( const Name& name ) { - map >::iterator idraw + map >::iterator idraw = _drawExtensionGos.find ( name ); if ( idraw != _drawExtensionGos.end() ) { @@ -334,6 +307,8 @@ namespace Hurricane { , const Transformation& transformation ) { + cerr << "DrawingQuery::drawGo() - " << go << endl; + const Segment* segment = dynamic_cast(go); if ( segment ) { if ( 1 < _cellWidget->dbuToDisplayLength(segment->getWidth()) ) { @@ -479,14 +454,20 @@ namespace Hurricane { } + void CellWidget::updatePalette () + { + emit updatePalette(getCell()); + } + void CellWidget::bindToPalette ( HPalette* palette ) { detachFromPalette (); _palette = palette; - connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(redraw()) ); - connect ( this , SIGNAL(cellChanged(Cell*)), _palette, SLOT(updateExtensions(Cell*))); + connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(redraw()) ); + connect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) ); + connect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) ); } @@ -619,12 +600,12 @@ namespace Hurricane { _textDrawingQuery.doQuery (); } - _drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells ); - + //_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells ); forEach ( ExtensionSlice*, islice, _cell->getExtensionSlices() ) { - if ( isDrawableLayer((*islice)->getName()) ) { + if ( isDrawableExtension((*islice)->getName()) ) { _drawingQuery.setExtensionMask ( (*islice)->getMask() ); _drawingQuery.setDrawExtensionGo ( (*islice)->getName() ); + _drawingQuery.setFilter ( Query::DoExtensionGos ); _drawingQuery.doQuery (); } } @@ -717,6 +698,14 @@ namespace Hurricane { } + void CellWidget::drawBox ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) + { + _redrawRectCount++; + _drawingPlanes.setLineMode ( false ); + _drawingPlanes.painter().drawRect ( dbuToDisplayRect(x1,y1,x2,y2) ); + } + + void CellWidget::drawBox ( const Box& box ) { _redrawRectCount++; @@ -739,6 +728,13 @@ namespace Hurricane { } + void CellWidget::drawLine ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) + { + _drawingPlanes.setLineMode ( true ); + _drawingPlanes.painter().drawLine ( dbuToDisplayPoint(x1,y1), dbuToDisplayPoint(x2,y2) ); + } + + void CellWidget::drawLine ( const Point& p1, const Point& p2 ) { _drawingPlanes.setLineMode ( true ); diff --git a/hurricane/src/hviewer/ColorScale.cpp b/hurricane/src/hviewer/ColorScale.cpp new file mode 100644 index 00000000..b9a33c1e --- /dev/null +++ b/hurricane/src/hviewer/ColorScale.cpp @@ -0,0 +1,106 @@ + +// -*- 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 : "./ColorScale.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include "hurricane/viewer/ColorScale.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "Hurricane::ColorScale" + + + ColorScale::ColorScale ( const Name& name ) + : _name(name) + { + for ( size_t i=0 ; i<256 ; i++ ) { + _red [i] = 0; + _green[i] = 0; + _blue [i] = 0; + _color[i] = NULL; + _brush[i] = NULL; + } + } + + + ColorScale::~ColorScale () + { + if ( _brush[0] ) { + for ( size_t i=0 ; i<256 ; i++ ) { + delete _brush[i]; + delete _color[i]; + } + } + } + + + void ColorScale::qtAllocate () + { + if ( !_brush[0] ) { + for ( size_t i=0 ; i<256 ; i++ ) { + _color[i] = new QColor ( _red[i], _green[i], _blue[i] ); + _brush[i] = new QBrush ( *_color[i] ); + } + } + } + + + QBrush ColorScale::getBrush ( size_t i, int darkening ) const + { + assert ( _brush[i] != NULL ); + + QBrush brush ( *_brush[i] ); + brush.setColor ( _color[i]->darker(darkening) ); + return brush; + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::FireColorScale" + + + FireColorScale::FireColorScale () + : ColorScale("Fire") + { + for ( size_t i=0 ; i<128 ; i++ ) { + _red [i] = i * 2; + _green[i] = 0; + _blue [i] = 0; + } + for ( size_t i=128 ; i<224 ; i++ ) { + _red [i] = 255; + _green[i] = ((i-128)*8)/3; + _blue [i] = 0; + } + for ( size_t i=224 ; i<256 ; i++ ) { + _red [i] = 255; + _green[i] = 255; + _blue [i] = (i-224)*8; + } + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/Graphics.cpp b/hurricane/src/hviewer/Graphics.cpp index 71b75506..2900cbb2 100644 --- a/hurricane/src/hviewer/Graphics.cpp +++ b/hurricane/src/hviewer/Graphics.cpp @@ -74,6 +74,7 @@ namespace Hurricane { Graphics::Graphics () : _styles() , _active(NULL) + , _fireColorScale() , _qtEnabled(false) { } @@ -128,6 +129,8 @@ namespace Hurricane { _qtEnabled = true; for ( size_t si=0 ; si < _styles.size() ; si++ ) _styles[si]->qtAllocate (); + + _fireColorScale.qtAllocate (); } @@ -289,6 +292,12 @@ namespace Hurricane { } + const ColorScale& Graphics::getColorScale ( ColorScale::ScaleType id ) + { + return getGraphics()->_getColorScale ( id ); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h index ea987569..72d3d875 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h @@ -1,36 +1,9 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag // =================================================================== // // $Id$ @@ -93,6 +66,7 @@ namespace Hurricane { public: CellViewer ( QWidget* parent=NULL ); + QMenu* createDebugMenu (); inline void setApplicationName ( const QString& name ); void setCell ( Cell* cell ); Cell* getCell (); @@ -112,6 +86,8 @@ namespace Hurricane { void browseNetlist (); void selectionBrowserDestroyed (); void netlistBrowserDestroyed (); + signals: + void redrawCellWidget (); public: enum { CellHistorySize = 10 }; @@ -164,8 +140,6 @@ namespace Hurricane { inline void CellViewer::setApplicationName ( const QString& name ) { _applicationName = name; } - - } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index edff43e1..ec455c6b 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -1,43 +1,16 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag // =================================================================== // // $Id$ // // x-----------------------------------------------------------------x // | | -// | H U R R I C A N E | +// | C O R I O L I S | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | @@ -50,18 +23,18 @@ // x-----------------------------------------------------------------x -# ifndef __CELL_WIDGET_H__ -# define __CELL_WIDGET_H__ +#ifndef __HURRICANE_CELL_WIDGET_H__ +#define __HURRICANE_CELL_WIDGET_H__ -# include +#include -# include +#include -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include class QCursor; class QResizeEvent; @@ -70,15 +43,15 @@ class QKeyEvent; class QAction; -# include "hurricane/Commons.h" -# include "hurricane/Point.h" -# include "hurricane/Box.h" -# include "hurricane/Transformation.h" -# include "hurricane/Query.h" +#include "hurricane/Commons.h" +#include "hurricane/Point.h" +#include "hurricane/Box.h" +#include "hurricane/Transformation.h" +#include "hurricane/Query.h" -# include "hurricane/viewer/DisplayStyle.h" -# include "hurricane/viewer/CellWidgets.h" -# include "hurricane/viewer/Selector.h" +#include "hurricane/viewer/DisplayStyle.h" +#include "hurricane/viewer/CellWidgets.h" +#include "hurricane/viewer/Selector.h" @@ -109,13 +82,13 @@ namespace Hurricane { private: class DrawingPlanes; public: - typedef void ( DrawExtensionGo_t ) ( CellWidget* - , const Go* - , const BasicLayer* - , const Box& - , const Transformation& - ); - typedef void ( InitDrawExtension_t )( CellWidget* ); + typedef void ( DrawExtensionGo_t )( CellWidget* + , const Go* + , const BasicLayer* + , const Box& + , const Transformation& + ); + typedef void ( InitExtensionGo_t )( CellWidget* ); public: // Constructor & Destructor. CellWidget ( QWidget* parent=NULL ); @@ -135,12 +108,15 @@ 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 void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* ); + inline QPainter& getPainter (); inline float getScale () const; bool isDrawableLayer ( const Name& ); bool isDrawableExtension ( const Name& ); + void drawBox ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); void drawBox ( const Box& ); + void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); void drawLine ( const Point&, const Point& ); void drawText ( const Point&, const Name&, int angle=0, bool reverse=false ); void drawGrid (); @@ -179,6 +155,7 @@ namespace Hurricane { void mouseReleaseEvent ( QMouseEvent* ); signals: void cellChanged ( Cell* ); + void updatePalette ( Cell* ); void mousePositionChanged ( const Point& position ); void selectionChanged ( const set&, Cell* ); void occurrenceToggled ( Occurrence ); @@ -194,6 +171,7 @@ namespace Hurricane { void toggleSelect ( Occurrence occurence, bool fromPopup ); void setShowSelection ( bool state ); void setCumulativeSelection ( bool state ); + void updatePalette (); inline void redraw (); void redraw ( QRect redrawArea ); inline void redrawSelection (); @@ -285,7 +263,7 @@ namespace Hurricane { , unsigned int filter ); inline void addDrawExtensionGo ( const Name& - , InitDrawExtension_t* + , InitExtensionGo_t* , DrawExtensionGo_t* ); void setDrawExtensionGo ( const Name& ); @@ -304,7 +282,7 @@ namespace Hurricane { protected: CellWidget* _cellWidget; DrawExtensionGo_t* _drawExtensionGo; - map > + map > _drawExtensionGos; }; @@ -376,11 +354,11 @@ namespace Hurricane { } - inline void CellWidget::DrawingQuery::addDrawExtensionGo ( const Name& name - , InitDrawExtension_t* initDrawExtension - , DrawExtensionGo_t* drawExtensionGo + inline void CellWidget::DrawingQuery::addDrawExtensionGo ( const Name& name + , InitExtensionGo_t* initExtensionGo + , DrawExtensionGo_t* drawExtensionGo ) - { _drawExtensionGos[name] = make_pair(initDrawExtension,drawExtensionGo); } + { _drawExtensionGos[name] = make_pair(initExtensionGo,drawExtensionGo); } inline bool CellWidget::DrawingPlanes::getLineMode () const @@ -460,11 +438,11 @@ namespace Hurricane { { copyToScreen ( 0, 0, width(), height() ); } - inline void CellWidget::addDrawExtensionGo ( const Name& name - , InitDrawExtension_t* initDrawExtension - , DrawExtensionGo_t* drawExtensionGo + inline void CellWidget::addDrawExtensionGo ( const Name& name + , InitExtensionGo_t* initExtensionGo + , DrawExtensionGo_t* drawExtensionGo ) - { _drawingQuery.addDrawExtensionGo ( name, initDrawExtension, drawExtensionGo ); } + { _drawingQuery.addDrawExtensionGo ( name, initExtensionGo, drawExtensionGo ); } inline void CellWidget::setStartLevel ( int level ) @@ -575,19 +553,23 @@ namespace Hurricane { { return _showBoundaries; } - inline bool CellWidget::showSelection () const + inline bool CellWidget::showSelection () const { return _showSelection; } - inline float CellWidget::getScale () const + inline QPainter& CellWidget::getPainter () + { return _drawingPlanes.painter(); } + + + inline float CellWidget::getScale () const { return _scale; } - inline void CellWidget::setQueryFilter ( int filter ) + inline void CellWidget::setQueryFilter ( int filter ) { _queryFilter = filter; } } // End of Hurricane namespace. -# endif +#endif // __HURRICANE_CELL_WIDGET__ diff --git a/hurricane/src/hviewer/hurricane/viewer/ColorScale.h b/hurricane/src/hviewer/hurricane/viewer/ColorScale.h new file mode 100644 index 00000000..35071b32 --- /dev/null +++ b/hurricane/src/hviewer/hurricane/viewer/ColorScale.h @@ -0,0 +1,94 @@ + +// -*- 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 : "./ColorScale.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_COLOR_SCALE__ +#define __HURRICANE_COLOR_SCALE__ + + +#include +#include +#include "hurricane/Name.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "Hurricane::ColorScale" + + + class ColorScale { + + public: + // Types. + enum ScaleType { Grey = 1 + , Fire + , Rainbow + }; + + public: + // Accessors. + void qtAllocate (); + inline const Name& getName () const; + QBrush getBrush ( size_t , int darkening ) const; + + protected: + // Internal - Attributes. + const Name _name; + int _red [256]; + int _green[256]; + int _blue [256]; + QColor *_color[256]; + QBrush *_brush[256]; + + protected: + // Internal - Constructors & Destructors. + ColorScale ( const Name& ); + ~ColorScale (); + private: + ColorScale ( const ColorScale& ); + ColorScale& operator= ( const ColorScale& ); + + }; + + +// ------------------------------------------------------------------- +// Class : "Hurricane::FireColorScale" + + + class FireColorScale : public ColorScale { + public: + FireColorScale (); + }; + + +// Functions. + inline const Name& ColorScale::getName () const { return _name; } + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_COLOR_SCALE__ diff --git a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h index 19d4b412..4f803a91 100644 --- a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h +++ b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h @@ -1,36 +1,9 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag // =================================================================== // // $Id$ @@ -50,28 +23,26 @@ // x-----------------------------------------------------------------x -# ifndef __DISPLAYSTYLE_H__ -# define __DISPLAYSTYLE_H__ +#ifndef __HURRICANE_DISPLAYSTYLE_H__ +#define __HURRICANE_DISPLAYSTYLE_H__ -# include -# include +#include +#include -# include -# include -# include +#include +#include +#include -# include "hurricane/Commons.h" -# include "hurricane/Name.h" +#include "hurricane/Commons.h" +#include "hurricane/Name.h" -# include "hurricane/viewer/ScreenUtilities.h" +#include "hurricane/viewer/ScreenUtilities.h" namespace Hurricane { - - class DrawingStyle { public: @@ -259,4 +230,4 @@ namespace Hurricane { } // End of Hurricane namespace. -# endif +#endif // __HURRICANE_DISPLAYSTYLE__ diff --git a/hurricane/src/hviewer/hurricane/viewer/Graphics.h b/hurricane/src/hviewer/hurricane/viewer/Graphics.h index cfcea092..7bafd262 100644 --- a/hurricane/src/hviewer/hurricane/viewer/Graphics.h +++ b/hurricane/src/hviewer/hurricane/viewer/Graphics.h @@ -1,36 +1,9 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag // =================================================================== // // $Id$ @@ -50,16 +23,17 @@ // x-----------------------------------------------------------------x -# ifndef __GRAPHICS_H__ -# define __GRAPHICS_H__ +#ifndef __HURRICANE_GRAPHICS__ +#define __HURRICANE_GRAPHICS__ -# include -# include +#include +#include -# include "hurricane/viewer/DisplayStyle.h" +#include "hurricane/viewer/DisplayStyle.h" +#include "hurricane/viewer/ColorScale.h" -# include +#include class QColor; class QPen; @@ -89,6 +63,7 @@ namespace Hurricane { static const string& getPattern ( const Name& key ); static float getThreshold ( const Name& key ); static int getDarkening (); + static const ColorScale& getColorScale ( ColorScale::ScaleType ); // Modifiers. static void addStyle ( DisplayStyle* displayStyle ); @@ -104,6 +79,7 @@ namespace Hurricane { static Graphics* _singleton; vector _styles; DisplayStyle* _active; + FireColorScale _fireColorScale; bool _qtEnabled; // Internals - Constructors & Destructors. @@ -127,6 +103,7 @@ namespace Hurricane { inline const string& _getPattern ( const Name& key ) const; inline float _getThreshold ( const Name& key ) const; inline int _getDarkening () const; + inline const ColorScale& _getColorScale ( ColorScale::ScaleType ) const; inline void _enable (); }; @@ -153,6 +130,17 @@ namespace Hurricane { inline int Graphics::_getDarkening () const { return _active->getDarkening(); } + inline const ColorScale& Graphics::_getColorScale ( ColorScale::ScaleType id ) const + { + switch ( id ) { + case ColorScale::Grey: + case ColorScale::Fire: + case ColorScale::Rainbow: + break; + } + return _fireColorScale; + } + inline DisplayStyle* Graphics::_getStyle () const { return _active; } @@ -165,4 +153,4 @@ namespace Hurricane { } // End of Hurricane namespace. -# endif +#endif // __HURRICANE_GRAPHICS__