From 47f3771f1d64602a188c8543879a09f02dfb40df Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 16 Nov 2012 12:48:38 +0000 Subject: [PATCH] * All Tools: - A complete sweep of cleanup to suppress allmost all compiler warnings. * ./hurricane/doc/hurricane: - New: Documentation cleanup and update, particularly on the new Layer derived classes. * ./hurricane/src/hurricane, ./hurricane/src/isobar, ./hurricane/src/viewer: - New: Creation of new methods, more explicit on DbU. Based on a to/from naming scheme. - New: Python support extented to include all objects needed to configure through python scripts. - Change: Finally understood what's causing the _XOPEN_SOURCE redefinition. Basically the Python.h must be included first before any other include. The type-puned problem will remains still (that is a Python problem, not our own). - Change: In DisplayStyle, uses shared_ptr for DrawingStyle instead of custom made reference count. --- hurricane/doc/hurricane/ASIM.css | 107 ++- hurricane/doc/hurricane/BasicLayer.dox | 73 +- hurricane/doc/hurricane/Box.dox | 31 - hurricane/doc/hurricane/Cell.dox | 30 - hurricane/doc/hurricane/Collection.dox | 259 +++++-- hurricane/doc/hurricane/Command.dox | 29 +- hurricane/doc/hurricane/Commons.dox | 12 +- hurricane/doc/hurricane/Component.dox | 39 +- hurricane/doc/hurricane/CompositeLayer.dox | 20 +- hurricane/doc/hurricane/Contact.dox | 20 +- hurricane/doc/hurricane/ContactLayer.dox | 41 + hurricane/doc/hurricane/DBo.dox | 166 ++-- hurricane/doc/hurricane/DataBase.dox | 12 - hurricane/doc/hurricane/DbU.dox | 197 ++++- hurricane/doc/hurricane/DiffusionLayer.dox | 41 + hurricane/doc/hurricane/DoxygenLayout.xml | 184 +++++ hurricane/doc/hurricane/Entity.dox | 9 +- hurricane/doc/hurricane/Error.dox | 62 +- hurricane/doc/hurricane/Exception.dox | 29 +- hurricane/doc/hurricane/Filter.dox | 151 ++-- hurricane/doc/hurricane/GenericCollection.dox | 14 - hurricane/doc/hurricane/GenericFilter.dox | 2 - hurricane/doc/hurricane/Go.dox | 126 ++- hurricane/doc/hurricane/Hook.dox | 22 +- hurricane/doc/hurricane/Horizontal.dox | 20 +- hurricane/doc/hurricane/Instance.dox | 22 +- hurricane/doc/hurricane/Interruption.dox | 18 - hurricane/doc/hurricane/Interval.dox | 32 - hurricane/doc/hurricane/Layer.dox | 200 ++++- hurricane/doc/hurricane/Library.dox | 21 +- hurricane/doc/hurricane/ListCollection.dox | 6 - hurricane/doc/hurricane/Locator.dox | 87 ++- hurricane/doc/hurricane/MainView.dox | 18 - hurricane/doc/hurricane/MapCollection.dox | 6 - hurricane/doc/hurricane/MapView.dox | 9 - hurricane/doc/hurricane/Name.dox | 25 - hurricane/doc/hurricane/Net.dox | 32 +- hurricane/doc/hurricane/Occurence.dox | 40 +- hurricane/doc/hurricane/Occurrence.dox | 43 +- hurricane/doc/hurricane/Pad.dox | 8 +- hurricane/doc/hurricane/Path.dox | 41 +- hurricane/doc/hurricane/Plug.dox | 32 +- hurricane/doc/hurricane/Point.dox | 19 - hurricane/doc/hurricane/PrivateProperty.dox | 15 +- hurricane/doc/hurricane/Property.dox | 59 +- hurricane/doc/hurricane/QuadTree.dox | 32 - hurricane/doc/hurricane/Quark.dox | 24 +- hurricane/doc/hurricane/RecordHandles.dox | 3 - hurricane/doc/hurricane/RegularLayer.dox | 93 +++ hurricane/doc/hurricane/Rubber.dox | 9 +- hurricane/doc/hurricane/Segment.dox | 15 +- hurricane/doc/hurricane/SelectCommand.dox | 8 - hurricane/doc/hurricane/SelectNetCommand.dox | 7 - hurricane/doc/hurricane/SetCollection.dox | 7 - hurricane/doc/hurricane/SharedProperty.dox | 8 - hurricane/doc/hurricane/Slice.dox | 30 +- hurricane/doc/hurricane/Symbol.dox | 20 +- hurricane/doc/hurricane/Tabulation.dox | 20 - hurricane/doc/hurricane/Technology.dox | 83 +- hurricane/doc/hurricane/Transformation.dox | 31 - hurricane/doc/hurricane/TransistorLayer.dox | 41 + hurricane/doc/hurricane/VectorCollection.dox | 7 - hurricane/doc/hurricane/Vertical.dox | 20 +- hurricane/doc/hurricane/ViaLayer.dox | 41 + hurricane/doc/hurricane/View.dox | 34 +- hurricane/doc/hurricane/Warning.dox | 46 +- hurricane/doc/hurricane/ZoomCommand.dox | 8 - hurricane/doc/hurricane/customHierarchy.html | 14 +- hurricane/doc/hurricane/customSummary.html | 4 +- hurricane/doc/hurricane/doxyfile | 14 +- hurricane/doc/hurricane/footer.html | 2 +- hurricane/doc/viewer/ASIM.css | 107 ++- hurricane/doc/viewer/CellImage.dox | 132 ++++ hurricane/doc/viewer/CellPrinter.dox | 117 +++ hurricane/doc/viewer/CellViewer.dox | 73 +- hurricane/doc/viewer/CellWidget.dox | 24 + hurricane/doc/viewer/DisplayStyle.dox | 69 +- hurricane/doc/viewer/Graphics.dox | 51 +- hurricane/doc/viewer/InspectorWidget.dox | 25 +- hurricane/doc/viewer/customSummary.html | 8 +- hurricane/doc/viewer/doxyfile | 7 +- hurricane/doc/viewer/footer.html | 2 +- hurricane/src/hurricane/BasicLayer.cpp | 5 - hurricane/src/hurricane/Box.cpp | 8 +- hurricane/src/hurricane/Contact.cpp | 8 +- hurricane/src/hurricane/DbU.cpp | 7 + hurricane/src/hurricane/DiffusionLayer.cpp | 2 +- hurricane/src/hurricane/Horizontal.cpp | 6 +- hurricane/src/hurricane/Interval.cpp | 4 +- hurricane/src/hurricane/Layer.cpp | 17 +- hurricane/src/hurricane/Point.cpp | 4 +- hurricane/src/hurricane/RegularLayer.cpp | 4 +- hurricane/src/hurricane/Segment.cpp | 2 +- hurricane/src/hurricane/Vertical.cpp | 6 +- .../src/hurricane/hurricane/BasicLayer.h | 16 +- .../src/hurricane/hurricane/ContactLayer.h | 3 + hurricane/src/hurricane/hurricane/DbU.h | 51 +- .../src/hurricane/hurricane/DiffusionLayer.h | 3 + hurricane/src/hurricane/hurricane/Layer.h | 17 +- hurricane/src/hurricane/hurricane/Mask.h | 1 - .../src/hurricane/hurricane/RegularLayer.h | 3 + .../src/hurricane/hurricane/TransistorLayer.h | 3 + hurricane/src/hurricane/hurricane/ViaLayer.h | 3 + hurricane/src/isobar/CMakeLists.txt | 24 + hurricane/src/isobar/ProxyProperty.cpp | 124 +-- hurricane/src/isobar/PyBasicLayer.cpp | 191 +++++ .../src/isobar/PyBasicLayerCollection.cpp | 89 +++ hurricane/src/isobar/PyCell.cpp | 2 +- hurricane/src/isobar/PyContactLayer.cpp | 190 +++++ hurricane/src/isobar/PyDbU.cpp | 723 ++++++++++++------ hurricane/src/isobar/PyDiffusionLayer.cpp | 176 +++++ hurricane/src/isobar/PyEntity.cpp | 2 +- hurricane/src/isobar/PyHurricane.cpp | 408 ++++++---- hurricane/src/isobar/PyLayer.cpp | 395 ++++++++-- hurricane/src/isobar/PyLayerCollection.cpp | 89 +++ hurricane/src/isobar/PyLayerMask.cpp | 384 ++++++++++ hurricane/src/isobar/PyMaterial.cpp | 200 +++++ hurricane/src/isobar/PyNet.cpp | 4 +- hurricane/src/isobar/PyPath.cpp | 5 +- hurricane/src/isobar/PyPoint.cpp | 1 + hurricane/src/isobar/PyReference.cpp | 4 +- hurricane/src/isobar/PyRegularLayer.cpp | 153 ++++ .../src/isobar/PyRegularLayerCollection.cpp | 89 +++ hurricane/src/isobar/PyTechnology.cpp | 298 ++++++-- hurricane/src/isobar/PyTransistorLayer.cpp | 182 +++++ hurricane/src/isobar/PyViaLayer.cpp | 172 +++++ hurricane/src/isobar/PyViaLayerCollection.cpp | 89 +++ .../isobar/hurricane/isobar/ProxyProperty.h | 146 ++-- .../isobar/hurricane/isobar/PyBasicLayer.h | 85 ++ .../hurricane/isobar/PyBasicLayerCollection.h | 87 +++ .../src/isobar/hurricane/isobar/PyCell.h | 6 +- .../isobar/hurricane/isobar/PyContactLayer.h | 84 ++ hurricane/src/isobar/hurricane/isobar/PyDbU.h | 57 +- .../hurricane/isobar/PyDiffusionLayer.h | 84 ++ .../src/isobar/hurricane/isobar/PyHurricane.h | 719 ++++++++++++++--- .../src/isobar/hurricane/isobar/PyLayer.h | 25 +- .../hurricane/isobar/PyLayerCollection.h | 87 +++ .../src/isobar/hurricane/isobar/PyLayerMask.h | 85 ++ .../src/isobar/hurricane/isobar/PyMaterial.h | 86 +++ .../isobar/hurricane/isobar/PyRegularLayer.h | 84 ++ .../isobar/PyRegularLayerCollection.h | 87 +++ .../hurricane/isobar/PyTransistorLayer.h | 84 ++ .../src/isobar/hurricane/isobar/PyViaLayer.h | 84 ++ .../hurricane/isobar/PyViaLayerCollection.h | 87 +++ hurricane/src/viewer/CMakeLists.txt | 20 +- hurricane/src/viewer/CellImage.cpp | 181 +++++ hurricane/src/viewer/CellPrinter.cpp | 362 +++++++++ hurricane/src/viewer/CellViewer.cpp | 67 +- hurricane/src/viewer/CellWidget.cpp | 236 ++---- hurricane/src/viewer/DisplayStyle.cpp | 144 ++-- hurricane/src/viewer/GotoWidget.cpp | 14 +- hurricane/src/viewer/GraphicsWidget.cpp | 4 +- hurricane/src/viewer/InspectorWidget.cpp | 14 +- hurricane/src/viewer/PaletteWidget.cpp | 4 +- hurricane/src/viewer/PyCellViewer.cpp | 114 ++- hurricane/src/viewer/PyDisplayStyle.cpp | 420 ++++++++++ hurricane/src/viewer/PyDrawingGroup.cpp | 224 ++++++ hurricane/src/viewer/PyDrawingStyle.cpp | 189 +++++ hurricane/src/viewer/PyGraphics.cpp | 343 +++++++++ hurricane/src/viewer/PyHApplication.cpp | 165 ++++ hurricane/src/viewer/PyHSVr.cpp | 165 ++++ hurricane/src/viewer/PyViewer.cpp | 83 +- hurricane/src/viewer/ScreenUtilities.cpp | 98 +-- hurricane/src/viewer/Script.cpp | 67 +- hurricane/src/viewer/ScriptWidget.cpp | 1 + hurricane/src/viewer/StratusScript.cpp | 11 +- hurricane/src/viewer/StratusWidget.cpp | 1 + hurricane/src/viewer/ZoomCommand.cpp | 14 +- .../src/viewer/hurricane/viewer/CellImage.h | 94 +++ .../src/viewer/hurricane/viewer/CellPrinter.h | 114 +++ .../src/viewer/hurricane/viewer/CellViewer.h | 39 +- .../src/viewer/hurricane/viewer/CellWidget.h | 83 +- .../src/viewer/hurricane/viewer/Command.h | 16 +- .../viewer/hurricane/viewer/DisplayStyle.h | 319 ++++---- .../src/viewer/hurricane/viewer/Graphics.h | 16 +- .../viewer/hurricane/viewer/InspectorWidget.h | 16 +- .../viewer/hurricane/viewer/PyCellViewer.h | 16 +- .../viewer/hurricane/viewer/PyDisplayStyle.h | 66 ++ .../viewer/hurricane/viewer/PyDrawingGroup.h | 65 ++ .../viewer/hurricane/viewer/PyDrawingStyle.h | 65 ++ .../src/viewer/hurricane/viewer/PyGraphics.h | 61 ++ .../viewer/hurricane/viewer/PyHApplication.h | 58 ++ .../src/viewer/hurricane/viewer/PyHSVr.h | 61 ++ .../src/viewer/hurricane/viewer/Script.h | 13 +- .../viewer/hurricane/viewer/StratusScript.h | 17 +- 185 files changed, 10583 insertions(+), 3286 deletions(-) create mode 100644 hurricane/doc/hurricane/ContactLayer.dox create mode 100644 hurricane/doc/hurricane/DiffusionLayer.dox create mode 100644 hurricane/doc/hurricane/DoxygenLayout.xml create mode 100644 hurricane/doc/hurricane/RegularLayer.dox create mode 100644 hurricane/doc/hurricane/TransistorLayer.dox create mode 100644 hurricane/doc/hurricane/ViaLayer.dox create mode 100644 hurricane/doc/viewer/CellImage.dox create mode 100644 hurricane/doc/viewer/CellPrinter.dox create mode 100644 hurricane/doc/viewer/CellWidget.dox create mode 100644 hurricane/src/isobar/PyBasicLayer.cpp create mode 100644 hurricane/src/isobar/PyBasicLayerCollection.cpp create mode 100644 hurricane/src/isobar/PyContactLayer.cpp create mode 100644 hurricane/src/isobar/PyDiffusionLayer.cpp create mode 100644 hurricane/src/isobar/PyLayerCollection.cpp create mode 100644 hurricane/src/isobar/PyLayerMask.cpp create mode 100644 hurricane/src/isobar/PyMaterial.cpp create mode 100644 hurricane/src/isobar/PyRegularLayer.cpp create mode 100644 hurricane/src/isobar/PyRegularLayerCollection.cpp create mode 100644 hurricane/src/isobar/PyTransistorLayer.cpp create mode 100644 hurricane/src/isobar/PyViaLayer.cpp create mode 100644 hurricane/src/isobar/PyViaLayerCollection.cpp create mode 100644 hurricane/src/isobar/hurricane/isobar/PyBasicLayer.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyBasicLayerCollection.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyContactLayer.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyDiffusionLayer.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyLayerCollection.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyLayerMask.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyMaterial.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyRegularLayer.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyRegularLayerCollection.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyTransistorLayer.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyViaLayer.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyViaLayerCollection.h create mode 100644 hurricane/src/viewer/CellImage.cpp create mode 100644 hurricane/src/viewer/CellPrinter.cpp create mode 100644 hurricane/src/viewer/PyDisplayStyle.cpp create mode 100644 hurricane/src/viewer/PyDrawingGroup.cpp create mode 100644 hurricane/src/viewer/PyDrawingStyle.cpp create mode 100644 hurricane/src/viewer/PyGraphics.cpp create mode 100644 hurricane/src/viewer/PyHApplication.cpp create mode 100644 hurricane/src/viewer/PyHSVr.cpp create mode 100644 hurricane/src/viewer/hurricane/viewer/CellImage.h create mode 100644 hurricane/src/viewer/hurricane/viewer/CellPrinter.h create mode 100644 hurricane/src/viewer/hurricane/viewer/PyDisplayStyle.h create mode 100644 hurricane/src/viewer/hurricane/viewer/PyDrawingGroup.h create mode 100644 hurricane/src/viewer/hurricane/viewer/PyDrawingStyle.h create mode 100644 hurricane/src/viewer/hurricane/viewer/PyGraphics.h create mode 100644 hurricane/src/viewer/hurricane/viewer/PyHApplication.h create mode 100644 hurricane/src/viewer/hurricane/viewer/PyHSVr.h diff --git a/hurricane/doc/hurricane/ASIM.css b/hurricane/doc/hurricane/ASIM.css index 6d92a0c5..befe1aef 100644 --- a/hurricane/doc/hurricane/ASIM.css +++ b/hurricane/doc/hurricane/ASIM.css @@ -1,9 +1,9 @@ /* - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ * | HTML Standart Tags | - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ */ html, body, th, td, tr, p, li, h1, h2, h3, h4, h5, h6 { @@ -32,25 +32,25 @@ h1, h2, h3, h4, h5, h6 { - font-family: verdana, sans-serif; + font-family: "Liberation Serif", sans-serif; } h1 { text-align: center; } h2, h3, h4, h5, h6 { text-align: left; padding-top: 2em; } - h1, h2, h3 { font-family: "Trebuchet MS", sans-serif; - color: #09550B; + h1, h2, h3 { font-family: "Liberation Serif", sans-serif; + /*color: #09550B;*/ } - h1 { font-weight: bold; font-size: 170%; } - h2 { font-weight: bold; font-size: 140%; } - h3 { font-weight: bold; font-size: 118%; } + h1 { font-weight:normal; font-size: 170%; letter-spacing:0.2em; word-spacing:0.4em; } + h2 { font-weight:normal; font-size: 140%; letter-spacing:0.2em; word-spacing:0.4em; } + h3 { font-weight: bold; font-size: 118%; letter-spacing:0.2em; word-spacing:0.4em; } h4 { font-weight: bold; font-size: 100%; } h5 { font-style: italic; font-size: 100%; } h6 { font-variant: small-caps; font-size: 100%; } h2.classHierarchy { - /*border: 1px none #008500;*/ + /*border: 1px none #008500;*/ border: 1px none #000000; border-top-width: 2px; border-top-style: solid; @@ -164,9 +164,9 @@ /* - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ * | Doxygen Specific Classes | - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ */ @@ -257,9 +257,9 @@ div.qindex, div.nav { width: 100%-4px; - /*background-color: #DADAEF;*/ - /*background-color: #eeeeff;*/ - /*background-color: #EEEEEE;*/ + /*background-color: #DADAEF;*/ + /*background-color: #eeeeff;*/ + /*background-color: #EEEEEE;*/ background-color: #CCE6CA; border: 0px solid #003300; text-align: center; @@ -350,6 +350,44 @@ h3 a[name="index_7"], h3 a[name="index_8"], h3 a[name="index_9"] + h3 a[id="index__"], + h3 a#index_a, + h3 a#index_b, + h3 a#index_c, + h3 a#index_d, + h3 a#index_e, + h3 a#index_f, + h3 a#index_g, + h3 a#index_h, + h3 a#index_i, + h3 a#index_j, + h3 a#index_k, + h3 a#index_l, + h3 a#index_m, + h3 a#index_n, + h3 a#index_o, + h3 a#index_p, + h3 a#index_q, + h3 a#index_r, + h3 a#index_s, + h3 a#index_t, + h3 a#index_u, + h3 a#index_v, + h3 a#index_w, + h3 a#index_x, + h3 a#index_y, + h3 a#index_z, + h3 a#index_0, + h3 a#index_1, + h3 a#index_2, + h3 a#index_3, + h3 a#index_4, + h3 a#index_5, + h3 a#index_6, + h3 a#index_7, + h3 a#index_8, + h3 a#index_9, + h3 a#index_0x7e { font-family: time; font-size: 250%; @@ -376,14 +414,14 @@ */ .mdTable { - /*border: 1px solid #868686;*/ - /*background-color: #DADAEF;*/ - /*background-color: #F4F4FB;*/ + /*border: 1px solid #868686;*/ + /*background-color: #DADAEF;*/ + /*background-color: #F4F4FB;*/ border: 1px none #008500; border-left-width: 1px; border-left-style: solid; - /*background-color: #B8E6B8;*/ - /*background-color: #CCE6CA;*/ + /*background-color: #B8E6B8;*/ + /*background-color: #CCE6CA;*/ margin-top: 25px; font-size: 105%; } @@ -402,7 +440,7 @@ padding: 0px 8px 4px 8px; font-size: 11px; font-style: italic; - /*background-color: #FAFAFA;*/ + /*background-color: #FAFAFA;*/ border-top: 1px none #E0E0E0; border-right: 1px none #E0E0E0; border-bottom: 1px none #E0E0E0; @@ -431,31 +469,38 @@ .memdoc{ padding-left: 5px; - /*margin-top: -8px;*/ + /*margin-top: -8px;*/ border-left-width: 1px; border-left-style: solid; border-color: #008500; } + div.contents * table tr { + padding: 3px 3px 3px 8px; + } + .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight { - padding: 1px 0px 0px 8px; + /*padding: 1px 0px 0px 8px;*/ + padding: 3px 3px 3px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; + /* border-top-color: #0c0c0c; border-right-color: #0c0c0c; border-bottom-color: #0c0c0c; border-left-color: #0c0c0c; - border-top-style: solid; + */ + border-top-style: none; border-right-style: none; - border-bottom-style: none; + border-bottom-style: dotted; border-left-style: none; - /*background-color: #DADAEF;*/ - /*background-color: #eeeeff;*/ - /*background-color: #EEEEEE;*/ - background-color: #CCE6CA; + /*background-color: #DADAEF;*/ + /*background-color: #eeeeff;*/ + /*background-color: #EEEEEE;*/ + /*background-color: #CCE6CA;*/ } .memTemplItemLeft, .memTemplItemRight { @@ -478,8 +523,12 @@ .groupText, .groupHeader { color: #09550B; - margin-top: 15px; font-size: 130%; font-weight: bold; + margin-top: 15px; + } + + .groupHeader { + margin-bottom: -30pt; } diff --git a/hurricane/doc/hurricane/BasicLayer.dox b/hurricane/doc/hurricane/BasicLayer.dox index cd6ffbbc..95b1278c 100644 --- a/hurricane/doc/hurricane/BasicLayer.dox +++ b/hurricane/doc/hurricane/BasicLayer.dox @@ -7,11 +7,12 @@ /*! \class BasicLayer * \brief BasicLayer description (\b API) * + * For a more complete description of the Layers object, please refer + * to \ref secLayerIntro "Layer Introduction". + * + * For purpose of BasicLayers, also see BasicLayer::Material. */ - /*! \name Constructors - */ - // \{ /*! \function BasicLayer* BasicLayer::create(Technology* technology,const Name& name,const BasicLayer::Material& material,unsigned extractNumber,const DbU::Unit& minimalSize = 0,const DbU::Unit& minimalSpacing = 0); * creates and returns a new basic layer named \c \, of @@ -32,12 +33,6 @@ * extraction should ignore this layer. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const BasicLayer::Type& BasicLayer::getMaterial() const; * \Return the basic layer material. @@ -94,12 +89,10 @@ * and closer to the basic components */ - // \} - - - /*! \name Modifiers + /*! \function const Name& BasicLayer::getRealName() const; + * \Return the real (process) layer name, for GDS. */ - // \{ + /* \function void BasicLayer::SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue); * Sets the color of a basic layer. @@ -116,7 +109,18 @@ * Sets the display threshold of a basic layer. */ - // \} + /*! \function void BasicLayer::setBlockageLayer(BasicLayer* layer); + * Associate a blockage layer to this one. This is only meaningful + * for routing layers (RegularLayer). + */ + + /*! \function void BasicLayer::setExtractNumber(unsigned int); + * Set the extract number, for GDS. + */ + + /*! \function void BasicLayer::setRealName(const char*); + * Set the real (process) layer name, for GDS. + */ /*! \name BasicLayer Collection @@ -143,5 +147,44 @@ // \} + /*! \class BasicLayer::Material + * Encapsulate the BasicLayer::Material::Code enumeration that defines the + * BasicLayer purpose. + */ + + /*! \enum BasicLayer::Material::Code + * This enumeration defines the layer purpose inside the BasicLayer::Material. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::nWell + * This is a NWELL layer. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::pWell + * This is a PWELL layer. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::nImplant + * This is a N implant layer, for transistor source & drain. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::pImplant + * This is a P implant layer, for transistor source & drain. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::active + * For active area, for transistor gates. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::poly + * Polysilicium, for short connections & transistor gates. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::cut + * For the \e hole part of VIAs. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::metal + * For routing layers. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::blockage + * For blockages, associated to metals. + */ + /*! \var BasicLayer::Material::Code BasicLayer::Material::other + * Fallback for any other purposes. + */ + } diff --git a/hurricane/doc/hurricane/Box.dox b/hurricane/doc/hurricane/Box.dox index d418d460..9e5d083c 100644 --- a/hurricane/doc/hurricane/Box.dox +++ b/hurricane/doc/hurricane/Box.dox @@ -34,10 +34,6 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20 */ - /*! \name Constructors - */ - // \{ - /*! \function Box::Box(); * Default constructor : the returned box is empty. */ @@ -65,12 +61,6 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20 * Copy constructor. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Box& Box::operator=(const Box& box); * Assignment operator. @@ -86,12 +76,6 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20 * Difference operator. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const DbU::Unit& Box::getXMin() const; * \Return the XMin value : meaningful only for a non empty box. @@ -149,12 +133,6 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20 * either one of the two boxes is empty or if they are disjoint. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Box::isEmpty() const; * \Return \true if the box is empty, else \false. @@ -196,12 +174,6 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20 * least a common border side, else \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function Box& Box::makeEmpty(); * Transforms the box into an empty one. @@ -256,7 +228,4 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20 * and \c \. */ - // \} - - } diff --git a/hurricane/doc/hurricane/Cell.dox b/hurricane/doc/hurricane/Cell.dox index bc8bdee3..9e50d9d3 100644 --- a/hurricane/doc/hurricane/Cell.dox +++ b/hurricane/doc/hurricane/Cell.dox @@ -9,10 +9,6 @@ */ - /*! \name Constructors & Destructors - */ - // \{ - /*! \function Cell* Cell::create ( Library* library, const Name& name ); * creates and returns a new Cell named \e name for the Library * \e library. @@ -22,12 +18,6 @@ * Library. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function Library* Cell::getLibrary () const; * Returns the Library owning the Cell. @@ -160,12 +150,6 @@ * Returns the symbol associated to the cell. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Cell::isCalledBy ( Cell* cell ) const; * Returns \true if the cell \this is directly or indirectly called by @@ -180,12 +164,6 @@ * \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Cell::setName ( const Name& name ); * Allows to change the Cell Name. @@ -220,12 +198,6 @@ * De-materializes all components of all the nets of the Cell. */ - // \} - - - /*! \name Cell Collection - */ - // \{ /*! \typedef typedef GenericCollection Cells; * Generic collection representing a set of cell objects. @@ -243,6 +215,4 @@ * Macro for visiting all objects of a cell objects collection. */ - // \} - } diff --git a/hurricane/doc/hurricane/Collection.dox b/hurricane/doc/hurricane/Collection.dox index 33e702b6..3d70bbdb 100644 --- a/hurricane/doc/hurricane/Collection.dox +++ b/hurricane/doc/hurricane/Collection.dox @@ -18,6 +18,55 @@ * Collection\ whose first attribute will be a * pointer to the cell and a second attribute the rectangular * area. + * + * Main characteristics of Collections: + *
    + *
  • Collections do not own their elements (they + * remains when the Collection is deleted). + *
  • They can only be iterated \e forward. Once an + * element is consumed you cannot go back to it. + * You must restart the collection walktrough instead. + *
  • Collections are very light objects which are built, + * copied or destroyed very rapidly. + *
+ * + * + * \section secForEachMacro The forEach Macro + * + * Collections are to be used in conjunction with the \c forEach macro + * which allows to easily iterate over the elements. Iteration is done + * through a simplistic iterator which have overload for the + * operator*() and operator->() + * + * The \c forEach macro takes three arguments: + *
+ * + *
forEach(type,iterator,collection) + *
\c type Element's type of the collection. + *
\c iterator Name of the iterator's variable. + *
\c collection An appropriate collection to iterate over, that is, + * built over \c type elements. + *
+ *
+ * + * To use the forEach macro outside the Hurricane namespace, the + * following statement is necessary: +\code + using Hurricane::ForEachIterator +\endcode + * Here is a small example of a loop: +\code + using Hurricane::ForEachIterator; + + Cell* cell = ...; // Get a Cell from somewhere. + + forEach( Net*, inet, cell->getNets() ) { + cout << "This is " << (*inet); + if (inet->isExternal()) + cout << " [external net]."; + cout << endl; + } +\endcode * * * \section secGenericgetCollection The Generic getCollection @@ -34,14 +83,11 @@ set instanceSet; // here we fill the set with the desired instances... -for_each_instance(instance, getCollection(instanceSet)) { +forEach(Instance*, iinstance, getCollection(instanceSet)) { // process here each instance of the set // (the elements are visited according to the set ordering) - end_for; } \endcode - * - * * * \remark This approach is a little bit less efficient than the use of * STL iterators, not much indeed, but has the advantage to be @@ -53,7 +99,6 @@ for_each_instance(instance, getCollection(instanceSet)) { * is valid. Then you should not do the following: \code GenericCollection getInstances(...) -// ******************************************* { set instanceSet; @@ -67,26 +112,19 @@ GenericCollection getInstances(...) * * The same will occur anyway if you do: \code -Cell* cell = ... // we get the cell +Cell* cell = ...; // we get the cell -Nets nets = cellgetNets(); +Nets nets = cell->getNets(); -cellDelete(); +cell->destroy(); -for_each_net(net, nets) { +forEach(Net*, inet, nets) { ... - end_for; } \endcode * - * * - * \section secCollectionImportant Important - * - * Collections are very light objects which are built, copied or - * destroyed very rapidly. - * - * \section secCollectionLocators Locators + * \section secCollectionLocators Locators * * Each type of collection provides an associated Locator for * tracing through the corresponding set of elements. @@ -110,22 +148,11 @@ for_each_net(net, nets) { */ - - /*! \name Destructors - */ - // \{ - /*! \function Collection::~Collection(); * Destroys the collection but doesn't acts on elements refered * by this collection. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function Collection* Collection::getClone() const; * Allocates and returns a clone (copy) of the collection @@ -171,7 +198,6 @@ for_each_net(net, nets) { * \code Contacts Net::getContacts() const -// ****************************** { return getComponents().getSubSet(); } @@ -183,7 +209,6 @@ Contacts Net::getContacts() const * by the filter. \code Nets Cell::getExternalNets() const -// ******************************* { return getNets().getSubSet(Net::getIsExternalFilter()); } @@ -201,23 +226,18 @@ Nets Cell::getExternalNets() const * \sample Filter Hurricane::Segment according to their Layer. \code class IsOnLayer : public Filter { -// ************************************** - public: - Layer* _layer; - + public: IsOnLayer(Layer* layer) - : _layer(layer) + : _layer(layer) { - if (!_layer) - throw Error("Can't create IsOnLayer filter : null layer"); + if (!_layer) throw Error("Can't create IsOnLayer filter : null layer"); }; IsOnLayer(const IsOnLayer& isOnLayer) - : _layer(isOnLayer._layer) - { - }; + : _layer(isOnLayer._layer) + { }; IsOnLayer& operator=(const IsOnLayer& isOnLayer) { @@ -234,15 +254,14 @@ class IsOnLayer : public Filter { { return (segmentgetLayer() == _layer); }; - }; \endcode * * And somewher later: \code -Layer* metal = getDataBase()getTechnology()getLayer("metal"); +Layer* metal = getDataBase()->getTechnology()->getLayer("metal"); -Segments segments = netgetComponents()->getSubSet(IsOnLayer(metal)); +Segments segments = net->getComponents()->getSubSet(IsOnLayer(metal)); // segments represents here the subset of net components // which are of type Segment and located on layer metal @@ -251,23 +270,14 @@ Segments segments = netgetComponents()->getSubSet(IsOnLayer(metal)); * */ - // \} - - - /*! \name Predicates - */ - // \{ /* \function bool Collection::isEmpty() const; * This function returns \true if the collection designates no * element and else \false. */ - // \} - /*! \section secCollectionUtilitarians Utilitarians - * * * Collection::Fill * Collection::Fill @@ -280,8 +290,7 @@ Segments segments = netgetComponents()->getSubSet(IsOnLayer(metal)); - /*! \name Collection Collection - */ + //! \name Collection Collection // \{ /*! \def for_each_object(Type, element, collection) @@ -299,10 +308,9 @@ Segments segments = netgetComponents()->getSubSet(IsOnLayer(metal)); Cell* cell = ...; // we get the cell if (cell) { - for_each(Net*, net, cellgetExternalNets()) { - assert(netIsExternal()); - assert(netgetCell() == cell); - end_for; + forEach(Net*, inet, cellgetExternalNets()) { + assert(inet->isExternal()); + assert(inet->getCell() == cell); } } \endcode @@ -316,10 +324,9 @@ if (cell) { Cell* cell = ...; // we get the cell if (cell) { - for_each_net(net, cellgetExternalNets()) { - assert(netIsExternal()); - assert(netgetCell() == cell); - end_for; + forEach(Net*, inet, cellgetExternalNets()) { + assert(inet->isExternal()); + assert(inet->getCell() == cell); } } \endcode @@ -328,17 +335,6 @@ if (cell) { // \} - /*! \name Collection Functions - */ - // \{ - - // \} - - - /* \name Others - */ - // \{ - /* \function void Collection::Fill(list& list) const; * No description. */ @@ -352,6 +348,121 @@ if (cell) { * identified elements of a collection. */ - // \} + + /*! \class GenericCollection + * \brief Generic Collection auto-pointer. + * + * This class is an auto-pointer like wrapped around the raw collection. + * The database systematically returns collections wrapped inside + * GenericCollection. + * + * \remark The destruction of a GenericCollection triggers the destruction of + * the raw collection. + */ + + /*! \function GenericCollection::GenericCollection(Collection* collection); + * Constructor from a raw Collection. + * + * \remark This constructor do not build a copy of the raw collection. So the original + * raw collection must not be deleted. It's deletion will occurs with the one + * of the GenericCollection. + */ + + /*! \function GenericCollection::GenericCollection(const Collection& collection); + * Constructor from a raw Collection. + * + * \remark This constructor build a \e copy of the raw collection. So the originating + * collection can be safely deleted. + */ + + /*! \function GenericCollection::GenericCollection(const GenericCollection& collection); + * Constructor from a raw Collection. + * + * \remark This constructor build a \e copy of the raw collection. So the originating + * collection can be safely deleted. + */ + + /*! \class SubSetCollection + * \brief Applies a Filter to a Collection + * + * Build a sub-Collection of all the elements of the primary that + * match the Filter criterion. + */ + + /*! \function SubSetCollection::SubSetCollection(const Collection& collection, const Filter& filter); + * Constructor from a primary Collection and a Filter. + */ + + /*! \function SubSetCollection::SubSetCollection(const SubSetCollection& subSetCollection); + * Copy constructor. + */ + + /*! \class SubTypeCollection + * \brief Applies a Type Filter to a Collection + * + * Build a sub-Collection of all the elements of the primary that + * are of a certain sub-type. The filtering mechanism relies on a + * \c dynamic_cast<> so there must be an inheritance path between + * the Collection type and the sub-type. + */ + + /*! \function SubTypeCollection::SubTypeCollection(const Collection* collection); + * Constructor from a primary Collection and a Filter. + */ + + /*! \function SubTypeCollection::SubTypeCollection(const GenericCollection& collection); + * Constructor from a primary Collection and a Filter. + */ + + /*! \function SubTypeCollection::SubTypeCollection(const SubTypeCollection& subTypeCollection); + * Copy Constructor. + */ + +/*! \typedef typedef list ElementList; + * A simple typedef for Collection encapsulated lists. + */ + + /*! \class ListCollection + * \brief Hurricane Collection wrapper around a std::list. + * + * Automatically wrap a Hurricane Collection around a stl::list. + */ + + /*! \function ListCollection::ListCollection(const ElementList* elementList = NULL); + * Constructor from a STL list, the list must not be de-allocated. + */ + + /*! \class VectorCollection + * \brief Hurricane Collection wrapper around a std::vector. + * + * Automatically wrap a Hurricane Collection around a stl::vector. + */ + + /*! \function VectorCollection::VectorCollection(const ElementVector* elementVector = NULL); + * Constructor from a STL vector, the vector must not be de-allocated. + * + */ + + /*! \class MapCollection + * \brief Hurricane Collection wrapper around a std::map. + * + * Automatically wrap a Hurricane Collection around a stl::map. + */ + + /*! \function MapCollection::MapCollection(const ElementMap* elementMap = NULL); + * Constructor from a STL map, the map must not be de-allocated. + * + */ + + /*! \class SetCollection + * \brief Hurricane Collection wrapper around a std::set. + * + * Automatically wrap a Hurricane Collection around a stl::set. + */ + + /*! \function SetCollection::SetCollection(const ElementSet* elementSet = NULL); + * Constructor from a STL set, the set must not be de-allocated. + * + */ } diff --git a/hurricane/doc/hurricane/Command.dox b/hurricane/doc/hurricane/Command.dox index 2780a5b6..79d7e409 100644 --- a/hurricane/doc/hurricane/Command.dox +++ b/hurricane/doc/hurricane/Command.dox @@ -260,10 +260,6 @@ assert(GetZoomCommand()IsInstalledOn(view)); */ - /*! \name Accessors - */ - // \{ - /*! \function const Name& Command::GetName() const; * \Return the command name. */ @@ -276,25 +272,12 @@ assert(GetZoomCommand()IsInstalledOn(view)); * \Return the collection of views where this command is installed. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Command::IsInstalledOn(View* view) const; * \Return \true if the command is installed within the view, else * \false. */ - // \} - - - - /*! \name Messages - */ - // \{ /*! \function void Command::_OnInstalledOn(View* view); * Message called upon to inform the command that it has been @@ -358,12 +341,8 @@ assert(GetZoomCommand()IsInstalledOn(view)); * been released. */ - // \} - - - /*! \name Command Collection - */ + //! \name Command Collection // \{ /*! \typedef Commands @@ -386,10 +365,6 @@ assert(GetZoomCommand()IsInstalledOn(view)); // \} - /* \name Installation/Uninstallation - */ - // \{ - /*! \function void Command::InstallOn(View* view); * Allows to install the command in the view. * @@ -416,6 +391,4 @@ assert(GetZoomCommand()IsInstalledOn(view)); * _OnUnInstalledFrom() is issued by the view. */ - // \} - } diff --git a/hurricane/doc/hurricane/Commons.dox b/hurricane/doc/hurricane/Commons.dox index 0a9f4240..0254fc39 100644 --- a/hurricane/doc/hurricane/Commons.dox +++ b/hurricane/doc/hurricane/Commons.dox @@ -4,11 +4,17 @@ namespace Hurricane { - - /*! \addtogroup Generalities - * \{ + /*! \namespace Hurricane + * + * \brief Contains Almost Everything. + * + * Almost everything is inside the Hurricane namespace. */ + + //! \addtogroup Generalities + // \{ + /*! \function string demangle ( const char* symbol ); * Translate (demangle) a symbol from C++ (\c gnu-v3) internal format * into a human readable \string. diff --git a/hurricane/doc/hurricane/Component.dox b/hurricane/doc/hurricane/Component.dox index 97f0c762..f5d99d53 100644 --- a/hurricane/doc/hurricane/Component.dox +++ b/hurricane/doc/hurricane/Component.dox @@ -67,10 +67,6 @@ * hook). */ - /*! \name Accessors - */ - // \{ - /*! \function Net* Component::getNet() const; * \Return the net owning the component. */ @@ -109,31 +105,27 @@ * done in both methods, it is wise to redefine the method as * shown below for the Contact : \code -Unit Contact::getX() const -// *********************** +DbU::Unit Contact::getX() const { - Component* anchor = getAnchor(); - return (!anchor) ? _dx : anchorGetX() + _dx; + Component* anchor = getAnchor(); + return (not anchor) ? _dx : anchor->getX() + _dx; } -Unit Contact::getY() const -// *********************** + +DbU::Unit Contact::getY() const { - Component* anchor = getAnchor(); - return (!anchor) ? _dy : anchorGetY() + _dy; + Component* anchor = getAnchor(); + return (not anchor) ? _dy : anchor->getY() + _dy; } + Point Contact::getPosition() const -// ******************************* { - Component* anchor = getAnchor(); - return (!anchor) ? - Point(_dx, _dy) : - anchorGetPosition().Translate(_dx, _dy); + Component* anchor = getAnchor(); + return (not anchor) ? Point(_dx, _dy) + : anchor->getPosition().Translate(_dx, _dy); } \endcode - * - * * * Indeed, contacts can possibly bear on other components * through an offset defined by two attributes _dx and _dy. In @@ -199,12 +191,8 @@ Point Contact::getPosition() const * the rectangular \c \. */ - // \} - - - /*! \name Component Collection - */ + //! \name Component Collection // \{ /*! \typedef Components @@ -220,11 +208,10 @@ Point Contact::getPosition() const * some criteria. */ - /*! \def for_each_component(component, components) + /*! \def forEach(Component*, icomponent, components) * Macro for visiting all components of a components collection. */ // \} - } diff --git a/hurricane/doc/hurricane/CompositeLayer.dox b/hurricane/doc/hurricane/CompositeLayer.dox index ddaaf2e5..4b14b33c 100644 --- a/hurricane/doc/hurricane/CompositeLayer.dox +++ b/hurricane/doc/hurricane/CompositeLayer.dox @@ -36,9 +36,6 @@ * slots: VIA 5 Contact layer */ - /*! \name Constructors - */ - // \{ /*! \function CompositeLayer* CompositeLayer::create(Technology* technology,const Name& name,const CompositeLayer::Type& type,const Unit& minimalSize = 0,const Unit& minimalSpacing = 0); * creates and returns a new composite layer named \c \, @@ -49,12 +46,6 @@ * empty or if a layer of same name already exists. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const CompositeLayer::Type& CompositeLayer::getType() const; * \Return the composite layer type. @@ -103,12 +94,6 @@ * composite layer. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void CompositeLayer::add(BasicLayer* basicLayer,const Unit& contactSize,const Unit& segmentSize,const Unit& segmentExtention,const Unit& padSize); * adds the basic layer with associated characteristics @@ -150,11 +135,8 @@ assert(metal2GetPadSize(CM2) == padSize); * pertain to the composite layer. */ - // \} - - /*! \name CompositeLayer Collection - */ + //! \name CompositeLayer Collection // \{ /*! \typedef CompositeLayers diff --git a/hurricane/doc/hurricane/Contact.dox b/hurricane/doc/hurricane/Contact.dox index 92ab70f2..b0766c2c 100644 --- a/hurricane/doc/hurricane/Contact.dox +++ b/hurricane/doc/hurricane/Contact.dox @@ -38,9 +38,6 @@ * which means they are absolute. */ - /*! \name Constructors - */ - // \{ /*! \function Contact* Contact::create(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y,const DbU::Unit& width = 0, const DbU::Unit& height = 0); * creates and returns a new contact belonging to the net @@ -63,12 +60,6 @@ * \remark The new contact belongs to the anchor's net. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function Contact::AnchorHook* Contact::getAnchorHook(); * \Return the hook through which the contact can be attached upon an @@ -115,12 +106,6 @@ * \Return the contact half height. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Contact::setLayer(const Layer* layer); * sets the contact layer. @@ -181,11 +166,8 @@ * absolute location. */ - // \} - - /*! \name Contact Collection - */ + //! \name Contact Collection // \{ /*! \typedef Contacts diff --git a/hurricane/doc/hurricane/ContactLayer.dox b/hurricane/doc/hurricane/ContactLayer.dox new file mode 100644 index 00000000..cbb588d3 --- /dev/null +++ b/hurricane/doc/hurricane/ContactLayer.dox @@ -0,0 +1,41 @@ + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class ContactLayer + * \brief ContactLayer description (\b API) + * + * For a more complete description of the Layers objects, please refer + * to \ref secLayerIntro "Layer Introduction". + * + * ContactLayer is a symbolic layer that contains four layers + * (metal, cut, active, diffusion) plus an optional well layer. + * Use it to represent a contact from the first metal level toward + * an active layer. + * + * The accessors functions: + *
    + *
  • ContactLayer::getTop() + *
  • ContactLayer::getBottom() + *
  • ContactLayer::getOpposite() + *
+ * Have no meaning here. + * + * Only enclosure is used. Extention cap & extention width are not used. + */ + + + /*! \function ContactLayer* ContactLayer::create(Technology* technology,const Name& name, BasicLayer* metalLayer, BasicLayer* cutLayer, BasicLayer* activeLayer, BasicLayer* diffusionLayer, BasicLayer* wellLayer); + * creates and returns a new contact layer named \c \, + * composed of metal, cut, active & diffusion BasicLayer and an optional WELL + * BasicLayer. A NULL value indicates that no NWELL is used. + * + * \caution Throws an exception if the technology is null, if the name is + * empty, if a layer of same name already exists or if we + * overflow the capacity of the bit field associated to the + * layer mask. + */ + + } diff --git a/hurricane/doc/hurricane/DBo.dox b/hurricane/doc/hurricane/DBo.dox index d15754b0..20b79ada 100644 --- a/hurricane/doc/hurricane/DBo.dox +++ b/hurricane/doc/hurricane/DBo.dox @@ -61,7 +61,7 @@ * but a posteriori, that is once the object has been fully * built. In order to realize such an operation it must, once * all derived classes constructors have been called, call upon - * a function _PostCreate which realizes the additional + * a function _postCreate which realizes the additional * work and then return the pointer on the new objects (let us * recall that all member functions which must not be called * directly are prefixed by an underscore). @@ -71,15 +71,14 @@ * object. The following example shows its implementation for a * net : * \code - Net* Net::Create(Cell* cell, const Name& name) - // ******************************************* + Net* Net::Create(Cell* cell, const Name& name) { Net* net = new Net(cell, name); if (!net) throw Error("Can't create Net : allocation failed"); - net->_PostCreate(); + net->_postCreate(); return net; } @@ -87,51 +86,51 @@ * * Within this function, the net is created in a first time * thanks to the constructor spawn by the new operator. If - * everything goes right the function _PostCreate is + * everything goes right the function _postCreate is * called upon the net. This one realizes the additional * operations that the constructor couldn't realize and then - * calls the functions _PostCreate upon the base + * calls the functions _postCreate upon the base * classe. If everything goes right the net is returned, else an * exception is thrown if something abnormal or illegal occurs * (i.e. a net with the same name already exists). For the * example of a Line : the different called constructors - * will fully characterize the line, then the _PostCreate + * will fully characterize the line, then the _postCreate * method on a line will do nothing else than call upon the - * _PostCreate method of the go which will insert + * _postCreate method of the go which will insert * the line within the QuadTree (this is now feasible, * the line geometry being fully characterized). * - * \section sDBoDelete Deletion process + * \section sDBodestroy Deletion process * - * The Delete() member function : + * The destroy() member function : * * Data base ojects can be destroyed only by calling upon this * function and not by calling the C++ standard destructor * (which indeed is not provided). * * A process similar but opposite to the creation process is - * required. A function _PreDelete must be called upon + * required. A function _preDestroy must be called upon * before the effective object destruction. As a matter of fact, * if we take again the case of the Line for example, the * line must be removed from the QuadTree before the * destruction of its geometric characteristics (inverse of the - * previous phenomenon). Therefore the Delete function is + * previous phenomenon). Therefore the destroy function is * implemented that way : * \code - void DBo::Delete() + void DBo::destroy() // *************** { - _PreDelete(); + _preDestroy(); - delete *this; + delete this; } * \endcode * * \section sDBoExtentions Extentions * * For any new sub-type of DBo you must adhere to the same - * protocol. That is provide the methods _PostCreate and - * _PreDelete calling the methods _PostCreate and _PreDelete of + * protocol. That is provide the methods _postCreate and + * _preDestroy calling the methods _postCreate and _preDestroy of * their base class. Furthermore you must provide when this * class is instantiable a creation function (caution : only the * creation function, if any, must be \public (and \static) the @@ -140,74 +139,56 @@ * Extracted from the .h of a new type of cell. * \code class MyCell : public Cell { - // *********************** - - // Types - // ***** - - public: typedef Cell Inherit; - - // Construction - // ************ - - protected: MyCell(Library* library, const Name& name); - - public: static MyCell* Create(Library* library, const Name& name); - - // Others - // ****** - - protected: virtual void _PostCreate(); - - protected: virtual void _PreDelete(); - + public: + typedef Cell Inherit; + public: + // User-accessible creation method. + static MyCell* Create (Library* library, const Name& name); + protected: + // Internally used constructors & destructors. + MyCell (Library* library, const Name& name); + virtual void _postCreate (); + virtual void _preDestroy (); }; * \endcode * Extracted from the .cpp for this new type of cell. * \code MyCell::MyCell(Library* library, const Name& name) - // *********************************************** - : Inherit(library, name) + : Inherit(library, name) + { } + + + MyCell* MyCell::Create(Library* library, const Name& name) { + MyCell* myCell = new MyCell(library, name); + + if (!myCell) throw Error("Can't create MyCell : allocation failed"); + + myCell->_postCreate(); // must not be forgotten! + + return myCell; } - MyCell* MyCell::Create(Library* library, const Name& name) - // ******************************************************* + + void MyCell::_postCreate() { - MyCell* myCell = new MyCell(library, name); + Inherit::_postCreate(); // must not be forgotten! - if (!myCell) - throw Error("Can't create MyCell : allocation failed"); - - myCell->_PostCreate(); // must not be forgotten! - - return myCell; - } - - void MyCell::_PostCreate() - // *********************** - { // complete here the post creation - - Inherit::_PostCreate(); // must not be forgotten! - - // posibly do something here } - void MyCell::_PreDelete() - // ********************** + + void MyCell::_preDestroy() { - // posibly do something here + Inherit::_preDestroy(); // must not be forgotten! - Inherit::_PreDelete(); // must not be forgotten! - - // complete here the pre deletion + // complete here the pre-deletion. } * \endcode * * \remark The destructor, strictly speaking, is not defined because * necessary operations are done within the method - * _PreDelete. + * _preDestroy. * In the implementation of the class MyCell we have only * used the type Inherit (and never Cell). This opens * the door to hierarchy changes without affecting the code already @@ -224,12 +205,9 @@ /*! \function void DBo::destroy (); * - * The legal method to delete any DBo object (see \ref sDBoDelete). + * The legal method to delete any DBo object (see \ref sDBodestroy). */ - /*! \name Accessors - */ - // \{ /*! \function Property* DBo::getProperty ( const Name& name ) const; * \param name Name of the Property to return. @@ -237,12 +215,11 @@ * * \remark When writting what follows : * \code - for_each_dbo(dbo, dbos) { - Property* property = dbo->getProperty("width"); - if (property) { - // do something - } - end_for; + forEach(DBo*, idbo, dbos) { + Property* property = idbo->getProperty("width"); + if (property) { + // do something + } } * \endcode * @@ -251,23 +228,21 @@ * efficient to write : * \code Name width = "width"; - for_each_dbo(dbo, dbos) { - Property* property = dbo->getProperty(width); - if (property) { - // do something - } - end_for; + forEach(DBo*, idbo, dbos) { + Property* property = idbo->getProperty(width); + if (property) { + // do something + } } * \endcode * Or still better : * \code static Name WIDTH = "width"; - for_each_dbo(dbo, dbos) { - Property* property = dbo->getProperty(WIDTH); - if (property) { - // do something - } - end_for; + forEach(DBo*, idbo, dbos) { + Property* property = idbo->getProperty(WIDTH); + if (property) { + // do something + } } * \endcode * This remark applies each time you handle names. @@ -277,23 +252,11 @@ * \return The property Collection associated to the object (possibly empty). */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool DBo::hasProperty () const; * \return \true if the object has at least a property, else \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void DBo::put ( Property* property ); * @@ -324,11 +287,8 @@ * removes all properties attached to this object. */ - // \} - - /*! \name DBo Collection - */ + //! \name DBo Collection // \{ /*! \typedef typedef GenericCollection DBos; diff --git a/hurricane/doc/hurricane/DataBase.dox b/hurricane/doc/hurricane/DataBase.dox index 3416c7f5..224096cf 100644 --- a/hurricane/doc/hurricane/DataBase.dox +++ b/hurricane/doc/hurricane/DataBase.dox @@ -26,22 +26,12 @@ */ - /*! \name Constructors & Destructors - */ - // \{ - /*! \function DataBase* DataBase::create (); * creates and returns a pointer to a new DataBase. * * \caution An exception is thrown if a Database already exists. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function DataBase* DataBase::getDB (); * This static function returns the current @@ -57,6 +47,4 @@ * \return the root Library if it exists, else \NULL. */ - // \} - } diff --git a/hurricane/doc/hurricane/DbU.dox b/hurricane/doc/hurricane/DbU.dox index 713fb325..64f0af09 100644 --- a/hurricane/doc/hurricane/DbU.dox +++ b/hurricane/doc/hurricane/DbU.dox @@ -71,11 +71,19 @@ * * \section secDbUGrid Grid * + * Thoses function are closely related to editors. They allow to + * restrict to positions on a grid. We support three kind of grid, + * real, symbolic and user defined. + * *
    - *
  • DbU::getGridStep - *
  • DbU::setGridStep - *
  • DbU::isOnGrid - *
  • DbU::getOnGridUnit + *
  • DbU::getRealSnapGridStep + *
  • DbU::getOnRealSnapGrid + *
  • DbU::setRealSnapGridStep + *
  • DbU::getSymbolicSnapGridStep + *
  • DbU::getOnSymbolicSnapGrid + *
  • DbU::setSymbolicSnapGridStep + *
  • DbU::getOnCustomGrid + *
  • DbU::getOnPhysicalGrid *
* * @@ -83,16 +91,18 @@ * * Translate a DbU::Unit into grid or lambda length : *
    - *
  • long DbU::getDb (DbU::Unit u) - *
  • double DbU::getGrid (DbU::Unit u) - *
  • double DbU::getLambda(DbU::Unit u) + *
  • long DbU::toDb (DbU::Unit u) + *
  • double DbU::toGrid (DbU::Unit u) + *
  • double DbU::toLambda (DbU::Unit u) + *
  • double DbU::toPhysical (DbU::Unit u, UnitPower p) *
* * Translate a lambda length into a DbU::Unit : *
    - *
  • DbU::Unit DbU::db(long u) - *
  • DbU::Unit DbU::grid(double u) - *
  • DbU::Unit DbU::lambda(double u) + *
  • DbU::Unit DbU::fromDb (long v) + *
  • DbU::Unit DbU::fromGrid (double v) + *
  • DbU::Unit DbU::fromLambda (double v) + *
  • DbU::Unit DbU::fromPhysical (double v, UnitPower p) *
*/ @@ -134,6 +144,49 @@ * Units are printed as symbolic (lambdas). */ + /*! \function DbU::Unit DbU::fromDb(long u); + * \Return the unit corresponding to the value \c \ according to + * the current precision. This function do nothing apart from a + * cast. + */ + + /*! \function DbU::Unit DbU::fromGrid(double value); + * \Return the unit corresponding to the grid value \c \ + * according to the current precision. + */ + + /*! \function DbU::Unit DbU::fromLambda(double value); + * \Return the unit corresponding to the symbolic value \c \ + * according to the current precision. + */ + + /*! \function DbU::Unit DbU::fromPhysical(double value, UnitPower p); + * \Return the unit corresponding to the physical value \c \ + * with power \c p, according to the current precision. + */ + + /*! \function long DbU::toDb(Unit unit); + * \Return the external value associated to the unit \c \ + * according to the current precision. This function do + * nothing apart from a type cast. + */ + + /*! \function double DbU::toGrid(Unit unit); + * \Return the value expressed as a number of founder grid steps + * associated to the unit \c \ according to the current + * precision. + */ + + /*! \function double DbU::toLambda(Unit unit); + * \Return the symbolic value (expressed as a number lambdas) + * associated to the unit \c \ according to the current + * precision. + */ + + /*! \function double DbU::toPhysical(Unit unit, UnitPower p); + * \Return the physical value of \c u, expressed in the power \c p. + */ + /*! \function unsigned DbU::getPrecision(); * \Return the current precision (whose default is fixed to 1). */ @@ -168,6 +221,73 @@ * \Return How many founder grid steps makes one lambda. */ + /*! \function void DbU::setStringMode(unsigned int mode); + * Sets in which length the units are to be displayed by + * getValueString(). Avalaibles modes are : + */ + + /*! \function string DbU::getValueString(Unit unit, int mode=SmartTruncate); + * \return A character string representing the external value of + * \c \. The value is converted in the length according + * to setStringMode(): database, grid or symbolic. + * + * \remark This string is shorter than the one we could print from the + * external value because non needed decimals are not drawn (nor + * the point if value is integer). + */ + + /*! \function void DbU::setPrecision(unsigned int precision); + * Allows to set the precision at a requested value. This must + * be done at the begining of the program (before the creation + * of the first unit) and not changed for the following (unless + * mandatory and for a temporary period because all existing + * units would be misinterpreted). + * + * \remark This function throws an exception if the requested precision + * is greater than the maximal one. + */ + + /*! \function void DbU::setRealSnapGridStep(const DbU::Unit gridStep); + * Set the real (founder) grid step. + */ + + /*! \function DbU::Unit DbU::getRealSnapGridStep(); + * Get the real (founder) grid step. + */ + + /*! \function DbU::Unit DbU::getOnRealSnapGrid(DbU::Unit u, DbU::SnapMode mode=DbU::Nearest); + * Get the snap point from the unit \c u, using the rounding mode \c mode. + */ + + /*! \function void DbU::setSymbolicSnapGridStep(const DbU::Unit gridStep); + * Set the symbolic grid step. + */ + + /*! \function DbU::Unit DbU::getSymbolicSnapGridStep(); + * Get the symbolic grid step. + */ + + /*! \function DbU::Unit DbU::getOnSymbolicSnapGrid(DbU::Unit u, DbU::SnapMode mode=DbU::Nearest); + * Get the snap point from the unit \c u, using the rounding mode \c mode. + */ + + /*! \function DbU::Unit DbU::getOnCustomGrid(DbU::Unit u, DbU::Unit step, DbU::SnapMode mode=DbU::Nearest); + * Get the snap point from the unit \c u, with grid step \c step + * using the rounding mode \c mode. + */ + + /*! \function DbU::Unit DbU::getOnPhysicalGrid(DbU::Unit u, DbU::SnapMode mode=DbU::Superior); + * Get the physical grid unit nearest to \c u, with \c mode rounding. + * using the rounding mode \c mode. + */ + + /*! \name Obsoleteds + * + * Due to their somewhat unclear naming convention, those functions + * have been renamed by the \e to / \e from variants. + */ + // \{ + /*! \function DbU::Unit DbU::db(long u); * \Return the unit corresponding to the value \c \ according to * the current precision. This function do nothing apart from a @@ -202,34 +322,43 @@ * precision. */ - /*! \function void DbU::setStringMode(unsigned int mode); - * Sets in which length the units are to be displayed by - * getValueString(). Avalaibles modes are : + // \} + + /*! \enum DbU::UnitPower + * This enumeration defines the power applicable to physical units. + */ + /*! \var DbU::UnitPower DbU::Pico + * 10e-12 + */ + /*! \var DbU::UnitPower DbU::Nano + * 10e-9 + */ + /*! \var DbU::UnitPower DbU::Micro + * 10e-6 + */ + /*! \var DbU::UnitPower DbU::Milli + * 10e-3 + */ + /*! \var DbU::UnitPower DbU::Unity + * 1 + */ + /*! \var DbU::UnitPower DbU::Kilo + * 10e+3 */ - /*! \function string DbU::getValueString(Unit unit, int mode=SmartTruncate); - * \return A character string representing the external value of - * \c \. The value is converted in the length according - * to setStringMode(): database, grid or symbolic. - * - * \remark This string is shorter than the one we could print from the - * external value because non needed decimals are not drawn (nor - * the point if value is integer). + /*! \enum DbU::SnapMode + * This enumeration defines the rounding applicable to the grid management + * functions. */ - - /*! \function void DbU::setPrecision(unsigned int precision); - * Allows to set the precision at a requested value. This must - * be done at the begining of the program (before the creation - * of the first unit) and not changed for the following (unless - * mandatory and for a temporary period because all existing - * units would be misinterpreted). - * - * \remark This function throws an exception if the requested precision - * is greater than the maximal one. + /*! \var DbU::SnapMode DbU::Inferior + * Round to the inferior grid point. */ - - /* \function void DbU::setGridStep(const Unit& gridStep); - * Allows to change the grid step. + /*! \var DbU::SnapMode DbU::Superior + * Round to the superior grid point. + */ + /*! \var DbU::SnapMode DbU::Nearest + * Round nearest grid point, inferior or superior depending on the + * distance. */ // \} diff --git a/hurricane/doc/hurricane/DiffusionLayer.dox b/hurricane/doc/hurricane/DiffusionLayer.dox new file mode 100644 index 00000000..d65cbcf2 --- /dev/null +++ b/hurricane/doc/hurricane/DiffusionLayer.dox @@ -0,0 +1,41 @@ + + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class DiffusionLayer + * \brief DiffusionLayer description (\b API) + * + * For a more complete description of the Layers objects, please refer + * to \ref secLayerIntro "Layer Introduction". + * + * DiffusionLayer is a symbolic layer that contains two or three layers, + * an active layer, a diffusion layer and an optional WELL layer. + * + * The accessors functions: + *
    + *
  • DiffusionLayer::getTop() + *
  • DiffusionLayer::getBottom() + *
  • DiffusionLayer::getOpposite() + *
+ * Have no meaning here. + * + * Only extention cap & extention width are used here. Enclosure is not + * used. + */ + + + /*! \function DiffusionLayer* DiffusionLayer::create(Technology* technology,const Name& name, BasicLayer* activeLayer, BasicLayer* diffusionLayer, BasicLayer* wellLayer); + * creates and returns a new diffusion layer named \c \, + * composed of active & diffusion BasicLayer and an optional WELL + * BasicLayer. A NULL value indicates that no NWELL is used. + * + * \caution Throws an exception if the technology is null, if the name is + * empty, if a layer of same name already exists or if we + * overflow the capacity of the bit field associated to the + * layer mask. + */ + + } diff --git a/hurricane/doc/hurricane/DoxygenLayout.xml b/hurricane/doc/hurricane/DoxygenLayout.xml new file mode 100644 index 00000000..1c8525c3 --- /dev/null +++ b/hurricane/doc/hurricane/DoxygenLayout.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hurricane/doc/hurricane/Entity.dox b/hurricane/doc/hurricane/Entity.dox index c07cc87a..da6f73aa 100644 --- a/hurricane/doc/hurricane/Entity.dox +++ b/hurricane/doc/hurricane/Entity.dox @@ -14,10 +14,6 @@ */ - /*! \name Accessors - */ - // \{ - /*! \function Cell* Entity::getCell () const; * \return Returns the cell owning this entity (when the Entity is a Cell, * the Cell itself is returned) @@ -34,11 +30,8 @@ * Instance of the Plug. */ - // \} - - /*! \name Entity Collection - */ + //! \name Entity Collection // \{ /*! \typedef typedef GenericCollection Entities; diff --git a/hurricane/doc/hurricane/Error.dox b/hurricane/doc/hurricane/Error.dox index 680a6deb..f8a5dc66 100644 --- a/hurricane/doc/hurricane/Error.dox +++ b/hurricane/doc/hurricane/Error.dox @@ -17,7 +17,7 @@ try { throw Error("Something strange"); } catch {Exception& exception) { - cerr << exception << endl; + cerr << exception.what() << endl; } \endcode * Will produce the message : @@ -27,10 +27,10 @@ catch {Exception& exception) { * while the following code : \code try { - throw Error("Can't create Net : null cell", 3); + throw Error(3, "Can't create Net : null cell"); } catch {Exception& exception) { - cerr << exception << endl; + cerr << exception.what() << endl; } \endcode * Will produce the message : @@ -41,13 +41,13 @@ catch {Exception& exception) { * the following code : \code try { - throw Error("Can't create Net : null cell", 3); + throw Error(3, "Can't create Net : null cell"); } catch {Error& error) { - cerr << error.GetReason() << " (code " << error.GetCode() << ")" << endl; + cerr << error.getReason() << " (code " << error.getCode() << ")" << endl; } catch {Exception& exception) { - cerr << exception << endl; + cerr << exception.what() << endl; } \endcode * Which will produce the message : @@ -62,47 +62,51 @@ Can't create Net : null cell (code 3) * this class. */ - /*! \name Constructors - */ - // \{ - - /*! \function Error::Error(const string& reason, int code = 0); - * Builds an error characterized by a reason and an error code - * useful within a switch. - */ /*! \function Error::Error(const Error& error); * Copy constructor. */ - // \} - - - /*! \name Operators + /*! \function Error::Error(const string& reason); + * Builds a error characterized by a reason (code defaults to zero). */ - // \{ + + /*! \function Error::Error(const char* format, ...); + * Builds a error characterized by a reason, using the \c vararg protocol + * and \c printf format (code defaults to zero). + */ + + /*! \function Error::Error(int code, const string& reason); + * Builds a error characterized by a reason and a code useful + * within a switch. + */ + + /*! \function Error::Error(int code, const char* format, ...); + * Builds a error characterized by a reason and a code useful + * within a switch. The reason is supplied in a \c printf + * like fashion. + */ + /*! \function Error& Error::operator=(const Error& error); * Assignment operator. */ - // \} - - /*! \name Accessors - */ - // \{ - - /*! \function const string& Error::GetReason() const; + /*! \function string Error::getReason() const; * \Return the reason for which the error was thrown. */ - /*! \function int Error::GetCode() const; + /*! \function int Error::getCode() const; * \Return the error code number. */ - // \} - + /*! \function string Error::textWhere() const; + * \Return A stack trace, suitable for tty. + */ + /*! \function string Error::htmlWhere() const; + * \Return A stack trace, suitable for HTML. + */ } diff --git a/hurricane/doc/hurricane/Exception.dox b/hurricane/doc/hurricane/Exception.dox index 8198075d..c9dbf3b1 100644 --- a/hurricane/doc/hurricane/Exception.dox +++ b/hurricane/doc/hurricane/Exception.dox @@ -12,6 +12,8 @@ * The Exception class groups all exceptions thrown by functions * from the API. This virtual class is only useful to catch * exceptions originating from one of those functions. + * + * \remark Copy construction is disabled. * * * \section secExceptionExample Example @@ -22,7 +24,7 @@ try { } catch (Exception& exception) { // Go through here if the exception comes from a function of the API - cerr << exception << endl; + cerr << exception.what() << endl; exit(1); } catch (...) { @@ -34,6 +36,31 @@ catch (...) { \endcode */ + /*! \function string Exception::what() const; + * \Return an alias over the textWhat() method for convenience. + */ + /*! \function string Exception::textWhat() const; + * \Return an informative (hopefully) about what has caused the exception to + * occurs. Formatted for an output on a tty. + * + * \see setTextTranslator + */ + + /*! \function string Exception::htmlWhat() const; + * \Return an informative (hopefully) about what has caused the exception to + * occurs. Formatted for an output on a HTML capable device. + * + * \see setHtmlTranslator + */ + + /*! \function string Exception::setTextTranslator(const TextTranslator& translator); + * Set the translator used for text (tty) output. + */ + + /*! \function string Exception::setHtmlTranslator(const TextTranslator& translator); + * Set the translator used for HTML (hint: Qt manage simple HTML in text) + * output. + */ } diff --git a/hurricane/doc/hurricane/Filter.dox b/hurricane/doc/hurricane/Filter.dox index e70bef10..1c9398ed 100644 --- a/hurricane/doc/hurricane/Filter.dox +++ b/hurricane/doc/hurricane/Filter.dox @@ -19,46 +19,9 @@ * You will have also to define the default constructor, the * copy constructor, the assignment operator and overload the * two following member functions : - */ - - - - /*! \name Accessors - */ - // \{ - - /*! \function Filter* Filter::getClone() const; - * \Return a filter copy. - */ - - // \} - - - /*! \name Predicates - */ - // \{ - - /*! \function bool Filter::accept(Type element) const; - * This member function returns \true if the filter accepts the - * element else \false. - */ - - // \} - - - /*! \name Operators - */ - // \{ - - /*! \function GenericFilter Filter::operator ! () const; - * \Return the inverse filter of the filter \c \ (accepted - * elements are those rejected and conversely). - */ - - // \} - - - /*! \section secFilterSimpleExample Simple example + * + * + * \section secFilterSimpleExample Simple Example * * Definition of the filter selecting external nets of a cell : \code @@ -75,7 +38,7 @@ class IsExternal : public Filter { virtual Filter* getClone() const {return new IsExternal(*this);}; - virtual bool accept(Net* net) const {return netIsExternal();}; + virtual bool accept(Net* net) const {return net->isExternal();}; }; \endcode @@ -97,11 +60,9 @@ Nets Cell::getInternalNets() const return getNets().getSubSet(!IsExternal()); } \endcode - */ - - - - /*! \section secFilterComplexExample Complex example + * + * + * \section secFilterComplexExample Complex Example * * In order to implement previous examples we could have used * filter with a simpler interface. Now the filters as they are @@ -140,18 +101,17 @@ class MyFilter : public Filter { virtual bool accept(Net* net) const { - return netIsExternal() && (netGetName()[0] == _c); + return net->isExternal() && (net->getName()[0] == _c); }; }; \endcode * Afterwards do \code -for_each_net(net, cellGetNets().getSubSet(MyFilter('k'))) { - assert(net->IsExternal()); - assert(net->getName()[0] == 'k'); - cerr << "net: " << net << endl; - end_for; +forEach(Net*, inet, cell->getNets().getSubSet(MyFilter('k'))) { + assert(inet->isExternal()); + assert(inet->getName()[0] == 'k'); + cerr << "net: " << (*inet) << endl; } \endcode * Although this example is not of great interest, it @@ -168,18 +128,16 @@ for_each_net(net, cellGetNets().getSubSet(MyFilter('k'))) { * Indeed, for the previous example, preferably write it like * this : \code -for_each_net(net, cellGetNets()) { - if (netIsExternal() && (net->getName()[0] == 'k')) - cerr << "net: " << net << endl; - end_for; +forEach(Net*, inet, cell->getNets()) { + if (inet->isExternal() && (inet->getName()[0] == 'k')) + cerr << "net: " << *net << endl; } \endcode * or more simply : \code -for_each_net(net, cellGetExternalNets()) { - if (net->getName()[0] == 'k') - cerr << "net: " << net << endl; - end_for; +forEach(Net*, net, cell->getExternalNets()) { + if (inet->getName()[0] == 'k') + cerr << "net: " << *inet << endl; } \endcode * Filters are objects like any other : they can be passed as @@ -204,5 +162,78 @@ Nets Cell::getNets(const NetFilter& filter) const */ + /*! \function Filter* Filter::getClone() const; + * \Return a filter copy. + */ + + + /*! \function bool Filter::accept(Type element) const; + * This member function returns \true if the filter accepts the + * element else \false. + */ + + + /*! \function GenericFilter Filter::operator ! () const; + * \Return the inverse filter of the filter \c \ (accepted + * elements are those rejected and conversely). + */ + + + /*! \class GenericFilter + * \brief Generic Filter auto-pointer. + * + * This class is an auto-pointer like wrapped around the raw filter. + * The database systematically returns filters wrapped inside + * GenericFilter. + * + * \remark The destruction of a GenericFilter triggers the destruction of + * the raw filter. + */ + + /*! \function GenericFilter::GenericFilter(Filter* filter); + * Constructor from a raw Filter. + * + * \remark This constructor do not build a copy of the raw filter. So the original + * raw filter must not be deleted. It's deletion will occurs with the one + * of the GenericFilter. + */ + + /*! \function GenericFilter::GenericFilter(const Filter& filter); + * Constructor from a raw Filter. + * + * \remark This constructor build a \e copy of the raw filter. So the originating + * filter can be safely deleted. + */ + + /*! \function GenericFilter::GenericFilter(const GenericFilter& filter); + * Constructor from a raw Filter. + * + * \remark This constructor build a \e copy of the raw filter. So the originating + * filter can be safely deleted. + */ + + + /*! \class NotFilter + * \brief Filter negation. + * + * This filter invert the matching criterion of any other filter. + * + * \remark This is a raw Filter. + * + */ + + /*! \function NotFilter::NotFilter(const Filter& filter); + * Constructor from a raw Filter. + * + * \remark This constructor build a \e copy of the raw filter. So the originating + * filter can be safely deleted. + */ + + /*! \function NotFilter::NotFilter(const NotFilter& filter); + * Copy constructor. + * + * \remark This constructor build a \e copy of the raw filter. So the originating + * filter can be safely deleted. + */ } diff --git a/hurricane/doc/hurricane/GenericCollection.dox b/hurricane/doc/hurricane/GenericCollection.dox index 48a22781..60f2fc8d 100644 --- a/hurricane/doc/hurricane/GenericCollection.dox +++ b/hurricane/doc/hurricane/GenericCollection.dox @@ -141,9 +141,6 @@ if (cell) { * it. */ - /*! \name Constructors - */ - // \{ /*! \function GenericCollection::GenericCollection(); * Default constructor : The generic collection is unbound and @@ -175,13 +172,6 @@ if (cell) { * empty). */ - // \} - - - - /*! \name Operators - */ - // \{ /*! \function GenericCollection& GenericCollection::operator=(const Collection& collection); * Assignment operator : if the generic collection was bound to @@ -203,8 +193,4 @@ if (cell) { * \remark Here, again, you can do that only once ... */ - // \} - - - } diff --git a/hurricane/doc/hurricane/GenericFilter.dox b/hurricane/doc/hurricane/GenericFilter.dox index 6f642844..6a18f4ed 100644 --- a/hurricane/doc/hurricane/GenericFilter.dox +++ b/hurricane/doc/hurricane/GenericFilter.dox @@ -21,6 +21,4 @@ * don't detail this class. Kwowing that they exist is enough. */ - - } diff --git a/hurricane/doc/hurricane/Go.dox b/hurricane/doc/hurricane/Go.dox index b2195987..df82d6f8 100644 --- a/hurricane/doc/hurricane/Go.dox +++ b/hurricane/doc/hurricane/Go.dox @@ -64,15 +64,15 @@ * type: Let us examine the following piece of code which * illustrates that \code -OpenUpdateSession(); +UpdateSession::open(); -contact->SetLayer(...); -contact->SetSizes(...); -contact->SetPosition(...); +contact->setLayer(...); +contact->setSize(...); +contact->setPosition(...); -CloseUpdateSession(); +UpdateSession::close(); \endcode - * The call to the generic function OpenUpdateSession() + * The call to the generic function UpdateSession::open() * allows to open a new update_session. * * The three following lines call upon functions which modify @@ -80,7 +80,7 @@ CloseUpdateSession(); * directly or indirectly bear on it. * * At last the call to the generic function - * CloseUpdateSession() allows to close the last update + * UpdateSession::close() allows to close the last update * session currently open. * * type: What does really happen ? @@ -90,7 +90,7 @@ CloseUpdateSession(); * placed on the top of this stack represents the current * session. * - * When the object is modified : the method Invalidate + * When the object is modified : the method Go::invalidate() * which we will detail later is called upon. The purpose of * this method is to de-materialize all materialized objects * affected directly or indirectly by this modification and @@ -121,25 +121,15 @@ CloseUpdateSession(); */ - - /*! \name Predicates - */ - // \{ - /*! \function bool Go::autoMaterializationIsDisabled(); - * No description. + * \Return \true if the automatic materialization is disabled. */ /*! \function bool Go::isMaterialized() const; - * No description. + * \Return \true if the Go is materialized, that is, inserted in the + * QuadTree. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Go::enableAutoMaterialization(); * \see Go::DisableAutoMaterialization(). @@ -158,21 +148,19 @@ CloseUpdateSession(); * * The following sample code shows how to proceed : \code -Cell* LoadCellFromFile(...) -// ************************ +Cell* LoadCellFromFile ( ... ) { - Cell* cell = Cell::Create(...); + Cell* cell = Cell::create( ... ); - bool enabledFlag = ! AutoMaterializationIsDisabled(); - - DisableAutoMaterialization(); // we force the mode + bool enabledFlag = not Go::autoMaterializationIsDisabled(); + Go::disableAutoMaterialization(); // we force the mode ... // we open the file and load the cell if (enabledFlag) // we restore the initial state if needed - EnableAutoMaterialization(); + Go::enableAutoMaterialization(); - cell->Materialize(); // delayed materialization of cell content + cell->materialize(); // delayed materialization of cell content return cell; } @@ -180,11 +168,12 @@ Cell* LoadCellFromFile(...) */ /*! \function void Go::materialize(); - * No description. + * Triggers the materialization, that is, insert into the relevant + * QuadTree. */ /*! \function void Go::unmaterialize(); - * No description. + * Withdrawn the Go from it's QuadTree. */ /*! \function void Go::invalidate(bool propagateFlag = true); @@ -211,62 +200,51 @@ Cell* LoadCellFromFile(...) * * \sample We give as an example the implementation for the instances : \code -void Instance::Invalidate(bool propagateFlag) -// ****************************************** +void Instance::invalidate ( bool propagateFlag ) { - Inherit::Invalidate(false); + Inherit::invalidate(false); - if (propagateFlag) { - for_each_plug(plug, GetConnectedPlugs()) { - plugInvalidate(true); - end_for; - } - } + if (propagateFlag) { + forEach(Plug*, iplug, GetConnectedPlugs()) { + iplug->invalidate(true); + } + } } \endcode \code -void Component::Invalidate(bool propagateFlag) -// ******************************************* +void Component::invalidate ( bool propagateFlag ) { - Inherit::Invalidate(false); + Inherit::invalidate(false); - if (propagateFlag) { - for_each_component(component, GetSlaveComponents()) { - componentInvalidate(false); - end_for; - } - } + if (propagateFlag) { + forEach(Component*, icomponent, GetSlaveComponents()) { + icomponent->invalidate(false); + } + } } \endcode \code -void Contact::SetLayer(Layer* layer) -// ********************************* +void Contact::setLayer ( Layer* layer ) { - if (!layer) - throw Error("Can't set layer : null layer"); + if (!layer) throw Error("Can't set layer : null layer"); - if (layer != _layer) { + if (layer != _layer) { + // we do the change only if necessary + invalidate(false); // done before the modification - // we do the change only if necessary - - Invalidate(false); // done before the modification - - _layer = layer; - } + _layer = layer; + } } \endcode \code -void Instance::SetTransformation(const Transformation& transformation) -// ******************************************************************* +void Instance::setTransformation(const Transformation& transformation) { - if (transformation != _transformation) { - - // we do the change only if necessary - - Invalidate(true); // done before the modification - - _transformation = transformation; - } + if (transformation != _transformation) { + // we do the change only if necessary + invalidate(true); // done before the modification + + _transformation = transformation; + } } \endcode */ @@ -279,11 +257,8 @@ void Instance::SetTransformation(const Transformation& transformation) * graphic object. */ - // \} - - /*! \name Go Collection - */ + //! \name Go Collection // \{ /*! \typedef Gos @@ -299,12 +274,11 @@ void Instance::SetTransformation(const Transformation& transformation) * criteria. */ - /*! \def for_each_go(go, gos) + /*! \def forEach(Go*, igo, gos) * Macro for visiting all graphic objects of a graphic objects * collection. */ // \} - } diff --git a/hurricane/doc/hurricane/Hook.dox b/hurricane/doc/hurricane/Hook.dox index e336b727..150f7cf3 100644 --- a/hurricane/doc/hurricane/Hook.dox +++ b/hurricane/doc/hurricane/Hook.dox @@ -95,10 +95,6 @@ */ - /*! \name Accessors - */ - // \{ - /*! \function Component* Hook::getComponent() const; * \Return the component whose hook represents a part. * @@ -172,12 +168,6 @@ * The master is not included in this collection. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Hook::isMaster() const; * \Return \true if the hook must be considered as a master, else @@ -203,12 +193,6 @@ * \caution The meaning here is very different than for a slave hook! */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function Hook* Hook::detach(); * If the hook is a slave : @@ -265,11 +249,8 @@ * corresponding hyper-hooks. */ - // \} - - /*! \name Hook Collection - */ + //! \name Hook Collection // \{ /*! \typedef Hooks @@ -291,5 +272,4 @@ // \} - } diff --git a/hurricane/doc/hurricane/Horizontal.dox b/hurricane/doc/hurricane/Horizontal.dox index 0feea807..01826706 100644 --- a/hurricane/doc/hurricane/Horizontal.dox +++ b/hurricane/doc/hurricane/Horizontal.dox @@ -34,9 +34,6 @@ * knowing it. */ - /*! \name Constructors - */ - // \{ /*! \function Horizontal* Horizontal::create(Component* source, Component* target, const Layer* layer,const DbU::Unit& y, const DbU::Unit& width = 0,const DbU::Unit& dxSource = 0, const DbU::Unit& dxTarget = 0); * No description. @@ -52,12 +49,6 @@ * null. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const DbU::Unit& Horizontal::getDxSource() const; * \Return the relative source abscissa of the segment (may be absolute @@ -75,12 +66,6 @@ * getTargetY() defined at the Segment level. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Horizontal::setY(const DbU::Unit& x); * sets the ordinate of the segment. @@ -91,11 +76,8 @@ * \c \. */ - // \} - - /*! \name Horizontal Collection - */ + //! \name Horizontal Collection // \{ /*! \typedef Horizontals diff --git a/hurricane/doc/hurricane/Instance.dox b/hurricane/doc/hurricane/Instance.dox index c5c665f7..50203cd0 100644 --- a/hurricane/doc/hurricane/Instance.dox +++ b/hurricane/doc/hurricane/Instance.dox @@ -33,9 +33,6 @@ * knowing it. */ - /*! \name Constructors - */ - // \{ /*! \function Instance* Instance::create(Cell* cell, const Name& name, Cell* masterCell, bool secureFlag = true); * No description. @@ -57,12 +54,6 @@ * time, but at your own risks). */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const Name& Instance::getName() const; * \Return the instance name. @@ -122,12 +113,6 @@ * area. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Instance::setName(const Name& name); * Allows to change the instance name. @@ -163,12 +148,8 @@ * occurences are therefore deleted. */ - // \} - - - /*! \name Instance Collection - */ + //! \name Instance Collection // \{ /*! \typedef Instances @@ -191,5 +172,4 @@ // \} - } diff --git a/hurricane/doc/hurricane/Interruption.dox b/hurricane/doc/hurricane/Interruption.dox index 87a16ab0..b86a2935 100644 --- a/hurricane/doc/hurricane/Interruption.dox +++ b/hurricane/doc/hurricane/Interruption.dox @@ -22,9 +22,6 @@ * this class. */ - /*! \name Constructors - */ - // \{ /*! \function Interruption::Interruption(const string& reason, int code = 0); * Builds an interruption characterized by a reason and a code @@ -35,23 +32,11 @@ * Copy constructor. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Interruption& Interruption::operator=(const Interruption& interruption); * Assignment operator. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const string& Interruption::GetReason() const; * \Return the reason for which the interruption was thrown. @@ -61,7 +46,4 @@ * \Return the interruption code number. */ - // \} - - } diff --git a/hurricane/doc/hurricane/Interval.dox b/hurricane/doc/hurricane/Interval.dox index 6aa78ad8..3af3e7e6 100644 --- a/hurricane/doc/hurricane/Interval.dox +++ b/hurricane/doc/hurricane/Interval.dox @@ -26,10 +26,6 @@ - /*! \name Constructors - */ - // \{ - /*! \function Interval::Interval(bool makeEmpty=true); * Default constructor : the returned interval is empty if * makeEmpy is set to true (default) or full span @@ -50,12 +46,6 @@ * Copy constructor. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Interval& Interval::operator=(const Interval& interval); * Assignment operator. @@ -71,12 +61,6 @@ * Difference operator. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const DbU::Unit& Interval::getVMin() const; * \Return the VMin value : meaningful only for a non empty interval. @@ -112,12 +96,6 @@ * they are disjoint. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Interval::isEmpty() const; * \Return \true if the interval is empty, else \false. @@ -143,12 +121,6 @@ * else \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function Interval& Interval::makeEmpty(); * Transforms the interval into an empty one. @@ -204,8 +176,4 @@ assert(interval1.translate(10) == interval2.inflate(-10, 10)); * */ - // \} - - - } diff --git a/hurricane/doc/hurricane/Layer.dox b/hurricane/doc/hurricane/Layer.dox index 80b87891..97dccf94 100644 --- a/hurricane/doc/hurricane/Layer.dox +++ b/hurricane/doc/hurricane/Layer.dox @@ -9,29 +9,92 @@ * * \section secLayerIntro Introduction * - * There are two layer types : Basic layers which are indeed the - * real process layers (GDS ones) and composite layers on which - * are located components of the layout. A composite layer - * groups a set of basic layers. For example, the contact layer - * VIA12 is built of the basic layers CM1 (metal1), CM2 (metal2) - * and C12 (contact cuts between CM1 and CM2). + * Layers are divideds in three categories: + *
    + *
  • Layer : the base class, it supplies a generic interface + * sufficent for most manipulations. However, there are cases + * when a specific derived class may be needed. Mostly when + * assembling the symbolic layers. + *
  • BasicLayer : they represents the real process layers (GDS ones). + * They possesses the following characteristics: + *
      + *
    • Each BasicLayer is associated with an unique bit in the + * Layer::Mask. This bit is used to find if a symbolic layer + * contains that particular BasicLayer. + *
    • No dimension extentions. Database objects drawn with those + * layers have rectangles the exact size specified by the + * user. This is mandatory if you want to create a real layout + * (by opposition to a symbolic one). + *
    • They have a \b material field hinting the purpose of the + * layer (is a routing metal, a cut, a diffusion and so on). + *
    • They may have an associated blockage layer (for routing + * layers). + *
    + *
  • Symbolic Layers : used to draw the various components of + * a symbolic layout. They are made of a list of BasicLayers and + * how to extend their dimensions from the user specified sizes. + *
      + *
    • RegularLayer : contains one BasicLayer, use for wires. + *
    • ViaLayer : contains three BasicLayer, for contact between + * metal layers. The BasicLayers must be of \c (metal,cut,metal) + * materials. + *
    • ContactLayer : contains four or five BasicLayers, for contact + * towards active layers or transistor gates. The fifth optional + * parameter is the well. Materials of the components must be of + * type \c (metal,cut,active,diffusion[,well]) + *
    • DiffusionLayer : contains three BasicLayer, for diffusion area. + * Materials of the components must be of type + * \c (active,diffusion,well). + *
    • TransistorLayer : contains three to four layers, for representing + * digital transistors. Materials are of type : + * \c (gate,active,diffusion,well). + *
    + *
* * Like for the Technology object, a layer must not be deleted, * else all components located on it will have a dangling * pointer to an deleted object ... + * + * + * \subsection secBasicLayerOrder BasicLayer Creation Ordering + * + * The creation order is significant regarding the metal connectivity. + * The metal & cut layers must be created in alternately fashion, + * for example: + *
+ * + *
BasicLayerMaterialLayer::Mask + *
\c cut0 \c cut \c 0x00000010 + *
\c metal1 \c metal\c 0x00000020 + *
\c cut1 \c cut \c 0x00000040 + *
\c metal2 \c metal\c 0x00000080 + *
\c cut2 \c cut \c 0x00000100 + *
\c metal3 \c metal\c 0x00000200 + *
+ *
+ * + * + * \subsection secLayerLookup Looking Up a Layer from a Mask + * + * A BasicLayer is uniquely associated to a bit in the + * Layer::Mask. But, multiple symbolic layers could be built + * over that BasicLayer. In that case all those layers will + * have the same mask. For the mask lookup functions not + * to be confused, we introduce the concept of working layer + * in all the symbolic layers with the same mask, this is the + * one that will be returned. */ /*! \typedef Layer::Mask * This type represents a mask bit field characterising * efficiently the constituents of any kind of layer. It - * associates to each basic layer a bit and to each composite + * associates to each basic layer a bit and to each symbolic * layer the union of the bits corresponding to its basic * layers. */ - /*! \name Accessors - */ - // \{ + + // Accessors /*! \function Technology* Layer::getTechnology() const; * \Return the technolgy owning the layer. @@ -62,18 +125,93 @@ * \Return the minimal spacing between two pads on this layer. */ + /*! \function const DbU::Unit& Layer::getPitch() const; + * \Return the pitch between two routing wires on this layer. + * Only significant for metal. + */ + /*! \function BasicLayers Layer::getBasicLayers() const; * \Return the collection of basic layers within this layer. * * \remark For a basic layer the collection contains this one only. */ - // \} - - - /*! \name Predicates + /*! \function const Layer* Layer::getTop() const; + * \Return The uppermost layer of that layer. On BasicLayer, it is always + * the layer itself. In symbolic layers the meaning depends on the + * object structure. + * + * \remark In symbolic layers, top & bottom are not related to the Layer::Mask + * but to the \e structuration of the layer. It is advisable that + * the designer create layers and symbolic layers in way that ensure + * the top layer is indeed the one with the greater mask. + */ + + /*! \function const Layer* Layer::getBottom() const; + * \Return The lowermost layer of that layer. On BasicLayer, it is always + * the layer itself. In symbolic layers the meaning depends on the + * object structure. + */ + + /*! \function const Layer* Layer::getOpposite( const Layer* source ) const; + * \Return This method is only meaningful for ViaLayer. It returns the metal + * Layer opposite to the one given in arguments. + */ + + /*! \function Layer* Layer::getMetalAbove() const; + * \Return The metal working layer whose mask is immediatly above + * this one. + */ + + /*! \function Layer* Layer::getMetalBelow() const; + * \Return The metal working layer whose mask is immediatly below + * this one. + */ + + /*! \function Layer* Layer::getCutAbove() const; + * \Return The cut working layer whose mask is immediatly above + * this one. + */ + + /*! \function Layer* Layer::getCutBelow() const; + * \Return The cut working layer whose mask is immediatly below + * this one. + */ + + /*! \function DbU::Unit Layer::getEnclosure() const; + * \Return The maximal enclosure, of all layers. + */ + + /*! \function DbU::Unit Layer::getExtensionCap() const; + * \Return The maximal extension cap, of all layers. + */ + + /*! \function DbU::Unit Layer::getExtensionWidth() const; + * \Return The maximal extension width, of all layers. + */ + + /*! \function DbU::Unit Layer::getEnclosure(const BasicLayer* layer) const; + * \Return The enclosure, for the given layer. + */ + + /*! \function DbU::Unit Layer::getExtensionCap(const BasicLayer* layer) const; + * \Return The extension cap, for the given layer. + */ + + /*! \function DbU::Unit Layer::getExtensionWidth(const BasicLayer* layer) const; + * \Return The extension width, for the given layer. + */ + + + // Predicates + + /*! \function bool Layer::above(const Layer* layer) const; + * \Return \true, if \c layer is above this one. + */ + + /*! \function bool Layer::below(const Layer* layer) const; + * \Return \true, if \c layer is below this one. */ - // \{ /*! \function bool Layer::contains(const Layer* layer) const; * \Return \true if the \c \ is completely included in the layer @@ -86,12 +224,13 @@ * least a common basic layer, else \false. */ - // \} - - - /*! \name Modifiers + /*! \function bool Layer::isWorking() const; + * \Return \true, if this layer is the working one, that is, the + * one that will be returned for any layer with it's Layer::Mask. */ - // \{ + + + // Mutators /*! \function void Layer::setName(const Name& name); * sets or changes the layer name. @@ -101,18 +240,27 @@ */ /*! \function void Layer::setMinimalSize(const DbU::Unit& minimalSize); - * sets the minimal size of a pad on this layer. + * Sets the minimal size of a pad on this layer. */ /*! \function void Layer::setMinimalSpacing(const DbU::Unit& minimalSpacing); - * sets the minimal spacing between two pads on this layer. + * Sets the minimal spacing between two pads on this layer. */ - // \} - - - /*! \name Layer Collection + /*! \function void Layer::setEnclosure(const BasicLayer* layer, DbU::Unit& enclosure); + * Sets the enclosure for the given BasicLayer. */ + + /*! \function void Layer::setExtentionCap(const BasicLayer* layer, DbU::Unit ecap); + * Sets the extention cap for the given BasicLayer. + */ + + /*! \function void Layer::setExtentionWidth(const BasicLayer* layer, DbU::Unit ewidth); + * Sets the extention width for the given BasicLayer. + */ + + + //! \name Layer Collection // \{ /*! \typedef Layers diff --git a/hurricane/doc/hurricane/Library.dox b/hurricane/doc/hurricane/Library.dox index 6cffc37c..4f143f6e 100644 --- a/hurricane/doc/hurricane/Library.dox +++ b/hurricane/doc/hurricane/Library.dox @@ -24,9 +24,6 @@ * knowing it. */ - /*! \name Constructors - */ - // \{ /*! \function Library* Library::create(DataBase* dataBase, const Name& name); * creates and returns a new root library named \c \ for @@ -45,12 +42,6 @@ * the library. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function DataBase* Library::getDataBase() const; * \Return the data base owning directly or indirectly the library. @@ -88,12 +79,6 @@ * \Return the collection of all symbols of the library. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Library::setName(const Name& name); * Allows to change the library name. @@ -103,11 +88,8 @@ * with the same name. */ - // \} - - /*! \name Library Collection - */ + //! \name Library Collection // \{ /*! \typedef Libraries @@ -130,5 +112,4 @@ // \} - } diff --git a/hurricane/doc/hurricane/ListCollection.dox b/hurricane/doc/hurricane/ListCollection.dox index 70d936d1..7ce8c120 100644 --- a/hurricane/doc/hurricane/ListCollection.dox +++ b/hurricane/doc/hurricane/ListCollection.dox @@ -60,10 +60,6 @@ if (cell) { - /* \name Accessors - */ - // \{ - /*! \function GenericCollection ListCollection::GetCollection(const list& elementList); * \see below. */ @@ -74,6 +70,4 @@ if (cell) { * argument. */ - // \} - } diff --git a/hurricane/doc/hurricane/Locator.dox b/hurricane/doc/hurricane/Locator.dox index 90ee460f..4e4ab91a 100644 --- a/hurricane/doc/hurricane/Locator.dox +++ b/hurricane/doc/hurricane/Locator.dox @@ -10,7 +10,14 @@ * \section secLocatorIntro Introduction * * Locators are objects which allow to walk efficiently through - * the data structure. + * the data structure. + * + * Locators are indeed algorithms. They do not hold a list of + * elements but the way to go from one element to the next. + * As such, they are very light in memory, contrary to containers. + * Locators are the workhorse of Collection, and while they can + * be used directly, this is not the recommended way. + * * * \section secLocatorGeneralConcepts General concepts * @@ -43,16 +50,16 @@ Cell* cell = ...; // we get the cell if (cell) { - // CellGetNets() + // cell->getNets() // returns the nets collection of the cell // and getLocator() // allocates and returns a locator for traversing those nets - Locator* locator = CellGetNets().getLocator(); + Locator* locator = cell->getNets().getLocator(); - while (locatorIsValid()) { - Net* net = locatorGetElement(); - assert(netGetCell() == cell); - locatorProgress(); + while (locator->isValid()) { + Net* net = locator->getElement(); + assert(net->getCell() == cell); + locator->progress(); } // don't forget to release the allocated locator @@ -64,19 +71,19 @@ if (cell) { Cell* cell = ...; // we get a cell if (cell) { - Locator* locator1 = CellGetNets().getLocator(); - while (locator1IsValid()) { - Net* net1 = locator1GetElement(); + Locator* locator1 = cell->GetNets().getLocator(); + while (locator1->isValid()) { + Net* net1 = locator1->getElement(); - Locator* locator2 = locator1GetClone(); - while (locator2IsValid()) { - Net* net2 = locator2GetElement(); + Locator* locator2 = locator1->getClone(); + while (locator2->isValid()) { + Net* net2 = locator2->getElement(); cerr << net1 << " " << net2 << endl; - locator2Progress(); + locator2->progress(); } delete locator2; - locator1Progress(); + locator1->progress(); } delete locator1; } @@ -84,15 +91,10 @@ if (cell) { * \remark Those examples are given in order to explain how locators * work. We will see in the following how to do that more simply * by using generic locators, or even simpler by using the - * for_each macros. + * forEach macros. */ - - /*! \name Accessors - */ - // \{ - /*! \function Type Locator::getElement() const; * \Return the current element (or the value Type() when the * locator is not or no longer valid). @@ -109,30 +111,47 @@ if (cell) { * for you (to be explained later). */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Locator::isValid() const; * \Return \true while the walk has not exhausted the set of elements, * else \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Locator::progress(); * Moves forward the locator to the following element. */ - // \} + /*! \class GenericLocator + * \brief Generic Locator auto-pointer. + * + * This class is an auto-pointer like wrapped around the raw locator. + * + * \remark The destruction of a GenericLocator triggers the destruction of + * the raw locator. + */ + + /*! \function GenericLocator::GenericLocator(Locator* locator); + * Constructor from a raw Locator. + * + * \remark This constructor do not build a copy of the raw locator. So the original + * raw locator must not be deleted. It's deletion will occurs with the one + * of the GenericLocator. + */ + + /*! \function GenericLocator::GenericLocator(const Locator& locator); + * Constructor from a primary Locator. + * + * \remark This constructor build a \e copy of the raw locator. So the originating + * locator can be safely deleted. + */ + + /*! \function GenericLocator::GenericLocator(const GenericLocator& locator); + * Constructor from a primary Locator and a Filter. + * + * \remark This constructor build a \e copy of the raw locator. So the originating + * locator can be safely deleted. + */ } diff --git a/hurricane/doc/hurricane/MainView.dox b/hurricane/doc/hurricane/MainView.dox index 6a89fd9d..1e9db846 100644 --- a/hurricane/doc/hurricane/MainView.dox +++ b/hurricane/doc/hurricane/MainView.dox @@ -25,10 +25,6 @@ - /*! \name Accessors - */ - // \{ - /*! \function MapView* MainView::GetMapView() const; * \Return the associated map (never null). * @@ -36,12 +32,6 @@ * associated to the main view. */ - // \} - - - /*! \name MainView Collection - */ - // \{ /*! \typedef MainViews * Generic collection representing a set of main views. @@ -61,12 +51,6 @@ * views. */ - // \} - - - /* \name Constructors - */ - // \{ /*! \function MainView* MainView::Create(); * The default constructor (no cell is yet associated to the @@ -79,6 +63,4 @@ * activate only the display of the main view). */ - // \} - } diff --git a/hurricane/doc/hurricane/MapCollection.dox b/hurricane/doc/hurricane/MapCollection.dox index ea71bd8d..ec4c15fa 100644 --- a/hurricane/doc/hurricane/MapCollection.dox +++ b/hurricane/doc/hurricane/MapCollection.dox @@ -64,10 +64,6 @@ if (cell) { - /* \name Accessors - */ - // \{ - /*! \function GenericCollection MapCollection::GetCollection(const map& elementMap); * \see below. */ @@ -78,6 +74,4 @@ if (cell) { * argument. */ - // \} - } diff --git a/hurricane/doc/hurricane/MapView.dox b/hurricane/doc/hurricane/MapView.dox index aab5581d..1d756fac 100644 --- a/hurricane/doc/hurricane/MapView.dox +++ b/hurricane/doc/hurricane/MapView.dox @@ -33,17 +33,10 @@ */ - - /*! \name Accessors - */ - // \{ - /*! \function MainView* MapView::GetMainView() const; * \Return the main view associated to the map (never null). */ - // \} - /*! \section secMapViewRemark Remark * @@ -57,6 +50,4 @@ * by localizing the new visible area. */ - - } diff --git a/hurricane/doc/hurricane/Name.dox b/hurricane/doc/hurricane/Name.dox index 7dcb5b2d..e9563b4e 100644 --- a/hurricane/doc/hurricane/Name.dox +++ b/hurricane/doc/hurricane/Name.dox @@ -20,10 +20,6 @@ - /*! \name Constructors - */ - // \{ - /*! \function Name::Name(); * Default constructor (initialized with an empty string). */ @@ -40,24 +36,12 @@ * Copy constructor. */ - // \} - - - /*! \name Destructors - */ - // \{ /*! \function Name::~Name(); * The destructor releases the shared string if it no longer * referenced. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Name& Name::operator=(const Name& name); * Assignment operator. Very fast because there is only an @@ -145,18 +129,9 @@ for_each_net(net, cellGetNets()) { * modified]). */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Name::isEmpty () const; * \Return \true if the shared string is empty, else \false. */ - // \} - - } diff --git a/hurricane/doc/hurricane/Net.dox b/hurricane/doc/hurricane/Net.dox index d903fb05..98912459 100644 --- a/hurricane/doc/hurricane/Net.dox +++ b/hurricane/doc/hurricane/Net.dox @@ -77,9 +77,6 @@ * Type assigned to logical tri-states signals. */ - /*! \name Constructors - */ - // \{ /*! \function Net* Net::create(Cell* cell, const Name& name); * Creates and returns a new net named \c \ for the cell @@ -89,12 +86,6 @@ * if a net with same name already exists. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const Name& Net::getName() const; * \Return the net name. @@ -180,12 +171,6 @@ * \remark Meaningfull only for external nets. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Net::isGlobal() const; * \Return \true if the net is global else \false. @@ -211,12 +196,6 @@ * \Return \true if the net is a supply else \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Net::setName(const Name& name); * Allows to change net name. @@ -285,11 +264,8 @@ * their occurences). */ - // \} - - /*! \name Net Collection - */ + //! \name Net Collection // \{ /*! \typedef Nets @@ -312,10 +288,6 @@ // \} - /* \name Accessors - */ - // \{ - /*! \function NetFilter Net::getIsGlobalFilter(); * \Return the filter selecting global nets. */ @@ -336,6 +308,4 @@ * \Return the filter selecting supply nets. */ - // \} - } diff --git a/hurricane/doc/hurricane/Occurence.dox b/hurricane/doc/hurricane/Occurence.dox index fec6f18d..77fcaaaa 100644 --- a/hurricane/doc/hurricane/Occurence.dox +++ b/hurricane/doc/hurricane/Occurence.dox @@ -52,10 +52,6 @@ - /*! \name Constructors - */ - // \{ - /*! \function Occurrence(Entity* entity = NULL); * Builds an occurrence refering to an entity through a void * path, in some way it is equivalent to the entity itself. @@ -78,23 +74,11 @@ * Copy constructor. */ - // \} - - - /*! \name Destructors - */ - // \{ /*! \function Occurrence::~Occurrence(); * No description. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Occurrence& Occurrence::operator=(const Occurrence& occurrence); * Assignment operator. @@ -117,8 +101,6 @@ * a comparator. */ - // \} - /*! \section secOccurrenceRemarks Remarks * @@ -127,11 +109,6 @@ */ - - /*! \name Accessors - */ - // \{ - /*! \function Entity* Occurrence::GetEntity() const; * \Return the referenced entity or NULL if the occurrence is invalid. */ @@ -168,12 +145,6 @@ * box. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Occurrence::IsValid() const; * \Return \true if the occurrence is valid, else \false (the occurrence @@ -184,12 +155,6 @@ * \Return \true if the occurrence owns some property else \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Occurrence::Put(Property* property); * Adds the property \c \ to the occurrence property @@ -228,8 +193,6 @@ * \caution If the occurrence is invalid an exception is thrown. */ - // \} - /*! \section secOccurrenceNouveauxTypesGlobaux Nouveaux types globaux * @@ -247,8 +210,7 @@ - /*! \name Occurrence Collection - */ + //! \name Occurrence Collection // \{ /*! \def for_each_occurrence(occurrence, occurrences) diff --git a/hurricane/doc/hurricane/Occurrence.dox b/hurricane/doc/hurricane/Occurrence.dox index 6d7bb2c5..c3ffbbf0 100644 --- a/hurricane/doc/hurricane/Occurrence.dox +++ b/hurricane/doc/hurricane/Occurrence.dox @@ -53,11 +53,6 @@ */ - - /*! \name Constructors - */ - // \{ - /*! \function Occurrence::Occurrence(const Entity* entity = NULL); * Builds an occurrence refering to an entity through a void * path, in some way it is equivalent to the entity itself. @@ -80,23 +75,11 @@ * Copy constructor. */ - // \} - - - /*! \name Destructors - */ - // \{ /* \function Occurrence::~Occurrence(); * No description. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Occurrence& Occurrence::operator=(const Occurrence& occurrence); * Assignment operator. @@ -119,13 +102,6 @@ * a comparator. */ - // \} - - - - /*! \name Accessors - */ - // \{ /*! \function Entity* Occurrence::getEntity() const; * \Return the referenced entity or NULL if the occurrence is invalid. @@ -163,12 +139,6 @@ * box. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Occurrence::isValid() const; * \Return \true if the occurrence is valid, else \false (the occurrence @@ -179,12 +149,6 @@ * \Return \true if the occurrence owns some property else \false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Occurrence::put(Property* property); * Adds the property \c \ to the occurrence property @@ -223,13 +187,8 @@ * \caution If the occurrence is invalid an exception is thrown. */ - // \} - - - - /*! \name Occurrence Collection - */ + //! \name Occurrence Collection // \{ /*! \typedef Occurrences diff --git a/hurricane/doc/hurricane/Pad.dox b/hurricane/doc/hurricane/Pad.dox index 6d98becb..a5605327 100644 --- a/hurricane/doc/hurricane/Pad.dox +++ b/hurricane/doc/hurricane/Pad.dox @@ -19,19 +19,13 @@ * knowing it. */ - /*! \name Constructors - */ - // \{ /*! \function Pad* Pad::create(Net* net, const Layer* layer, const Box& boundingBox); * No description. */ - // \} - - /*! \name Pad Collection - */ + //! \name Pad Collection // \{ /*! \typedef Pads diff --git a/hurricane/doc/hurricane/Path.dox b/hurricane/doc/hurricane/Path.dox index 745bcc78..89f99b41 100644 --- a/hurricane/doc/hurricane/Path.dox +++ b/hurricane/doc/hurricane/Path.dox @@ -34,11 +34,6 @@ */ - - /*! \name Constructors - */ - // \{ - /*! \function Path::Path(SharedPath* sharedPath=NULL); * Default constructor : the path is then void. * @@ -97,23 +92,11 @@ * Copy constructor. */ - // \} - - - /*! \name Destructors - */ - // \{ /*! \function Path::~Path(); * No description. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Path& Path::operator=(const Path& path); * Assignment operator. @@ -135,13 +118,6 @@ * comparator. */ - // \} - - - - /*! \name Accessors - */ - // \{ /*! \function Instance* Path::getHeadInstance() const; * \Return the head instance or NULL if the path is void. @@ -189,23 +165,11 @@ * to the given \c \. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Path::isEmpty() const; * \Return \true if the path is void and else \false. */ - // \} - - - /*! \name Path Functions - */ - // \{ /*! \function char Path::getNameSeparator(); * \Return the special character used as a separator between the @@ -218,11 +182,8 @@ * it must not appear in any instance name). */ - // \} - - /*! \name Path Collection - */ + //! \name Path Collection // \{ /*! \typedef Pathes diff --git a/hurricane/doc/hurricane/Plug.dox b/hurricane/doc/hurricane/Plug.dox index f22a4eb3..54820ab3 100644 --- a/hurricane/doc/hurricane/Plug.dox +++ b/hurricane/doc/hurricane/Plug.dox @@ -12,8 +12,8 @@ * A plug can be assimilated to a "logical port instance" : it * designates both the concerned instance and the net of the * model cell instanciated to which it is connected. This net, - * which must be an external net, will be named "master - * net" because it is a net of the instance master cell + * which must be an external net, will be named "master + * net" because it is a net of the instance master cell * (notice that this net can be asimilated to a "logical port"). * * A plug is unique, that is, for a given instance there is one @@ -49,10 +49,6 @@ */ - /*! \name Accessors - */ - // \{ - /*! \function Instance* Plug::getInstance() const; * \Return the instance to which belongs the plug. */ @@ -65,12 +61,6 @@ * plug (or NULL if is unconnected). */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool Plug::isConnected() const; * \Return \true if the plug is connected, else \false. @@ -79,12 +69,6 @@ * return NULL. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Plug::setNet(Net* net); * This method allows to connect or change the net of a plug. @@ -97,12 +81,8 @@ * left unchanged. */ - // \} - - - /*! \name Plug Collection - */ + //! \name Plug Collection // \{ /*! \typedef Plugs @@ -125,10 +105,6 @@ // \} - /* \name Accessors - */ - // \{ - /*! \function PlugFilter Plug::getIsConnectedFilter(); * \Return a filter for selecting only connected plugs. */ @@ -137,6 +113,4 @@ * \Return a filter for selecting only unconnected plugs. */ - // \} - } diff --git a/hurricane/doc/hurricane/Point.dox b/hurricane/doc/hurricane/Point.dox index f18bdd3e..c1f144a8 100644 --- a/hurricane/doc/hurricane/Point.dox +++ b/hurricane/doc/hurricane/Point.dox @@ -10,10 +10,6 @@ */ - /*! \name Constructors - */ - // \{ - /*! \function Point::Point(); * Default constructor. */ @@ -26,12 +22,6 @@ * Copy constructor. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Point& Point::operator=(const Point& point); * Assignment operator. @@ -45,12 +35,6 @@ * Difference operator. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Point::setX(const DbU::Unit& x); * Modifies point abscissa. @@ -64,7 +48,4 @@ * Translates the point of dx and dy. */ - // \} - - } diff --git a/hurricane/doc/hurricane/PrivateProperty.dox b/hurricane/doc/hurricane/PrivateProperty.dox index 38b884a3..819409f7 100644 --- a/hurricane/doc/hurricane/PrivateProperty.dox +++ b/hurricane/doc/hurricane/PrivateProperty.dox @@ -13,8 +13,8 @@ * * When a new property is created, it is not yet assigned to any * particular object. It becomes effectively the property of an - * object after the call dbo-\>Put(property). The - * property then receives a message OnCapturedBy whose + * object after the call dbo-\>put(property). The + * property then receives a message onCapturedBy whose * argument is the additional owner. From that time onwards, * this object becomes partially responsible of the future of * the property. @@ -29,7 +29,7 @@ * * If a property of same name already exist : Two properties * with the same name can't cohabit, the older one is released - * by the object which receives the message OnReleasedBy + * by the object which receives the message onReleasedBy * from that old property and proceeds as required according to * the type of property. * @@ -41,7 +41,7 @@ * If the property owner is destroyed : All properties owned by * the object are then released. The future of each of those * properties is fully driven by their respective messages - * OnReleasedBy. + * onReleasedBy. */ @@ -66,16 +66,9 @@ */ - - /*! \name Accessors - */ - // \{ - /*! \function DBo* PrivateProperty::getOwner() const; * \Return the current owner of the property (or NULL if at not been * assigned yet). */ - // \} - } // End of Hurricane namespace. diff --git a/hurricane/doc/hurricane/Property.dox b/hurricane/doc/hurricane/Property.dox index 7a09a314..36909b0f 100644 --- a/hurricane/doc/hurricane/Property.dox +++ b/hurricane/doc/hurricane/Property.dox @@ -128,7 +128,7 @@ void DBo::put(Property* property); * Adds the property \c \ to the set of properties of * the object. \code -void Occurence::put(Property* property); +void Occurrence::put(Property* property); \endcode * This function searches the quark representing the occurence. * @@ -164,12 +164,12 @@ void Occurence::put(Property* property); * * Removing a property \code -void DBo::Remove(Property* property); +void DBo::remove(Property* property); \endcode * Removes the property \c \ from the set of * properties of the object. \code -void Occurence::Remove(Property* property); +void Occurrence::remove(Property* property); \endcode * The function searches for the quark associated to the * occurence. @@ -192,7 +192,7 @@ void DBo::clearProperties(); \endcode * Removes all properties attached to the object. \code -void Occurence::clearProperties(); +void Occurrence::clearProperties(); \endcode * First searches for the quark associated to the occurence. * @@ -251,8 +251,8 @@ void Occurence::clearProperties(); Property* property = occurence.getProperty("Hurricane::Selector"); if (property && is_a(property)) { - Selector* selector = (Selector*)property; - ... + Selector* selector = (Selector*)property; + // ... } \endcode * Which could become : @@ -260,7 +260,7 @@ if (property && is_a(property)) { Selector* selector = (Selector*)occurence.getProperty("Hurricane::Selector"); if (selector) { - ... + // ... } \endcode * @@ -291,11 +291,10 @@ Property* property = occurence.getProperty("Hurricane::Selector"); * on the other hand if the following static member function is * provided : \code -const Name& Selector::getPropertyName() -// ************************************ +const Name& Selector::getPropertyName () { - static Name NAME = "Hurricane::Selector"; - return NAME; + static Name NAME = "Hurricane::Selector"; + return NAME; } \endcode * You could write later : @@ -324,11 +323,10 @@ Property* property = occurence.getProperty(Selector::getPropertyName()); * That way, by defining (i.e. for the property ObjectId) the * function : \code -const Name& getObjectIdPropertyName() -// ********************************** +const Name& getObjectIdPropertyName () { - static Name NAME = "Hurricane::ObjectId"; - return NAME; + static Name NAME = "Hurricane::ObjectId"; + return NAME; } \endcode * You can write later : @@ -338,10 +336,6 @@ Property* property = occurence.getProperty(getObjectIdPropertyName()); */ - /*! \name Accessors - */ - // \{ - /*! \function Name Property::getName() const; * \Return the name of the property : this method must absolutely be * overloaded for all new property classes, because the property @@ -351,12 +345,6 @@ Property* property = occurence.getProperty(getObjectIdPropertyName()); * slot). */ - // \} - - - /*! \name Messages - */ - // \{ /*! \function void Property::onCapturedBy(DBo* dbo); * This message is called upon when the property is added to the @@ -387,12 +375,8 @@ Property* property = occurence.getProperty(getObjectIdPropertyName()); * specializing any of those two classes. */ - // \} - - - /*! \name Property Collection - */ + //! \name Property Collection // \{ /*! \typedef Properties @@ -408,14 +392,13 @@ Property* property = occurence.getProperty(getObjectIdPropertyName()); * criteria. */ - /*! \def for_each_property(property, properties) + /*! \def forEach(Property*, iproperty, properties) * Macro for visiting all properties of a property collection. \code -Occurence occurence = ...; // we get an occurence +Occurrence occurence = ...; // we get an occurence -for_each_property(property, occurence.getProperties()) { - cerr << property << endl; - end_for; +forEach(Property*, iproperty, occurence.getProperties()) { + cerr << *iproperty << endl; } \endcode */ @@ -423,16 +406,10 @@ for_each_property(property, occurence.getProperties()) { // \} - /* \name Destructors - */ - // \{ - /*! \function void Property::destroy(); * Like the data base objects, properties can be destroyed by * calling upon this function and not the standard C++ * destructor (which is not available). */ - // \} - } diff --git a/hurricane/doc/hurricane/QuadTree.dox b/hurricane/doc/hurricane/QuadTree.dox index f5f722c4..6f3800d8 100644 --- a/hurricane/doc/hurricane/QuadTree.dox +++ b/hurricane/doc/hurricane/QuadTree.dox @@ -22,21 +22,11 @@ - /*! \name Constructors - */ - // \{ - /*! \function QuadTree::QuadTree(); * Default constructor : the quadtree is initially empty * (objects will be inserted or removed on demand). */ - // \} - - - /*! \name Destructors - */ - // \{ /*! \function QuadTree::~QuadTree(); * Destroys the quadtree and its sub-quadtrees but doesn't touch @@ -44,12 +34,6 @@ * their respective quadtree nodes. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function Box QuadTree::getBoundingBox() const; * \Return the quadtree bounding box, that is the minimal bounding box @@ -68,24 +52,12 @@ * defined by \c \. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool QuadTree::isEmpty() const; * \Return true if the quadtree doesn't contain any object, else * false. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void QuadTree::insert(Go* go); * inserts the graphic object within the quadtree (if not yet @@ -112,8 +84,6 @@ * the system). */ - // \} - /*! \section secQuadTreeRemark Remark * @@ -179,6 +149,4 @@ void Component::Unmaterialize() * (slice-\>isEmpty()) slice-\>_Delete(); } } */ - - } diff --git a/hurricane/doc/hurricane/Quark.dox b/hurricane/doc/hurricane/Quark.dox index 487f8b9c..75681b90 100644 --- a/hurricane/doc/hurricane/Quark.dox +++ b/hurricane/doc/hurricane/Quark.dox @@ -52,7 +52,7 @@ * equivalent to destroying the properties associated to the * occurences whom it is the unique representative. * Conceptually, it is wiser to use the call : - * occurence.ClearProperties() which does the same. + * occurence.clearProperties() which does the same. * * * \section secQuarkExample Example @@ -63,29 +63,19 @@ Property* property = ...; // we get a property if (is_a(property)) { - for_each_dbo(dbo, ((SharedProperty*)property)getOwners()) { - if (!is_a(dbo)) - cerr << dbo << endl; - else - cerr << ((Quark*)dbo)getOccurence() << endl; - end_for; - } + forEach(DBo*, idbo, ((SharedProperty*)property)getOwners()) { + if (not is_a(*idbo)) + cerr << *idbo << endl; + else + cerr << ((Quark*)*idbo)->getOccurence() << endl; + } } \endcode */ - - /*! \name Accessors - */ - // \{ - /*! \function const Occurrence& Quark::getOccurrence() const; * \Return an occurence of which this quark is a representative. */ - // \} - - - } diff --git a/hurricane/doc/hurricane/RecordHandles.dox b/hurricane/doc/hurricane/RecordHandles.dox index a4246099..c73d1557 100644 --- a/hurricane/doc/hurricane/RecordHandles.dox +++ b/hurricane/doc/hurricane/RecordHandles.dox @@ -26,9 +26,6 @@ // \} - /*! \name Accessors - */ - // \{ /*! \function string* RecordHandles::_GetString () const; * \Return a string representing the object name and characteristics diff --git a/hurricane/doc/hurricane/RegularLayer.dox b/hurricane/doc/hurricane/RegularLayer.dox new file mode 100644 index 00000000..6a356343 --- /dev/null +++ b/hurricane/doc/hurricane/RegularLayer.dox @@ -0,0 +1,93 @@ + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class RegularLayer + * \brief RegularLayer description (\b API) + * + * For a more complete description of the Layers objects, please refer + * to \ref secLayerIntro "Layer Introduction". + * + * RegularLayer is a symbolic layer that contains exactly one BasicLayer. + * The accessors functions: + *
    + *
  • RegularLayer::getTop() + *
  • RegularLayer::getBottom() + *
  • RegularLayer::getOpposite() + *
+ * All returns that BasicLayer. + * + * It have one enclose, extention cap & extension width. + */ + + + /*! \function RegularLayer* RegularLayer::create(Technology* technology,const Name& name); + * creates and returns a new regular layer named \c \. + * + * \caution Throws an exception if the technology is null, if the name is + * empty, if a layer of same name already exists or if we + * overflow the capacity of the bit field associated to the + * layer mask. + */ + + + /*! \function BasicLayer* RegularLayer::getBasicLayer() const; + * \Return the one associated BasicLayer. + */ + + + /* \function void RegularLayer::SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue); + * Sets the color of a basic layer. + */ + + /* \function void RegularLayer::SetFillPattern(const string& fillPattern); + * Sets the filling pattern of a basic layer. + * + * \caution Throws an exception if the string does't obey to the rules + * described above. + */ + + /* \function void RegularLayer::SetDisplayThreshold(double threshold); + * Sets the display threshold of a basic layer. + */ + + /*! \function void RegularLayer::setBlockageLayer(RegularLayer* layer); + * Associate a blockage layer to this one. This is only meaningful + * for routing layers (RegularLayer). + */ + + /*! \function void RegularLayer::setExtractNumber(unsigned int); + * Set the extract number, for GDS. + */ + + /*! \function void RegularLayer::setRealName(const char*); + * Set the real (process) layer name, for GDS. + */ + + + //! \name RegularLayer Collection + // \{ + + /*! \typedef RegularLayers + * Generic collection representing a set of basic layers. + */ + + /*! \typedef RegularLayerLocator + * Generic locator for traversing a collection of basic layers. + */ + + /*! \typedef RegularLayerFilter + * Generic filter allowing to select a subset of basic layers + * matching some criteria. + */ + + /*! \def for_each_basic_layer(basicLayer, basicLayers) + * Macro for visiting all the layers of a collection of basic + * layers. + */ + + // \} + + } diff --git a/hurricane/doc/hurricane/Rubber.dox b/hurricane/doc/hurricane/Rubber.dox index 94251fa8..84d2322c 100644 --- a/hurricane/doc/hurricane/Rubber.dox +++ b/hurricane/doc/hurricane/Rubber.dox @@ -27,10 +27,6 @@ */ - /*! \name Accessors - */ - // \{ - /*! \function Net* Rubber::getNet() const; * \Return the net owning the rubber. */ @@ -57,11 +53,8 @@ * connect. */ - // \} - - /*! \name Rubber Collection - */ + //! \name Rubber Collection // \{ /*! \typedef Rubbers diff --git a/hurricane/doc/hurricane/Segment.dox b/hurricane/doc/hurricane/Segment.dox index 552a894d..4bc20a68 100644 --- a/hurricane/doc/hurricane/Segment.dox +++ b/hurricane/doc/hurricane/Segment.dox @@ -37,9 +37,6 @@ * "anchored". The TargetHook is always a slave hook. */ - /*! \name Accessors - */ - // \{ /*! \function Segment::SourceHook* Segment::getSourceHook(); * \Return the hook through which the segment origin can be anchored on @@ -132,12 +129,6 @@ * \Return the segment length. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Segment::setLayer(const Layer* layer); * sets the segment layer. @@ -152,11 +143,8 @@ * permutted. */ - // \} - - /*! \name Segment Collection - */ + //! \name Segment Collection // \{ /*! \typedef Segments @@ -179,5 +167,4 @@ // \} - } diff --git a/hurricane/doc/hurricane/SelectCommand.dox b/hurricane/doc/hurricane/SelectCommand.dox index ebb5accd..ec1b212c 100644 --- a/hurricane/doc/hurricane/SelectCommand.dox +++ b/hurricane/doc/hurricane/SelectCommand.dox @@ -49,16 +49,8 @@ */ - - /* \name SelectCommand Functions - */ - // \{ - /* \function SelectCommand* SelectCommand::GetSelectCommand(); * \Return the selection command. */ - // \} - - } diff --git a/hurricane/doc/hurricane/SelectNetCommand.dox b/hurricane/doc/hurricane/SelectNetCommand.dox index 4db4c71c..2e41545a 100644 --- a/hurricane/doc/hurricane/SelectNetCommand.dox +++ b/hurricane/doc/hurricane/SelectNetCommand.dox @@ -39,15 +39,8 @@ - /* \name SelectNetCommand Functions - */ - // \{ - /* \function SelectNetCommand* SelectNetCommand::GetSelectNetCommand(); * \Return the select net command object. */ - // \} - - } diff --git a/hurricane/doc/hurricane/SetCollection.dox b/hurricane/doc/hurricane/SetCollection.dox index 5139f4b3..7b07d6cd 100644 --- a/hurricane/doc/hurricane/SetCollection.dox +++ b/hurricane/doc/hurricane/SetCollection.dox @@ -59,11 +59,6 @@ if (cell) { */ - - /* \name Accessors - */ - // \{ - /*! \function GenericCollection SetCollection::GetCollection(const set& elementSet); * See below. */ @@ -74,6 +69,4 @@ if (cell) { * argument. */ - // \} - } diff --git a/hurricane/doc/hurricane/SharedProperty.dox b/hurricane/doc/hurricane/SharedProperty.dox index 538de56d..01c54949 100644 --- a/hurricane/doc/hurricane/SharedProperty.dox +++ b/hurricane/doc/hurricane/SharedProperty.dox @@ -68,17 +68,9 @@ */ - - /*! \name Accessors - */ - // \{ - /*! \function DBos SharedProperty::GetOwners() const; * \Return the collection of objects owning the property (might be empty * if the property has never been attached). */ - // \} - - } // End of Hurricane namespace. diff --git a/hurricane/doc/hurricane/Slice.dox b/hurricane/doc/hurricane/Slice.dox index 0b799409..d7ddcccb 100644 --- a/hurricane/doc/hurricane/Slice.dox +++ b/hurricane/doc/hurricane/Slice.dox @@ -39,26 +39,19 @@ BasicLayer* basicLayer = ...; // we get the basic layer Box area = ...; // we define the rectangular area -for_each_slice(slice, cell->getSlices()) { - if (slice->getLayer()->Contains(basicLayer)) { - for_each_componant(component, slice->getComponentsUnder(area)) { - ... - // here we visit all requested components - ... - end_for; - } - } - end_for; +forEach(Slice*, islice, cell->getSlices()) { + if (islice->getLayer()->contains(basicLayer)) { + forEach(Component*, icomponent, slice->getComponentsUnder(area)) { + // ... + // here we visit all requested components + // ... + } + } } \endcode */ - - /*! \name Accessors - */ - // \{ - /*! \function Cell* Slice::getCell() const; * \Return the cell owning the slice. */ @@ -86,12 +79,8 @@ for_each_slice(slice, cell->getSlices()) { * intersects the rectangular region defined by \c \. */ - // \} - - - /*! \name Slice Collection - */ + //! \name Slice Collection // \{ /*! \typedef Slices @@ -113,5 +102,4 @@ for_each_slice(slice, cell->getSlices()) { // \} - } diff --git a/hurricane/doc/hurricane/Symbol.dox b/hurricane/doc/hurricane/Symbol.dox index 91edc2a5..bc17395b 100644 --- a/hurricane/doc/hurricane/Symbol.dox +++ b/hurricane/doc/hurricane/Symbol.dox @@ -15,9 +15,6 @@ * knowing it. */ - /*! \name Constructors - */ - // \{ /*! \function Symbol* Symbol::Create(Library* library, const Name& name); * Creates and returns a new symbol named \c \ for the @@ -42,12 +39,6 @@ * the directions and names of the external nets of the cell. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function Library* Symbol::GetLibrary() const; * \Return the library owning the symbol. @@ -74,12 +65,6 @@ * \Return the pin of name \c \ if it exists, else NULL. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Symbol::SetName(const Name& name);; * Allows to change the symbol name. @@ -89,11 +74,8 @@ * name. */ - // \} - - /*! \name Symbol Collection - */ + //! \name Symbol Collection // \{ /*! \typedef Symbols diff --git a/hurricane/doc/hurricane/Tabulation.dox b/hurricane/doc/hurricane/Tabulation.dox index a76a874c..6a9e61bb 100644 --- a/hurricane/doc/hurricane/Tabulation.dox +++ b/hurricane/doc/hurricane/Tabulation.dox @@ -102,10 +102,6 @@ cell : ... - /*! \name Constructors - */ - // \{ - /*! \function Tabulation::Tabulation(const string& s = "   "); * Default constructor : The string \c \ represents the * elementary tabulation (fixed by default to 3 space @@ -116,23 +112,11 @@ cell : ... * Copy constructor. */ - // \} - - - /*! \name Destructors - */ - // \{ /*! \function Tabulation::~Tabulation(); * No description. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Tabulation& Tabulation::operator=(const Tabulation& tabulation); * Assignment operator. @@ -160,8 +144,4 @@ cell : ... * returns the previous tabulation. */ - // \} - - - } diff --git a/hurricane/doc/hurricane/Technology.dox b/hurricane/doc/hurricane/Technology.dox index 871e5b33..52b28e23 100644 --- a/hurricane/doc/hurricane/Technology.dox +++ b/hurricane/doc/hurricane/Technology.dox @@ -20,10 +20,6 @@ */ - /*! \name Constructors - */ - // \{ - /*! \function Technology* Technology::create ( DataBase* dataBase, const Name& name ); * \Return a newly created technology named \c \ for the data base \c \. * @@ -31,12 +27,10 @@ * the \c dataBase has already a technology. */ - // \} - - /*! \name Accessors + /*! \function bool Technology::isMetal (const Layer* layer) const; + * \Return \true if the \c layer is indeed of type BasicLayer::Material::metal. */ - // \{ /*! \function DataBase* Technology::getDataBase () const; * \Return the DataBase owning the technology. @@ -54,8 +48,16 @@ * \Return the Layer named \c \ if it exists and is a BasicLayer, else \NULL. */ + /*! \function BasicLayer* Technology::getRegularLayer ( const Name& name ) const; + * \Return the Layer named \c \ if it exists and is a RegularLayer, else \NULL. + */ + + /*! \function BasicLayer* Technology::getViaLayer ( const Name& name ) const; + * \Return the Layer named \c \ if it exists and is a ViaLayer, else \NULL. + */ + /*! \function Layers Technology::getLayers () const; - * \Return Returns the collection of layers of the technology. + * \Return the collection of layers of the technology. * * \remark The layers are traversed according to their * creation order. This order is very important, @@ -66,26 +68,73 @@ */ /*! \function BasicLayers Technology::getBasicLayers () const; - * \Return Returns the collection of basic layers of the technology + * \Return the collection of basic layers of the technology * (uses the same order). */ /*! \function BasicLayers Technology::getBasicLayers ( const Layer::Mask& mask ) const; - * \Return Returns the collection of basic layers of the technology + * \Return the collection of basic layers of the technology * which matches the Layer mask \c \ (uses the same order). */ - // \} - - - /*! \name Modifiers + /*! \function RegularLayers Technology::getRegularLayers () const; + * \Return the collection of regular layers of the technology + * (uses the same order). */ - // \{ + + /*! \function ViaLayers Technology::getViaLayers () const; + * \Return the collection of via layers of the technology + * (uses the same order). + */ + + /*! \function Layer* Technology::getLayer ( const Layer::Mask& mask, bool useWorking=true) const; + * \Return the layer whose mask equal \c mask and is flagged as working layer. + * if there is no working layer, returns the first layer that matches. + */ + + /*! \function Layer* Technology::getMetalAbove ( const Layer* layer, bool useWorking=true) const; + * \Return the first layer of metal type whose mask is above the current one. + * if there is no working layer, returns the first layer that matches. + */ + + /*! \function Layer* Technology::getMetalBelow ( const Layer* layer, bool useWorking=true) const; + * \Return the first layer of metal type whose mask is below the current one. + * if there is no working layer, returns the first layer that matches. + */ + + /*! \function Layer* Technology::getCutAbove ( const Layer* layer, bool useWorking=true) const; + * \Return the first layer of cut type whose mask is above the current one. + * if there is no working layer, returns the first layer that matches. + */ + + /*! \function Layer* Technology::getCutBelow ( const Layer* layer, bool useWorking=true) const; + * \Return the first layer of cut type whose mask is below the current one. + * if there is no working layer, returns the first layer that matches. + */ + + /*! \function Layer* Technology::getViaBetween ( const Layer* layer1, const Layer* layer2) const; + * \Return the cut layer between \c layer1 and \c layer2. They must be both of + * metal kind and contiguous. + */ + + /*! \function Layer* Technology::getNthMetal ( int depth ) const; + * \Return the \c Nth metal layer from the substrate. So a \c depth of zero should + * mean \c metal1. + */ + /*! \function void Technology::setName ( const Name& name ); * Allows to change the technology name (if empty name, throws an exception). */ - // \} + /*! \function bool Technology::setWorkingLayer ( const Name& name ); + * Sets the layer \c name as the working layer for it's mask. + * Returns \true on success (the layer exists). + */ + + /*! \function bool Technology::setWorkingLayer ( const Layer* layer ); + * Sets the \c layer as the working layer for it's mask. + * Returns \true on success (the layer exists). + */ } diff --git a/hurricane/doc/hurricane/Transformation.dox b/hurricane/doc/hurricane/Transformation.dox index d02a1350..3152c429 100644 --- a/hurricane/doc/hurricane/Transformation.dox +++ b/hurricane/doc/hurricane/Transformation.dox @@ -19,7 +19,6 @@ */ - /*! \class Transformation::Orientation * This enumeration defines the orientation associated to a * transformation object. @@ -103,9 +102,6 @@ * */ - /*! \name Constructors - */ - // \{ /*! \function Transformation::Transformation(); * Default constructor : The translation is null and the @@ -134,12 +130,6 @@ * Copy constructor. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Transformation& Transformation::operator=(const Transformation& transformation); * Assignment operator. @@ -155,12 +145,6 @@ * translations or orientation differ. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const DbU::Unit& Transformation::getTx() const; * \Return the horizontal component of the translation. @@ -247,20 +231,12 @@ * \Return the inverse transformation. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function Transformation& Transformation::invert(); * inverts the transformation \c \ and returns a * reference to it in order to apply in sequence a new function. */ - // \} - /*! \section secTransformationTransformers Transformers * @@ -275,11 +251,6 @@ */ - - /* \name Others - */ - // \{ - /*! \function void Transformation::applyOn(DbU::Unit& x, DbU::Unit& y) const; * Applies the transformation on the coordinates given in * arguments. @@ -299,6 +270,4 @@ * resulting of the product of those two. */ - // \} - } diff --git a/hurricane/doc/hurricane/TransistorLayer.dox b/hurricane/doc/hurricane/TransistorLayer.dox new file mode 100644 index 00000000..65acc540 --- /dev/null +++ b/hurricane/doc/hurricane/TransistorLayer.dox @@ -0,0 +1,41 @@ + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class TransistorLayer + * \brief TransistorLayer description (\b API) + * + * For a more complete description of the Layers objects, please refer + * to \ref secLayerIntro "Layer Introduction". + * + * TransistorLayer is a symbolic layer that contains three layers + * (gate, active, diffusion) plus an optional well layer. As you may + * guess, it is used to represent digital transistors. + * + * The accessors functions: + *
    + *
  • TransistorLayer::getTop() + *
  • TransistorLayer::getBottom() + *
  • TransistorLayer::getOpposite() + *
+ * Have no meaning here. + * + * Only extention cap & extention width are used here. Enclosure is not + * used. + */ + + + /*! \function TransistorLayer* TransistorLayer::create(Technology* technology,const Name& name, BasicLayer* gateLayer, BasicLayer* activeLayer, BasicLayer* diffusionLayer, BasicLayer* wellLayer); + * creates and returns a new transistor layer named \c \, + * composed of gate, active & diffusion BasicLayer and an optional WELL + * BasicLayer. A NULL value indicates that no NWELL is used. + * + * \caution Throws an exception if the technology is null, if the name is + * empty, if a layer of same name already exists or if we + * overflow the capacity of the bit field associated to the + * layer mask. + */ + + } diff --git a/hurricane/doc/hurricane/VectorCollection.dox b/hurricane/doc/hurricane/VectorCollection.dox index 9c365d07..f5bb14ab 100644 --- a/hurricane/doc/hurricane/VectorCollection.dox +++ b/hurricane/doc/hurricane/VectorCollection.dox @@ -70,11 +70,6 @@ if (cell) { */ - - /* \name Accessors - */ - // \{ - /*! \function GenericCollection VectorCollection::GetCollection(const vector& elementVector); * See below. */ @@ -89,6 +84,4 @@ if (cell) { * in argument. */ - // \} - } diff --git a/hurricane/doc/hurricane/Vertical.dox b/hurricane/doc/hurricane/Vertical.dox index 9841f895..3d375b70 100644 --- a/hurricane/doc/hurricane/Vertical.dox +++ b/hurricane/doc/hurricane/Vertical.dox @@ -35,9 +35,6 @@ * knowing it. */ - /*! \name Constructors - */ - // \{ /*! \function Vertical* Vertical::create(Component* source, Component* target, const Layer* layer,const DbU::Unit& x,const DbU::Unit& width = 0,const DbU::Unit& dySource = 0, const DbU::Unit& dyTarget = 0); * creates and returns a vertical segment whose origin lies @@ -62,12 +59,6 @@ * null. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const DbU::Unit& Vertical::getDySource() const; * \Return the relative source ordinate of the segment (may be absolute @@ -85,12 +76,6 @@ * getTargetX() defined at the Segment level. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void Vertical::setX(const DbU::Unit& x); * sets the abscissa of the segment. @@ -101,11 +86,8 @@ * \c \. */ - // \} - - /*! \name Vertical Collection - */ + //! \name Vertical Collection // \{ /*! \typedef Verticals diff --git a/hurricane/doc/hurricane/ViaLayer.dox b/hurricane/doc/hurricane/ViaLayer.dox new file mode 100644 index 00000000..d4136c2b --- /dev/null +++ b/hurricane/doc/hurricane/ViaLayer.dox @@ -0,0 +1,41 @@ + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class ViaLayer + * \brief ViaLayer description (\b API) + * + * For a more complete description of the Layers objects, please refer + * to \ref secLayerIntro "Layer Introduction". + * + * ViaLayer is a symbolic layer that contains three layers, a bottom + * metal, a cut and a top metal. + * + * The accessors functions: + *
    + *
  • ViaLayer::getTop() + *
  • ViaLayer::getBottom() + *
  • ViaLayer::getOpposite() + *
+ * Works on the top/bottom layers. They do not rely on the Layer::Mask, + * but on what has been passed as argument to the ViaLayer::create() + * constructor. + * + * Only enclosure have meaning on this class. Extension cap and extention + * width are not used. + */ + + + /*! \function ViaLayer* ViaLayer::create(Technology* technology,const Name& name, BasicLayer* bottomLayer, BasicLayer* cutLayer, BasicLayer* topLayer); + * creates and returns a new VIA layer named \c \, made of + * the two metals and a cut. + * + * \caution Throws an exception if the technology is null, if the name is + * empty, if a layer of same name already exists or if we + * overflow the capacity of the bit field associated to the + * layer mask. + */ + + } diff --git a/hurricane/doc/hurricane/View.dox b/hurricane/doc/hurricane/View.dox index df2a2bd0..d2553f72 100644 --- a/hurricane/doc/hurricane/View.dox +++ b/hurricane/doc/hurricane/View.dox @@ -72,11 +72,6 @@ */ - - /*! \name Accessors - */ - // \{ - /*! \function GtkWidget* View::GetFrame() const; * \Return the widget containing the drawing area associated to the * view. @@ -245,12 +240,6 @@ Unit clientAperture = view->GetSize(screenAperture); * \Return the collection of selectors associated to the view. */ - // \} - - - /*! \name Predicates - */ - // \{ /*! \function bool View::GridIsVisible() const; * \Return \true if the grid is visible else \false. @@ -304,12 +293,6 @@ Unit clientAperture = view->GetSize(screenAperture); * \Return \false if the selection is empty, else \true. */ - // \} - - - /*! \name Modifiers - */ - // \{ /*! \function void View::SetCell(Cell* cell); * Allows to change the cell displayed within the view. @@ -463,12 +446,6 @@ viewUpdate(); * Unselects all the selected occurrences. */ - // \} - - - /*! \name Managers - */ - // \{ /*! \function void View::Invalidate(); * Invalidates the whole view, therefore at the next call upon @@ -628,12 +605,6 @@ viewUpdate(); // to get an immediate effect * context. */ - // \} - - - /*! \name Drawing Primitives - */ - // \{ /*! \function void View::DrawLine(const Unit& xo, const Unit& yo, const Unit& xe, const Unit& ye); * No description. @@ -669,11 +640,8 @@ viewUpdate(); // to get an immediate effect * stipple when this flag is off (default behaviour). */ - // \} - - /*! \name View Collection - */ + //! \name View Collection // \{ /*! \typedef Views diff --git a/hurricane/doc/hurricane/Warning.dox b/hurricane/doc/hurricane/Warning.dox index 8c12dd5e..dd66171f 100644 --- a/hurricane/doc/hurricane/Warning.dox +++ b/hurricane/doc/hurricane/Warning.dox @@ -24,10 +24,10 @@ * You can also use this object to print messages without * throwing an exception as shown below : \code -Cell* cell = libraryGetCell("adder"); // we get the cell +Cell* cell = library->getCell("adder"); // we get the cell if (!cell) - cerr << Warning("Unknown cell adder") << endl; + cerr << Warning("Unknown cell adder").what() << endl; else { // we know what to do here } @@ -36,48 +36,42 @@ else { */ - - /*! \name Constructors + /*! \function Warning::Warning(const Warning& warning); + * Copy constructor. */ - // \{ - /*! \function Warning::Warning(const string& reason, int code = 0); + /*! \function Warning::Warning(const string& reason); + * Builds a warning characterized by a reason (code defaults to zero). + */ + + /*! \function Warning::Warning(const char* format, ...); + * Builds a warning characterized by a reason, using the \c vararg protocol + * and \c printf format (code defaults to zero). + */ + + /*! \function Warning::Warning(int code, const string& reason); * Builds a warning characterized by a reason and a code useful * within a switch. */ - /*! \function Warning::Warning(const Warning& warning); - * Copy constructor. + /*! \function Warning::Warning(int code, const char* format, ...); + * Builds a warning characterized by a reason and a code useful + * within a switch. The reason is supplied in a \c printf + * like fashion. */ - // \} - - - /*! \name Operators - */ - // \{ /*! \function Warning& Warning::operator=(const Warning& warning); * Assignment operator. */ - // \} - - /*! \name Accessors - */ - // \{ - - /*! \function const string& Warning::GetReason() const; + /*! \function string Warning::getReason() const; * \Return the reason for which the warning was thrown. */ - /*! \function int Warning::GetCode() const; + /*! \function int Warning::getCode() const; * \Return the warning code number. */ - // \} - - - } diff --git a/hurricane/doc/hurricane/ZoomCommand.dox b/hurricane/doc/hurricane/ZoomCommand.dox index 38454863..c7b73bf8 100644 --- a/hurricane/doc/hurricane/ZoomCommand.dox +++ b/hurricane/doc/hurricane/ZoomCommand.dox @@ -57,16 +57,8 @@ void ZoomCommand::_OnButtonRelease(View* view, const Point& position) */ - - /* \name ZoomCommand Functions - */ - // \{ - /* \function ZoomCommand* ZoomCommand::GetZoomCommand(); * \Return the zoom command. */ - // \} - - } diff --git a/hurricane/doc/hurricane/customHierarchy.html b/hurricane/doc/hurricane/customHierarchy.html index c9d17740..e234d882 100644 --- a/hurricane/doc/hurricane/customHierarchy.html +++ b/hurricane/doc/hurricane/customHierarchy.html @@ -100,11 +100,17 @@ - + + + + +
BasicLayer
CompositeLayer
RegularLayer
ViaLayer
ContactLayer
DiffusionLayer
TransistorLayer
+
Library
Entity
@@ -133,8 +139,11 @@
+
Quark
+

Properties

@@ -212,7 +222,7 @@
- +
Hurricane DocumentationCopyright © 2000-2009 Bull S.A. All rights reservedCopyright © 2000-2012 Bull S.A. All rights reserved
diff --git a/hurricane/doc/hurricane/customSummary.html b/hurricane/doc/hurricane/customSummary.html index 7603ae5d..ed99ddc4 100644 --- a/hurricane/doc/hurricane/customSummary.html +++ b/hurricane/doc/hurricane/customSummary.html @@ -41,11 +41,13 @@
  • Member Functions Index (doxygen).
  • Namespaces (doxygen). +
    @@ -58,7 +60,7 @@ - +
    Hurricane DocumentationCopyright © 2000-2009 Bull S.A. All rights reservedCopyright © 2000-2012 Bull S.A. All rights reserved
    diff --git a/hurricane/doc/hurricane/doxyfile b/hurricane/doc/hurricane/doxyfile index c8af3fb9..1127f91c 100644 --- a/hurricane/doc/hurricane/doxyfile +++ b/hurricane/doc/hurricane/doxyfile @@ -590,6 +590,9 @@ INPUT = ../../src/hurricane/hurricane/Commons.h \ ../../src/hurricane/hurricane/Warning.h \ ../../src/hurricane/hurricane/Interruption.h \ Exception.dox \ + Error.dox \ + Warning.dox \ + Interruption.dox \ ../../src/hurricane/hurricane/Collection.h \ ../../src/hurricane/hurricane/ListCollection.h \ ../../src/hurricane/hurricane/MapCollection.h \ @@ -632,9 +635,18 @@ INPUT = ../../src/hurricane/hurricane/Commons.h \ ../../src/hurricane/hurricane/Layers.h \ ../../src/hurricane/hurricane/Layer.h \ Layer.dox \ - ../../src/hurricane/hurricane/BasicLayers.h \ ../../src/hurricane/hurricane/BasicLayer.h \ BasicLayer.dox \ + ../../src/hurricane/hurricane/RegularLayer.h \ + RegularLayer.dox \ + ../../src/hurricane/hurricane/ViaLayer.h \ + ViaLayer.dox \ + ../../src/hurricane/hurricane/ContactLayer.h \ + ContactLayer.dox \ + ../../src/hurricane/hurricane/DiffusionLayer.h \ + DiffusionLayer.dox \ + ../../src/hurricane/hurricane/TransistorLayer.h \ + TransistorLayer.dox \ ../../src/hurricane/hurricane/Libraries.h \ ../../src/hurricane/hurricane/Library.h \ Library.dox \ diff --git a/hurricane/doc/hurricane/footer.html b/hurricane/doc/hurricane/footer.html index 7fee0761..b60e625c 100644 --- a/hurricane/doc/hurricane/footer.html +++ b/hurricane/doc/hurricane/footer.html @@ -9,7 +9,7 @@ - +
    Hurricane DocumentationCopyright © 2000-2009 Bull S.A. All rights reservedCopyright © 2000-2012 Bull S.A. All rights reserved
    diff --git a/hurricane/doc/viewer/ASIM.css b/hurricane/doc/viewer/ASIM.css index 6d92a0c5..befe1aef 100644 --- a/hurricane/doc/viewer/ASIM.css +++ b/hurricane/doc/viewer/ASIM.css @@ -1,9 +1,9 @@ /* - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ * | HTML Standart Tags | - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ */ html, body, th, td, tr, p, li, h1, h2, h3, h4, h5, h6 { @@ -32,25 +32,25 @@ h1, h2, h3, h4, h5, h6 { - font-family: verdana, sans-serif; + font-family: "Liberation Serif", sans-serif; } h1 { text-align: center; } h2, h3, h4, h5, h6 { text-align: left; padding-top: 2em; } - h1, h2, h3 { font-family: "Trebuchet MS", sans-serif; - color: #09550B; + h1, h2, h3 { font-family: "Liberation Serif", sans-serif; + /*color: #09550B;*/ } - h1 { font-weight: bold; font-size: 170%; } - h2 { font-weight: bold; font-size: 140%; } - h3 { font-weight: bold; font-size: 118%; } + h1 { font-weight:normal; font-size: 170%; letter-spacing:0.2em; word-spacing:0.4em; } + h2 { font-weight:normal; font-size: 140%; letter-spacing:0.2em; word-spacing:0.4em; } + h3 { font-weight: bold; font-size: 118%; letter-spacing:0.2em; word-spacing:0.4em; } h4 { font-weight: bold; font-size: 100%; } h5 { font-style: italic; font-size: 100%; } h6 { font-variant: small-caps; font-size: 100%; } h2.classHierarchy { - /*border: 1px none #008500;*/ + /*border: 1px none #008500;*/ border: 1px none #000000; border-top-width: 2px; border-top-style: solid; @@ -164,9 +164,9 @@ /* - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ * | Doxygen Specific Classes | - * x-----------------------------------------------------------------x + * +-----------------------------------------------------------------+ */ @@ -257,9 +257,9 @@ div.qindex, div.nav { width: 100%-4px; - /*background-color: #DADAEF;*/ - /*background-color: #eeeeff;*/ - /*background-color: #EEEEEE;*/ + /*background-color: #DADAEF;*/ + /*background-color: #eeeeff;*/ + /*background-color: #EEEEEE;*/ background-color: #CCE6CA; border: 0px solid #003300; text-align: center; @@ -350,6 +350,44 @@ h3 a[name="index_7"], h3 a[name="index_8"], h3 a[name="index_9"] + h3 a[id="index__"], + h3 a#index_a, + h3 a#index_b, + h3 a#index_c, + h3 a#index_d, + h3 a#index_e, + h3 a#index_f, + h3 a#index_g, + h3 a#index_h, + h3 a#index_i, + h3 a#index_j, + h3 a#index_k, + h3 a#index_l, + h3 a#index_m, + h3 a#index_n, + h3 a#index_o, + h3 a#index_p, + h3 a#index_q, + h3 a#index_r, + h3 a#index_s, + h3 a#index_t, + h3 a#index_u, + h3 a#index_v, + h3 a#index_w, + h3 a#index_x, + h3 a#index_y, + h3 a#index_z, + h3 a#index_0, + h3 a#index_1, + h3 a#index_2, + h3 a#index_3, + h3 a#index_4, + h3 a#index_5, + h3 a#index_6, + h3 a#index_7, + h3 a#index_8, + h3 a#index_9, + h3 a#index_0x7e { font-family: time; font-size: 250%; @@ -376,14 +414,14 @@ */ .mdTable { - /*border: 1px solid #868686;*/ - /*background-color: #DADAEF;*/ - /*background-color: #F4F4FB;*/ + /*border: 1px solid #868686;*/ + /*background-color: #DADAEF;*/ + /*background-color: #F4F4FB;*/ border: 1px none #008500; border-left-width: 1px; border-left-style: solid; - /*background-color: #B8E6B8;*/ - /*background-color: #CCE6CA;*/ + /*background-color: #B8E6B8;*/ + /*background-color: #CCE6CA;*/ margin-top: 25px; font-size: 105%; } @@ -402,7 +440,7 @@ padding: 0px 8px 4px 8px; font-size: 11px; font-style: italic; - /*background-color: #FAFAFA;*/ + /*background-color: #FAFAFA;*/ border-top: 1px none #E0E0E0; border-right: 1px none #E0E0E0; border-bottom: 1px none #E0E0E0; @@ -431,31 +469,38 @@ .memdoc{ padding-left: 5px; - /*margin-top: -8px;*/ + /*margin-top: -8px;*/ border-left-width: 1px; border-left-style: solid; border-color: #008500; } + div.contents * table tr { + padding: 3px 3px 3px 8px; + } + .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight { - padding: 1px 0px 0px 8px; + /*padding: 1px 0px 0px 8px;*/ + padding: 3px 3px 3px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; + /* border-top-color: #0c0c0c; border-right-color: #0c0c0c; border-bottom-color: #0c0c0c; border-left-color: #0c0c0c; - border-top-style: solid; + */ + border-top-style: none; border-right-style: none; - border-bottom-style: none; + border-bottom-style: dotted; border-left-style: none; - /*background-color: #DADAEF;*/ - /*background-color: #eeeeff;*/ - /*background-color: #EEEEEE;*/ - background-color: #CCE6CA; + /*background-color: #DADAEF;*/ + /*background-color: #eeeeff;*/ + /*background-color: #EEEEEE;*/ + /*background-color: #CCE6CA;*/ } .memTemplItemLeft, .memTemplItemRight { @@ -478,8 +523,12 @@ .groupText, .groupHeader { color: #09550B; - margin-top: 15px; font-size: 130%; font-weight: bold; + margin-top: 15px; + } + + .groupHeader { + margin-bottom: -30pt; } diff --git a/hurricane/doc/viewer/CellImage.dox b/hurricane/doc/viewer/CellImage.dox new file mode 100644 index 00000000..52e2d589 --- /dev/null +++ b/hurricane/doc/viewer/CellImage.dox @@ -0,0 +1,132 @@ + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class CellImage + * \brief Widget to generate Image files. + * + * + * \section secImageBasicUsage Basic Usage + * + * CellImage is a simple Qt Widget to write the contents of a CellWidget + * into a QImage. As it may uses lots of memory (due to the high-res bitmaps) + * it is advisable to delete it immediatly after usage. The same rendering engine + * is used to both display on screen and onto the image so it is a "What You + * See Is What You Get" mode (except for the higher resolution). + * + * \see CellPrinter. + * + * It's use is straigtforward, as shown in the example below. It consist + * of six steps: + *
      + *
    1. Widget allocation. + *
    2. Bind to a screen CellWidget (CellImage::setScreenCellWidget()). + *
    3. Draw into a QImage (CellImage::toImage()). + *
    4. Delete the widget. + *
    5. Save the QImage or do whatever you want with it. + *
    6. Delete the QImage. + *
    + * + * Code example (took from CellViewer): +\code + void CellViewer::imageDisplay () + { + if (_cellWidget == NULL) return; + if (_cellWidget->getCell() == NULL) { + cerr << Warning("Unable to save to image, no cell loaded yet.") << endl; + return; + } + + CellImage* cellImage = new CellImage(); + cellImage->setScreenCellWidget( _cellWidget ); + QImage* image = cellImage->toImage(0); + delete cellImage; + + char workingDirectory [1024]; + getcwd ( workingDirectory, 1024 ); + + QString filePath = QFileDialog::getSaveFileName ( this + , tr("Save Image as ...") + , workingDirectory + , tr("Image (*.png)") + ); + + image->save ( filePath, "png" ); + delete image; + } +\endcode + * + * + * \section secImageConfiguration Configuration Variables + * + * The CellImage reads the following configuration variables for + * it's defaults settings (they are located in \c misc.conf, for + * the system-wide settings). + *
      + *
    • \c "viewer.printer.mode", select between the two resolution + * modes (Cell or Design). + *
    + * + * + * \section secImageImplDetails Implementation details + * + * This widget is build as a QMainWindow (top-level) one + * encapsulating only a CellWidget. It is configured to never been + * shown thanks to the \c Qt::WA_DontShowOnScreen attribute, but + * all the display computations still takes place as if it actually + * was. + * + * The CellImage returns a newly allocated QImage, it is the responsability + * of the caller to delete it after usage. + * + * To obtain a sufficent resolution the CellImage/CellWidget are + * resized to the resolution of the printed page. For a better look + * select a display style with patterns of 32x32 pixels, such as + * \c "Image.Coriolis". + */ + + + /*! \function CellImage::CellImage(QWidget* parent=NULL); + * Construct a CellImage window no screen CellWidget is actually bound. + */ + /*! \function CellImage::~CellImage(); + * Destructor. + */ + /*! \function void CellImage::setScreenCellWidget(CellWidget* screenCellWidget); + * Bind the CellImage to the screen CellWidget \c screenCellWidget. + * It is those contents that will be printed. + */ + /*! \function void CellImage::setMode(int mode); + * Sets the display mode, that is the resolution that will be used. + * Two modes are availables: + *
      + *
    • CellWidget::Res_CellMode: (approx. 150 dpi), best suited for + * displaying lone Cell or very small scale designs. + *
    • CellWidget::Res_DesignMode: (approx. 300 dpi), for full + * fledged designs. + *
    + */ + /*! \function QImage* CellImage::toImage(unsigned int flags=0); + * \param flags Control some tweaks. + * + * \return A newly allocated QImage displaying the contents of the bound + * \c screenCellWidget. The deletion of the QImage is left to caller. + * + * Availables flags: + *
      + *
    • ShowScale: display a false color scale at the bottom of the + * image. Useful if you draw a density map for instance. + *
    + */ + + /*! \enum CellImage::Flags + * Some flags to tweak the image display. + */ + /*! \var CellImage::Flags CellImage::ShowScale; + * Adds a false color scale at the bottom of the image. + * Useful if you draw a density map for instance. + */ + + } diff --git a/hurricane/doc/viewer/CellPrinter.dox b/hurricane/doc/viewer/CellPrinter.dox new file mode 100644 index 00000000..ba8aa39f --- /dev/null +++ b/hurricane/doc/viewer/CellPrinter.dox @@ -0,0 +1,117 @@ + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class CellPrinter + * \brief Widget to generate PDF file. + * + * + * \section secPrinterBasicUsage Basic Usage + * + * CellPrinter is a simple Qt Widget to write the contents of a CellWidget + * into a QPrinter. As it may uses lots of memory (due to the high-res bitmaps) + * it is advisable to delete it immediatly after usage. The same rendering engine + * is used to both display on screen and onto the printer so it is a "What You + * See Is What You Get" mode (except for the higher resolution). It optionaly + * adds a frame and a cartouche (on by default). + * + * \see CellImage. + * + * It's use is straigtforward, as shown in the example below. It consist + * of four steps: + *
      + *
    1. Widget allocation. + *
    2. Bind to a screen CellWidget (CellPrinter::setScreenCellWidget()). + *
    3. Draw into a QPrinter (CellPrinter::toPdf()). + *
    4. Delete the widget. + *
    + * + * Code example (took from CellViewer): +\code + void CellViewer::printDisplay () + { + if (_cellWidget == NULL) return; + if (_cellWidget->getCell() == NULL) { + cerr << Warning("Unable to print, no cell loaded yet.") << endl; + return; + } + + QPrinter printer( QPrinter::ScreenResolution ); + printer.setPaperSize + ( (QPrinter::PaperSize)Cfg::getParamEnumerate("viewer.printer.paper",0)->asInt() ); + printer.setOutputFileName ( "unicorn-snapshot.pdf" ); + + QPrintDialog dialog ( &printer ); + if ( dialog.exec() == QDialog::Accepted ) { + CellPrinter* cellPrinter = new CellPrinter(); + + cellPrinter->setScreenCellWidget( _cellWidget ); + cellPrinter->toPdf ( &printer, false ); + + delete cellPrinter; + } + } +\endcode + * + * \remark The generated PDF file are bitmaps, so they can grew very large if + * you uses paper above A2... + * + * + * \section secPrinterConfiguration Configuration Variables + * + * The CellPrinter reads the following configuration variables for + * it's defaults settings (they are located in \c misc.conf, for + * the system-wide settings). + *
      + *
    • \c "viewer.printer.mode", select between the two resolution + * modes (Cell or Design). + *
    • \c "viewer.printer.paper", the output paper size, should be + * one value from the QPrinter::PaperSize enumeration. + *
    + * + * + * \section secPrinterImplDetails Implementation details + * + * This widget is build as a QMainWindow (top-level) one + * encapsulating only a CellWidget. It is configured to never been + * shown thanks to the \c Qt::WA_DontShowOnScreen attribute, but + * all the display computations still takes place as if it actually + * was. + * + * To obtain a sufficent resolution the CellPrinter/CellWidget are + * resized to the resolution of the printed page. For a better look + * select a display style with patterns of 32x32 pixels, such as + * \c "Printer.Coriolis". + */ + + + /*! \function CellPrinter::CellPrinter(QWidget* parent=NULL); + * Construct a CellPrinter window no screen CellWidget is actually bound. + */ + /*! \function CellPrinter::~CellPrinter(); + * Destructor. + */ + /*! \function void CellPrinter::setScreenCellWidget(CellWidget* screenCellWidget); + * Bind the CellPrinter to the screen CellWidget \c screenCellWidget. + * It is those contents that will be printed. + */ + /*! \function void CellPrinter::setMode(int mode); + * Sets the display mode, that is the resolution that will be used. + * Two modes are availables: + *
      + *
    • CellWidget::Res_CellMode: (approx. 150 dpi), best suited for + * displaying lone Cell or very small scale designs. + *
    • CellWidget::Res_DesignMode: (approx. 300 dpi), for full + * fledged designs. + *
    + */ + /*! \function void CellPrinter::toPdf(QPrinter* printer, bool imageOnly=false); + * \param printer The QPrinter to draw into. + * \param imageOnly Whether to add the frame & cartouche or not. + * + * Perform the drawing operation on the QPrinter. + */ + + } diff --git a/hurricane/doc/viewer/CellViewer.dox b/hurricane/doc/viewer/CellViewer.dox index ffed697e..cc532738 100644 --- a/hurricane/doc/viewer/CellViewer.dox +++ b/hurricane/doc/viewer/CellViewer.dox @@ -1,5 +1,4 @@ - // -*- C++ -*- @@ -7,18 +6,76 @@ /*! \class CellViewer * \brief A simple top level window embedding the CellWidget. + * + * This classe group together a CellWidget to view layout and + * a ControllerWidget that enables to control it. It should + * be used as the base for complete viewer. */ - /*! \name Constructors & Destructors - */ - // \{ - /*! \function CellViewer::CellViewer(QWidget* parent=NULL); * Construct a CellView window no Cell is actually loaded. */ - - // \} - + /*! \function CellViewer::~CellViewer(); + * Destructor. + */ + /*! \function bool CellViewer::isToolInterrupted() const; + * \Return \true if the viewer has received an interruption request, + * in that case it will abort it's current redrawing pass + * (if any) and process the next drawing request. + */ + /*! \function void CellViewer::setEnableRedrawInterrupt(bool state); + * Allows/disallow the redrawing interruptions. If disabled, + * the viewer will not abort it's drawing passes. + */ + /*! \function void CellViewer::setApplicationName(const QString& name); + * Sets the Qt application name. The name under which the application + * will appears for window managers. + */ + /*! \function Cell* CellViewer::getCell() const; + * \Return The Cell currently viewer (may be \c NULL if there is none). + */ + /*! \function void CellViewer::setCell(Cell* cell); + * Load \c cell into the viewer. + */ + /*! \function void CellViewer::renameCell(const char* name); + * Change the name of the currently loaded Cell. + */ + /*! \function Cell* CellViewer::getCellFromDb(const char* name); + * \Return Load through a framework the Cell \c name. + * + * \important This function is virtual and actually empty. It is a placeholder + * for derived classes. It has not be made pure virtual as not + * every derived classes needs it. Instead it display a warning + * message. + */ + /*! \function CellWidget* CellViewer::getCellWidget(); + * \Return The associated CellWidget (the actual widget that do the display). + */ + /*! \function const CellWidget* CellViewer::getCellWidget() const; + * \Return The associated CellWidget (the actual widget that do the display). + * This is the \e const flavor. + */ + /*! \function ControllerWidget* CellViewer::getControllerWidget(); + * \Return The associated ControllerWidget. + */ + /*! \function void CellViewer::setAnonNetSelectable(bool state); + * Allows/disallow the selection of anonymous nets whith the + * selection menu. + */ + /*! \function void CellViewer::select(Occurrence& occurrence); + * Add \c occurrence the set of selected occurrences. Also + * switch the viewer in selection mode (if not already on). + */ + /*! \function void CellViewer::unselect(Occurrence& occurrence); + * Whidraw \c occurrence from the set of selected occurrences. + */ + /*! \function void CellViewer::unselectAll(); + * Clear the whole set of selected occurrences. + */ + /*! \function void CellViewer::setLayerVisible(const Name& layer, bool visible); + * Sets the visibility state of \c layer. This is the programatic + * equivalent of the ControllerWidget. + */ } diff --git a/hurricane/doc/viewer/CellWidget.dox b/hurricane/doc/viewer/CellWidget.dox new file mode 100644 index 00000000..7fba446e --- /dev/null +++ b/hurricane/doc/viewer/CellWidget.dox @@ -0,0 +1,24 @@ + + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class CellWidget + * \brief The Widget to display a Cell. + * + * This is the workhorse of the viewer. This Widget provides the + * comprehensive paraphernalia to display a Cell. + */ + + /*! \enum CellWidget::ResolutionMode + * Defines the resolutions mode for both CellPrinter & CellImage. + */ + /*! \var CellWidget::ResolutionMode CellWidget::Res_CellMode; + * Suited for displaying Cell or very small designs. + */ + /*! \var CellWidget::ResolutionMode CellWidget::Res_DesignMode; + * Suited for displaying full fledged designs. + */ + + } diff --git a/hurricane/doc/viewer/DisplayStyle.dox b/hurricane/doc/viewer/DisplayStyle.dox index 11571463..b63a6fd6 100644 --- a/hurricane/doc/viewer/DisplayStyle.dox +++ b/hurricane/doc/viewer/DisplayStyle.dox @@ -16,10 +16,6 @@ */ - /*! \name Constructors & Destructors - */ - // \{ - /*! \function DisplayStyle::DisplayStyle(const Name& name); * Construct a DisplayStyle named \e name. The DisplayStyle * is populated with a minimal sets of DrawingStyles which @@ -31,37 +27,39 @@ * The standart destructor. */ - // \} - - - /*! \name Accessors - */ - // \{ /*! \function const Name& DisplayStyle::getName() const; * \Return The name of this DisplayStyle. */ + /*! \function const std::string& DisplayStyle::getDescription() const; + * \Return The long description of this DisplayStyle. + */ + + /*! \function const DisplayStyle::HSVr& DisplayStyle::getDarkening() const; + * \Return The darkening factor. + */ + /*! \function const Name& DisplayStyle::getGroup(const Name& key) const; * \Return The group owning the DrawingStyle of which key is \e key. */ - /*! \function const QColor& DisplayStyle::getColor(const Name& key, int darkening) const; + /*! \function const string& DisplayStyle::getPattern(const Name& key) const; + * \Return The pattern associated to the DrawingStyle \e key. + */ + + /*! \function const QColor& DisplayStyle::getColor(const Name& key, const DisplayStyle::HSVr& darkening) const; * \Return The QColor associated to the DrawingStyle \e key darkened by a factor \e darkening. */ - /*! \function const QPen& DisplayStyle::getColor(const Name& key, int darkening) const; + /*! \function const QPen& DisplayStyle::getPen(const Name& key, const DisplayStyle::HSVr& darkening) const; * \Return The QPen associated to the DrawingStyle \e key darkened by a factor \e darkening. */ - /*! \function const QBrush& DisplayStyle::getBrush(const Name& key, int darkening) const; + /*! \function const QBrush& DisplayStyle::getBrush(const Name& key, const DisplayStyle::HSVr& darkening) const; * \Return The QBrush associated to the DrawingStyle \e key darkened by a factor \e darkening. */ - /*! \function const string& DisplayStyle::getPattern(const Name& key) const; - * \Return The pattern associated to the DrawingStyle \e key. - */ - /*! \function const float DisplayStyle::getThreshold(const Name& key) const; * \Return The display threshold associated to the DrawingStyle \e key. */ @@ -75,20 +73,33 @@ * matches \e key, the \e default DrawingStyle is returned. */ - // \} - - /*! \name Modifiers - */ - // \{ - - /*! \function void DisplayStyle::inheritFrom(const DisplayStyle* base); - * Clone the \e base DisplayStyle into the current one. Any - * previous settings are eraseds. + /*! \function QColor DisplayStyle::darken( const QColor& color, const DisplayStyle::HSVr& darkening ); + * \Return The \e color with the darkening factor \c darkening applied. * */ - /*! \function void DisplayStyle::addDrawingStyle(const Name& groupKey, const Name& key, const string& pattern, int red, int green, int blue, int borderWidth, float threshold); + /*! \function void DisplayStyle::qtAllocate(); + * Triggers the allocation of Qt pens & brushes. Should not be used + * directly but only through Graphics::enable(). + */ + + /*! \function void DisplayStyle::setDescription(const std::string& description); + * Sets the Display style informative text. + */ + + /*! \function void DisplayStyle::inheritFrom(const DisplayStyle* base); + * Clone the \e base DisplayStyle into the current one. Any + * previous settings are eraseds. The base style is \e duplicated + * into this one. Further modification of \e base after this point + * will have no effect on the current style. + */ + + /*! \function void DisplayStyle::setDarkening(const HSVr&); + * Sets the darkening factor. + */ + + /*! \function void DisplayStyle::addDrawingStyle(const Name& groupKey, const Name& key, const std::string& pattern, int red, int green, int blue, int borderWidth, float threshold, bool goMatched=true); * \param groupKey in which group to insert this DrawinStyle. * \param key the DrawingStyle's name. * \param pattern the stipple pattern (for the brush). @@ -97,12 +108,10 @@ * \param blue the blue color component (for Brush & Pen). * \param borderWidth the width of the drawing (for Pen). * \param threshold the display threshold. + * \param goMatched tells if this style is used to draw a Go. * * Adds a new DrawingStyle. If any previous DrawingStyle of the same * name was existing it is erased. */ - // \} - - } diff --git a/hurricane/doc/viewer/Graphics.dox b/hurricane/doc/viewer/Graphics.dox index 82fd0440..9bcd3a33 100644 --- a/hurricane/doc/viewer/Graphics.dox +++ b/hurricane/doc/viewer/Graphics.dox @@ -66,20 +66,22 @@ * styles used to draw all the objects from the CellWidget. */ - // !} + //! \} - //! \name Accessors - // \{ - /*! \function Graphics* Graphics::getGraphics(); * \Return The Graphics singleton. */ + + /*! \function bool Graphics::isEnabled(); + * \Return \true if Qt has been activated. + */ - /*! \function const QFont Graphics::getFixedFont(int weight=-1, bool italic=false, bool underline=false); + /*! \function const QFont Graphics::getFixedFont(int weight=QFont::Normal, bool italic=false, bool underline=false, int scale=0); * \param weight the font's weight (see Qt::Weight). * \param italic select the italic variant of the font. * \param underline the font will be underlined. + * \param scale added to the font's default point size. * \return A QFont, the size of the font is guessed from the system's default. */ @@ -87,15 +89,15 @@ * \Return The group owning the DrawingStyle of which key is \e key. */ - /*! \function const QColor& Graphics::getColor(const Name& key, int darkening=100); + /*! \function const QColor& Graphics::getColor(const Name& key, const DisplayStyle::HSVr& darkening=DisplayStyle::HSVr()); * \Return The QColor associated to the DrawingStyle \e key darkened by a factor \e darkening. */ - /*! \function const QPen& Graphics::getPen(const Name& key, int darkening=100); + /*! \function const QPen& Graphics::getPen(const Name& key, const DisplayStyle::HSVr& darkening=DisplayStyle::HSVr()); * \Return The QPen associated to the DrawingStyle \e key darkened by a factor \e darkening. */ - /*! \function const QBrush& Graphics::getBrush(const Name& key, int darkening=100); + /*! \function const QBrush& Graphics::getBrush(const Name& key, const DisplayStyle::HSVr& darkening=DisplayStyle::HSVr()); * \Return The QBrush associated to the DrawingStyle \e key by a factor \e darkening. */ @@ -107,11 +109,33 @@ * \Return The display threshold associated to the DrawingStyle \e key. */ - // \} + /*! \function const DisplayStyle::HSVr& Graphics::getDarkening(); + * \Return The darkening factor applied to non-selected objects. + */ + /*! \function const ColorScale& Graphics::getColorScale( ColorScale::ScaleType ); + * \Return The darkening factor applied to non-selected objects. + */ + + /*! \function const QColor Graphics::darken( const QColor& color ); + * \Return The QColor with the darkening factor applied. + */ + + /*! \function const QColor Graphics::darken( const QColor& color ); + * \Return The QColor with the darkening factor applied. + */ + + /*! \function const TextTranslator& Graphics::getHtmlTranslator(); + * \Return The translator applied to generate html text. + * \see toHtml() + */ + + /*! \function const string Graphics::toHtml( const string& ); + * \Return A string suitable for HTML enabled devices, such as most of the + * Qt widgets. Special characters like \c '&' are replaced by their + * HTML counterpart (\c \&) + */ - //! \name Modifiers - // \{ /*! \function const void Graphics::addStyle(DisplayStyle* displayStyle); * Adds a new DisplayStyle to the Graphics environment. @@ -133,7 +157,8 @@ * \Return The DisplayStyle which is currently in use. */ - // \} - + /*! \function void Graphics::enable(); + * Effectively calls Qt, allocated Pens & Brushes and so on. + */ } diff --git a/hurricane/doc/viewer/InspectorWidget.dox b/hurricane/doc/viewer/InspectorWidget.dox index 66b3749f..5b4cdafe 100644 --- a/hurricane/doc/viewer/InspectorWidget.dox +++ b/hurricane/doc/viewer/InspectorWidget.dox @@ -5,7 +5,7 @@ namespace Hurricane { - /*! \class HInspectorWidget + /*! \class InspectorWidget * \brief A Widget to browse through the Hurricane objetcs. * * \section secInspectorMM Inspector Memory Management @@ -39,27 +39,24 @@ */ - //! \name Constructors & Destructors - // \{ - /*! \function InspectorWidget::InspectorWidget(QWidget* parent=NULL); - * Construct a HInspectorWidget. The root Record to browse must + * Construct a InspectorWidget. The root Record to browse must * be sets immediatly afterwards with the setRootRecord() * method. */ - // \} - - //! \name Modifiers - // \{ - /*! \function void InspectorWidget::setRootRecord(Record* record); - * Sets the root record of the Inspector. Note that the - * previous root record is freed. + * Sets the root record of the Inspector. + * + * \remark The previous root record is freed. */ - // \} - + + /*! \function void InspectorWidget::setRootOccurrence(Occurrence& occurrence); + * Build a Record from the Occurrence and set it as the root Record. + * + * \remark The previous root record is freed. + */ } diff --git a/hurricane/doc/viewer/customSummary.html b/hurricane/doc/viewer/customSummary.html index 55a7036c..14747174 100644 --- a/hurricane/doc/viewer/customSummary.html +++ b/hurricane/doc/viewer/customSummary.html @@ -29,17 +29,23 @@

    API documentations

    +
    @@ -52,7 +58,7 @@ - +
    Hurricane Viewer DocumentationCopyright © 2008-2008 LIP6/UPMC All rights reservedCopyright © 2008-2012 LIP6/UPMC All rights reserved
    diff --git a/hurricane/doc/viewer/doxyfile b/hurricane/doc/viewer/doxyfile index c3469f3c..92bcbab5 100644 --- a/hurricane/doc/viewer/doxyfile +++ b/hurricane/doc/viewer/doxyfile @@ -245,7 +245,7 @@ OPTIMIZE_OUTPUT_VHDL = NO # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. -BUILTIN_STL_SUPPORT = NO +BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. @@ -588,6 +588,11 @@ INPUT = ../../src/viewer/hurricane/viewer/Graphics.h \ ../../src/viewer/hurricane/viewer/DisplayStyle.h \ DisplayStyle.dox \ ../../src/viewer/hurricane/viewer/CellWidget.h \ + CellWidget.dox \ + ../../src/viewer/hurricane/viewer/CellPrinter.h \ + CellPrinter.dox \ + ../../src/viewer/hurricane/viewer/CellImage.h \ + CellImage.dox \ ../../src/viewer/hurricane/viewer/CellViewer.h \ CellViewer.dox \ ../../src/viewer/hurricane/viewer/InspectorWidget.h \ diff --git a/hurricane/doc/viewer/footer.html b/hurricane/doc/viewer/footer.html index a52c62f6..a74e5355 100644 --- a/hurricane/doc/viewer/footer.html +++ b/hurricane/doc/viewer/footer.html @@ -9,7 +9,7 @@ - +
    Hurricane Viewer DocumentationCopyright © 2008-2008 LIP6/UPMC All rights reservedCopyright © 2008-2012 LIP6/UPMC All rights reserved
    diff --git a/hurricane/src/hurricane/BasicLayer.cpp b/hurricane/src/hurricane/BasicLayer.cpp index 204de0a1..b09e1811 100644 --- a/hurricane/src/hurricane/BasicLayer.cpp +++ b/hurricane/src/hurricane/BasicLayer.cpp @@ -184,7 +184,6 @@ namespace Hurricane { ,minimalSpacing) ,_material (material) ,_extractNumber (extractNumber) - ,_connectorLayer(NULL) ,_blockageLayer (NULL) ,_realName ("") { } @@ -207,10 +206,6 @@ namespace Hurricane { } - BasicLayer* BasicLayer::getConnectorLayer () const - { return _connectorLayer; } - - BasicLayer* BasicLayer::getBlockageLayer () const { return _blockageLayer; } diff --git a/hurricane/src/hurricane/Box.cpp b/hurricane/src/hurricane/Box.cpp index 33480276..e4f2a676 100644 --- a/hurricane/src/hurricane/Box.cpp +++ b/hurricane/src/hurricane/Box.cpp @@ -346,10 +346,10 @@ Record* Box::_getRecord() const if (isEmpty()) return NULL; Record* record = new Record(getString(this)); - record->add(getSlot("XMin", &_xMin)); - record->add(getSlot("YMin", &_yMin)); - record->add(getSlot("XMax", &_xMax)); - record->add(getSlot("YMax", &_yMax)); + record->add(DbU::getValueSlot("XMin", &_xMin)); + record->add(DbU::getValueSlot("YMin", &_yMin)); + record->add(DbU::getValueSlot("XMax", &_xMax)); + record->add(DbU::getValueSlot("YMax", &_yMax)); return record; } diff --git a/hurricane/src/hurricane/Contact.cpp b/hurricane/src/hurricane/Contact.cpp index 3390d310..ef8d7422 100644 --- a/hurricane/src/hurricane/Contact.cpp +++ b/hurricane/src/hurricane/Contact.cpp @@ -354,10 +354,10 @@ Record* Contact::_getRecord() const record->add(getSlot("AnchorHook", &_anchorHook)); record->add(getSlot("Anchor", getAnchor())); record->add(getSlot("Layer", _layer)); - record->add(getSlot("Dx", &_dx)); - record->add(getSlot("Dy", &_dy)); - record->add(getSlot("Width", &_width)); - record->add(getSlot("Height", &_height)); + record->add(DbU::getValueSlot("Dx", &_dx)); + record->add(DbU::getValueSlot("Dy", &_dy)); + record->add(DbU::getValueSlot("Width", &_width)); + record->add(DbU::getValueSlot("Height", &_height)); } return record; } diff --git a/hurricane/src/hurricane/DbU.cpp b/hurricane/src/hurricane/DbU.cpp index 87ea004c..2a76a011 100644 --- a/hurricane/src/hurricane/DbU.cpp +++ b/hurricane/src/hurricane/DbU.cpp @@ -253,6 +253,13 @@ namespace Hurricane { } + void DbU::getStringMode ( unsigned int& mode, UnitPower& p ) + { + mode = _stringMode; + p = _stringModeUnitPower; + } + + string DbU::getValueString ( DbU::Unit u, int mode ) { char buffer[1024]; diff --git a/hurricane/src/hurricane/DiffusionLayer.cpp b/hurricane/src/hurricane/DiffusionLayer.cpp index a07dad21..1f2bf189 100644 --- a/hurricane/src/hurricane/DiffusionLayer.cpp +++ b/hurricane/src/hurricane/DiffusionLayer.cpp @@ -70,7 +70,7 @@ namespace Hurricane { ) : Layer(technology ,name ,0 // minimalSize. - ,0) // minmalSpacing. + ,0) // minimalSpacing. ,_basicLayers() ,_extentionCaps() ,_extentionWidths() diff --git a/hurricane/src/hurricane/Horizontal.cpp b/hurricane/src/hurricane/Horizontal.cpp index a342922b..4f689351 100644 --- a/hurricane/src/hurricane/Horizontal.cpp +++ b/hurricane/src/hurricane/Horizontal.cpp @@ -184,9 +184,9 @@ Record* Horizontal::_getRecord() const { Record* record = Inherit::_getRecord(); if (record) { - record->add(getSlot("Y", &_y)); - record->add(getSlot("DxSource", &_dxSource)); - record->add(getSlot("DxTarget", &_dxTarget)); + record->add(DbU::getValueSlot("Y", &_y)); + record->add(DbU::getValueSlot("DxSource", &_dxSource)); + record->add(DbU::getValueSlot("DxTarget", &_dxTarget)); } return record; } diff --git a/hurricane/src/hurricane/Interval.cpp b/hurricane/src/hurricane/Interval.cpp index a2e1c443..c860b0c6 100644 --- a/hurricane/src/hurricane/Interval.cpp +++ b/hurricane/src/hurricane/Interval.cpp @@ -254,8 +254,8 @@ Record* Interval::_getRecord() const // *************************** { Record* record = new Record(getString(this)); - record->add(getSlot("VMin", &_vMin)); - record->add(getSlot("VMin", &_vMax)); + record->add(DbU::getValueSlot("VMin", &_vMin)); + record->add(DbU::getValueSlot("VMin", &_vMax)); return record; } diff --git a/hurricane/src/hurricane/Layer.cpp b/hurricane/src/hurricane/Layer.cpp index 3f4c8799..559afb13 100644 --- a/hurricane/src/hurricane/Layer.cpp +++ b/hurricane/src/hurricane/Layer.cpp @@ -63,7 +63,6 @@ namespace Hurricane { , _extractMask(0) , _minimalSize(minimalSize) , _minimalSpacing(minimalSpacing) - , _pitch(pitch) , _nextOfTechnologyLayerMap(NULL) , _working(false) { @@ -78,10 +77,6 @@ namespace Hurricane { } - Layer* Layer::getConnectorLayer () const - { return NULL; } - - const Layer* Layer::getBlockageLayer () const { return NULL; } @@ -178,12 +173,6 @@ namespace Hurricane { } - void Layer::setPitch ( const DbU::Unit& pitch ) - { - _pitch = pitch; - } - - void Layer::setEnclosure ( const BasicLayer* layer, DbU::Unit ) { cerr << "[WARNING] Layer::setEnclosure() musn't be called on " @@ -227,7 +216,6 @@ namespace Hurricane { { _minimalSize = (DbU::Unit)( (float)_minimalSize * scale ); _minimalSpacing = (DbU::Unit)( (float)_minimalSpacing * scale ); - _pitch = (DbU::Unit)( (float)_pitch * scale ); } @@ -247,9 +235,8 @@ namespace Hurricane { 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(DbU::getValueSlot("MinimalSize" , &_minimalSize )); + record->add(DbU::getValueSlot("MinimalSpacing", &_minimalSpacing)); } return record; } diff --git a/hurricane/src/hurricane/Point.cpp b/hurricane/src/hurricane/Point.cpp index 87c1ac77..26acf255 100644 --- a/hurricane/src/hurricane/Point.cpp +++ b/hurricane/src/hurricane/Point.cpp @@ -118,8 +118,8 @@ Record* Point::_getRecord() const // ****************************** { Record* record = new Record(getString(this)); - record->add(getSlot("X", &_x)); - record->add(getSlot("Y", &_y)); + record->add(DbU::getValueSlot("X", &_x)); + record->add(DbU::getValueSlot("Y", &_y)); return record; } diff --git a/hurricane/src/hurricane/RegularLayer.cpp b/hurricane/src/hurricane/RegularLayer.cpp index 0f24c2b6..ddf1277c 100644 --- a/hurricane/src/hurricane/RegularLayer.cpp +++ b/hurricane/src/hurricane/RegularLayer.cpp @@ -328,8 +328,8 @@ namespace Hurricane { if (record) { record->add(getSlot("_basicLayer" , _basicLayer )); record->add(getSlot("_enclosure" , &_enclosure )); - record->add(getSlot("_extentionCap" , &_extentionCap )); - record->add(getSlot("_extentionWidth", &_extentionWidth)); + record->add(DbU::getValueSlot("_extentionCap" , &_extentionCap )); + record->add(DbU::getValueSlot("_extentionWidth", &_extentionWidth)); } return record; } diff --git a/hurricane/src/hurricane/Segment.cpp b/hurricane/src/hurricane/Segment.cpp index 1c28ed11..5496542f 100644 --- a/hurricane/src/hurricane/Segment.cpp +++ b/hurricane/src/hurricane/Segment.cpp @@ -322,7 +322,7 @@ Record* Segment::_getRecord() const record->add(getSlot("TargetHook", &_targetHook)); record->add(getSlot("Target", getTarget())); record->add(getSlot("Layer", _layer)); - record->add(getSlot("Width", &_width)); + record->add(DbU::getValueSlot("Width", &_width)); } return record; } diff --git a/hurricane/src/hurricane/Vertical.cpp b/hurricane/src/hurricane/Vertical.cpp index 3a72b3b9..729d26ab 100644 --- a/hurricane/src/hurricane/Vertical.cpp +++ b/hurricane/src/hurricane/Vertical.cpp @@ -187,9 +187,9 @@ Record* Vertical::_getRecord() const { Record* record = Inherit::_getRecord(); if (record) { - record->add(getSlot("X", &_x)); - record->add(getSlot("DySource", &_dySource)); - record->add(getSlot("DyTarget", &_dyTarget)); + record->add(DbU::getValueSlot("X", &_x)); + record->add(DbU::getValueSlot("DySource", &_dySource)); + record->add(DbU::getValueSlot("DyTarget", &_dyTarget)); } return record; } diff --git a/hurricane/src/hurricane/hurricane/BasicLayer.h b/hurricane/src/hurricane/hurricane/BasicLayer.h index 39fb86ae..3521c4a0 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayer.h +++ b/hurricane/src/hurricane/hurricane/BasicLayer.h @@ -19,12 +19,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $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 | // | | @@ -32,10 +27,7 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/BasicLayer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ # ifndef __HURRICANE_BASIC_LAYER__ @@ -96,11 +88,9 @@ namespace Hurricane { inline const Material& getMaterial () const; inline unsigned getExtractNumber () const; virtual BasicLayers getBasicLayers () const; - virtual BasicLayer* getConnectorLayer () const; virtual BasicLayer* getBlockageLayer () const; inline const Name& getRealName () const; // Updators - inline void setConnectorLayer ( BasicLayer* layer); inline void setBlockageLayer ( BasicLayer* layer); inline void setExtractNumber ( unsigned int ); inline void setRealName ( const char* realName); @@ -114,7 +104,6 @@ namespace Hurricane { // Internal: Attributes Material _material; unsigned _extractNumber; - BasicLayer* _connectorLayer; BasicLayer* _blockageLayer; Name _realName; @@ -141,7 +130,6 @@ namespace Hurricane { BasicLayer::getMaterial () const { return _material; } inline unsigned BasicLayer::getExtractNumber () const { return _extractNumber; } inline const Name& BasicLayer::getRealName () const { return _realName; } - inline void BasicLayer::setConnectorLayer ( BasicLayer* layer) { _connectorLayer = layer; } inline void BasicLayer::setBlockageLayer ( BasicLayer* layer) { _blockageLayer = layer; } inline void BasicLayer::setExtractNumber ( unsigned int number ) { _extractNumber=number; } inline void BasicLayer::setRealName ( const char* realName) { _realName = realName; } diff --git a/hurricane/src/hurricane/hurricane/ContactLayer.h b/hurricane/src/hurricane/hurricane/ContactLayer.h index a7d1e223..8f31a639 100644 --- a/hurricane/src/hurricane/hurricane/ContactLayer.h +++ b/hurricane/src/hurricane/hurricane/ContactLayer.h @@ -94,4 +94,7 @@ namespace Hurricane { } // End of Hurricane namespace. +INSPECTOR_P_SUPPORT(Hurricane::ContactLayer); + + # endif diff --git a/hurricane/src/hurricane/hurricane/DbU.h b/hurricane/src/hurricane/hurricane/DbU.h index 299de0b9..050c10d5 100644 --- a/hurricane/src/hurricane/hurricane/DbU.h +++ b/hurricane/src/hurricane/hurricane/DbU.h @@ -74,6 +74,11 @@ namespace Hurricane { public: // User to DB Converters. + static inline Unit fromDb ( long value ); + static inline Unit fromGrid ( double value ); + static inline Unit fromLambda ( double value ); + static inline Unit fromPhysical ( double value, UnitPower p ); + // Old naming scheme (was not very clear). static inline Unit db ( long value ); static inline Unit grid ( double value ); static inline Unit lambda ( double value ); @@ -101,6 +106,14 @@ namespace Hurricane { static DbU::Unit getOnCustomGrid ( DbU::Unit u, DbU::Unit step, SnapMode mode=Nearest ); static inline DbU::Unit getOnPhysicalGrid ( DbU::Unit u, SnapMode mode=Superior ); // Conversions. + static inline long toDb ( Unit u ); + static inline double toGrid ( Unit u ); + static inline double toGrid ( double u ); + static inline double toLambda ( Unit u ); + static inline double toLambda ( double u ); + static inline double toPhysical ( Unit u, UnitPower p ); + static inline double toPhysical ( double u, UnitPower p ); + // Old naming scheme (not very clear). static inline long getDb ( Unit u ); static inline double getGrid ( Unit u ); static inline double getGrid ( double u ); @@ -113,6 +126,7 @@ namespace Hurricane { static Record* getValueRecord ( const Unit* u ); static Slot* getValueSlot ( const string& name, const Unit* u ); static void setStringMode ( unsigned int mode, UnitPower p=Nano ); + static void getStringMode ( unsigned int& mode, UnitPower& p ); public: // Static Attributes: constants. @@ -133,17 +147,32 @@ namespace Hurricane { // Inline Functions. - inline DbU::Unit DbU::db ( long value ) { return value; } - inline DbU::Unit DbU::grid ( double value ) { return (long)rint( value/_resolution ); } - inline DbU::Unit DbU::lambda ( double value ) { return grid(value*_gridsPerLambda); } - inline DbU::Unit DbU::physicalToDbu ( double value, UnitPower p ) { return grid((value*getUnitPower(p))/_physicalsPerGrid); } - inline long DbU::getDb ( DbU::Unit u ) { return u; } - inline double DbU::getGrid ( DbU::Unit u ) { return _resolution*(double)u; } - inline double DbU::getGrid ( double u ) { return _resolution*u; } - inline double DbU::getLambda ( DbU::Unit u ) { return getGrid(u)/_gridsPerLambda; } - inline double DbU::getLambda ( double u ) { return getGrid(u)/_gridsPerLambda; } - inline double DbU::getPhysical ( DbU::Unit u, UnitPower p ) { return (_physicalsPerGrid*_resolution*(double)u)/getUnitPower(p); } - inline double DbU::getPhysical ( double u, UnitPower p ) { return (_physicalsPerGrid*_resolution*u)/getUnitPower(p); } +// New converter naming scheme. + inline DbU::Unit DbU::fromDb ( long value ) { return value; } + inline DbU::Unit DbU::fromGrid ( double value ) { return (long)rint( value/_resolution ); } + inline DbU::Unit DbU::fromLambda ( double value ) { return grid(value*_gridsPerLambda); } + inline DbU::Unit DbU::fromPhysical ( double value, UnitPower p ) { return grid((value*getUnitPower(p))/_physicalsPerGrid); } + inline long DbU::toDb ( DbU::Unit u ) { return u; } + inline double DbU::toGrid ( DbU::Unit u ) { return _resolution*(double)u; } + inline double DbU::toGrid ( double u ) { return _resolution*u; } + inline double DbU::toLambda ( DbU::Unit u ) { return getGrid(u)/_gridsPerLambda; } + inline double DbU::toLambda ( double u ) { return getGrid(u)/_gridsPerLambda; } + inline double DbU::toPhysical ( DbU::Unit u, UnitPower p ) { return (_physicalsPerGrid*_resolution*(double)u)/getUnitPower(p); } + inline double DbU::toPhysical ( double u, UnitPower p ) { return (_physicalsPerGrid*_resolution*u)/getUnitPower(p); } + +// Old converter naming scheme. + inline DbU::Unit DbU::db ( long value ) { return fromDb(value); } + inline DbU::Unit DbU::grid ( double value ) { return fromGrid(value); } + inline DbU::Unit DbU::lambda ( double value ) { return fromLambda(value); } + inline DbU::Unit DbU::physicalToDbu ( double value, UnitPower p ) { return fromPhysical(value,p); } + inline long DbU::getDb ( DbU::Unit u ) { return toDb(u); } + inline double DbU::getGrid ( DbU::Unit u ) { return toGrid(u); } + inline double DbU::getGrid ( double u ) { return toGrid(u); } + inline double DbU::getLambda ( DbU::Unit u ) { return toLambda(u); } + inline double DbU::getLambda ( double u ) { return toLambda(u); } + inline double DbU::getPhysical ( DbU::Unit u, UnitPower p ) { return toPhysical(u,p); } + inline double DbU::getPhysical ( double u, UnitPower p ) { return toPhysical(u,p); } + inline void DbU::setRealSnapGridStep ( DbU::Unit step ) { _realSnapGridStep = step; } inline void DbU::setSymbolicSnapGridStep ( DbU::Unit step ) { _symbolicSnapGridStep = step; } inline DbU::Unit DbU::getOnPhysicalGrid ( DbU::Unit u, SnapMode mode ) { return getOnCustomGrid(u, grid(1), mode); } diff --git a/hurricane/src/hurricane/hurricane/DiffusionLayer.h b/hurricane/src/hurricane/hurricane/DiffusionLayer.h index be67e1a0..a3aa4557 100644 --- a/hurricane/src/hurricane/hurricane/DiffusionLayer.h +++ b/hurricane/src/hurricane/hurricane/DiffusionLayer.h @@ -96,4 +96,7 @@ namespace Hurricane { } // End of Hurricane namespace. +INSPECTOR_P_SUPPORT(Hurricane::DiffusionLayer); + + # endif diff --git a/hurricane/src/hurricane/hurricane/Layer.h b/hurricane/src/hurricane/hurricane/Layer.h index a03fdb32..705b6584 100644 --- a/hurricane/src/hurricane/hurricane/Layer.h +++ b/hurricane/src/hurricane/hurricane/Layer.h @@ -19,12 +19,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $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 | // | | @@ -32,10 +27,7 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/Layer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #ifndef __HURRICANE_LAYER__ @@ -66,9 +58,7 @@ namespace Hurricane { inline const Mask& getExtractMask () const; inline const DbU::Unit& getMinimalSize () const; inline const DbU::Unit& getMinimalSpacing () const; - inline DbU::Unit getPitch () const; virtual BasicLayers getBasicLayers () const = 0; - virtual Layer* getConnectorLayer () const; virtual const Layer* getBlockageLayer () const; virtual const Layer* getTop () const; virtual const Layer* getBottom () const; @@ -94,7 +84,6 @@ namespace Hurricane { inline void setWorking ( bool ); void setMinimalSize ( const DbU::Unit& minimalSize ); void setMinimalSpacing ( const DbU::Unit& minimalSpacing ); - void setPitch ( const DbU::Unit& pitch ); virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit ); virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit ); virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit ); @@ -119,7 +108,6 @@ namespace Hurricane { Mask _extractMask; DbU::Unit _minimalSize; DbU::Unit _minimalSpacing; - DbU::Unit _pitch; Layer* _nextOfTechnologyLayerMap; bool _working; @@ -146,7 +134,6 @@ namespace Hurricane { inline const Layer::Mask& Layer::getExtractMask () const { return _extractMask; } 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; } diff --git a/hurricane/src/hurricane/hurricane/Mask.h b/hurricane/src/hurricane/hurricane/Mask.h index 1ed2fbf1..7e8608a4 100644 --- a/hurricane/src/hurricane/hurricane/Mask.h +++ b/hurricane/src/hurricane/hurricane/Mask.h @@ -59,7 +59,6 @@ namespace Hurricane { inline bool isSet ( const Mask mask ) const; inline bool contains ( const Mask mask ) const; inline bool intersect ( const Mask mask ) const; - inline Mask& merge ( const Mask mask ) const; inline Mask nthbit ( unsigned int ) const; inline Mask operator compl () const; inline Mask operator bitand ( const Mask mask ) const; diff --git a/hurricane/src/hurricane/hurricane/RegularLayer.h b/hurricane/src/hurricane/hurricane/RegularLayer.h index b53c5190..3662e351 100644 --- a/hurricane/src/hurricane/hurricane/RegularLayer.h +++ b/hurricane/src/hurricane/hurricane/RegularLayer.h @@ -101,4 +101,7 @@ namespace Hurricane { } // End of Hurricane namespace. +INSPECTOR_P_SUPPORT(Hurricane::RegularLayer); + + # endif diff --git a/hurricane/src/hurricane/hurricane/TransistorLayer.h b/hurricane/src/hurricane/hurricane/TransistorLayer.h index fb565357..52a04cd7 100644 --- a/hurricane/src/hurricane/hurricane/TransistorLayer.h +++ b/hurricane/src/hurricane/hurricane/TransistorLayer.h @@ -99,4 +99,7 @@ namespace Hurricane { } // End of Hurricane namespace. +INSPECTOR_P_SUPPORT(Hurricane::TransistorLayer); + + # endif diff --git a/hurricane/src/hurricane/hurricane/ViaLayer.h b/hurricane/src/hurricane/hurricane/ViaLayer.h index ae253c27..6aae8cb2 100644 --- a/hurricane/src/hurricane/hurricane/ViaLayer.h +++ b/hurricane/src/hurricane/hurricane/ViaLayer.h @@ -95,4 +95,7 @@ namespace Hurricane { } // End of Hurricane namespace. +INSPECTOR_P_SUPPORT(Hurricane::ViaLayer); + + # endif diff --git a/hurricane/src/isobar/CMakeLists.txt b/hurricane/src/isobar/CMakeLists.txt index a2b1a3ac..f0fba2e2 100644 --- a/hurricane/src/isobar/CMakeLists.txt +++ b/hurricane/src/isobar/CMakeLists.txt @@ -21,7 +21,19 @@ PyHyperNet.cpp PyInstance.cpp PyInstanceCollection.cpp + PyMaterial.cpp PyLayer.cpp + PyLayerMask.cpp + PyBasicLayer.cpp + PyRegularLayer.cpp + PyContactLayer.cpp + PyDiffusionLayer.cpp + PyTransistorLayer.cpp + PyViaLayer.cpp + PyLayerCollection.cpp + PyBasicLayerCollection.cpp + PyRegularLayerCollection.cpp + PyViaLayerCollection.cpp PyLibrary.cpp PyNet.cpp PyNetCollection.cpp @@ -60,7 +72,19 @@ hurricane/isobar/PyHyperNet.h hurricane/isobar/PyInstance.h hurricane/isobar/PyInstanceCollection.h + hurricane/isobar/PyMaterial.h + hurricane/isobar/PyLayerMask.h hurricane/isobar/PyLayer.h + hurricane/isobar/PyBasicLayer.h + hurricane/isobar/PyRegularLayer.h + hurricane/isobar/PyContactLayer.h + hurricane/isobar/PyDiffusionLayer.h + hurricane/isobar/PyTransistorLayer.h + hurricane/isobar/PyLayerCollection.h + hurricane/isobar/PyBasicLayerCollection.h + hurricane/isobar/PyRegularLayerCollection.h + hurricane/isobar/PyViaLayerCollection.h + hurricane/isobar/PyViaLayer.h hurricane/isobar/PyLibrary.h hurricane/isobar/PyNet.h hurricane/isobar/PyNetCollection.h diff --git a/hurricane/src/isobar/ProxyProperty.cpp b/hurricane/src/isobar/ProxyProperty.cpp index ee549b97..d89594ce 100644 --- a/hurricane/src/isobar/ProxyProperty.cpp +++ b/hurricane/src/isobar/ProxyProperty.cpp @@ -1,98 +1,49 @@ // -*- 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-2012, 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: ProxyProperty.cpp,v 1.13 2007/07/30 16:02:51 jpc Exp $ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | -// | Author : Jean-Paul CHAPUT | +// | Authors : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./ProxyProperty.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - +// | C++ Module : "./ProxyProperty.cpp" | +// +-----------------------------------------------------------------+ +#if not defined(__PYTHON_MODULE__) #include #include - #include "hurricane/isobar/ProxyProperty.h" - #include "hurricane/Error.h" #include "hurricane/Warning.h" using namespace Hurricane; - - namespace Isobar { namespace { - using namespace std; - - // --------------------------------------------------------------- - // Miscellaneous. - - - - // --------------------------------------------------------------- // Local Variables. const char* twiceSetOffset = - "FragmentProperty::SetOffest () :\n\n" + "ProxyProperty::setOffset () :\n\n" " Attempt to sets the _shadow member offset twice.\n"; } - - // x-----------------------------------------------------------------x // | "::ProxyProperty" Global Variables | // x-----------------------------------------------------------------x @@ -109,36 +60,23 @@ namespace { // x-----------------------------------------------------------------x -// ------------------------------------------------------------------- -// Constructor : "ProxyProperty::ProxyProperty ()". - ProxyProperty::ProxyProperty ( void* shadow ) - : Property() - , _owner(NULL) - , _shadow(shadow) + : Property() + , _owner (NULL) + , _shadow (shadow) { } - - -// ------------------------------------------------------------------- -// Constructor : "ProxyProperty::create ()". - ProxyProperty* ProxyProperty::create ( void* shadow ) { ProxyProperty* property = new ProxyProperty ( shadow ); if ( property == NULL ) throw Error ( "ProxyProperty::create()" ); - return ( property ); + return property; } - - -// ------------------------------------------------------------------- -// Destructor : "ProxyProperty::_preDestroy ()". - void ProxyProperty::_preDestroy () { if ( _owner ) _owner->_onDestroyed ( this ); @@ -154,11 +92,6 @@ void ProxyProperty::_preDestroy () { } - - -// ------------------------------------------------------------------- -// Method : "ProxyProperty::onCapturedBy ()". - void ProxyProperty::onCapturedBy ( DBo* owner ) { if ( ( _owner != NULL ) && ( _owner != owner ) ) throw Error ( getString(this).c_str() ); @@ -167,43 +100,23 @@ void ProxyProperty::onCapturedBy ( DBo* owner ) { } - - -// ------------------------------------------------------------------- -// Method : "ProxyProperty::onReleasedBy ()". - void ProxyProperty::onReleasedBy ( DBo* owner ) { if ( _owner == owner ) onNotOwned (); } - - -// ------------------------------------------------------------------- -// Method : "ProxyProperty::onNotOwned ()". - void ProxyProperty::onNotOwned () { destroy (); } - - -// ------------------------------------------------------------------- -// Method : "ProxyProperty::SetOffset ()". - -void ProxyProperty::SetOffset ( int offset ) { - if ( _offset >= 0 ) throw Error ( twiceSetOffset ); +void ProxyProperty::setOffset ( int offset ) { + if ( _offset >= 0 ) throw Error(twiceSetOffset); _offset = offset; } - - -// ------------------------------------------------------------------- -// Method : "ProxyProperty::_getString()". - string ProxyProperty::_getString () const { ostringstream os; @@ -216,11 +129,6 @@ string ProxyProperty::_getString () const { } - - -// ------------------------------------------------------------------- -// Method : "ProxyProperty::_getRecord()". - Record* ProxyProperty::_getRecord () const { Record* record = Property::_getRecord (); @@ -234,6 +142,6 @@ Record* ProxyProperty::_getRecord () const } +} // Isobar namespace. - -} // End of Isobar namespace. +#endif diff --git a/hurricane/src/isobar/PyBasicLayer.cpp b/hurricane/src/isobar/PyBasicLayer.cpp new file mode 100644 index 00000000..80ac60e5 --- /dev/null +++ b/hurricane/src/isobar/PyBasicLayer.cpp @@ -0,0 +1,191 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyBasicLayer.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyBasicLayer.h" +#include "hurricane/isobar/PyMaterial.h" +#include "hurricane/isobar/PyTechnology.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +# undef ACCESS_OBJECT +# undef ACCESS_CLASS +# define ACCESS_OBJECT _baseObject._object +# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject) +# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(BasicLayer,basicLayer,function) + + +// +=================================================================+ +// | "PyBasicLayer" Python Module Code Part | +// +=================================================================+ + +# if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyBasicLayer" Attribute Methods | + // +-------------------------------------------------------------+ + + + static PyObject* PyBasicLayer_create ( PyObject*, PyObject* args ) + { + trace << "PyBasicLayer_create()" << endl; + + BasicLayer* basicLayer = NULL; + + HTRY + PyObject* pyTechnology = NULL; + char* name = NULL; + PyObject* pyMaterial = NULL; + unsigned int extractNumber = 0; + long minimalSize = 0; + long minimalSpacing = 0; + + if (PyArg_ParseTuple( args + , "OsO|Ill:BasicLayer.create" + , &pyTechnology + , &name + , &pyMaterial + , &extractNumber + , &minimalSize + , &minimalSpacing + )) { + if (not IsPyTechnology(pyTechnology)) { + PyErr_SetString ( ConstructorError, "Hurricane.create(): First argument is not of type Technology." ); + return NULL; + } + if (not IsPyMaterial(pyMaterial)) { + PyErr_SetString ( ConstructorError, "Hurricane.create(): Third argument is not of type Material." ); + return NULL; + } + + basicLayer = BasicLayer::create( PYTECHNOLOGY_O(pyTechnology) + , Name(name) + , *PYMATERIAL_O(pyMaterial) + , extractNumber + , minimalSize + , minimalSpacing + ); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to BasicLayer.create()." ); + return NULL; + } + HCATCH + + return PyBasicLayer_Link(basicLayer); + } + + + updatorFromBasicLayer (setBlockageLayer ,PyBasicLayer,BasicLayer) + DirectSetLongAttribute (PyBasicLayer_setExtractNumber,setExtractNumber,"BasicLayer.setExtractNumber",PyBasicLayer,BasicLayer) + DirectSetCStringAttribute(PyBasicLayer_setRealName ,setRealName ,"BasicLayer.setRealName" ,PyBasicLayer,BasicLayer) + + + // Standart destroy (Attribute). + DBoDestroyAttribute(PyBasicLayer_destroy, PyBasicLayer) + + + // --------------------------------------------------------------- + // PyBasicLayer Attribute Method table. + + PyMethodDef PyBasicLayer_Methods[] = + { { "create" , (PyCFunction)PyBasicLayer_create , METH_VARARGS|METH_STATIC + , "Create a new BasicLayer." } + , { "setBlockageLayer" , (PyCFunction)PyBasicLayer_setBlockageLayer , METH_VARARGS + , "Sets the blockage layer associated to this one." } + , { "setExtractNumber" , (PyCFunction)PyBasicLayer_setExtractNumber , METH_VARARGS + , "Sets the layer extract number (for GDSII)." } + , { "setRealName" , (PyCFunction)PyBasicLayer_setRealName , METH_VARARGS + , "Sets the real name of this layer (as seen in GDSII)." } + , { "destroy" , (PyCFunction)PyBasicLayer_destroy , METH_NOARGS + , "destroy associated hurricane object, the python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + // +-------------------------------------------------------------+ + // | "PyHorizontal" Object Methods | + // +-------------------------------------------------------------+ + + + DBoDeleteMethod(BasicLayer) + PyTypeObjectLinkPyType(BasicLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyBasicLayer" Shared Library Code Part | +// +=================================================================+ + + + // Link/Creation Method. + DBoLinkCreateMethod(BasicLayer) + + + PyTypeInheritedObjectDefinitions(BasicLayer, Layer) + + + extern void PyBasicLayer_postModuleInit () + { + PyMaterial_postModuleInit (); + + PyDict_SetItemString ( PyTypeBasicLayer.tp_dict, "Material", (PyObject*)&PyTypeMaterial ); + } + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. + diff --git a/hurricane/src/isobar/PyBasicLayerCollection.cpp b/hurricane/src/isobar/PyBasicLayerCollection.cpp new file mode 100644 index 00000000..590ba051 --- /dev/null +++ b/hurricane/src/isobar/PyBasicLayerCollection.cpp @@ -0,0 +1,89 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyBasicLayerCollection.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyBasicLayerCollection.h" +#include "hurricane/isobar/PyBasicLayer.h" + +namespace Isobar { + +using namespace Hurricane; + + +extern "C" { + + +// +=================================================================+ +// | "PyBasicLayerCollection" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyBasicLayerCollection" Attribute Methods | + // +-------------------------------------------------------------+ + + + DirectDeleteMethod(PyBasicLayerCollection_DeAlloc, PyBasicLayerCollection) + LocatorNextMethod(BasicLayer) + CollectionMethods(BasicLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyBasicLayerCollection" Shared Library Code Part | +// +=================================================================+ + + PyTypeCollectionObjectDefinitions(BasicLayerCollection) + PyTypeCollectionObjectDefinitions(BasicLayerCollectionLocator) + + +#endif // End of Shared Library Code Part. + +} // extern "C". + +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index 85a9a6bf..368821da 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -569,7 +569,7 @@ extern "C" { if (!PyArg_ParseTuple(args,"O:Cell.setTerminal", &arg0) && PyBool_Check(arg0)) { return NULL; } - (arg0 == Py_True)?cell->setTerminal(true):cell->setTerminal(false); + PyObject_IsTrue(arg0)?cell->setTerminal(true):cell->setTerminal(false); HCATCH Py_RETURN_NONE; } diff --git a/hurricane/src/isobar/PyContactLayer.cpp b/hurricane/src/isobar/PyContactLayer.cpp new file mode 100644 index 00000000..312bde71 --- /dev/null +++ b/hurricane/src/isobar/PyContactLayer.cpp @@ -0,0 +1,190 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyContactLayer.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyContactLayer.h" +#include "hurricane/isobar/PyTechnology.h" +#include "hurricane/isobar/PyBasicLayer.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +# undef ACCESS_OBJECT +# undef ACCESS_CLASS +# define ACCESS_OBJECT _baseObject._object +# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject) +# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(ContactLayer,contactLayer,function) + + +// +=================================================================+ +// | "PyContactLayer" Python Module Code Part | +// +=================================================================+ + +# if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyContactLayer" Attribute Methods | + // +-------------------------------------------------------------+ + + + static PyObject* PyContactLayer_create ( PyObject*, PyObject* args ) + { + trace << "PyContactLayer_create()" << endl; + + ContactLayer* contactLayer = NULL; + + HTRY + PyObject* pyTechnology = NULL; + char* name = NULL; + PyObject* pyMetal = NULL; + PyObject* pyCut = NULL; + PyObject* pyActive = NULL; + PyObject* pyDiffusion = NULL; + PyObject* pyWell = NULL; + + if (PyArg_ParseTuple( args + , "OsOOOOO:ContactLayer.create" + , &pyTechnology + , &name + , &pyMetal + , &pyCut + , &pyActive + , &pyDiffusion + , &pyWell + )) { + if (not IsPyTechnology(pyTechnology)) { + PyErr_SetString ( ConstructorError, "Contact.create(): First argument is not of type Technology." ); + return NULL; + } + if (not IsPyBasicLayer(pyMetal)) { + PyErr_SetString ( ConstructorError, "Contact.create(): Third argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyCut)) { + PyErr_SetString ( ConstructorError, "Contact.create(): Fourth argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyActive)) { + PyErr_SetString ( ConstructorError, "Contact.create(): Fifth argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyDiffusion)) { + PyErr_SetString ( ConstructorError, "Contact.create(): Sixth argument is not of type BasicLayer." ); + return NULL; + } + BasicLayer* xwell = NULL; + if (pyWell != Py_None) { + if (not IsPyBasicLayer(pyWell)) { + PyErr_SetString ( ConstructorError, "Contact.create(): Seventh argument is not of type BasicLayer." ); + return NULL; + } + xwell = PYBASICLAYER_O(pyWell); + } + + contactLayer = ContactLayer::create( PYTECHNOLOGY_O(pyTechnology) + , Name(name) + , PYBASICLAYER_O(pyMetal) + , PYBASICLAYER_O(pyCut) + , PYBASICLAYER_O(pyActive) + , PYBASICLAYER_O(pyDiffusion) + , xwell + ); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to ContactLayer.create()." ); + return NULL; + } + HCATCH + + return PyContactLayer_Link(contactLayer); + } + + + // Standart destroy (Attribute). + DBoDestroyAttribute(PyContactLayer_destroy, PyContactLayer) + + + // --------------------------------------------------------------- + // PyContactLayer Attribute Method table. + + PyMethodDef PyContactLayer_Methods[] = + { { "create" , (PyCFunction)PyContactLayer_create , METH_VARARGS|METH_STATIC + , "Create a new ContactLayer." } + , { "destroy" , (PyCFunction)PyContactLayer_destroy , METH_NOARGS + , "destroy associated hurricane object, the python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + DBoDeleteMethod(ContactLayer) + PyTypeObjectLinkPyType(ContactLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyContactLayer" Shared Library Code Part | +// +=================================================================+ + + + // Link/Creation Method. + DBoLinkCreateMethod(ContactLayer) + + + PyTypeInheritedObjectDefinitions(ContactLayer, Layer) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. + diff --git a/hurricane/src/isobar/PyDbU.cpp b/hurricane/src/isobar/PyDbU.cpp index e81063a3..116068b6 100644 --- a/hurricane/src/isobar/PyDbU.cpp +++ b/hurricane/src/isobar/PyDbU.cpp @@ -31,25 +31,16 @@ // // License-Tag // Authors-Tag -// =================================================================== // -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./PyDbU.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - +// | C++ Module : "./PyDbU.cpp" | +// +-----------------------------------------------------------------+ #include "hurricane/isobar/PyDbU.h" @@ -61,20 +52,13 @@ using namespace Hurricane; extern "C" { -#define LOAD_CONSTANT(CONSTANT_VALUE,CONSTANT_NAME) \ - constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \ - PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \ - Py_DECREF ( constant ); -// x=================================================================x +// +=================================================================+ // | "PyDbU" Python Module Code Part | -// x=================================================================x +// +=================================================================+ #if defined(__PYTHON_MODULE__) - // x-------------------------------------------------------------x - // | "PyDbU" Local Functions | - // x-------------------------------------------------------------x static DbU::SnapMode PyInt_AsSnapMode ( PyObject* object ) { switch ( PyInt_AsLong(object) ) { @@ -99,209 +83,518 @@ extern "C" { return ( DbU::Micro ); } - // x-------------------------------------------------------------x + + // +-------------------------------------------------------------+ // | Global Constants Loading | - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ + + + // +-------------------------------------------------------------+ + // | "PyDbU" General Methods | + // +-------------------------------------------------------------+ + + + extern PyObject* PyDbU_fromDb ( PyObject* , PyObject* args ) + { + PyObject* arg0; + DbU::Unit result = 0; + + HTRY + __cs.init ( "DbU.fromDb" ); + if ( ! PyArg_ParseTuple(args,"|O&:DbU.fromDb",Converter,&arg0) ) + return ( NULL ); + + if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::fromDb ( PyInt_AsLong ( arg0 ) ); } + else { + PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.fromDb converter." ); + return ( NULL ); + } + HCATCH + + return Py_BuildValue("i",result); + } + + + extern PyObject* PyDbU_fromGrid ( PyObject* , PyObject* args ) + { + PyObject* arg0; + DbU::Unit result = 0; + + HTRY + __cs.init ( "DbU.grid" ); + if ( ! PyArg_ParseTuple(args,"|O&:DbU.fromGrid",Converter,&arg0) ) + return ( NULL ); + + if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::fromGrid ( PyFloat_AsDouble ( arg0 ) ); } + else if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::fromGrid ( PyInt_AsLong ( arg0 ) ); } + else { + PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.fromGrid converter." ); + return ( NULL ); + } + HCATCH + + return Py_BuildValue("i",result); + } + + + extern PyObject* PyDbU_fromLambda ( PyObject* , PyObject* args ) + { + PyObject* arg0; + DbU::Unit result = 0; + + HTRY + __cs.init ( "DbU.fromLambda" ); + if ( ! PyArg_ParseTuple(args,"|O&:DbU.fromLambda",Converter,&arg0) ) + return ( NULL ); + + if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::fromLambda ( PyFloat_AsDouble ( arg0 ) ); } + else if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::fromLambda ( PyLong_AsLong ( arg0 ) ); } + else { + PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.fromLambda converter." ); + return ( NULL ); + } + HCATCH + + return Py_BuildValue ("i",result); + } + + + extern PyObject* PyDbU_fromPhysical ( PyObject* , PyObject* args ) + { + double value = 0.0; + int power = DbU::Micro; + DbU::Unit result = 0; + + HTRY + if (not PyArg_ParseTuple(args,"di:DbU.fromPhysical", &value, &power) ) { + PyErr_SetString ( ConstructorError, "DbU.fromPhysical(): Invalid/bad type parameters ." ); + return NULL; + } + result = DbU::fromPhysical(value,(DbU::UnitPower)power); + HCATCH + + return Py_BuildValue("l",result); + } + + + extern PyObject* PyDbU_getPrecision ( PyObject* ) + { return Py_BuildValue("I",DbU::getPrecision()); } + + + extern PyObject* PyDbU_getMaximalPrecision ( PyObject* ) + { return Py_BuildValue("I",DbU::getMaximalPrecision()); } + + + extern PyObject* PyDbU_getResolution ( PyObject* ) + { return Py_BuildValue("d",DbU::getResolution()); } + + + extern PyObject* PyDbU_setPrecision ( PyObject* , PyObject* args ) + { + unsigned int precision = 0; + + HTRY + if (not PyArg_ParseTuple(args,"I:DbU.setPrecision", &precision) ) { + PyErr_SetString ( ConstructorError, "DbU.setPrecision(): Invalid/bad type parameters ." ); + return NULL; + } + DbU::setPrecision(precision); + HCATCH + + Py_RETURN_NONE; + } + + + extern PyObject* PyDbU_getUnitPower ( PyObject* , PyObject* args ) + { + double value = 0.0; + unsigned int power = 0; + + HTRY + if (not PyArg_ParseTuple(args,"i:DbU.getUnitPower", &power) ) { + PyErr_SetString ( ConstructorError, "DbU.getUnitPower(): Invalid/bad type parameters ." ); + return NULL; + } + value = DbU::getUnitPower((DbU::UnitPower)power); + HCATCH + + return Py_BuildValue("d",value); + } + + + extern PyObject* PyDbU_setPhysicalsPerGrid ( PyObject* , PyObject* args ) + { + double gridsPerLambda = 0.0; + unsigned int power = 0; + + HTRY + if (not PyArg_ParseTuple(args,"di:DbU.setPhysicalsPerGrid", &gridsPerLambda, &power) ) { + PyErr_SetString ( ConstructorError, "DbU.setPhysicalsPerGrid(): Invalid/bad type parameters ." ); + return NULL; + } + DbU::setPhysicalsPerGrid(gridsPerLambda,(DbU::UnitPower)power); + HCATCH + + Py_RETURN_NONE; + } + + + extern PyObject* PyDbU_getPhysicalsPerGrid ( PyObject* ) + { return Py_BuildValue("d",DbU::getPhysicalsPerGrid()); } + + + extern PyObject* PyDbU_physicalToGrid ( PyObject* , PyObject* args ) + { + double value = 0.0; + int power = DbU::Micro; + double result = 0; + + HTRY + if (not PyArg_ParseTuple(args,"di:DbU.physicalToGrid", &value, &power) ) { + PyErr_SetString ( ConstructorError, "DbU.physicalToGrid(): Invalid/bad type parameters ." ); + return NULL; + } + result = DbU::physicalToGrid(value,(DbU::UnitPower)power); + HCATCH + + return Py_BuildValue("d",result); + } + + + extern PyObject* PyDbU_setGridsPerLambda ( PyObject* , PyObject* args ) + { + double gridsPerLambda = 0.0; + + HTRY + if (not PyArg_ParseTuple(args,"d:DbU.setGridsPerLambda", &gridsPerLambda) ) { + PyErr_SetString ( ConstructorError, "DbU.setGridsPerLambda(): Invalid/bad type parameters ." ); + return NULL; + } + DbU::setGridsPerLambda(gridsPerLambda); + HCATCH + + Py_RETURN_NONE; + } + + + extern PyObject* PyDbU_getGridsPerLambda ( PyObject* ) + { return Py_BuildValue("d",DbU::getGridsPerLambda()); } + + + extern PyObject* PyDbU_getRealSnapGridStep ( PyObject* ) + { return Py_BuildValue("l",DbU::getRealSnapGridStep()); } + + + extern PyObject* PyDbU_getOnRealSnapGrid ( PyObject* , PyObject* args ) + { + long value = 0; + int snap = DbU::Nearest; + DbU::Unit result = 0; + + HTRY + if (not PyArg_ParseTuple(args,"l|i:DbU.getOnRealSnapGrid", &value, &snap) ) { + PyErr_SetString ( ConstructorError, "DbU.getOnRealSnapGrid(): Invalid/bad type parameters ." ); + return NULL; + } + result = DbU::getOnRealSnapGrid(DbU::db(value),(DbU::SnapMode)snap); + HCATCH + + return Py_BuildValue("l",result); + } + + + extern PyObject* PyDbU_setRealSnapGridStep ( PyObject* , PyObject* args ) + { + long step = 0; + + HTRY + if (not PyArg_ParseTuple(args,"l:DbU.setRealSnapGridStep", &step) ) { + PyErr_SetString ( ConstructorError, "DbU.setRealSnapGridStep(): Invalid/bad type parameters ." ); + return NULL; + } + DbU::setRealSnapGridStep(DbU::db(step)); + HCATCH + + Py_RETURN_NONE; + } + + + extern PyObject* PyDbU_getSymbolicSnapGridStep ( PyObject* ) + { return Py_BuildValue("l",DbU::getSymbolicSnapGridStep()); } + + + extern PyObject* PyDbU_getOnSymbolicSnapGrid ( PyObject* , PyObject* args ) + { + long value = 0; + int snap = DbU::Nearest; + DbU::Unit result = 0; + + HTRY + if (not PyArg_ParseTuple(args,"l|i:DbU.getOnSymbolicSnapGrid", &value, &snap) ) { + PyErr_SetString ( ConstructorError, "DbU.getOnSymbolicSnapGrid(): Invalid/bad type parameters ." ); + return NULL; + } + result = DbU::getOnSymbolicSnapGrid(DbU::db(value),(DbU::SnapMode)snap); + HCATCH + + return Py_BuildValue("l",result); + } + + + extern PyObject* PyDbU_setSymbolicSnapGridStep ( PyObject* , PyObject* args ) + { + long step = 0; + + HTRY + if (not PyArg_ParseTuple(args,"l:DbU.setSymbolicSnapGridStep", &step) ) { + PyErr_SetString ( ConstructorError, "DbU.setSymbolicSnapGridStep(): Invalid/bad type parameters ." ); + return NULL; + } + DbU::setSymbolicSnapGridStep(DbU::db(step)); + HCATCH + + Py_RETURN_NONE; + } + + + extern PyObject* PyDbU_getOnCustomGrid ( PyObject* , PyObject* args ) + { + long value = 0; + long step = 1; + int snap = DbU::Nearest; + DbU::Unit result = 0; + + HTRY + if (not PyArg_ParseTuple(args,"ll|i:DbU.getOnCustomGrid", &value, &step, &snap) ) { + PyErr_SetString ( ConstructorError, "DbU.getOnCustomGrid(): Invalid/bad type parameters ." ); + return NULL; + } + result = DbU::getOnCustomGrid(DbU::db(value),DbU::db(step),(DbU::SnapMode)snap); + HCATCH + + return Py_BuildValue("l",result); + } + + + extern PyObject* PyDbU_getOnPhysicalGrid ( PyObject* , PyObject* args ) + { + long value = 0; + int snap = DbU::Superior; + DbU::Unit result = 0; + + HTRY + if (not PyArg_ParseTuple(args,"l|i:DbU.getOnPhysicalGrid", &value, &snap) ) { + PyErr_SetString ( ConstructorError, "DbU.getOnPhysicalGrid(): Invalid/bad type parameters ." ); + return NULL; + } + result = DbU::getOnPhysicalGrid(DbU::db(value),(DbU::SnapMode)snap); + HCATCH + + return Py_BuildValue("l",result); + } + + + extern PyObject* PyDbU_toDb ( PyObject* , PyObject* args ) + { + PyObject* arg0; + if ( not ParseOneArg( "Dbu.toDb", args,INT_ARG, &arg0 ) ) return NULL; + return Py_BuildValue("i",DbU::toDb(PyInt_AsLong(arg0))); + } + + + extern PyObject* PyDbU_toGrid ( PyObject* , PyObject* args ) + { + PyObject* arg0; + if ( not ParseOneArg( "Dbu.toGrid", args,INT_ARG, &arg0 ) ) return NULL; + return Py_BuildValue("d",DbU::toGrid(PyInt_AsLong(arg0))); + } + + + extern PyObject* PyDbU_toLambda ( PyObject* , PyObject* args ) + { + PyObject* arg0; + if ( not ParseOneArg( "Dbu.toLambda", args,INT_ARG, &arg0 ) ) return NULL; + return Py_BuildValue("d",DbU::toLambda(PyInt_AsLong(arg0))); + } + + + extern PyObject* PyDbU_toPhysical ( PyObject* , PyObject* args ) + { + PyObject* arg0; + PyObject* arg1; + if ( not ParseTwoArg( "Dbu.toPhysical", args,INTS2_ARG, &arg0, &arg1 ) ) return NULL; + return Py_BuildValue("d",DbU::toPhysical(PyInt_AsLong(arg0), PyInt_AsUnitPower(arg1))); + } + + + extern PyObject* PyDbU_getValueString ( PyObject* , PyObject* args ) + { + long value = 0; + int mode = DbU::SmartTruncate; + string result = ""; + + HTRY + if (not PyArg_ParseTuple(args,"l|i:DbU.getValueString", &value, &mode) ) { + PyErr_SetString ( ConstructorError, "DbU.getValueString(): Invalid/bad type parameters ." ); + return NULL; + } + result = DbU::getValueString(DbU::db(value),mode); + HCATCH + + return Py_BuildValue("s",result.c_str()); + } + + + extern PyObject* PyDbU_setStringMode ( PyObject* , PyObject* args ) + { + unsigned int mode = 0; + unsigned int power = DbU::Nano; + + HTRY + if (not PyArg_ParseTuple(args,"I|i:DbU.setStringMode", &mode, &power) ) { + PyErr_SetString ( ConstructorError, "DbU.setStringMode(): Invalid/bad type parameters ." ); + return NULL; + } + DbU::setStringMode(mode,(DbU::UnitPower)power); + HCATCH + + Py_RETURN_NONE; + } + + + PyMethodDef PyDbU_Methods[] = + // Translate from user length to DbU. + { { "fromDb" , (PyCFunction)PyDbU_fromDb , METH_VARARGS|METH_STATIC + , "Convert a raw unit into a DbU (C++ DbU::fromDb())." } + , { "fromGrid" , (PyCFunction)PyDbU_fromGrid , METH_VARARGS|METH_STATIC + , "Convert a length in grid step into a DbU (C++ DbU::fromGrid())." } + , { "fromLambda" , (PyCFunction)PyDbU_fromLambda , METH_VARARGS|METH_STATIC + , "Convert a length in lambda into a DbU (C++ DbU::fromLambda())." } + , { "fromPhysical" , (PyCFunction)PyDbU_fromPhysical , METH_VARARGS|METH_STATIC + , "Convert a physical length into a DbU (C++ DbU::fromPhysical())." } + // Precision & Resolution Managment. + , { "getPrecision" , (PyCFunction)PyDbU_getPrecision , METH_NOARGS|METH_STATIC + , "Sets the precision, the fixed point for rounding computations." } + , { "getMaximalPrecision" , (PyCFunction)PyDbU_getMaximalPrecision , METH_NOARGS|METH_STATIC + , "Returns the maximum allowed precision." } + , { "getResolution" , (PyCFunction)PyDbU_getResolution , METH_NOARGS|METH_STATIC + , "Get the smallest manageable unit." } + , { "setPrecision" , (PyCFunction)PyDbU_setPrecision , METH_VARARGS|METH_STATIC + , "Sets the precision, the fixed point for rounding computations." } + // Founder Grid Managment. + , { "getUnitPower" , (PyCFunction)PyDbU_getUnitPower , METH_VARARGS|METH_STATIC + , "Returns the numerical value associated to the symbolic power." } + , { "setPhysicalsPerGrid" , (PyCFunction)PyDbU_setPhysicalsPerGrid , METH_VARARGS|METH_STATIC + , "Set the physical length represented by exactly one unit." } + , { "getPhysicalsPerGrid" , (PyCFunction)PyDbU_getPhysicalsPerGrid , METH_NOARGS|METH_STATIC + , "Returns the physical length represented by exactly one unit." } + , { "physicalToGrid" , (PyCFunction)PyDbU_physicalToGrid , METH_VARARGS|METH_STATIC + , "Compute the number of grid units representing that physical length." } + // Lambda Managment. + , { "setGridsPerLambda" , (PyCFunction)PyDbU_setGridsPerLambda , METH_VARARGS|METH_STATIC + , "Set the numbers of grid units in one lambda." } + , { "getGridsPerLambda" , (PyCFunction)PyDbU_getGridsPerLambda , METH_NOARGS|METH_STATIC + , "Returns the physical length represented by exactly one unit." } + // Snap Grid Managment. + , { "getRealSnapGridStep" , (PyCFunction)PyDbU_getRealSnapGridStep , METH_NOARGS|METH_STATIC + , "Returns the step of the real snap grid." } + , { "getOnRealSnapGrid" , (PyCFunction)PyDbU_getOnRealSnapGrid , METH_VARARGS|METH_STATIC + , "Get a real snap grid position from this one." } + , { "setRealSnapGridStep" , (PyCFunction)PyDbU_setRealSnapGridStep , METH_VARARGS|METH_STATIC + , "Sets the real snap grid step." } + , { "getSymbolicSnapGridStep", (PyCFunction)PyDbU_getSymbolicSnapGridStep, METH_NOARGS|METH_STATIC + , "Returns the step of the symbolic snap grid." } + , { "getOnSymbolicSnapGrid" , (PyCFunction)PyDbU_getOnSymbolicSnapGrid , METH_VARARGS|METH_STATIC + , "Get a symbolic snap grid position from this one." } + , { "setSymbolicSnapGridStep", (PyCFunction)PyDbU_setSymbolicSnapGridStep, METH_VARARGS|METH_STATIC + , "Sets the symbolic snap grid step." } + , { "getOnCustomGrid" , (PyCFunction)PyDbU_getOnCustomGrid , METH_VARARGS|METH_STATIC + , "Get a custom snap grid position from this one." } + , { "getOnPhysicalGrid" , (PyCFunction)PyDbU_getOnPhysicalGrid , METH_VARARGS|METH_STATIC + , "Get a physical grid position from this one." } + // Convert from DbU to various units (grid,lambda,physical). + , { "toDb" , (PyCFunction)PyDbU_toDb , METH_VARARGS|METH_STATIC + , "Convert a DbU into raw unit (C++ DbU::getDb())." } + , { "toGrid" , (PyCFunction)PyDbU_toGrid , METH_VARARGS|METH_STATIC + , "Convert a DbU into grid length (C++ DbU::getGrid())." } + , { "toLambda" , (PyCFunction)PyDbU_toLambda , METH_VARARGS|METH_STATIC + , "Convert a DbU into lambda length (C++ DbU::getLambda())." } + , { "toPhysical" , (PyCFunction)PyDbU_toPhysical , METH_VARARGS|METH_STATIC + , "Convert a DbU into a physcal length (metric system, C++ DbU::getPhysical())." } + , { "getValueString" , (PyCFunction)PyDbU_getValueString , METH_VARARGS|METH_STATIC + , "Convert a DbU into a human readable string." } + , { "setStringMode" , (PyCFunction)PyDbU_setStringMode , METH_VARARGS|METH_STATIC + , "Tells what unit to use when converting a DbU into a string." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + extern void PyDbU_LinkPyType() + { + trace << "PyDbU_LinkType()" << endl; + + PyTypeDbU.tp_methods = PyDbU_Methods; + } + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyDbU" Shared Library Code Part | +// +=================================================================+ + + + PyTypeObject PyTypeDbU = + { PyObject_HEAD_INIT(NULL) + 0 /* ob_size. */ + , "Hurricane.DbU" /* tp_name. */ + , sizeof(PyDbU) /* tp_basicsize. */ + , 0 /* tp_itemsize. */ + /* methods. */ + , 0 /* tp_dealloc. */ + , 0 /* tp_print. */ + , 0 /* tp_getattr. */ + , 0 /* tp_setattr. */ + , 0 /* tp_compare. */ + , 0 /* tp_repr. */ + , 0 /* tp_as_number. */ + , 0 /* tp_as_sequence. */ + , 0 /* tp_as_mapping. */ + , 0 /* tp_hash. */ + , 0 /* tp_call. */ + , 0 /* tp_str */ + , 0 /* tp_getattro. */ + , 0 /* tp_setattro. */ + , 0 /* tp_as_buffer. */ + , Py_TPFLAGS_DEFAULT /* tp_flags */ + , "Hurricane.DbU (do not uses as object)" /* tp_doc. */ + }; + extern void DbULoadConstants ( PyObject* dictionnary ) { PyObject* constant; - LOAD_CONSTANT ( DbU::Inferior, "SnapModeInferior" ) - LOAD_CONSTANT ( DbU::Superior, "SnapModeSuperior" ) - LOAD_CONSTANT ( DbU::Nearest , "SnapModeNearest" ) - LOAD_CONSTANT ( DbU::Pico , "UnitPowerPico" ) - LOAD_CONSTANT ( DbU::Nano , "UnitPowerNano" ) - LOAD_CONSTANT ( DbU::Micro , "UnitPowerMicro" ) - LOAD_CONSTANT ( DbU::Milli , "UnitPowerMilli" ) - LOAD_CONSTANT ( DbU::Unity , "UnitPowerUnity" ) - LOAD_CONSTANT ( DbU::Kilo , "UnitPowerKilo" ) - } - - // x-------------------------------------------------------------x - // | "PyDbU" General Methods | - // x-------------------------------------------------------------x - - - // --------------------------------------------------------------- - // Module Method : "PyDbU_db ()" - - extern PyObject* PyDbU_db ( PyObject* module, PyObject* args ) - { - trace << "PyDbU_db ()" << endl; - - PyObject* arg0; - DbU::Unit result = 0; - - HTRY - - __cs.init ( "DbU.db" ); - if ( ! PyArg_ParseTuple(args,"|O&:DbU.db",Converter,&arg0) ) - return ( NULL ); - - if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::db ( PyInt_AsLong ( arg0 ) ); } - else { - PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.db converter." ); - return ( NULL ); - } - - HCATCH - - return ( Py_BuildValue ( "i", result ) ); + LoadObjectConstant ( dictionnary, DbU::Inferior , "SnapModeInferior" ) + LoadObjectConstant ( dictionnary, DbU::Superior , "SnapModeSuperior" ) + LoadObjectConstant ( dictionnary, DbU::Nearest , "SnapModeNearest" ) + LoadObjectConstant ( dictionnary, DbU::Pico , "UnitPowerPico" ) + LoadObjectConstant ( dictionnary, DbU::Nano , "UnitPowerNano" ) + LoadObjectConstant ( dictionnary, DbU::Micro , "UnitPowerMicro" ) + LoadObjectConstant ( dictionnary, DbU::Milli , "UnitPowerMilli" ) + LoadObjectConstant ( dictionnary, DbU::Unity , "UnitPowerUnity" ) + LoadObjectConstant ( dictionnary, DbU::Kilo , "UnitPowerKilo" ) + LoadObjectConstant ( dictionnary, DbU::Db , "StringModeDb" ) + LoadObjectConstant ( dictionnary, DbU::Grid , "StringModeGrid" ) + LoadObjectConstant ( dictionnary, DbU::Symbolic , "StringModeSymbolic" ) + LoadObjectConstant ( dictionnary, DbU::Physical , "StringModePhysical" ) + LoadObjectConstant ( dictionnary, DbU::SmartTruncate, "StringModeSmartTruncate" ) } - // --------------------------------------------------------------- - // Module Method : "PyDbU_grid ()" - - extern PyObject* PyDbU_grid ( PyObject* module, PyObject* args ) + extern void PyDbU_postModuleInit () { - trace << "PyDbU_grid ()" << endl; - - PyObject* arg0; - DbU::Unit result = 0; - - HTRY - - __cs.init ( "DbU.grid" ); - if ( ! PyArg_ParseTuple(args,"|O&:DbU.grid",Converter,&arg0) ) - return ( NULL ); - - if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::grid ( PyFloat_AsDouble ( arg0 ) ); } - else if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::grid ( PyInt_AsLong ( arg0 ) ); } - else { - PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.grid converter." ); - return ( NULL ); - } - - HCATCH - - return ( Py_BuildValue ( "i", result ) ); - } - - - // --------------------------------------------------------------- - // Module Method : "PyDbU_lambda ()" - - extern PyObject* PyDbU_lambda ( PyObject* module, PyObject* args ) - { - trace << "PyDbU_symbolic ()" << endl; - - PyObject* arg0; - DbU::Unit result = 0; - - HTRY - - __cs.init ( "DbU.symbolic" ); - if ( ! PyArg_ParseTuple(args,"|O&:DbU.symbolic",Converter,&arg0) ) - return ( NULL ); - - if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::lambda ( PyFloat_AsDouble ( arg0 ) ); } - else if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::lambda ( PyLong_AsLong ( arg0 ) ); } - else { - PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.symbolic converter." ); - return ( NULL ); - } - - HCATCH - - return ( Py_BuildValue ( "i", result ) ); - } - - - // --------------------------------------------------------------- - // Module Method : "PyDbU_getDb ()" - - extern PyObject* PyDbU_getDb ( PyObject* module, PyObject* args ) - { - trace << "PyDbU_getDb ()" << endl; - - PyObject* arg0; - if ( ! ParseOneArg ( "Dbu.getDb", args,INT_ARG, &arg0 ) ) return ( NULL ); - - return ( Py_BuildValue("i",DbU::getDb(PyInt_AsLong(arg0))) ); - } - - - // --------------------------------------------------------------- - // Module Method : "PyDbU_getGrid ()" - - extern PyObject* PyDbU_getGrid ( PyObject* module, PyObject* args ) - { - trace << "PyDbU_getGrid ()" << endl; - - PyObject* arg0; - if ( ! ParseOneArg ( "Dbu.getGrid", args,INT_ARG, &arg0 ) ) return ( NULL ); - - return ( Py_BuildValue("d",DbU::getGrid(PyInt_AsLong(arg0))) ); - } - - - // --------------------------------------------------------------- - // Module Method : "PyDbU_getLambda ()" - - extern PyObject* PyDbU_getLambda ( PyObject* module, PyObject* args ) - { - trace << "PyDbU_getLambda ()" << endl; - - PyObject* arg0; - if ( ! ParseOneArg ( "Dbu.getLambda", args,INT_ARG, &arg0 ) ) return ( NULL ); - - return ( Py_BuildValue("d",DbU::getLambda(PyInt_AsLong(arg0))) ); - } - - - // --------------------------------------------------------------- - // Module Method : "PyDbU_getPhysical ()" - - extern PyObject* PyDbU_getPhysical ( PyObject* module, PyObject* args ) - { - trace << "PyDbU_getPhysical ()" << endl; - - PyObject* arg0; - PyObject* arg1; - if ( ! ParseTwoArg ( "Dbu.getPhysical", args,INTS2_ARG, &arg0, &arg1 ) ) return ( NULL ); - - return ( Py_BuildValue("d",DbU::getPhysical(PyInt_AsLong(arg0), PyInt_AsUnitPower(arg1))) ); - } - - // --------------------------------------------------------------- - // Module Method : "PyDbU_getResolution ()" - - extern PyObject* PyDbU_getResolution ( PyObject* module ) - { - trace << "PyDbU_getResolution ()" << endl; - - return ( Py_BuildValue("d",DbU::getResolution()) ); - } - - - // --------------------------------------------------------------- - // Module Method : "PyDbu_getOnPhysicalGrid ()" - - extern PyObject* PyDbU_getOnPhysicalGrid ( PyObject* module, PyObject* args ) - { - trace << "PyDbU_getOnPhysicalGrid ()" << endl; - - PyObject* arg0; - PyObject* arg1; - DbU::Unit result = 0; - - HTRY - __cs.init ( "DbU.getOnPhysicalGrid" ); - if (!PyArg_ParseTuple(args, "O&|O&O&:DbU.getOnPhysicalGrid", Converter, &arg0, Converter, &arg1)) { - return NULL; - } - - if ( __cs.getObjectIds() == INTS2_ARG ) { - result = DbU::getOnPhysicalGrid ( PyInt_AsLong(arg0), PyInt_AsSnapMode(arg1) ); - } else if ( __cs.getObjectIds() == INT_ARG ) { - result = DbU::getOnPhysicalGrid ( PyInt_AsLong(arg0) ); - } else { - return NULL; - } - HCATCH - - return ( Py_BuildValue ( "i", result ) ); + DbULoadConstants(PyTypeDbU.tp_dict); } diff --git a/hurricane/src/isobar/PyDiffusionLayer.cpp b/hurricane/src/isobar/PyDiffusionLayer.cpp new file mode 100644 index 00000000..fab985fd --- /dev/null +++ b/hurricane/src/isobar/PyDiffusionLayer.cpp @@ -0,0 +1,176 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyDiffusionLayer.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyDiffusionLayer.h" +#include "hurricane/isobar/PyTechnology.h" +#include "hurricane/isobar/PyBasicLayer.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +# undef ACCESS_OBJECT +# undef ACCESS_CLASS +# define ACCESS_OBJECT _baseObject._object +# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject) +# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DiffusionLayer,diffusionLayer,function) + + +// +=================================================================+ +// | "PyDiffusionLayer" Python Module Code Part | +// +=================================================================+ + +# if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyDiffusionLayer" Attribute Methods | + // +-------------------------------------------------------------+ + + + static PyObject* PyDiffusionLayer_create ( PyObject*, PyObject* args ) + { + trace << "PyDiffusionLayer_create()" << endl; + + DiffusionLayer* diffusionLayer = NULL; + + HTRY + PyObject* pyTechnology = NULL; + char* name = NULL; + PyObject* pyActive = NULL; + PyObject* pyDiffusion = NULL; + PyObject* pyWell = NULL; + + if (PyArg_ParseTuple( args + , "OsOOO:DiffusionLayer.create" + , &pyTechnology + , &name + , &pyActive + , &pyDiffusion + , &pyWell + )) { + if (not IsPyTechnology(pyTechnology)) { + PyErr_SetString ( ConstructorError, "Diffusion.create(): First argument is not of type Technology." ); + return NULL; + } + if (not IsPyBasicLayer(pyActive)) { + PyErr_SetString ( ConstructorError, "Diffusion.create(): Third argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyDiffusion)) { + PyErr_SetString ( ConstructorError, "Diffusion.create(): Fourth argument is not of type BasicLayer." ); + return NULL; + } + BasicLayer* xwell = NULL; + if (pyWell != Py_None) { + if (not IsPyBasicLayer(pyWell)) { + PyErr_SetString ( ConstructorError, "Diffusion.create(): Fifth argument is not of type BasicLayer." ); + return NULL; + } + xwell = PYBASICLAYER_O(pyWell); + } + + diffusionLayer = DiffusionLayer::create( PYTECHNOLOGY_O(pyTechnology) + , Name(name) + , PYBASICLAYER_O(pyActive) + , PYBASICLAYER_O(pyDiffusion) + , xwell + ); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to DiffusionLayer.create()." ); + return NULL; + } + HCATCH + + return PyDiffusionLayer_Link(diffusionLayer); + } + + + // Standart destroy (Attribute). + DBoDestroyAttribute(PyDiffusionLayer_destroy, PyDiffusionLayer) + + + // --------------------------------------------------------------- + // PyDiffusionLayer Attribute Method table. + + PyMethodDef PyDiffusionLayer_Methods[] = + { { "create" , (PyCFunction)PyDiffusionLayer_create , METH_VARARGS|METH_STATIC + , "Create a new DiffusionLayer." } + , { "destroy" , (PyCFunction)PyDiffusionLayer_destroy , METH_NOARGS + , "destroy associated hurricane object, the python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + DBoDeleteMethod(DiffusionLayer) + PyTypeObjectLinkPyType(DiffusionLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyDiffusionLayer" Shared Library Code Part | +// +=================================================================+ + + + // Link/Creation Method. + DBoLinkCreateMethod(DiffusionLayer) + + + PyTypeInheritedObjectDefinitions(DiffusionLayer, Layer) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. + diff --git a/hurricane/src/isobar/PyEntity.cpp b/hurricane/src/isobar/PyEntity.cpp index ed8dce62..c50ac1c5 100644 --- a/hurricane/src/isobar/PyEntity.cpp +++ b/hurricane/src/isobar/PyEntity.cpp @@ -15,7 +15,6 @@ // | | // x-----------------------------------------------------------------x -#include "hurricane/Cell.h" #include "hurricane/isobar/PyNet.h" #include "hurricane/isobar/PyLayer.h" #include "hurricane/isobar/PyPoint.h" @@ -30,6 +29,7 @@ #include "hurricane/isobar/PyContact.h" #include "hurricane/isobar/PyPad.h" #include "hurricane/isobar/PyPin.h" +#include "hurricane/Cell.h" namespace Isobar { diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 30e2a069..6d6eb074 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -31,23 +31,16 @@ // // License-Tag // Authors-Tag -// =================================================================== // -// $Id: PyHurricane.cpp,v 1.58 2008/02/07 19:09:58 xtof Exp $ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Module : "./PyHurricane.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Module : "./PyHurricane.cpp" | +// +-----------------------------------------------------------------+ @@ -65,6 +58,18 @@ #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyCellCollection.h" #include "hurricane/isobar/PyLayer.h" +#include "hurricane/isobar/PyLayerMask.h" +#include "hurricane/isobar/PyMaterial.h" +#include "hurricane/isobar/PyBasicLayer.h" +#include "hurricane/isobar/PyRegularLayer.h" +#include "hurricane/isobar/PyContactLayer.h" +#include "hurricane/isobar/PyDiffusionLayer.h" +#include "hurricane/isobar/PyTransistorLayer.h" +#include "hurricane/isobar/PyViaLayer.h" +#include "hurricane/isobar/PyLayerCollection.h" +#include "hurricane/isobar/PyBasicLayerCollection.h" +#include "hurricane/isobar/PyRegularLayerCollection.h" +#include "hurricane/isobar/PyViaLayerCollection.h" #include "hurricane/isobar/PyPin.h" #include "hurricane/isobar/PyPinCollection.h" #include "hurricane/isobar/PyInstance.h" @@ -97,19 +102,18 @@ namespace Isobar { #if !defined(__PYTHON_MODULE__) -// x=================================================================x +// +=================================================================+ // | "PyHurricane" Shared Library Code Part | -// x=================================================================x +// +=================================================================+ -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ // | "PyHurricane" C++ Local Variables | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ namespace { - using namespace std; // --------------------------------------------------------------- @@ -120,17 +124,15 @@ namespace { " Attempt to add twice a type with identifier \n"; -} // End of local namespace. +} // Anonymous namespace. using namespace Hurricane; - - -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ // | "PyHurricane" C++ Global Variables | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ const char* ConverterState::ObjectType::_inheritStop @@ -138,9 +140,10 @@ using namespace Hurricane; ConverterState __cs = ConverterState (); int __objectOffset = offsetof ( PyPoint, _object ); -// x-----------------------------------------------------------------x + +// +-----------------------------------------------------------------+ // | "PyHurricane" C++ Functions | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ // ------------------------------------------------------------------- @@ -153,8 +156,6 @@ using namespace Hurricane; } - - // ------------------------------------------------------------------- // Method : "::ConverterState::ObjectType::PyBase ()" @@ -173,8 +174,6 @@ using namespace Hurricane; } - - // ------------------------------------------------------------------- // Method : "::ConverterState::ObjectType::PyBaseId ()" @@ -186,8 +185,6 @@ using namespace Hurricane; } - - // ------------------------------------------------------------------- // Destructor : "::ConverterState::~ConverterState ()" @@ -197,8 +194,6 @@ using namespace Hurricane; } - - // ------------------------------------------------------------------- // Method : "::ConverterState::addType ()" @@ -229,8 +224,6 @@ using namespace Hurricane; } - - // ------------------------------------------------------------------- // Method : "::ConverterState::getObjectType ()" @@ -259,8 +252,6 @@ using namespace Hurricane; } - - // ------------------------------------------------------------------- // Method : "::ConverterState::getObjectId ()" @@ -277,8 +268,6 @@ using namespace Hurricane; return ( "unknown" ); // return 'X' } - - // ------------------------------------------------------------------- @@ -292,6 +281,7 @@ using namespace Hurricane; return ( NULL ); } + // ------------------------------------------------------------------- // Method : "::ConverterState::getObjectName ()" @@ -301,8 +291,6 @@ using namespace Hurricane; } return ( "" ); } - - // ------------------------------------------------------------------- @@ -314,10 +302,10 @@ using namespace Hurricane; ObjectType::_inheritStop = inheritStop; }; + // ------------------------------------------------------------------- // Function : "Converter ()" - int Converter ( PyObject* object, void** pArg ) { ostringstream message; string unboundObject = ""; @@ -358,7 +346,6 @@ using namespace Hurricane; PyErr_SetString ( ProxyError, message.str().c_str() ); return ( 0 ); } - // ------------------------------------------------------------------- @@ -368,46 +355,67 @@ using namespace Hurricane; ostringstream message; __cs.init ( function ); - if ( ! PyArg_ParseTuple(args,"O&",Converter,arg) ) return ( false ); + if (not PyArg_ParseTuple(args,"O&",Converter,arg)) { + ostringstream m; + m << function << ": Take exactly one argument."; + PyErr_SetString(ConstructorError, m.str().c_str()); + return false; + } string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); + if ( firstArgType != firstArgTypeExp ) { - return ( false ); + ostringstream m; + m << function << ": Argument type mismatch, should be:<" << firstArgTypeExp + << "> not <" << firstArgType << ">"; + PyErr_SetString(ConstructorError, m.str().c_str()); + return false; } - return ( true ); + return true; } - - // ------------------------------------------------------------------- // Function : "ParseTwoArg ()" bool ParseTwoArg ( const char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ) { ostringstream message; __cs.init ( function ); - if ( ! PyArg_ParseTuple(args,"O&O&",Converter,arg0,Converter,arg1) ) return ( false ); + if (not PyArg_ParseTuple(args,"O&O&",Converter,arg0,Converter,arg1)) { + ostringstream m; + m << function << ": Take exactly two argument."; + PyErr_SetString(ConstructorError, m.str().c_str()); + return false; + } string firstArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 0 ); string firstArgTypeExp = ConverterState::getObjectType ( format , 0 ); + if ( firstArgType != firstArgTypeExp ) { - return ( false ); + ostringstream m; + m << function << ": First argument type mismatch, should be:<" << firstArgTypeExp + << "> not <" << firstArgType << ">"; + PyErr_SetString(ConstructorError, m.str().c_str()); + return false; } + string secondArgType = ConverterState::getObjectType ( __cs.getObjectIds(), 1 ); string secondArgTypeExp = ConverterState::getObjectType ( format , 1 ); + if ( secondArgType != secondArgTypeExp ) { - return ( false ); + ostringstream m; + m << function << ": Second argument type mismatch, should be:<" << secondArgTypeExp + << "> not <" << secondArgType << ">"; + PyErr_SetString(ConstructorError, m.str().c_str()); + return false; } - - return ( true ); + return true; } - - // ------------------------------------------------------------------- // Function : "ParseThreeArg ()" @@ -437,16 +445,13 @@ using namespace Hurricane; return ( false ); } - return ( true ); } - - -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ // | "PyHurricane" C Global Variables | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ extern "C" { @@ -461,29 +466,44 @@ extern "C" { } - # else // End of PyHurricane Shared Library Code Part. -// x=================================================================x +// +=================================================================+ // | "PyHurricane" Python Module Code Part | -// x=================================================================x +// +=================================================================+ extern "C" { - - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ // | "PyHurricane" Module Methods | - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ + + static PyObject* PyCommons_trace ( PyObject* self, PyObject* args ) + { + HTRY + PyObject* state = NULL; + if (PyArg_ParseTuple(args , "O:Hurricane.trace()", &state)) { + if (PyObject_IsTrue(state)) trace_on (); + else trace_off(); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to BasicLayer.create()." ); + return NULL; + } + HCATCH + + Py_RETURN_NONE; + } static PyMethodDef PyHurricane_Methods[] = - { { "DbU_db" , PyDbU_db , METH_VARARGS, "Converts an integer to DbU::Unit (no scale factor)." } - , { "DbU_grid" , PyDbU_grid , METH_VARARGS, "Converts a founder grid to DbU::Unit." } - , { "DbU_lambda" , PyDbU_lambda , METH_VARARGS, "Converts a symbolic (lambda) to DbU::Unit." } - , { "DbU_getDb" , PyDbU_getDb , METH_VARARGS, "Converts a DbU::Unit to an integer value (no scale factor)." } - , { "DbU_getGrid" , PyDbU_getGrid , METH_VARARGS, "Converts a DbU::Unit to a to grid founder." } - , { "DbU_getLambda" , PyDbU_getLambda , METH_VARARGS, "Converts a DbU::Unit to a symbolic value (to lambda)." } - , { "DbU_getPhysical" , PyDbU_getPhysical , METH_VARARGS, "Converts a DbU::Unit to a physical value." } + { { "trace" , PyCommons_trace , METH_VARARGS, "Switch on/off the trace mode (for debugging)." } + , { "DbU_db" , PyDbU_fromDb , METH_VARARGS, "Converts an integer to DbU::Unit (no scale factor)." } + , { "DbU_grid" , PyDbU_fromGrid , METH_VARARGS, "Converts a founder grid to DbU::Unit." } + , { "DbU_lambda" , PyDbU_fromLambda , METH_VARARGS, "Converts a symbolic (lambda) to DbU::Unit." } + , { "DbU_getDb" , PyDbU_toDb , METH_VARARGS, "Converts a DbU::Unit to an integer value (no scale factor)." } + , { "DbU_getGrid" , PyDbU_toGrid , METH_VARARGS, "Converts a DbU::Unit to a to grid founder." } + , { "DbU_getLambda" , PyDbU_toLambda , METH_VARARGS, "Converts a DbU::Unit to a symbolic value (to lambda)." } + , { "DbU_getPhysical" , PyDbU_toPhysical , METH_VARARGS, "Converts a DbU::Unit to a physical value." } , { "DbU_getOnPhysicalGrid" , PyDbU_getOnPhysicalGrid , METH_VARARGS, "Adjusts a DbU::Unit to physical grid." } , { "Point" , PyPoint_create , METH_VARARGS, "Creates a new Point." } , { "Box" , PyBox_create , METH_VARARGS, "Creates a new Box." } @@ -504,12 +524,10 @@ extern "C" { , { "Pad" , (PyCFunction)PyPad_create , METH_VARARGS, "Creates a new Pad." } , { "Path" , (PyCFunction)PyPath_create , METH_VARARGS, "Creates a new Path." } , { "Occurrence" , (PyCFunction)PyOccurrence_create , METH_VARARGS, "Creates a new Occurrence." } - , {NULL, NULL, 0, NULL} /* sentinel */ + , {NULL, NULL, 0, NULL} /* sentinel */ }; - - // --------------------------------------------------------------- // Module Initialization : "initHurricane ()" @@ -517,6 +535,7 @@ extern "C" { trace << "initHurricane()" << endl; PyUpdateSession_LinkPyType (); + PyDbU_LinkPyType (); PyPoint_LinkPyType (); PyBox_LinkPyType (); PyTransformation_LinkPyType (); @@ -525,6 +544,18 @@ extern "C" { PyLibrary_LinkPyType (); PyEntity_LinkPyType (); PyLayer_LinkPyType (); + PyLayerMask_LinkPyType (); + PyBasicLayer_LinkPyType (); + PyRegularLayer_LinkPyType (); + PyDiffusionLayer_LinkPyType (); + PyTransistorLayer_LinkPyType (); + PyContactLayer_LinkPyType (); + PyViaLayer_LinkPyType (); + PyLayerCollection_LinkPyType (); + PyBasicLayerCollection_LinkPyType (); + PyRegularLayerCollection_LinkPyType (); + PyViaLayerCollection_LinkPyType (); + PyMaterial_LinkPyType (); PyPath_LinkPyType (); PyOccurrence_LinkPyType (); PyInstanceCollection_LinkPyType (); @@ -552,95 +583,124 @@ extern "C" { PyPlug_LinkPyType (); PyBreakpoint_LinkPyType (); - PYTYPE_READY ( UpdateSession ) - PYTYPE_READY ( Point ) - PYTYPE_READY ( Box ) - PYTYPE_READY ( Transformation ) - PYTYPE_READY ( DataBase ) - PYTYPE_READY ( Technology ) - PYTYPE_READY ( Library ) - PYTYPE_READY ( Entity ) - PYTYPE_READY ( Layer ) - PYTYPE_READY ( Path ) - PYTYPE_READY ( Occurrence ) - PYTYPE_READY ( InstanceCollection ) - PYTYPE_READY ( InstanceCollectionLocator ) - PYTYPE_READY ( PlugCollection ) - PYTYPE_READY ( PlugCollectionLocator ) - PYTYPE_READY ( NetCollection ) - PYTYPE_READY ( NetCollectionLocator ) - PYTYPE_READY ( CellCollection ) - PYTYPE_READY ( CellCollectionLocator ) - PYTYPE_READY ( PinCollection ) - PYTYPE_READY ( PinCollectionLocator ) - PYTYPE_READY ( SegmentCollection ) - PYTYPE_READY ( SegmentCollectionLocator ) - PYTYPE_READY ( ComponentCollection ) - PYTYPE_READY ( ComponentCollectionLocator ) - PYTYPE_READY ( OccurrenceCollection ) - PYTYPE_READY ( OccurrenceCollectionLocator ) - PYTYPE_READY ( ReferenceCollection ) - PYTYPE_READY ( ReferenceCollectionLocator ) - PYTYPE_READY ( HyperNet ) - PYTYPE_READY ( NetExternalComponents ) - PYTYPE_READY ( Breakpoint ) + PYTYPE_READY ( UpdateSession ) + PYTYPE_READY ( Point ) + PYTYPE_READY ( DbU ) + PYTYPE_READY ( Box ) + PYTYPE_READY ( Transformation ) + PYTYPE_READY ( DataBase ) + PYTYPE_READY ( Technology ) + PYTYPE_READY ( Library ) + PYTYPE_READY ( Entity ) + PYTYPE_READY ( Material ) + PYTYPE_READY ( Layer ) + PYTYPE_READY ( LayerMask ) + PYTYPE_READY ( BasicLayerCollection ) + PYTYPE_READY ( BasicLayerCollectionLocator ) + PYTYPE_READY ( LayerCollection ) + PYTYPE_READY ( LayerCollectionLocator ) + PYTYPE_READY ( RegularLayerCollection ) + PYTYPE_READY ( RegularLayerCollectionLocator ) + PYTYPE_READY ( ViaLayerCollection ) + PYTYPE_READY ( ViaLayerCollectionLocator ) + PYTYPE_READY ( Path ) + PYTYPE_READY ( Occurrence ) + PYTYPE_READY ( InstanceCollection ) + PYTYPE_READY ( InstanceCollectionLocator ) + PYTYPE_READY ( PlugCollection ) + PYTYPE_READY ( PlugCollectionLocator ) + PYTYPE_READY ( NetCollection ) + PYTYPE_READY ( NetCollectionLocator ) + PYTYPE_READY ( CellCollection ) + PYTYPE_READY ( CellCollectionLocator ) + PYTYPE_READY ( PinCollection ) + PYTYPE_READY ( PinCollectionLocator ) + PYTYPE_READY ( SegmentCollection ) + PYTYPE_READY ( SegmentCollectionLocator ) + PYTYPE_READY ( ComponentCollection ) + PYTYPE_READY ( ComponentCollectionLocator ) + PYTYPE_READY ( OccurrenceCollection ) + PYTYPE_READY ( OccurrenceCollectionLocator ) + PYTYPE_READY ( ReferenceCollection ) + PYTYPE_READY ( ReferenceCollectionLocator ) + PYTYPE_READY ( HyperNet ) + PYTYPE_READY ( NetExternalComponents ) + PYTYPE_READY ( Breakpoint ) - PYTYPE_READY_SUB ( Cell , Entity ) - PYTYPE_READY_SUB ( Instance , Entity ) - PYTYPE_READY_SUB ( Reference , Entity ) - PYTYPE_READY_SUB ( Net , Entity ) - PYTYPE_READY_SUB ( Component , Entity ) - PYTYPE_READY_SUB ( Segment , Component) - PYTYPE_READY_SUB ( Horizontal, Segment ) - PYTYPE_READY_SUB ( Vertical , Segment ) + PYTYPE_READY_SUB ( BasicLayer , Layer ) + PYTYPE_READY_SUB ( RegularLayer , Layer ) + PYTYPE_READY_SUB ( ContactLayer , Layer ) + PYTYPE_READY_SUB ( DiffusionLayer , Layer ) + PYTYPE_READY_SUB ( TransistorLayer, Layer ) + PYTYPE_READY_SUB ( ViaLayer , Layer ) + PYTYPE_READY_SUB ( Cell , Entity ) + PYTYPE_READY_SUB ( Instance , Entity ) + PYTYPE_READY_SUB ( Reference , Entity ) + PYTYPE_READY_SUB ( Net , Entity ) + PYTYPE_READY_SUB ( Component , Entity ) + PYTYPE_READY_SUB ( Segment , Component) + PYTYPE_READY_SUB ( Horizontal , Segment ) + PYTYPE_READY_SUB ( Vertical , Segment ) - PYTYPE_READY_SUB ( Contact , Component) - PYTYPE_READY_SUB ( Pin , Contact ) - PYTYPE_READY_SUB ( Plug , Component) - PYTYPE_READY_SUB ( Pad , Component) + PYTYPE_READY_SUB ( Contact , Component) + PYTYPE_READY_SUB ( Pin , Contact ) + PYTYPE_READY_SUB ( Plug , Component) + PYTYPE_READY_SUB ( Pad , Component) // Identifier string can take up to 10 characters ! - __cs.addType ( "box" , &PyTypeBox , "" , false ); - __cs.addType ( "ent" , &PyTypeEntity , "" , false ); - __cs.addType ( "cell" , &PyTypeCell , "" , false, "ent" ); - __cs.addType ( "cellCol" , &PyTypeCellCollection , "" , false ); - __cs.addType ( "comp" , &PyTypeComponent , "" , false, "ent" ); - __cs.addType ( "compCol" , &PyTypeComponentCollection , "" , false ); - __cs.addType ( "contact" , &PyTypeContact , "" , false, "comp" ); + __cs.addType ( "box" , &PyTypeBox , "" , false ); + __cs.addType ( "ent" , &PyTypeEntity , "" , false ); + __cs.addType ( "cell" , &PyTypeCell , "" , false, "ent" ); + __cs.addType ( "cellCol" , &PyTypeCellCollection , "" , false ); + __cs.addType ( "comp" , &PyTypeComponent , "" , false, "ent" ); + __cs.addType ( "compCol" , &PyTypeComponentCollection , "" , false ); + __cs.addType ( "contact" , &PyTypeContact , "" , false, "comp" ); // Do not change the "none" string. It's hardwired to the None object. - __cs.addType ( "none" , Py_None->ob_type , "" , true ); - __cs.addType ( "float" , &PyFloat_Type , "" , true ); - __cs.addType ( "int" , &PyInt_Type , "" , true ); - __cs.addType ( "bool" , &PyBool_Type , "" , true ); - __cs.addType ( "string" , &PyString_Type , "" , true ); - __cs.addType ( "list" , &PyList_Type , "" , true ); + __cs.addType ( "none" , Py_None->ob_type , "" , true ); + __cs.addType ( "float" , &PyFloat_Type , "" , true ); + __cs.addType ( "int" , &PyInt_Type , "" , true ); + __cs.addType ( "bool" , &PyBool_Type , "" , true ); + __cs.addType ( "string" , &PyString_Type , "" , true ); + __cs.addType ( "list" , &PyList_Type , "" , true ); // Do not change the "function" string. It's hardwired to callable (function) objects. - __cs.addType ( "function" , NULL , "" , true ); - __cs.addType ( "horiz" , &PyTypeHorizontal , "" , false, "segment" ); - __cs.addType ( "inst" , &PyTypeInstance , "" , false, "ent" ); - __cs.addType ( "instCol" , &PyTypeInstanceCollection , "" , false ); - __cs.addType ( "layer" , &PyTypeLayer , "" , false ); - __cs.addType ( "library" , &PyTypeLibrary , "" , false ); - __cs.addType ( "ref" , &PyTypeReference , "" , false, "ent" ); - __cs.addType ( "refCol" , &PyTypeReferenceCollection , "" , false ); - __cs.addType ( "net" , &PyTypeNet , "" , false, "ent" ); - __cs.addType ( "netCol" , &PyTypeNetCollection , "" , false ); - __cs.addType ( "hyperNet" , &PyTypeHyperNet , "" , false ); - __cs.addType ( "pin" , &PyTypePin , "" , false, "contact" ); - __cs.addType ( "pinCol" , &PyTypePinCollection , "" , false ); - __cs.addType ( "plug" , &PyTypePlug , "" , false, "comp" ); - __cs.addType ( "plugCol" , &PyTypePlugCollection , "" , false ); - __cs.addType ( "point" , &PyTypePoint , "" , false ); - __cs.addType ( "segment" , &PyTypeSegment , "" , false, "comp" ); - __cs.addType ( "pad " , &PyTypePad , "" , false, "comp" ); - __cs.addType ( "segmentCol" , &PyTypeSegmentCollection , "" , false ); - __cs.addType ( "db" , &PyTypeDataBase , "" , false ); - __cs.addType ( "techno" , &PyTypeTechnology , "" , false ); - __cs.addType ( "transfo" , &PyTypeTransformation , "" , false ); - __cs.addType ( "vert" , &PyTypeVertical , "" , false, "segment" ); - __cs.addType ( "path" , &PyTypePath , "" , false ); - __cs.addType ( "occur" , &PyTypeOccurrence , "" , false ); - __cs.addType ( "occurCol" , &PyTypeOccurrenceCollection, "", false ); + __cs.addType ( "function" , NULL , "" , true ); + __cs.addType ( "horiz" , &PyTypeHorizontal , "" , false, "segment" ); + __cs.addType ( "inst" , &PyTypeInstance , "" , false, "ent" ); + __cs.addType ( "instCol" , &PyTypeInstanceCollection , "" , false ); + __cs.addType ( "mat" , &PyTypeMaterial , "" , false ); + __cs.addType ( "basicLayer" , &PyTypeBasicLayer , "" , false, "layer" ); + __cs.addType ( "regLayer" , &PyTypeRegularLayer , "" , false, "layer" ); + __cs.addType ( "contLayer" , &PyTypeContactLayer , "" , false, "layer" ); + __cs.addType ( "diffLayer" , &PyTypeDiffusionLayer , "" , false, "layer" ); + __cs.addType ( "tranLayer" , &PyTypeTransistorLayer , "" , false, "layer" ); + __cs.addType ( "viaLayer" , &PyTypeViaLayer , "" , false, "layer" ); + __cs.addType ( "layerColl" , &PyTypeLayerCollection , "" , false ); + __cs.addType ( "blayerColl" , &PyTypeBasicLayerCollection , "" , false ); + __cs.addType ( "rlayerColl" , &PyTypeRegularLayerCollection, "", false ); + __cs.addType ( "vlayerColl" , &PyTypeViaLayerCollection , "" , false ); + __cs.addType ( "layer" , &PyTypeLayer , "" , false ); + __cs.addType ( "lmask" , &PyTypeLayerMask , "" , false ); + __cs.addType ( "library" , &PyTypeLibrary , "" , false ); + __cs.addType ( "ref" , &PyTypeReference , "" , false, "ent" ); + __cs.addType ( "refCol" , &PyTypeReferenceCollection , "" , false ); + __cs.addType ( "net" , &PyTypeNet , "" , false, "ent" ); + __cs.addType ( "netCol" , &PyTypeNetCollection , "" , false ); + __cs.addType ( "hyperNet" , &PyTypeHyperNet , "" , false ); + __cs.addType ( "pin" , &PyTypePin , "" , false, "contact" ); + __cs.addType ( "pinCol" , &PyTypePinCollection , "" , false ); + __cs.addType ( "plug" , &PyTypePlug , "" , false, "comp" ); + __cs.addType ( "plugCol" , &PyTypePlugCollection , "" , false ); + __cs.addType ( "point" , &PyTypePoint , "" , false ); + __cs.addType ( "segment" , &PyTypeSegment , "" , false, "comp" ); + __cs.addType ( "pad " , &PyTypePad , "" , false, "comp" ); + __cs.addType ( "segmentCol" , &PyTypeSegmentCollection , "" , false ); + __cs.addType ( "db" , &PyTypeDataBase , "" , false ); + __cs.addType ( "techno" , &PyTypeTechnology , "" , false ); + __cs.addType ( "transfo" , &PyTypeTransformation , "" , false ); + __cs.addType ( "vert" , &PyTypeVertical , "" , false, "segment" ); + __cs.addType ( "path" , &PyTypePath , "" , false ); + __cs.addType ( "occur" , &PyTypeOccurrence , "" , false ); + __cs.addType ( "occurCol" , &PyTypeOccurrenceCollection , "" , false ); PyObject* module = Py_InitModule ( "Hurricane", PyHurricane_Methods ); @@ -650,12 +710,30 @@ extern "C" { return; } + Py_INCREF ( &PyTypeDbU ); + PyModule_AddObject ( module, "DbU" , (PyObject*)&PyTypeDbU ); + Py_INCREF ( &PyTypeTechnology ); + PyModule_AddObject ( module, "Technology" , (PyObject*)&PyTypeTechnology ); + Py_INCREF ( &PyTypeLayer ); + PyModule_AddObject ( module, "Layer" , (PyObject*)&PyTypeLayer ); + Py_INCREF ( &PyTypeBasicLayer ); + PyModule_AddObject ( module, "BasicLayer" , (PyObject*)&PyTypeBasicLayer ); + Py_INCREF ( &PyTypeRegularLayer ); + PyModule_AddObject ( module, "RegularLayer" , (PyObject*)&PyTypeRegularLayer ); + Py_INCREF ( &PyTypeContactLayer ); + PyModule_AddObject ( module, "ContactLayer" , (PyObject*)&PyTypeContactLayer ); + Py_INCREF ( &PyTypeDiffusionLayer ); + PyModule_AddObject ( module, "DiffusionLayer" , (PyObject*)&PyTypeDiffusionLayer ); + Py_INCREF ( &PyTypeTransistorLayer ); + PyModule_AddObject ( module, "TransistorLayer" , (PyObject*)&PyTypeTransistorLayer ); + Py_INCREF ( &PyTypeContactLayer ); + PyModule_AddObject ( module, "ViaLayer" , (PyObject*)&PyTypeViaLayer ); Py_INCREF ( &PyTypeNetExternalComponents ); PyModule_AddObject ( module, "NetExternalComponents", (PyObject*)&PyTypeNetExternalComponents ); Py_INCREF ( &PyTypeUpdateSession ); - PyModule_AddObject ( module, "UpdateSession", (PyObject*)&PyTypeUpdateSession ); + PyModule_AddObject ( module, "UpdateSession" , (PyObject*)&PyTypeUpdateSession ); Py_INCREF ( &PyTypeBreakpoint ); - PyModule_AddObject ( module, "Breakpoint", (PyObject*)&PyTypeBreakpoint ); + PyModule_AddObject ( module, "Breakpoint" , (PyObject*)&PyTypeBreakpoint ); PyObject* dictionnary = PyModule_GetDict ( module ); @@ -675,16 +753,16 @@ extern "C" { InstanceLoadConstants ( dictionnary ); PinLoadConstants ( dictionnary ); + PyDbU_postModuleInit (); + PyLayer_postModuleInit (); + PyBasicLayer_postModuleInit (); + trace << "Hurricane.so loaded " << (void*)&typeid(string) << endl; } -} // End of extern "C". - +} // extern "C". #endif // End of Python Module Code Part. - - - -} // End of Isobar namespace. +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyLayer.cpp b/hurricane/src/isobar/PyLayer.cpp index 4b86d911..87ca5d20 100644 --- a/hurricane/src/isobar/PyLayer.cpp +++ b/hurricane/src/isobar/PyLayer.cpp @@ -1,22 +1,53 @@ -// x-----------------------------------------------------------------x -// | | + +// -*- 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 +// +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | -// | Author : Damien Dupuis | -// | E-mail : Damien.Dupuis@asim.lip6.fr | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Module : "./PyLayer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Module : "./PyLayer.cpp" | +// +-----------------------------------------------------------------+ - - -#include "hurricane/isobar/PyLayer.h" #include "hurricane/isobar/PyTechnology.h" +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/isobar/PyLayerMask.h" +#include "hurricane/isobar/PyBasicLayer.h" +#include "hurricane/isobar/PyBasicLayerCollection.h" namespace Isobar { @@ -29,27 +60,212 @@ extern "C" { #define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Layer,layer,function) -// x=================================================================x +// +=================================================================+ // | "PyLayer" Python Module Code Part | -// x=================================================================x +// +=================================================================+ #if defined(__PYTHON_MODULE__) - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ // | "PyLayer" Attribute Methods | - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ - // Standart Accessors (Attributes). +# define accessorDbuFromOptBasicLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + DbU::Unit rvalue = 0; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* arg0 = NULL; \ + \ + __cs.init (#SELF_TYPE"."#FUNC_NAME"()"); \ + if (PyArg_ParseTuple( args, "|O&:"#SELF_TYPE"."#FUNC_NAME"()", Converter, &arg0)) { \ + if ( __cs.getObjectIds() == ":basiclayer" ) \ + rvalue = cobject->FUNC_NAME( PYBASICLAYER_O(arg0) ); \ + else if ( __cs.getObjectIds() == "" ) \ + rvalue = cobject->FUNC_NAME(); \ + else { \ + PyErr_SetString ( ConstructorError \ + , "invalid parameter type for "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + HCATCH \ + \ + return Py_BuildValue("l",rvalue); \ + } - // Standart destroy (Attribute). - DBoDestroyAttribute(PyLayer_destroy, PyLayer) +# define accessorLayerFromLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Layer* rlayer = 0; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* arg0 = NULL; \ + \ + if (PyArg_ParseTuple( args, "O:"#SELF_TYPE"."#FUNC_NAME"()", &arg0)) { \ + Layer* argLayer = PYLAYER_O(arg0); \ + if (argLayer == NULL) { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): Parameter is not of Layer type" ); \ + return NULL; \ + } \ + rlayer = const_cast(cobject->FUNC_NAME( argLayer )); \ + } else { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): Parameter is not of Layer type" ); \ + return NULL; \ + } \ + HCATCH \ + \ + return PyLayer_Link(rlayer); \ + } + + +# define accessorLayerFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Layer* rlayer = NULL; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + rlayer = const_cast(cobject->FUNC_NAME()); \ + HCATCH \ + \ + if (rlayer == NULL) Py_RETURN_NONE; \ + return PyLayer_Link(rlayer); \ + } + + +# define accessorMaskFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Layer::Mask mask = 0; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + mask = cobject->FUNC_NAME(); \ + HCATCH \ + \ + return PyLayerMask_Link(mask); \ + } + + +# define accessorLayerFromOptBool(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Layer* rlayer = NULL; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* arg0 = NULL; \ + bool useWorking = true; \ + \ + if (PyArg_ParseTuple( args, "|O:"#SELF_TYPE"."#FUNC_NAME"()", &arg0)) { \ + if (arg0 != NULL) { \ + useWorking = PyObject_IsTrue(arg0); \ + } \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + rlayer = const_cast(cobject->FUNC_NAME(useWorking)); \ + HCATCH \ + \ + if (rlayer == NULL) Py_RETURN_NONE; \ + return PyLayer_Link(rlayer); \ + } + + +# define predicateFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + if (cobject->FUNC_NAME()) Py_RETURN_TRUE; \ + HCATCH \ + \ + Py_RETURN_FALSE; \ + } + + +# define updatorFromDbu(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + long dimension = 0; \ + \ + if (PyArg_ParseTuple( args, "l:"#SELF_TYPE"."#FUNC_NAME"()", &dimension)) { \ + cobject->FUNC_NAME( dimension ); \ + } else { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): Parameter is not of long (DbU) type" ); \ + return NULL; \ + } \ + HCATCH \ + \ + Py_RETURN_NONE; \ + } + + +# define updatorFromBasicLayerDbu(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* pyBasicLayer = NULL; \ + long dimension = 0; \ + \ + if (PyArg_ParseTuple( args, "Ol:"#SELF_TYPE"."#FUNC_NAME"()", &pyBasicLayer, &dimension)) { \ + BasicLayer* layer = PYBASICLAYER_O(pyBasicLayer); \ + if (layer == NULL) { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): First parameter is not of BasicLayer type" ); \ + return NULL; \ + } \ + cobject->FUNC_NAME( layer, dimension ); \ + } else { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): Bad parameters types or numbers." ); \ + return NULL; \ + } \ + HCATCH \ + \ + Py_RETURN_NONE; \ + } - - // --------------------------------------------------------------- - // Attribute Method : "PyLayer_getTechnology ()" static PyObject* PyLayer_getTechnology ( PyLayer *self ) { trace << "PyLayer_getTechnology ()" << endl; @@ -61,39 +277,113 @@ extern "C" { techno = layer->getTechnology (); HCATCH - return PyTechnology_Link ( techno ); + return PyTechnology_Link(techno); } - - // --------------------------------------------------------------- - // Attribute Method : "PyLayer_getName ()" - - GetNameMethod(Layer, layer) - - // --------------------------------------------------------------- - // Attribute Method : "PyLayer_SetName ()" + GetNameMethod (Layer, layer) + predicateFromLayer ( above ,PyLayer,Layer) + predicateFromLayer ( below ,PyLayer,Layer) + predicateFromLayer ( contains ,PyLayer,Layer) + predicateFromLayer ( intersect ,PyLayer,Layer) + predicateFromVoid ( isWorking ,PyLayer,Layer) + accessorDbuFromOptBasicLayer( getEnclosure ,PyLayer,Layer) + accessorDbuFromOptBasicLayer( getExtentionCap ,PyLayer,Layer) + accessorDbuFromOptBasicLayer( getExtentionWidth,PyLayer,Layer) + accessorCollectionFromVoid ( getBasicLayers ,PyLayer,Layer,BasicLayer) + accessorMaskFromVoid ( getMask ,PyLayer,Layer) + accessorMaskFromVoid ( getExtractMask ,PyLayer,Layer) + accessorLayerFromVoid ( getBlockageLayer ,PyLayer,Layer) + accessorLayerFromVoid ( getTop ,PyLayer,Layer) + accessorLayerFromVoid ( getBottom ,PyLayer,Layer) + accessorLayerFromLayer ( getOpposite ,PyLayer,Layer) + accessorLayerFromOptBool ( getMetalAbove ,PyLayer,Layer) + accessorLayerFromOptBool ( getMetalBelow ,PyLayer,Layer) + accessorLayerFromOptBool ( getCutAbove ,PyLayer,Layer) + accessorLayerFromOptBool ( getCutBelow ,PyLayer,Layer) + DirectGetLongAttribute (PyLayer_getMinimalSize ,getMinimalSize ,PyLayer,Layer) + DirectGetLongAttribute (PyLayer_getMinimalSpacing,getMinimalSpacing,PyLayer,Layer) SetNameMethod(Layer, layer) + updatorFromDbu (setMinimalSize ,PyLayer,Layer) + updatorFromDbu (setMinimalSpacing,PyLayer,Layer) + updatorFromBasicLayerDbu(setEnclosure ,PyLayer,Layer) + updatorFromBasicLayerDbu(setExtentionCap ,PyLayer,Layer) + updatorFromBasicLayerDbu(setExtentionWidth,PyLayer,Layer) + + // Standart destroy (Attribute). + DBoDestroyAttribute(PyLayer_destroy, PyLayer) - // --------------------------------------------------------------- - // PyLayer Attribute Method table. PyMethodDef PyLayer_Methods[] = - { { "getTechnology" , (PyCFunction)PyLayer_getTechnology , METH_NOARGS , "Returns the technology owning the layer." } - , { "getName" , (PyCFunction)PyLayer_getName , METH_NOARGS , "Returns the name of the layer." } - , { "setName" , (PyCFunction)PyLayer_setName , METH_VARARGS, "Allows to change the layer name." } + { { "getTechnology" , (PyCFunction)PyLayer_getTechnology , METH_NOARGS + , "Returns the technology owning the layer." } + , { "getName" , (PyCFunction)PyLayer_getName , METH_NOARGS + , "Returns the name of the layer." } + , { "getMask" , (PyCFunction)PyLayer_getMask , METH_NOARGS + , "Returns the mask (bits) of the layer." } + , { "getExtractMask" , (PyCFunction)PyLayer_getExtractMask , METH_NOARGS + , "Returns the extract mask of the layer (for GDSII)." } + , { "getMinimalSize" , (PyCFunction)PyLayer_getMinimalSize , METH_NOARGS + , "Returns the minimum width allowed for the layer." } + , { "getMinimalSpacing" , (PyCFunction)PyLayer_getMinimalSpacing , METH_NOARGS + , "Returns the spacing allowed for the layer (edge to edge)." } + , { "getBasicLayers" , (PyCFunction)PyLayer_getBasicLayers , METH_NOARGS + , "Returns the collection of BasicLayer the Layer is built upon." } + , { "getBlockageLayer" , (PyCFunction)PyLayer_getBlockageLayer , METH_NOARGS + , "Returns the associated connector layer." } + , { "getTop" , (PyCFunction)PyLayer_getTop , METH_NOARGS + , "Returns the top layer (in case of a muti-layer)." } + , { "getBottom" , (PyCFunction)PyLayer_getBottom , METH_NOARGS + , "Returns the bottom layer (in case of a muti-layer)." } + , { "getOpposite" , (PyCFunction)PyLayer_getOpposite , METH_VARARGS + , "Returns the layer opposite the one given." } + , { "getMetalAbove" , (PyCFunction)PyLayer_getMetalAbove , METH_VARARGS + , "Returns the metal layer above this one." } + , { "getMetalBelow" , (PyCFunction)PyLayer_getMetalBelow , METH_VARARGS + , "Returns the metal layer below this one." } + , { "getCutAbove" , (PyCFunction)PyLayer_getCutAbove , METH_VARARGS + , "Returns the cut layer above this one." } + , { "getCutBelow" , (PyCFunction)PyLayer_getCutBelow , METH_VARARGS + , "Returns the cut layer below this one." } + , { "getEnclosure" , (PyCFunction)PyLayer_getEnclosure , METH_VARARGS + , "Returns the enclosure (global or for one BasicLayer)." } + , { "getExtentionCap" , (PyCFunction)PyLayer_getExtentionCap , METH_VARARGS + , "Returns the extention cap (global or for one BasicLayer)." } + , { "getExtentionWidth" , (PyCFunction)PyLayer_getExtentionWidth , METH_VARARGS + , "Returns the extention width (global or for one BasicLayer)." } + , { "above" , (PyCFunction)PyLayer_above , METH_VARARGS + , "Tells if the layer is above the one passed as argument." } + , { "below" , (PyCFunction)PyLayer_below , METH_VARARGS + , "Tells if the layer is below the one passed as argument." } + , { "contains" , (PyCFunction)PyLayer_contains , METH_VARARGS + , "Tells if the layer fully contains the one passed as argument." } + , { "intersect" , (PyCFunction)PyLayer_intersect , METH_VARARGS + , "Tells if the layer share some BasicLayer with the one passed as argument." } + , { "isWorking" , (PyCFunction)PyLayer_isWorking , METH_NOARGS + , "Tells if the layer is the working one for this BasicLayer." } + , { "setName" , (PyCFunction)PyLayer_setName , METH_VARARGS + , "Allows to change the layer name." } + , { "setWorking" , (PyCFunction)PyLayer_setName , METH_VARARGS + , "Sets the layer as the working one." } + , { "setMinimalSize" , (PyCFunction)PyLayer_setMinimalSize , METH_VARARGS + , "Sets the layer minimal size (width)." } + , { "setMinimalSpacing" , (PyCFunction)PyLayer_setMinimalSpacing , METH_VARARGS + , "Sets the layer minimal spacing (edge to edge)." } + , { "setEnclosure" , (PyCFunction)PyLayer_setEnclosure , METH_VARARGS + , "Sets the enclosure for the given BasicLayer sub-component." } + , { "setExtentionCap" , (PyCFunction)PyLayer_setExtentionCap , METH_VARARGS + , "Sets the extention cap for the given BasiLayer sub-component." } + , { "setExtentionWidth" , (PyCFunction)PyLayer_setExtentionWidth , METH_VARARGS + , "Sets the extention width for the given BasiLayer sub-component." } , { "destroy" , (PyCFunction)PyLayer_destroy , METH_NOARGS , "Destroy associated hurricane object The python object remains." } - , {NULL, NULL, 0, NULL} /* sentinel */ + , {NULL, NULL, 0, NULL} /* sentinel */ }; - - - // x-------------------------------------------------------------x - // | "PyLayer" Object Methods | - // x-------------------------------------------------------------x + // --------------------------------------------------------------- + // PyLayer Type Methods. DBoDeleteMethod(Layer) @@ -103,27 +393,24 @@ extern "C" { #else // End of Python Module Code Part. -// x=================================================================x +// +=================================================================+ // | "PyLayer" Shared Library Code Part | -// x=================================================================x - +// +=================================================================+ // Link/Creation Method. DBoLinkCreateMethod(Layer) + PyTypeRootObjectDefinitions(Layer) - - // --------------------------------------------------------------- - // PyLayer Object Definitions. - - PyTypeObjectDefinitions(Layer) + extern void PyLayer_postModuleInit () + { + PyDict_SetItemString ( PyTypeLayer.tp_dict, "Mask", (PyObject*)&PyTypeLayerMask ); + } #endif // End of Shared Library Code Part. +} // extern "C". -} // End of extern "C". - - -} // End of Isobar namespace. +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyLayerCollection.cpp b/hurricane/src/isobar/PyLayerCollection.cpp new file mode 100644 index 00000000..a53310aa --- /dev/null +++ b/hurricane/src/isobar/PyLayerCollection.cpp @@ -0,0 +1,89 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyLayerCollection.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyLayerCollection.h" +#include "hurricane/isobar/PyLayer.h" + +namespace Isobar { + +using namespace Hurricane; + + +extern "C" { + + +// +=================================================================+ +// | "PyLayerCollection" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyLayerCollection" Attribute Methods | + // +-------------------------------------------------------------+ + + + DirectDeleteMethod(PyLayerCollection_DeAlloc, PyLayerCollection) + LocatorNextMethod(Layer) + CollectionMethods(Layer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyLayerCollection" Shared Library Code Part | +// +=================================================================+ + + PyTypeCollectionObjectDefinitions(LayerCollection) + PyTypeCollectionObjectDefinitions(LayerCollectionLocator) + + +#endif // End of Shared Library Code Part. + +} // extern "C". + +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyLayerMask.cpp b/hurricane/src/isobar/PyLayerMask.cpp new file mode 100644 index 00000000..5a7951bf --- /dev/null +++ b/hurricane/src/isobar/PyLayerMask.cpp @@ -0,0 +1,384 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyLayerMask.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyLayerMask.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +// +=================================================================+ +// | "PyLayerMask" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + + +#define methodRMaskFromMask(FUNC_NAME) \ + PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* self, PyObject* args ) \ + { \ + PyObject* arg0; \ + if (PyArg_ParseTuple( args, "O:Layer.Mask."#FUNC_NAME"()", &arg0)) { \ + if (not IsPyLayerMask(arg0)) { \ + PyErr_SetString ( ConstructorError \ + , "Layer.Mask."#FUNC_NAME"(): Argument is not of Layer.Mask type." ); \ + return NULL; \ + } \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to Layer.Mask."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + self->_object.FUNC_NAME(PYLAYERMASK_O(arg0)); \ + Py_INCREF(self); \ + return (PyObject*)self; \ + } + + +#define predicateFromMask(FUNC_NAME) \ + PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* self, PyObject* args ) \ + { \ + PyObject* arg0; \ + if (PyArg_ParseTuple( args, "O:Layer.Mask."#FUNC_NAME"()", &arg0)) { \ + if (not IsPyLayerMask(arg0)) { \ + PyErr_SetString ( ConstructorError \ + , "Layer.Mask."#FUNC_NAME"(): Argument is not of Layer.Mask type." ); \ + return NULL; \ + } \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to Layer.Mask."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + if (self->_object.FUNC_NAME(PYLAYERMASK_O(arg0))) Py_RETURN_TRUE; \ + Py_RETURN_FALSE; \ + } + + + // --------------------------------------------------------------- + // PyLayer Attribute Methods. + + static PyObject* PyLayerMask_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) + { + trace << "PyLayerMask_new()" << endl; + + PyLayerMask* pyMask = (PyLayerMask*)type->tp_alloc(type,0); + + if ( pyMask ) { + unsigned long long value = 0; + if (PyArg_ParseTuple(args,"K:LayerMask.new", &value)) { + pyMask->_object = Layer::Mask(value); + } else { + PyErr_SetString ( ConstructorError, "Invalid/bad number of parameters for LayerMask()." ); + return NULL; + } + } + return (PyObject*)pyMask; + } + + + PyObject* PyLayerMask_zero ( PyLayerMask* self ) + { + self->_object.zero(); + Py_RETURN_NONE; + } + + + PyObject* PyLayerMask_nthbit ( PyLayerMask* self, PyObject* pyInt ) + { + Layer::Mask result; + result = self->_object.nthbit(PyInt_AsLong(pyInt)); + return PyLayerMask_Link(result); + } + + + predicateFromMask (isSet) + predicateFromMask (contains) + predicateFromMask (intersect) + methodRMaskFromMask(set) + methodRMaskFromMask(unset) + + + PyMethodDef PyLayerMask_Methods[] = + { { "zero" , (PyCFunction)PyLayerMask_zero , METH_NOARGS + , "Reset all the bits." } + , { "set" , (PyCFunction)PyLayerMask_set , METH_VARARGS + , "Sets to one the bits given in the argument (aka bitwise or)." } + , { "unset" , (PyCFunction)PyLayerMask_unset , METH_VARARGS + , "Sets to zero the bits given in the argument (aka bitwise and with complement)." } + , { "isSet" , (PyCFunction)PyLayerMask_isSet , METH_VARARGS + , "Returns true if some of bits at the mask's position are set (aka bitwise and)." } + , { "contains" , (PyCFunction)PyLayerMask_contains , METH_VARARGS + , "Returns true if all the bits at the mask's position are set (aka bitwise and)." } + , { "intersect" , (PyCFunction)PyLayerMask_intersect , METH_VARARGS + , "Returns true if some of bits at the mask's position are set (aka bitwise and)." } + , { "nthbit" , (PyCFunction)PyLayerMask_nthbit , METH_VARARGS + , "Returns a new mask with only the Nth bit copied." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + // --------------------------------------------------------------- + // PyLayer Number Protocol Methods. + + +#define binaryInFunctionMaskMask(FUNC_NAME,OP) \ + PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* pyMask0, PyLayerMask* pyMask1 ) \ + { \ + pyMask0->_object OP pyMask1->_object; \ + Py_INCREF(pyMask0); \ + return (PyObject*)pyMask0; \ + } + + +#define binaryInFunctionMaskInt(FUNC_NAME,OP) \ + PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* pyMask0, PyObject* pyInt ) \ + { \ + pyMask0->_object OP= PyInt_AsLong(pyInt); \ + Py_INCREF(pyMask0); \ + return (PyObject*)pyMask0; \ + } + + +#define binaryFunctionMaskMask(FUNC_NAME,OP) \ + PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* pyMask0, PyLayerMask* pyMask1 ) \ + { \ + Layer::Mask result; \ + result = pyMask0->_object OP pyMask1->_object; \ + return PyLayerMask_Link(result); \ + } + + +#define binaryFunctionMaskInt(FUNC_NAME,OP) \ + PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* pyMask0, PyObject* pyInt ) \ + { \ + Layer::Mask result; \ + result = pyMask0->_object OP PyInt_AsLong(pyInt); \ + return PyLayerMask_Link(result); \ + } + + + int PyLayerMask_nonzero ( PyLayerMask* pyMask ) + { return pyMask->_object != Layer::Mask(0); } + + + int PyLayerMask_invert ( PyLayerMask* pyMask ) + { return not pyMask->_object; } + + + binaryFunctionMaskInt (lshift,<<) + binaryFunctionMaskInt (rshift,>>) + binaryFunctionMaskMask (and ,bitand) + binaryFunctionMaskMask (xor ,^) + binaryFunctionMaskMask (or ,bitor) + binaryInFunctionMaskMask(andIn ,&=) + binaryInFunctionMaskMask(orIn ,|=) + + + PyNumberMethods PyLayerMask_NumberMethods = { + 0 // binaryfunc nb_add; + , 0 // binaryfunc nb_subtract; + , 0 // binaryfunc nb_multiply; + , 0 // binaryfunc nb_divide; + , 0 // binaryfunc nb_remainder; + , 0 // binaryfunc nb_divmod; + , 0 // ternaryfunc nb_power; + , 0 // unaryfunc nb_negative; + , 0 // unaryfunc nb_positive; + , 0 // unaryfunc nb_absolute; + , (inquiry) PyLayerMask_nonzero // inquiry nb_nonzero; -- Used by PyObject_IsTrue + , (unaryfunc) PyLayerMask_invert // unaryfunc nb_invert; + , (binaryfunc)PyLayerMask_lshift // binaryfunc nb_lshift; + , (binaryfunc)PyLayerMask_rshift // binaryfunc nb_rshift; + , (binaryfunc)PyLayerMask_and // binaryfunc nb_and; + , (binaryfunc)PyLayerMask_xor // binaryfunc nb_xor; + , (binaryfunc)PyLayerMask_or // binaryfunc nb_or; + , 0 // coercion nb_coerce; -- Used by the coerce() function + , 0 // unaryfunc nb_int; + , 0 // unaryfunc nb_long; + , 0 // unaryfunc nb_float; + , 0 // unaryfunc nb_oct; + , 0 // unaryfunc nb_hex; + // Added in release 2.0 + , 0 // binaryfunc nb_inplace_add; + , 0 // binaryfunc nb_inplace_subtract; + , 0 // binaryfunc nb_inplace_multiply; + , 0 // binaryfunc nb_inplace_divide; + , 0 // binaryfunc nb_inplace_remainder; + , 0 // ternaryfunc nb_inplace_power; + , 0 // binaryfunc nb_inplace_lshift; + , 0 // binaryfunc nb_inplace_rshift; + , (binaryfunc)PyLayerMask_andIn // binaryfunc nb_inplace_and; + , 0 // binaryfunc nb_inplace_xor; + , (binaryfunc)PyLayerMask_orIn // binaryfunc nb_inplace_or; + // Added in release 2.2 + , 0 // binaryfunc nb_floor_divide; + , 0 // binaryfunc nb_true_divide; + , 0 // binaryfunc nb_inplace_floor_divide; + , 0 // binaryfunc nb_inplace_true_divide; + // Added in release 2.5 + , 0 // unaryfunc nb_index; + }; + + + // --------------------------------------------------------------- + // PyLayer Type Methods. + + + static PyObject* PyLayerMask_Repr ( PyLayerMask *self ) + { + ostringstream repr; + repr << "[" << hex << self << "<->" << (void*)&(self->_object) << " " << self->_object << "]"; + return ( PyString_FromString(repr.str().c_str()) ); + } + + + static PyObject* PyLayerMask_Str ( PyLayerMask *self ) + { + return ( PyString_FromString(getString(self->_object).c_str()) ); + } + + + static void PyLayerMask_DeAlloc ( PyLayerMask *self ) + { + trace << "PyLayerMask_DeAlloc(" << hex << self << ") " << self->_object << endl; + PyObject_DEL ( self ); + } + + + static int PyLayerMask_Cmp ( PyLayerMask *self, PyObject* other ) + { + if ( not IsPyLayerMask(other) ) return -1; + + PyLayerMask* otherPyObject = (PyLayerMask*)other; + if ( self->_object == otherPyObject->_object ) return 0; + if ( self->_object < otherPyObject->_object ) return -1; + + return 1; + } + + + static int PyLayerMask_Hash ( PyLayerMask *self) + { + return (long)&(self->_object); + } + + + extern void PyLayerMask_LinkPyType() + { + trace << "PyLayerMask_LinkType()" << endl; + + PyTypeLayerMask.tp_new = PyLayerMask_new; + PyTypeLayerMask.tp_dealloc = (destructor) PyLayerMask_DeAlloc; + PyTypeLayerMask.tp_compare = (cmpfunc) PyLayerMask_Cmp; + PyTypeLayerMask.tp_repr = (reprfunc) PyLayerMask_Repr; + PyTypeLayerMask.tp_str = (reprfunc) PyLayerMask_Str; + PyTypeLayerMask.tp_hash = (hashfunc) PyLayerMask_Hash; + PyTypeLayerMask.tp_methods = PyLayerMask_Methods; + PyTypeLayerMask.tp_as_number = &PyLayerMask_NumberMethods; + } + + +#else // End of Python Module Code Part. + + +// x=================================================================x +// | "PyLayer" Shared Library Code Part | +// x=================================================================x + + + // Link/Creation Method. + PyObject* PyLayerMask_Link ( const Layer::Mask& mask ) + { + PyLayerMask* pyMask = NULL; + pyMask = PyObject_NEW(PyLayerMask, &PyTypeLayerMask); + if (pyMask == NULL) return NULL; + + pyMask->_object = mask; + + return (PyObject*)pyMask; + } + + + // --------------------------------------------------------------- + // PyLayer Object Definitions. + + PyTypeObject PyTypeLayerMask = + { PyObject_HEAD_INIT(NULL) + 0 /* ob_size. */ + , "Hurricane.Layer.Mask" /* tp_name. */ + , sizeof(PyLayerMask) /* tp_basicsize. */ + , 0 /* tp_itemsize. */ + /* methods. */ + , 0 /* tp_dealloc. */ + , 0 /* tp_print. */ + , 0 /* tp_getattr. */ + , 0 /* tp_setattr. */ + , 0 /* tp_compare. */ + , 0 /* tp_repr. */ + , 0 /* tp_as_number. */ + , 0 /* tp_as_sequence. */ + , 0 /* tp_as_mapping. */ + , 0 /* tp_hash. */ + , 0 /* tp_call. */ + , 0 /* tp_str */ + , 0 /* tp_getattro. */ + , 0 /* tp_setattro. */ + , 0 /* tp_as_buffer. */ + , Py_TPFLAGS_DEFAULT /* tp_flags */ + , "Layer::Mask objects" /* tp_doc. */ + }; + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyMaterial.cpp b/hurricane/src/isobar/PyMaterial.cpp new file mode 100644 index 00000000..7ace9e43 --- /dev/null +++ b/hurricane/src/isobar/PyMaterial.cpp @@ -0,0 +1,200 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyMaterial.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyTechnology.h" +#include "hurricane/isobar/PyMaterial.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(BasicLayer::Material,material,function) + + +// +=================================================================+ +// | "PyMaterial" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyMaterial" Attribute Methods | + // +-------------------------------------------------------------+ + + + static PyObject* PyMaterial_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) + { + trace << "PyMaterial_new()" << endl; + + BasicLayer::Material* material = NULL; + PyMaterial* pyMaterial = (PyMaterial*)type->tp_alloc(type,0); + + HTRY + if ( pyMaterial ) { + int code = 0; + if (PyArg_ParseTuple(args,"i:BasicLayer.Material.new", &code)) { + BasicLayer::Material::Code enumCode; + if (code <= (int)BasicLayer::Material::other) enumCode = (BasicLayer::Material::Code)code; + else { + PyErr_SetString(ConstructorError,"BasicLayer::Material(): Invalid code value."); + return NULL; + } + material = new BasicLayer::Material(enumCode); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for BasicLayer.Material()." ); + return NULL; + } + pyMaterial->_object = material; + } + HCATCH + + return (PyObject*)pyMaterial; + } + + + PyObject* PyMaterial_getCode ( PyMaterial* self ) + { + trace << "PyMaterial_getCode()" << endl; + + int code = 0; + + HTRY + METHOD_HEAD("Material.getCode()") + code = (int)material->getCode(); + HCATCH + + return Py_BuildValue("i",code); + } + + + + // --------------------------------------------------------------- + // PyMaterial Attribute Method table. + + PyMethodDef PyMaterial_Methods[] = + { { "getCode" , (PyCFunction)PyMaterial_getCode, METH_NOARGS + , "Returns the numerical code of the material (enum)." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + // +-------------------------------------------------------------+ + // | "PyMaterial" Object Methods | + // +-------------------------------------------------------------+ + + DirectHashMethod (PyMaterial_Hash , PyMaterial) + DirectReprMethod (PyMaterial_Repr , PyMaterial, BasicLayer::Material) + DirectStrMethod (PyMaterial_Str , PyMaterial, BasicLayer::Material) + DirectStrMethod (PyMaterial_Cmp , PyMaterial, BasicLayer::Material) + DirectDeleteMethod(PyMaterial_DeAlloc, PyMaterial) + + extern void PyMaterial_LinkPyType() { + trace << "PyMaterial_LinkType()" << endl; + + PyTypeMaterial.tp_new = PyMaterial_new; + PyTypeMaterial.tp_dealloc = (destructor) PyMaterial_DeAlloc; + PyTypeMaterial.tp_repr = (reprfunc) PyMaterial_Repr; + PyTypeMaterial.tp_str = (reprfunc) PyMaterial_Str; + PyTypeMaterial.tp_compare = (cmpfunc) PyMaterial_Cmp; + PyTypeMaterial.tp_hash = (hashfunc) PyMaterial_Hash; + PyTypeMaterial.tp_methods = PyMaterial_Methods; + } + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyMaterial" Shared Library Code Part | +// +=================================================================+ + + + // Link/Creation Method. + PyObject* PyMaterial_Link ( BasicLayer::Material* object ) { + if ( object == NULL ) Py_RETURN_NONE; + + PyMaterial* pyObject = NULL; + HTRY + pyObject = PyObject_NEW(PyMaterial, &PyTypeMaterial); + if (pyObject == NULL) return NULL; + + pyObject->ACCESS_OBJECT = object; + HCATCH + + return (PyObject*)pyObject; + } + + + extern void PyMaterial_postModuleInit () + { + PyObject* constant; + + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::nWell ,"nWell" ); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::pWell ,"pWell" ); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::nImplant,"nImplant"); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::pImplant,"pImplant"); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::active ,"active" ); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::poly ,"poly" ); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::cut ,"cut" ); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::metal ,"metal" ); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::blockage,"blockage"); + LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::other ,"other" ); + } + + + PyTypeObjectDefinitions(Material) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index defc0aaf..e0f0712a 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -292,7 +292,7 @@ extern "C" { METHOD_HEAD ( "Net.setGlobal()" ) PyObject* arg0; if (PyArg_ParseTuple(args,"O:Net.setGlobal", &arg0) && PyBool_Check(arg0)) { - (arg0 == Py_True)?net->setGlobal(true):net->setGlobal(false); + PyObject_IsTrue(arg0)?net->setGlobal(true):net->setGlobal(false); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Net.setGlobal." ); return NULL; @@ -314,7 +314,7 @@ extern "C" { METHOD_HEAD ( "Net.setExternal()" ) PyObject* arg0; if (PyArg_ParseTuple(args,"O:Net.setExternal", &arg0) && PyBool_Check(arg0)) { - (arg0 == Py_True)?net->setExternal(true):net->setExternal(false); + PyObject_IsTrue(arg0)?net->setExternal(true):net->setExternal(false); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Net.setExternal." ); return NULL; diff --git a/hurricane/src/isobar/PyPath.cpp b/hurricane/src/isobar/PyPath.cpp index 2ac0644d..b8ff9e76 100644 --- a/hurricane/src/isobar/PyPath.cpp +++ b/hurricane/src/isobar/PyPath.cpp @@ -12,14 +12,13 @@ // | | // x-----------------------------------------------------------------x -#include "hurricane/Cell.h" -using namespace Hurricane; - #include "hurricane/isobar/PyTransformation.h" #include "hurricane/isobar/PyPath.h" #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyInstance.h" #include "hurricane/isobar/PyInstanceCollection.h" +#include "hurricane/Cell.h" +using namespace Hurricane; namespace Isobar { diff --git a/hurricane/src/isobar/PyPoint.cpp b/hurricane/src/isobar/PyPoint.cpp index e0beb03e..c72a954a 100644 --- a/hurricane/src/isobar/PyPoint.cpp +++ b/hurricane/src/isobar/PyPoint.cpp @@ -55,6 +55,7 @@ #include "hurricane/isobar/PyPoint.h" + namespace Isobar { using namespace Hurricane; diff --git a/hurricane/src/isobar/PyReference.cpp b/hurricane/src/isobar/PyReference.cpp index 62b45307..f23b85f2 100644 --- a/hurricane/src/isobar/PyReference.cpp +++ b/hurricane/src/isobar/PyReference.cpp @@ -13,14 +13,14 @@ // x-----------------------------------------------------------------x -#include "hurricane/Cell.h" -using namespace Hurricane; #include "hurricane/isobar/PyReference.h" #include "hurricane/isobar/PyPoint.h" #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyNet.h" #include "hurricane/isobar/PyBox.h" +#include "hurricane/Cell.h" +using namespace Hurricane; namespace Isobar { diff --git a/hurricane/src/isobar/PyRegularLayer.cpp b/hurricane/src/isobar/PyRegularLayer.cpp new file mode 100644 index 00000000..dec90c02 --- /dev/null +++ b/hurricane/src/isobar/PyRegularLayer.cpp @@ -0,0 +1,153 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyRegularLayer.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyRegularLayer.h" +#include "hurricane/isobar/PyMaterial.h" +#include "hurricane/isobar/PyBasicLayer.h" +#include "hurricane/isobar/PyTechnology.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +# undef ACCESS_OBJECT +# undef ACCESS_CLASS +# define ACCESS_OBJECT _baseObject._object +# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject) +# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(RegularLayer,regularLayer,function) + + +// +=================================================================+ +// | "PyRegularLayer" Python Module Code Part | +// +=================================================================+ + +# if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyRegularLayer" Attribute Methods | + // +-------------------------------------------------------------+ + + + static PyObject* PyRegularLayer_create ( PyObject*, PyObject* args ) + { + trace << "PyRegularLayer_create()" << endl; + + RegularLayer* regularLayer = NULL; + + HTRY + PyObject* pyTechnology = NULL; + char* name = NULL; + + if (PyArg_ParseTuple( args + , "Os:RegularLayer.create" + , &pyTechnology + , &name + )) { + if (not IsPyTechnology(pyTechnology)) { + PyErr_SetString ( ConstructorError, "RegularLayer.create(): First argument is not of type Technology." ); + return NULL; + } + + regularLayer = RegularLayer::create( PYTECHNOLOGY_O(pyTechnology), Name(name) ); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to RegularLayer.create()." ); + return NULL; + } + HCATCH + + return PyRegularLayer_Link(regularLayer); + } + + + // Standart Attribute. + updatorFromBasicLayer(setBasicLayer ,PyRegularLayer,RegularLayer) + DBoDestroyAttribute (PyRegularLayer_destroy, PyRegularLayer) + + + // --------------------------------------------------------------- + // PyRegularLayer Attribute Method table. + + PyMethodDef PyRegularLayer_Methods[] = + { { "create" , (PyCFunction)PyRegularLayer_create , METH_VARARGS|METH_STATIC + , "Create a new RegularLayer." } + , { "setBasicLayer", (PyCFunction)PyRegularLayer_setBasicLayer, METH_VARARGS + , "Associate a BasicLayer with this RegularLayer." } + , { "destroy" , (PyCFunction)PyRegularLayer_destroy , METH_NOARGS + , "destroy associated hurricane object, the python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + DBoDeleteMethod(RegularLayer) + PyTypeObjectLinkPyType(RegularLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyRegularLayer" Shared Library Code Part | +// +=================================================================+ + + + // Link/Creation Method. + DBoLinkCreateMethod(RegularLayer) + + + PyTypeInheritedObjectDefinitions(RegularLayer, Layer) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. + diff --git a/hurricane/src/isobar/PyRegularLayerCollection.cpp b/hurricane/src/isobar/PyRegularLayerCollection.cpp new file mode 100644 index 00000000..cfa9e379 --- /dev/null +++ b/hurricane/src/isobar/PyRegularLayerCollection.cpp @@ -0,0 +1,89 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyRegularLayerCollection.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyRegularLayerCollection.h" +#include "hurricane/isobar/PyRegularLayer.h" + +namespace Isobar { + +using namespace Hurricane; + + +extern "C" { + + +// +=================================================================+ +// | "PyRegularLayerCollection" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyRegularLayerCollection" Attribute Methods | + // +-------------------------------------------------------------+ + + + DirectDeleteMethod(PyRegularLayerCollection_DeAlloc, PyRegularLayerCollection) + LocatorNextMethod(RegularLayer) + CollectionMethods(RegularLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyRegularLayerCollection" Shared Library Code Part | +// +=================================================================+ + + PyTypeCollectionObjectDefinitions(RegularLayerCollection) + PyTypeCollectionObjectDefinitions(RegularLayerCollectionLocator) + + +#endif // End of Shared Library Code Part. + +} // extern "C". + +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyTechnology.cpp b/hurricane/src/isobar/PyTechnology.cpp index b3c05eff..7ba416d2 100644 --- a/hurricane/src/isobar/PyTechnology.cpp +++ b/hurricane/src/isobar/PyTechnology.cpp @@ -1,20 +1,59 @@ -// x-----------------------------------------------------------------x -// | | + +// -*- 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 +// +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | // | Author : Damien DUPUIS | // | E-mail : Damien.Dupuis@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./PyTechnology.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Module : "./PyTechnology.cpp" | +// +-----------------------------------------------------------------+ + #include "hurricane/isobar/PyDataBase.h" -#include "hurricane/isobar/PyLayer.h" #include "hurricane/isobar/PyTechnology.h" +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/isobar/PyLayerMask.h" +#include "hurricane/isobar/PyBasicLayer.h" +#include "hurricane/isobar/PyRegularLayer.h" +#include "hurricane/isobar/PyViaLayer.h" +#include "hurricane/isobar/PyLayerCollection.h" +#include "hurricane/isobar/PyBasicLayerCollection.h" +#include "hurricane/isobar/PyRegularLayerCollection.h" +#include "hurricane/isobar/PyViaLayerCollection.h" namespace Isobar { @@ -27,73 +66,83 @@ extern "C" { #define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Technology,techno,function) -// x=================================================================x +// +=================================================================+ // | "PyTechnology" Python Module Code Part | -// x=================================================================x +// +=================================================================+ #if defined(__PYTHON_MODULE__) - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ // | "PyTechnology" Attribute Methods | - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ + static PyObject* PyTechnology_create ( PyTechnology*, PyObject* args ) + { + trace << "Technology.create()" << endl; - - // --------------------------------------------------------------- - // Attribute Method : "PyTechnology_getName ()" - - static PyObject* PyTechnology_getName(PyTechnology *self) { - trace << "PyTechnology_getName ()" << endl; + Technology* technology = NULL; HTRY - METHOD_HEAD("Technology.getName()") - return PyString_FromString(getString(techno->getName()).c_str()); - HCATCH - - return NULL; - } - - - // --------------------------------------------------------------- - // Attribute Method : "PyTechnology_setName ()" - - static PyObject* PyTechnology_setName(PyTechnology *self, PyObject* args) { - trace << "Technology.setName()" << endl; - - HTRY - METHOD_HEAD ( "Technology.setName()" ) - char* name = NULL; - if (PyArg_ParseTuple(args,"s:Technology.setName", &name)) { - techno->setName(Name(name)); - } else { - PyErr_SetString(ConstructorError, "invalid number of parameters for Technology.setName."); + PyDataBase* pyDb = NULL; + char* name = NULL; + if (PyArg_ParseTuple(args,"Os:Technology.create", &pyDb, &name)) { + if (not IsPyDataBase(pyDb) ) { + PyErr_SetString(ConstructorError,"Technology.create(): First parameter is not a DataBase."); return NULL; + } + technology = Technology::create( PYDATABASE_O(pyDb), Name(name) ); + } else { + PyErr_SetString(ConstructorError, "Technology.create(): Bad parameter(s) number or type."); + return NULL; } HCATCH - - Py_RETURN_NONE; + + return PyTechnology_Link(technology); } + static PyObject* PyTechnology_getDataBase ( PyTechnology* self ) + { + trace << "PyTechnology_getDataBase()" << endl; - // --------------------------------------------------------------- - // Attribute Method : "PyTechnology_getLayer ()" + DataBase* db = NULL; - static PyObject* PyTechnology_getLayer ( PyTechnology *self, PyObject* args ) { + HTRY + METHOD_HEAD("Technology.getDataBase()") + db = techno->getDataBase(); + HCATCH + + if (db == NULL) Py_RETURN_NONE; + return PyDataBase_Link(db); + } + + + static PyObject* PyTechnology_getLayer ( PyTechnology *self, PyObject* args ) + { trace << "Technology.getLayer()" << endl; + METHOD_HEAD("Technology.getLayer()") Layer* layer = NULL; HTRY - char* name = NULL; - if (PyArg_ParseTuple(args,"s:Technology.getLayer", &name)) { - layer = techno->getLayer(Name(name)); - } else { + PyObject* arg0 = NULL; + PyObject* arg1 = NULL; + if (PyArg_ParseTuple(args,"O|OO:Technology.getLayer", &arg0, &arg1)) { + if (PyString_Check(arg0)) { + layer = techno->getLayer(Name(PyString_AsString(arg0))); + } else if (IsPyLayerMask(arg0)) { + bool useWorking = (arg1 != NULL) ? PyObject_IsTrue(arg1) : true; + layer = techno->getLayer(PYLAYERMASK_O(arg0), useWorking); + } else { PyErr_SetString(ConstructorError, "invalid number of parameters for getLayer."); return NULL; + } + } else { + PyErr_SetString(ConstructorError, "Hurricane.getLayer(): Bad parameter(s) type."); + return NULL; } HCATCH @@ -101,62 +150,167 @@ extern "C" { } + static PyObject* PyTechnology_getBasicLayers ( PyTechnology* self, PyObject* args ) + { + trace << "PyTechnology_getBasicLayers()" << endl; + + PyBasicLayerCollection* pyObjects = NULL; + + HTRY + METHOD_HEAD("Technology.getBasicLayers()") + + PyObject* pyMask = NULL; + BasicLayers* objects = NULL; + + if (PyArg_ParseTuple( args, "O:Technology.getBasicLayers()", &pyMask)) { + if (not IsPyLayerMask(pyMask)) { + PyErr_SetString ( ConstructorError + , "Technology.getBasicLayers(): First argument is not of Layer.Mask type." ); + return NULL; + } + } else { + PyErr_SetString ( ConstructorError + , "Invalid number of parameters passed to Technology.getBasicLayers()." ); + return NULL; + } + + if (pyMask != NULL) + objects = new BasicLayers(techno->getBasicLayers(PYLAYERMASK_O(pyMask))); + else + objects = new BasicLayers(techno->getBasicLayers()); + + pyObjects = PyObject_NEW(PyBasicLayerCollection,&PyTypeBasicLayerCollection); + if (pyObjects == NULL) return NULL; + pyObjects->_object = objects; + HCATCH + + return (PyObject*)pyObjects; + } + + + static PyObject* PyTechnology_setWorkingLayer ( PyTechnology *self, PyObject* args ) { + trace << "Technology.setWorkingLayer()" << endl; + + METHOD_HEAD("Technology.setWorkingLayer()") + + bool rvalue = false; + + HTRY + PyObject* arg0 = NULL; + if (PyArg_ParseTuple(args,"O:Technology.setWorkingLayer", &arg0)) { + if (PyString_Check(arg0)) { + rvalue = techno->setWorkingLayer(Name(PyString_AsString(arg0))); + } else if (IsPyLayer(arg0)) { + rvalue = techno->setWorkingLayer(PYLAYER_O(arg0)); + } else { + PyErr_SetString(ConstructorError, "Hurricane.setWorkingLayer(): Invalid number of parameters."); + return NULL; + } + } else { + PyErr_SetString(ConstructorError, "Hurricane.setWorkingLayer(): Bad parameter type."); + return NULL; + } + HCATCH + + if (rvalue) Py_RETURN_TRUE; + Py_RETURN_FALSE; + } // Standart Accessors (Attributes). + GetNameMethod (Technology,techno) + SetNameMethod (Technology,techno) + predicateFromLayer (isMetal ,PyTechnology,Technology) + accessorAnyLayerFromName (getBasicLayer ,PyTechnology,Technology,BasicLayer ) + accessorAnyLayerFromName (getRegularLayer ,PyTechnology,Technology,RegularLayer) + accessorAnyLayerFromName (getViaLayer ,PyTechnology,Technology,ViaLayer ) + accessorCollectionFromVoid (getLayers ,PyTechnology,Technology,Layer ) + accessorCollectionFromVoid (getRegularLayers,PyTechnology,Technology,RegularLayer) + accessorCollectionFromVoid (getViaLayers ,PyTechnology,Technology,ViaLayer ) + accessorLayerFromLayerOptBool(getMetalAbove ,PyTechnology,Technology) + accessorLayerFromLayerOptBool(getMetalBelow ,PyTechnology,Technology) + accessorLayerFromLayerOptBool(getCutAbove ,PyTechnology,Technology) + accessorLayerFromLayerOptBool(getCutBelow ,PyTechnology,Technology) + accessorLayerFromLayerLayer (getViaBetween ,PyTechnology,Technology) + accessorLayerFromInt (getNthMetal ,PyTechnology,Technology) // Standard destroy (Attribute). DBoDestroyAttribute(PyTechnology_destroy, PyTechnology) - - // --------------------------------------------------------------- // PyTechnology Attribute Method table. PyMethodDef PyTechnology_Methods[] = - { { "getName" , (PyCFunction)PyTechnology_getName , METH_NOARGS , "Returns the name of the technology." } - , { "setName" , (PyCFunction)PyTechnology_setName , METH_VARARGS, "Allows to change the technology name." } - , { "getLayer" , (PyCFunction)PyTechnology_getLayer , METH_VARARGS, "Returns the layer named name." } - , { "destroy" , (PyCFunction)PyTechnology_destroy , METH_NOARGS - , "Destroy associated hurricane object The python object remains." } - , {NULL, NULL, 0, NULL} /* sentinel */ + { { "create" , (PyCFunction)PyTechnology_create , METH_VARARGS|METH_STATIC + , "Create the Technology object." } + , { "isMetal" , (PyCFunction)PyTechnology_isMetal , METH_VARARGS + , "Tells if the given layer is of metal kind (Material)." } + , { "getDataBase" , (PyCFunction)PyTechnology_getDataBase , METH_NOARGS + , "Returns the associated DataBase." } + , { "getName" , (PyCFunction)PyTechnology_getName , METH_NOARGS + , "Returns the name of the technology." } + , { "getLayer" , (PyCFunction)PyTechnology_getLayer , METH_VARARGS + , "Returns the layer named name." } + , { "getBasicLayer" , (PyCFunction)PyTechnology_getBasicLayer , METH_VARARGS + , "Returns the BasicLayer named name." } + , { "getRegularLayer" , (PyCFunction)PyTechnology_getRegularLayer , METH_VARARGS + , "Returns the RegularLayer named name." } + , { "getViaLayer" , (PyCFunction)PyTechnology_getViaLayer , METH_VARARGS + , "Returns the ViaLayer named name." } + , { "getLayers" , (PyCFunction)PyTechnology_getLayers , METH_NOARGS + , "Returns the collection of all Layers." } + , { "getBasicLayers" , (PyCFunction)PyTechnology_getBasicLayers , METH_VARARGS + , "Returns the collection of all BasicLayers." } + , { "getRegularLayers" , (PyCFunction)PyTechnology_getRegularLayers, METH_NOARGS + , "Returns the collection of all RegularLayers." } + , { "getViaLayers" , (PyCFunction)PyTechnology_getViaLayers , METH_NOARGS + , "Returns the collection of all BasicLayers." } + , { "getMetalAbove" , (PyCFunction)PyTechnology_getMetalAbove , METH_VARARGS + , "Returns the metal layer immediatly above this one." } + , { "getMetalBelow" , (PyCFunction)PyTechnology_getMetalBelow , METH_VARARGS + , "Returns the metal layer immediatly below this one." } + , { "getCutAbove" , (PyCFunction)PyTechnology_getCutAbove , METH_VARARGS + , "Returns the cut layer immediatly above this one." } + , { "getCutBelow" , (PyCFunction)PyTechnology_getCutBelow , METH_VARARGS + , "Returns the cut layer immediatly below." } + , { "getViaBetween" , (PyCFunction)PyTechnology_getViaBetween , METH_VARARGS + , "Returns the VIA between those two layers (must be adjacent)." } + , { "getNthMetal" , (PyCFunction)PyTechnology_getNthMetal , METH_VARARGS + , "Returns Nth metal (zero is nearest substrate)." } + , { "setName" , (PyCFunction)PyTechnology_setName , METH_VARARGS + , "Allows to change the technology name." } + , { "setWorkingLayer" , (PyCFunction)PyTechnology_setWorkingLayer , METH_VARARGS + , "Mark a Layer as the working one (by name or by Layer)." } + , { "destroy" , (PyCFunction)PyTechnology_destroy , METH_NOARGS + , "Destroy associated hurricane object The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ }; - - - // x-------------------------------------------------------------x - // | "PyTechnology" Object Methods | - // x-------------------------------------------------------------x - - DBoDeleteMethod(Technology) PyTypeObjectLinkPyType(Technology) + #else // End of Python Module Code Part. -// x=================================================================x +// +=================================================================+ // | "PyTechnology" Shared Library Code Part | -// x=================================================================x - +// +=================================================================+ // Link/Creation Method. DBoLinkCreateMethod(Technology) // --------------------------------------------------------------- // PyTechnology Object Definitions. + PyTypeObjectDefinitions(Technology) #endif // End of Shared Library Code Part. +} // extern "C". -} // End of extern "C". - - - - -} // End of Isobar namespace. +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyTransistorLayer.cpp b/hurricane/src/isobar/PyTransistorLayer.cpp new file mode 100644 index 00000000..89f56a28 --- /dev/null +++ b/hurricane/src/isobar/PyTransistorLayer.cpp @@ -0,0 +1,182 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyTransistorLayer.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyTransistorLayer.h" +#include "hurricane/isobar/PyTechnology.h" +#include "hurricane/isobar/PyBasicLayer.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +# undef ACCESS_OBJECT +# undef ACCESS_CLASS +# define ACCESS_OBJECT _baseObject._object +# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject) +# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(TransistorLayer,transistorLayer,function) + + +// +=================================================================+ +// | "PyTransistorLayer" Python Module Code Part | +// +=================================================================+ + +# if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyTransistorLayer" Attribute Methods | + // +-------------------------------------------------------------+ + + + static PyObject* PyTransistorLayer_create ( PyObject*, PyObject* args ) + { + trace << "PyTransistorLayer_create()" << endl; + + TransistorLayer* transistorLayer = NULL; + + HTRY + PyObject* pyTechnology = NULL; + char* name = NULL; + PyObject* pyGate = NULL; + PyObject* pyActive = NULL; + PyObject* pyDiffusion = NULL; + PyObject* pyWell = NULL; + + if (PyArg_ParseTuple( args + , "OsOOOO:TransistorLayer.create" + , &pyTechnology + , &name + , &pyGate + , &pyActive + , &pyDiffusion + , &pyWell + )) { + if (not IsPyTechnology(pyTechnology)) { + PyErr_SetString ( ConstructorError, "Transistor.create(): First argument is not of type Technology." ); + return NULL; + } + if (not IsPyBasicLayer(pyGate)) { + PyErr_SetString ( ConstructorError, "Transistor.create(): Third argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyActive)) { + PyErr_SetString ( ConstructorError, "Transistor.create(): Fourth argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyDiffusion)) { + PyErr_SetString ( ConstructorError, "Transistor.create(): Fifth argument is not of type BasicLayer." ); + return NULL; + } + BasicLayer* xwell = NULL; + if (pyWell != Py_None) { + if (not IsPyBasicLayer(pyWell)) { + PyErr_SetString ( ConstructorError, "Transistor.create(): Sixth argument is not of type BasicLayer." ); + return NULL; + } + xwell = PYBASICLAYER_O(pyWell); + } + + transistorLayer = TransistorLayer::create( PYTECHNOLOGY_O(pyTechnology) + , Name(name) + , PYBASICLAYER_O(pyGate) + , PYBASICLAYER_O(pyActive) + , PYBASICLAYER_O(pyDiffusion) + , xwell + ); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to TransistorLayer.create()." ); + return NULL; + } + HCATCH + + return PyTransistorLayer_Link(transistorLayer); + } + + + // Standart destroy (Attribute). + DBoDestroyAttribute(PyTransistorLayer_destroy, PyTransistorLayer) + + + // --------------------------------------------------------------- + // PyTransistorLayer Attribute Method table. + + PyMethodDef PyTransistorLayer_Methods[] = + { { "create" , (PyCFunction)PyTransistorLayer_create , METH_VARARGS|METH_STATIC + , "Create a new TransistorLayer." } + , { "destroy" , (PyCFunction)PyTransistorLayer_destroy , METH_NOARGS + , "destroy associated hurricane object, the python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + DBoDeleteMethod(TransistorLayer) + PyTypeObjectLinkPyType(TransistorLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyTransistorLayer" Shared Library Code Part | +// +=================================================================+ + + + // Link/Creation Method. + DBoLinkCreateMethod(TransistorLayer) + + + PyTypeInheritedObjectDefinitions(TransistorLayer, Layer) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyViaLayer.cpp b/hurricane/src/isobar/PyViaLayer.cpp new file mode 100644 index 00000000..02c2f14d --- /dev/null +++ b/hurricane/src/isobar/PyViaLayer.cpp @@ -0,0 +1,172 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyViaLayer.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyViaLayer.h" +#include "hurricane/isobar/PyTechnology.h" +#include "hurricane/isobar/PyBasicLayer.h" + + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + + +# undef ACCESS_OBJECT +# undef ACCESS_CLASS +# define ACCESS_OBJECT _baseObject._object +# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject) +# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(ViaLayer,viaLayer,function) + + +// +=================================================================+ +// | "PyViaLayer" Python Module Code Part | +// +=================================================================+ + +# if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyViaLayer" Attribute Methods | + // +-------------------------------------------------------------+ + + + static PyObject* PyViaLayer_create ( PyObject*, PyObject* args ) + { + trace << "PyViaLayer_create()" << endl; + + ViaLayer* viaLayer = NULL; + + HTRY + PyObject* pyTechnology = NULL; + char* name = NULL; + PyObject* pyBottom = NULL; + PyObject* pyCut = NULL; + PyObject* pyTop = NULL; + + if (PyArg_ParseTuple( args + , "OsOOO:ViaLayer.create" + , &pyTechnology + , &name + , &pyBottom + , &pyCut + , &pyTop + )) { + if (not IsPyTechnology(pyTechnology)) { + PyErr_SetString ( ConstructorError, "Via.create(): First argument is not of type Technology." ); + return NULL; + } + if (not IsPyBasicLayer(pyBottom)) { + PyErr_SetString ( ConstructorError, "Via.create(): Third argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyCut)) { + PyErr_SetString ( ConstructorError, "Via.create(): Fourth argument is not of type BasicLayer." ); + return NULL; + } + if (not IsPyBasicLayer(pyTop)) { + PyErr_SetString ( ConstructorError, "Via.create(): Fifth argument is not of type BasicLayer." ); + return NULL; + } + + viaLayer = ViaLayer::create( PYTECHNOLOGY_O(pyTechnology) + , Name(name) + , PYBASICLAYER_O(pyBottom) + , PYBASICLAYER_O(pyCut) + , PYBASICLAYER_O(pyTop) + ); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to ViaLayer.create()." ); + return NULL; + } + HCATCH + + return PyViaLayer_Link(viaLayer); + } + + + // Standart destroy (Attribute). + DBoDestroyAttribute(PyViaLayer_destroy, PyViaLayer) + + + // --------------------------------------------------------------- + // PyViaLayer Attribute Method table. + + PyMethodDef PyViaLayer_Methods[] = + { { "create" , (PyCFunction)PyViaLayer_create , METH_VARARGS|METH_STATIC + , "Create a new ViaLayer." } + , { "destroy" , (PyCFunction)PyViaLayer_destroy , METH_NOARGS + , "destroy associated hurricane object, the python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + DBoDeleteMethod(ViaLayer) + PyTypeObjectLinkPyType(ViaLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyViaLayer" Shared Library Code Part | +// +=================================================================+ + + + // Link/Creation Method. + DBoLinkCreateMethod(ViaLayer) + + + PyTypeInheritedObjectDefinitions(ViaLayer, Layer) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // Isobar namespace. + diff --git a/hurricane/src/isobar/PyViaLayerCollection.cpp b/hurricane/src/isobar/PyViaLayerCollection.cpp new file mode 100644 index 00000000..8e1541a5 --- /dev/null +++ b/hurricane/src/isobar/PyViaLayerCollection.cpp @@ -0,0 +1,89 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyViaLayerCollection.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyViaLayerCollection.h" +#include "hurricane/isobar/PyViaLayer.h" + +namespace Isobar { + +using namespace Hurricane; + + +extern "C" { + + +// +=================================================================+ +// | "PyViaLayerCollection" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + + + // +-------------------------------------------------------------+ + // | "PyViaLayerCollection" Attribute Methods | + // +-------------------------------------------------------------+ + + + DirectDeleteMethod(PyViaLayerCollection_DeAlloc, PyViaLayerCollection) + LocatorNextMethod(ViaLayer) + CollectionMethods(ViaLayer) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyViaLayerCollection" Shared Library Code Part | +// +=================================================================+ + + PyTypeCollectionObjectDefinitions(ViaLayerCollection) + PyTypeCollectionObjectDefinitions(ViaLayerCollectionLocator) + + +#endif // End of Shared Library Code Part. + +} // extern "C". + +} // Isobar namespace. diff --git a/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h b/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h index c7be318f..2b01d853 100644 --- a/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h +++ b/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h @@ -1,61 +1,22 @@ // -*- 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-2012, 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: ProxyProperty.h,v 1.9 2007/07/29 15:27:27 jpc Exp $ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | -// | Author : Jean-Paul CHAPUT | +// | Authors : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./ProxyProperty.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/isobar/ProxyProperty.h" | +// +-----------------------------------------------------------------+ - - - -#ifndef __PROXYPROPERTY__ -#define __PROXYPROPERTY__ - +#ifndef __PROXY_PROPERTY__ +#define __PROXY_PROPERTY__ #include "hurricane/DBo.h" #include "hurricane/Property.h" @@ -63,74 +24,57 @@ namespace Isobar { - using namespace Hurricane; - - -// ------------------------------------------------------------------- -// Miscellaneous. - #define F_PY_OWNED ( 1 << 0 ) -#define CHECK_OFFSET(PY_STRUCT) \ - if ( ProxyProperty::getOffset() < 0 ) \ - ProxyProperty::SetOffset ( (unsigned long)(&(PY_STRUCT->ACCESS_OBJECT)) \ - - (unsigned long)PY_STRUCT ); - +#define CHECK_OFFSET(PY_STRUCT,TYPE) \ + if ( ProxyProperty::getOffset() < 0 ) { \ + ProxyProperty::setOffset( (unsigned long)(&(PY_STRUCT->ACCESS_OBJECT)) \ + - (unsigned long)PY_STRUCT); \ + } // ------------------------------------------------------------------- // Class : "::ProxyProperty" class ProxyProperty : public Property { + public: + static const Name& getPropertyName () { return _name; } + static int getOffset () { return _offset; }; + static void setOffset ( int offset ); + static ProxyProperty* create ( void* _shadow=NULL ); + public: + DBo* getOwner () const { return _owner; }; + void* getShadow () const { return _shadow; }; + void* getShadowMember () const { return (void*)((unsigned long)_shadow+_offset); }; + template + DBoType* getAsType () { return dynamic_cast(_owner); }; + public: + virtual Name getName () const { return getPropertyName(); } + virtual void onCapturedBy ( DBo* owner ); + virtual void onReleasedBy ( DBo* owner ); + virtual void onNotOwned (); + public: + virtual string _getString () const; + virtual Record* _getRecord () const; + virtual string _getTypeName () const { return _TName("ProxyProperty"); }; - // Shared Attributes. - protected: static Name _name; - protected: static int _offset; - - // Attributes. - protected: DBo* _owner; - protected: void* _shadow; - - // Constructors. - protected: ProxyProperty ( void* _shadow ); - private: ProxyProperty ( const ProxyProperty& ); - private: ProxyProperty& operator= ( const ProxyProperty& ); - public: static ProxyProperty* create ( void* _shadow=NULL ); - - // Accessors. - public: DBo* getOwner () const { return ( _owner ); }; - public: void* getShadow () const { return ( _shadow ); }; - public: void* getShadowMember () const { return ( (void*)((unsigned long)_shadow+_offset) ); }; - public: template - DBoType* getAsType () { return ( dynamic_cast(_owner) ); }; - - // Static methods. - public: static int getOffset () { return ( _offset ); }; - public: static void SetOffset ( int offset ); - - // Property Managment. - public: static const Name &getPropertyName () { return ( _name ); } - public: virtual Name getName () const { return (getPropertyName()); } - public: virtual void onCapturedBy ( DBo* owner ); - public: virtual void onReleasedBy ( DBo* owner ); - public: virtual void onNotOwned (); - protected: virtual void _preDestroy (); - - // Hurricane Managment. - public: virtual string _getString () const; - public: virtual Record* _getRecord () const; - public: virtual string _getTypeName () const { return _TName("ProxyProperty"); }; - + protected: + static Name _name; + static int _offset; + DBo* _owner; + void* _shadow; + protected: + ProxyProperty ( void* _shadow ); + virtual void _preDestroy (); + private: + ProxyProperty ( const ProxyProperty& ); + ProxyProperty& operator= ( const ProxyProperty& ); }; - - -} // End of Isobar namespace. - - +} // Isobar namespace. #endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyBasicLayer.h b/hurricane/src/isobar/hurricane/isobar/PyBasicLayer.h new file mode 100644 index 00000000..fd8ba94a --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyBasicLayer.h @@ -0,0 +1,85 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyBasicLayer.h" | +// +-----------------------------------------------------------------+ + + +# ifndef __PYBASICLAYER__ +# define __PYBASICLAYER__ + +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/BasicLayer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyBasicLayer". + + typedef struct { + PyLayer _baseObject; + } PyBasicLayer; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeBasicLayer; + extern PyMethodDef PyBasicLayer_Methods[]; + + extern PyObject* PyBasicLayer_Link ( Hurricane::BasicLayer* object ); + extern void PyBasicLayer_LinkPyType (); + extern void PyBasicLayer_postModuleInit (); + +# define IsPyBasicLayer(v) ( (v)->ob_type == &PyTypeBasicLayer ) +# define PYBASICLAYER(v) ( (PyBasicLayer*)(v) ) +# define PYBASICLAYER_O(v) ( dynamic_cast(PYBASICLAYER(v)->_baseObject._object) ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyBasicLayerCollection.h b/hurricane/src/isobar/hurricane/isobar/PyBasicLayerCollection.h new file mode 100644 index 00000000..9ffdf76a --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyBasicLayerCollection.h @@ -0,0 +1,87 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyBasicLayerCollection.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __PY_BASICLAYER_COLLECTION__ +#define __PY_BASICLAYER_COLLECTION__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/BasicLayers.h" + + +namespace Isobar { + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyBasicLayerCollection". + + typedef struct { + PyObject_HEAD + Hurricane::BasicLayers* _object; + } PyBasicLayerCollection; + + + typedef struct { + PyObject_HEAD + Hurricane::Locator* _object; + PyBasicLayerCollection* _collection; + } PyBasicLayerCollectionLocator; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeBasicLayerCollection; + extern PyTypeObject PyTypeBasicLayerCollectionLocator; + + extern void PyBasicLayerCollection_LinkPyType(); + + +} // extern "C". + +} // Isobar namespace. + +#endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyCell.h b/hurricane/src/isobar/hurricane/isobar/PyCell.h index 61f3ece1..3fb14881 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyCell.h +++ b/hurricane/src/isobar/hurricane/isobar/PyCell.h @@ -56,14 +56,10 @@ #ifndef __PYCELL__ #define __PYCELL__ - #include "hurricane/isobar/PyEntity.h" +#include "hurricane/Cell.h" -namespace Hurricane { - class Cell; -} - namespace Isobar { extern "C" { diff --git a/hurricane/src/isobar/hurricane/isobar/PyContactLayer.h b/hurricane/src/isobar/hurricane/isobar/PyContactLayer.h new file mode 100644 index 00000000..6350378b --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyContactLayer.h @@ -0,0 +1,84 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyContactLayer.h" | +// +-----------------------------------------------------------------+ + + +# ifndef __PYCONTACTLAYER__ +# define __PYCONTACTLAYER__ + +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/ContactLayer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyContactLayer". + + typedef struct { + PyLayer _baseObject; + } PyContactLayer; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeContactLayer; + extern PyMethodDef PyContactLayer_Methods[]; + + extern PyObject* PyContactLayer_Link ( Hurricane::ContactLayer* object ); + extern void PyContactLayer_LinkPyType (); + +# define IsPyContactLayer(v) ( (v)->ob_type == &PyTypeContactLayer ) +# define PYCONTACTLAYER(v) ( (PyContactLayer*)(v) ) +# define PYCONTACTLAYER_O(v) ( dynamic_cast(PYCONTACTLAYER(v)->_baseObject._object) ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyDbU.h b/hurricane/src/isobar/hurricane/isobar/PyDbU.h index 419ec98e..71a4f930 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyDbU.h +++ b/hurricane/src/isobar/hurricane/isobar/PyDbU.h @@ -31,11 +31,8 @@ // // License-Tag // Authors-Tag -// =================================================================== // -// $Id$ -// -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ // | | // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | @@ -43,14 +40,8 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./PyDbU.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - - +// | C++ Header : "./hurricane/isobar/PyDbU.h" | +// +-----------------------------------------------------------------+ #ifndef __PYUNIT__ @@ -58,46 +49,50 @@ #include "hurricane/isobar/PyHurricane.h" - #include "hurricane/DbU.h" namespace Isobar { - extern "C" { // ------------------------------------------------------------------- // Python Object : "PyDbU". +// +// This is nothing but a hollow shell to provide a "DbU" name space +// at Python level. DbU are just treaded as long long. + typedef struct { + PyObject_HEAD + } PyDbU; // ------------------------------------------------------------------- // Functions & Types exported to "PyHurricane.ccp". - extern PyObject* PyDbU_db ( PyObject* module, PyObject* args ); - extern PyObject* PyDbU_grid ( PyObject* module, PyObject* args ); - extern PyObject* PyDbU_lambda ( PyObject* module, PyObject* args ); - extern PyObject* PyDbU_getDb ( PyObject* module, PyObject* args ); - extern PyObject* PyDbU_getGrid ( PyObject* module, PyObject* args ); - extern PyObject* PyDbU_getLambda ( PyObject* module, PyObject* args ); - extern PyObject* PyDbU_getPhysical ( PyObject* module, PyObject* args ); - extern PyObject* PyDbU_getResolution ( PyObject* module ); - extern PyObject* PyDbU_getOnPhysicalGrid ( PyObject* module, PyObject* args ); + extern PyTypeObject PyTypeDbU; + extern PyMethodDef PyDbU_Methods[]; - extern void DbULoadConstants ( PyObject* dictionnary ); + extern void PyDbU_LinkPyType (); + extern PyObject* PyDbU_fromDb ( PyObject* module, PyObject* args ); + extern PyObject* PyDbU_fromGrid ( PyObject* module, PyObject* args ); + extern PyObject* PyDbU_fromLambda ( PyObject* module, PyObject* args ); + extern PyObject* PyDbU_toDb ( PyObject* module, PyObject* args ); + extern PyObject* PyDbU_toGrid ( PyObject* module, PyObject* args ); + extern PyObject* PyDbU_toLambda ( PyObject* module, PyObject* args ); + extern PyObject* PyDbU_toPhysical ( PyObject* module, PyObject* args ); + extern PyObject* PyDbU_getResolution ( PyObject* module ); + extern PyObject* PyDbU_getOnPhysicalGrid ( PyObject* module, PyObject* args ); + + extern void DbULoadConstants ( PyObject* dictionnary ); + extern void PyDbU_postModuleInit (); -} // End of extern "C". - - - - -} // End of Isobar namespace. - +} // extern "C". +} // Isobar namespace. #endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyDiffusionLayer.h b/hurricane/src/isobar/hurricane/isobar/PyDiffusionLayer.h new file mode 100644 index 00000000..a755bdae --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyDiffusionLayer.h @@ -0,0 +1,84 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyDiffusionLayer.h" | +// +-----------------------------------------------------------------+ + + +# ifndef __PYDIFFUSIONLAYER__ +# define __PYDIFFUSIONLAYER__ + +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/DiffusionLayer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyDiffusionLayer". + + typedef struct { + PyLayer _baseObject; + } PyDiffusionLayer; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeDiffusionLayer; + extern PyMethodDef PyDiffusionLayer_Methods[]; + + extern PyObject* PyDiffusionLayer_Link ( Hurricane::DiffusionLayer* object ); + extern void PyDiffusionLayer_LinkPyType (); + +# define IsPyDiffusionLayer(v) ( (v)->ob_type == &PyTypeDiffusionLayer ) +# define PYDIFFUSIONLAYER(v) ( (PyDiffusionLayer*)(v) ) +# define PYDIFFUSIONLAYER_O(v) ( dynamic_cast(PYDIFFUSIONLAYER(v)->_baseObject._object) ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index 6ed92d7b..9314a4d3 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -1,36 +1,32 @@ -// x-----------------------------------------------------------------x -// | | + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | -// | Author : Jean-Paul CHAPUT | +// | Authors : Jean-Paul CHAPUT | +// | Damien DUPUIS | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./PyHurricane.h" | -// | *************************************************************** | -// | U p d a t e s | -// | Damien DUPUIS 26/04/2005 | -// | | -// x-----------------------------------------------------------------x - - +// | C++ Header : "./hurricane/isobar/PyHurricane.h" | +// +-----------------------------------------------------------------+ #ifndef __PYHURRICANE__ #define __PYHURRICANE__ - #include "Python.h" - #include #include #include #include #include - #include "hurricane/Error.h" #include "hurricane/Warning.h" - #include "hurricane/isobar/ProxyProperty.h" namespace Isobar { @@ -215,6 +211,36 @@ extern "C" { } +# define predicateFromLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* arg0 = NULL; \ + bool rvalue = false; \ + \ + __cs.init (#SELF_TYPE"."#FUNC_NAME"()"); \ + if (PyArg_ParseTuple( args, "O&:"#SELF_TYPE"."#FUNC_NAME"()", Converter, &arg0)) { \ + if ( __cs.getObjectIds() == ":layer" ) \ + rvalue = cobject->FUNC_NAME( PYLAYER_O(arg0) ); \ + else { \ + PyErr_SetString ( ConstructorError \ + , "invalid parameter type for "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + if (rvalue) Py_RETURN_TRUE; \ + HCATCH \ + \ + Py_RETURN_FALSE; \ + } // ------------------------------------------------------------------- @@ -224,11 +250,29 @@ extern "C" { static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetBoolAttribute()") \ - if (cobject->FUNC_NAME()) { \ - Py_RETURN_TRUE; \ - } else { \ - Py_RETURN_FALSE; \ - } \ + if (cobject->FUNC_NAME()) \ + Py_RETURN_TRUE; \ + Py_RETURN_FALSE; \ + } + + + + +// ------------------------------------------------------------------- +// Attribute Method Macro For Predicates. + +# define DirectIsAFromCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectIsAFromCStringAttribute()") \ + HTRY \ + char* value = NULL; \ + if ( !PyArg_ParseTuple(args, "s:", &value) ) \ + return NULL; \ + if (cobject->FUNC_NAME(value)) \ + Py_RETURN_TRUE; \ + HCATCH \ + Py_RETURN_FALSE; \ } @@ -245,14 +289,184 @@ extern "C" { } +// ------------------------------------------------------------------- +// Attribute Method Macro For Unsigned Int. + +# define DirectGetUIntAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetUIntAttribute()") \ + return ( Py_BuildValue ("I",cobject->FUNC_NAME()) ); \ + } + + // ------------------------------------------------------------------- // Attribute Method Macro For Double. # define DirectGetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ - static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ - { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetDoubleAttribute()") \ - return ( Py_BuildValue ("d",cobject->FUNC_NAME()) ); \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetDoubleAttribute()") \ + return ( Py_BuildValue ("d",cobject->FUNC_NAME()) ); \ + } + + +// ------------------------------------------------------------------- +// Attribute Method Macro For String. + +# define DirectGetStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetStringAttribute()") \ + return ( Py_BuildValue ("s",cobject->FUNC_NAME().c_str()) ); \ + } + + +# define accessorAnyLayerFromName(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE,LAYER_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + LAYER_TYPE * rlayer = NULL; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + char* name = NULL; \ + \ + if (PyArg_ParseTuple( args, "s:"#SELF_TYPE"."#FUNC_NAME"()", &name)) { \ + rlayer = const_cast< LAYER_TYPE *>( cobject->FUNC_NAME(Name(name)) ); \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + HCATCH \ + \ + if (rlayer == NULL) Py_RETURN_NONE; \ + return Py##LAYER_TYPE##_Link(rlayer); \ + } + + +# define accessorLayerFromLayerOptBool(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Layer* rlayer = NULL; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* arg0 = NULL; \ + PyObject* arg1 = NULL; \ + bool useWorking = true; \ + \ + if (PyArg_ParseTuple( args, "O|O:"#SELF_TYPE"."#FUNC_NAME"()", &arg0, &arg1)) { \ + if (not IsPyLayer(arg0)) { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): First argument is not of Layer type." ); \ + return NULL; \ + } \ + if (arg1 != NULL) { \ + useWorking = PyObject_IsTrue(arg1); \ + } \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + rlayer = const_cast(cobject->FUNC_NAME( PYLAYER_O(arg0), useWorking) ); \ + HCATCH \ + \ + if (rlayer == NULL) Py_RETURN_NONE; \ + return PyLayer_Link(rlayer); \ + } + + +# define accessorLayerFromLayerLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Layer* rlayer = NULL; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* arg0 = NULL; \ + PyObject* arg1 = NULL; \ + \ + if (PyArg_ParseTuple( args, "OO:"#SELF_TYPE"."#FUNC_NAME"()", &arg0, &arg1)) { \ + if (not IsPyLayer(arg0) or not IsPyLayer(arg1)) { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): First or second argument is not of Layer type." ); \ + return NULL; \ + } \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + rlayer = const_cast(cobject->FUNC_NAME( PYLAYER_O(arg0), PYLAYER_O(arg1)) ); \ + HCATCH \ + \ + if (rlayer == NULL) Py_RETURN_NONE; \ + return PyLayer_Link(rlayer); \ + } + + +# define accessorLayerFromInt(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Layer* rlayer = NULL; \ + int value = 0; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + if (PyArg_ParseTuple( args, "i:"#SELF_TYPE"."#FUNC_NAME"()", &value)) { \ + rlayer = const_cast(cobject->FUNC_NAME(value) ); \ + } else { \ + PyErr_SetString ( ConstructorError \ + , "Invalid number of parameters passed to "#SELF_TYPE"."#FUNC_NAME"()." ); \ + return NULL; \ + } \ + HCATCH \ + \ + if (rlayer == NULL) Py_RETURN_NONE; \ + return PyLayer_Link(rlayer); \ + } + + +# define updatorFromBasicLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + \ + PyObject* pyBasicLayer = NULL; \ + \ + if (PyArg_ParseTuple( args, "O:"#SELF_TYPE"."#FUNC_NAME"()", &pyBasicLayer)) { \ + BasicLayer* layer = PYBASICLAYER_O(pyBasicLayer); \ + if (layer == NULL) { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): First parameter is not of BasicLayer type" ); \ + return NULL; \ + } \ + cobject->FUNC_NAME( layer ); \ + } else { \ + PyErr_SetString ( ConstructorError \ + , #SELF_TYPE"."#FUNC_NAME"(): Bad parameters types or numbers." ); \ + return NULL; \ + } \ + HCATCH \ + \ + Py_RETURN_NONE; \ } @@ -269,7 +483,7 @@ extern "C" { if ( not PyArg_ParseTuple ( args, "O:" STR_FUNC_NAME, &arg0 ) or PyBool_Check(arg0) ) \ return NULL; \ \ - (arg0 == Py_True) ? cobject->FUNC_NAME (true) : cobject->FUNC_NAME (false); \ + (PyObject_IsTrue(arg0)) ? cobject->FUNC_NAME (true) : cobject->FUNC_NAME (false); \ HCATCH \ \ Py_RETURN_NONE; \ @@ -295,6 +509,44 @@ extern "C" { } +// ------------------------------------------------------------------- +// Attribute Method Macro For Double. + +#define DirectSetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetDoubleAttribute()") \ + \ + HTRY \ + PyObject* arg0; \ + if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \ + return ( NULL ); \ + cobject->FUNC_NAME ( PyFloat_AsDouble(arg0) ); \ + HCATCH \ + \ + Py_RETURN_NONE; \ + } + + +// ------------------------------------------------------------------- +// Attribute Method Macro For C String (char*). + +#define DirectSetCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetCStringAttribute()") \ + \ + HTRY \ + char* value = NULL; \ + if ( !PyArg_ParseTuple(args, "s:" PY_FORMAT, &value) ) \ + return NULL; \ + cobject->FUNC_NAME ( value ); \ + HCATCH \ + \ + Py_RETURN_NONE; \ + } + + // ------------------------------------------------------------------- // Attribute Method Macro For Names. @@ -344,18 +596,18 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method For Deletion. -#define DirectDeleteMethod(PY_FUNC_NAME, PY_SELF_TYPE) \ - static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ - { \ - trace << #PY_SELF_TYPE"_DeAlloc(" << hex << self << ") " \ - << self->ACCESS_OBJECT << endl; \ - \ - if ( self->ACCESS_OBJECT ) { \ - trace << "C++ object := " << hex \ - << &(self->ACCESS_OBJECT) << endl; \ - delete self->ACCESS_OBJECT; \ - } \ - PyObject_DEL ( self ); \ +#define DirectDeleteMethod(PY_FUNC_NAME, PY_SELF_TYPE) \ + static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ + { \ + trace << #PY_SELF_TYPE"_DeAlloc(" << hex << self << ") " \ + << self->ACCESS_OBJECT << endl; \ + \ + if ( self->ACCESS_OBJECT ) { \ + trace << "C++ object := " << hex \ + << &(self->ACCESS_OBJECT) << endl; \ + delete self->ACCESS_OBJECT; \ + } \ + PyObject_DEL ( self ); \ } @@ -387,6 +639,7 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method For void methods. + #define DirectVoidMethod(SELF_TYPE, SELF_OBJECT, FUNC_NAME) \ static PyObject* Py##SELF_TYPE##_##FUNC_NAME(Py##SELF_TYPE* self) \ { \ @@ -402,48 +655,48 @@ extern "C" { // ------------------------------------------------------------------- // Collection and Locator macros - -#define CollectionMethods(TYPE) \ - static PyObject* GetLocator(Py##TYPE##Collection* collection) { \ - Py##TYPE##CollectionLocator* cl = \ - PyObject_New(Py##TYPE##CollectionLocator, &PyType##TYPE##CollectionLocator); \ - if (cl == NULL) { \ - return NULL; \ - } \ - cl->_collection = collection; \ - cl->_object = collection->_object->getLocator(); \ - Py_INCREF(collection); \ - return (PyObject *)cl; \ - } \ - \ - static void Py##TYPE##CollectionLocatorDeAlloc(Py##TYPE##CollectionLocator* locator) { \ - Py_XDECREF(locator->_collection); \ - if (locator->_object) { \ - delete locator->_object; \ - } \ - PyObject_Del(locator); \ - } \ - \ - extern void Py##TYPE##Collection_LinkPyType () { \ - trace << "Py"#TYPE"Collection_LinkType()" << endl; \ - PyType##TYPE##Collection.tp_iter = (getiterfunc)GetLocator; /* tp_iter */ \ - PyType##TYPE##Collection.tp_dealloc = (destructor)Py##TYPE##Collection_DeAlloc; \ - PyType##TYPE##CollectionLocator.tp_dealloc = (destructor)Py##TYPE##CollectionLocatorDeAlloc; \ - PyType##TYPE##CollectionLocator.tp_iter = PyObject_SelfIter; \ - PyType##TYPE##CollectionLocator.tp_iternext = (iternextfunc)Py##TYPE##LocatorNext; \ +#define CollectionMethods(TYPE) \ + static PyObject* GetLocator(Py##TYPE##Collection* pyCollection) \ + { \ + Py##TYPE##CollectionLocator* pyLocator = \ + PyObject_New(Py##TYPE##CollectionLocator, &PyType##TYPE##CollectionLocator); \ + if (pyLocator == NULL) return NULL; \ + \ + pyLocator->_collection = pyCollection; \ + pyLocator->_object = pyCollection->_object->getLocator(); \ + Py_INCREF(pyCollection); \ + return (PyObject*)pyLocator; \ + } \ + \ + static void Py##TYPE##CollectionLocatorDeAlloc(Py##TYPE##CollectionLocator* pyLocator) \ + { \ + Py_XDECREF(pyLocator->_collection); \ + if (pyLocator->_object) delete pyLocator->_object; \ + PyObject_Del(pyLocator); \ + } \ + \ + extern void Py##TYPE##Collection_LinkPyType () \ + { \ + trace << "Py"#TYPE"Collection_LinkType()" << endl; \ + PyType##TYPE##Collection.tp_iter = (getiterfunc)GetLocator; \ + PyType##TYPE##Collection.tp_dealloc = (destructor)Py##TYPE##Collection_DeAlloc; \ + PyType##TYPE##CollectionLocator.tp_dealloc = (destructor)Py##TYPE##CollectionLocatorDeAlloc; \ + PyType##TYPE##CollectionLocator.tp_iter = PyObject_SelfIter; \ + PyType##TYPE##CollectionLocator.tp_iternext = (iternextfunc)Py##TYPE##LocatorNext; \ } -#define LocatorNextMethod(TYPE) \ - static PyObject* Py##TYPE##LocatorNext(Py##TYPE##CollectionLocator* pyLocator) { \ - Locator* locator = pyLocator->_object; \ - HTRY \ - if (locator->isValid()) { \ - TYPE* object = locator->getElement(); \ - locator->progress(); \ - return Py##TYPE##_Link(object); \ - } \ - HCATCH \ - return NULL; \ +#define LocatorNextMethod(TYPE) \ + static PyObject* Py##TYPE##LocatorNext(Py##TYPE##CollectionLocator* pyLocator) \ + { \ + Locator* locator = pyLocator->_object; \ + HTRY \ + if (locator->isValid()) { \ + TYPE* object = locator->getElement(); \ + locator->progress(); \ + return Py##TYPE##_Link(object); \ + } \ + HCATCH \ + return NULL; \ } @@ -461,6 +714,147 @@ extern "C" { } +# define accessorCollectionFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE,COLL_TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Py##COLL_TYPE##Collection* pyObjects = NULL; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + COLL_TYPE##s* objects = new COLL_TYPE##s(cobject->FUNC_NAME()); \ + pyObjects = PyObject_NEW(Py##COLL_TYPE##Collection,&PyType##COLL_TYPE##Collection); \ + if (pyObjects == NULL) return NULL; \ + pyObjects->_object = objects; \ + HCATCH \ + \ + return (PyObject*)pyObjects; \ + } + + +// ------------------------------------------------------------------- +// Vector macros + +#define declareVectorObject(TYPE) \ + typedef struct { \ + PyObject_HEAD \ + const std::vector* _container; \ + } Py##TYPE##Vector; \ + \ + typedef struct { \ + PyObject_HEAD \ + Py##TYPE##Vector* _pyContainer; \ + std::vector::const_iterator _iterator; \ + } Py##TYPE##VectorIterator; \ + \ + extern PyTypeObject PyType##TYPE##Vector; \ + extern PyTypeObject PyType##TYPE##VectorIterator; \ + \ + extern void Py##TYPE##Vector_LinkPyType(); + + +#define VectorMethods(TYPE) \ + static PyObject* Py##TYPE##Vector_GetIterator(Py##TYPE##Vector* pyVector) \ + { \ + Py##TYPE##VectorIterator* pyIterator = \ + PyObject_New(Py##TYPE##VectorIterator, &PyType##TYPE##VectorIterator); \ + if (pyIterator == NULL) return NULL; \ + \ + pyIterator->_pyContainer = pyVector; \ + pyIterator->_iterator = pyVector->_container->begin(); \ + Py_INCREF(pyVector); \ + return (PyObject*)pyIterator; \ + } \ + \ + static void Py##TYPE##Vector_DeAlloc(Py##TYPE##Vector* pyVector) \ + { \ + PyObject_Del(pyVector); \ + } \ + \ + static void Py##TYPE##VectorIterator_DeAlloc(Py##TYPE##VectorIterator* pyIterator) \ + { \ + Py_XDECREF(pyIterator->_pyContainer); \ + PyObject_Del(pyIterator); \ + } \ + \ + extern void Py##TYPE##Vector_LinkPyType () \ + { \ + trace << "Py"#TYPE"Vector_LinkType()" << endl; \ + \ + PyType##TYPE##Vector.tp_iter = (getiterfunc)Py##TYPE##Vector_GetIterator; \ + PyType##TYPE##Vector.tp_dealloc = (destructor)Py##TYPE##Vector_DeAlloc; \ + PyType##TYPE##VectorIterator.tp_dealloc = (destructor)Py##TYPE##VectorIterator_DeAlloc; \ + PyType##TYPE##VectorIterator.tp_iter = PyObject_SelfIter; \ + PyType##TYPE##VectorIterator.tp_iternext = (iternextfunc)Py##TYPE##IteratorNext; \ + } + +#define IteratorNextMethod(TYPE) \ + static PyObject* Py##TYPE##IteratorNext(Py##TYPE##VectorIterator* pyIterator) \ + { \ + HTRY \ + if (pyIterator->_iterator != pyIterator->_pyContainer->_container->end()) { \ + TYPE* object = *(pyIterator->_iterator); \ + ++(pyIterator->_iterator); \ + return Py##TYPE##_Link(object); \ + } \ + HCATCH \ + return NULL; \ + } + + +# define accessorVectorFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE,TYPE) \ + static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ + { \ + trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + \ + Py##TYPE##Vector* pyVector = NULL; \ + \ + HTRY \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ + pyVector = PyObject_NEW(Py##TYPE##Vector,&PyType##TYPE##Vector); \ + if (pyVector == NULL) return NULL; \ + pyVector->_container = &cobject->FUNC_NAME(); \ + HCATCH \ + \ + return (PyObject*)pyVector; \ + } + + +// ------------------------------------------------------------------- +// Vector macros (partials redefinition only) + +#define declareVectorValObject(TYPE) \ + typedef struct { \ + PyObject_HEAD \ + const std::vector* _container; \ + } Py##TYPE##Vector; \ + \ + typedef struct { \ + PyObject_HEAD \ + Py##TYPE##Vector* _pyContainer; \ + std::vector::const_iterator _iterator; \ + } Py##TYPE##VectorIterator; \ + \ + extern PyTypeObject PyType##TYPE##Vector; \ + extern PyTypeObject PyType##TYPE##VectorIterator; \ + \ + extern void Py##TYPE##Vector_LinkPyType(); + +#define IteratorValNextMethod(TYPE) \ + static PyObject* Py##TYPE##IteratorNext(Py##TYPE##VectorIterator* pyIterator) \ + { \ + HTRY \ + if (pyIterator->_iterator != pyIterator->_pyContainer->_container->end()) { \ + TYPE object = *(pyIterator->_iterator); \ + ++(pyIterator->_iterator); \ + return Py##TYPE##_Link(object); \ + } \ + HCATCH \ + return NULL; \ + } + + // ------------------------------------------------------------------- // Attribute Method For Repr. @@ -528,31 +922,51 @@ extern "C" { } +// ------------------------------------------------------------------- +// Attribute Macro For Simple Link/Creation. + +#define LinkCreateMethod(SELF_TYPE) \ + PyObject* Py##SELF_TYPE##_Link ( SELF_TYPE* object ) { \ + if ( object == NULL ) { \ + Py_RETURN_NONE; \ + } \ + Py##SELF_TYPE* pyObject = NULL; \ + HTRY \ + pyObject = PyObject_NEW(Py##SELF_TYPE, &PyType##SELF_TYPE); \ + if (pyObject == NULL) { return NULL; } \ + \ + pyObject->ACCESS_OBJECT = object; \ + HCATCH \ + \ + return ( (PyObject*)pyObject ); \ + } + + // ------------------------------------------------------------------- // Attribute Macro For DBo Deletion. -# define DBoDestroyAttribute(PY_FUNC_NAME,PY_SELF_TYPE) \ - static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ - { \ - HTRY \ - if ( self->ACCESS_OBJECT == NULL ) { \ - ostringstream message; \ +# define DBoDestroyAttribute(PY_FUNC_NAME,PY_SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ + { \ + HTRY \ + if ( self->ACCESS_OBJECT == NULL ) { \ + ostringstream message; \ message << "applying a Delete to a Python object with no HURRICANE object attached"; \ - PyErr_SetString ( ProxyError, message.str().c_str() ); \ - return ( NULL ); \ - } \ - ProxyProperty* proxy = static_cast \ + PyErr_SetString ( ProxyError, message.str().c_str() ); \ + return ( NULL ); \ + } \ + ProxyProperty* proxy = static_cast \ ( self->ACCESS_OBJECT->getProperty ( ProxyProperty::getPropertyName() ) ); \ - if (proxy == NULL) { \ - ostringstream message; \ - message << "Trying to Delete a Hurricane object of with no Proxy attached "; \ - PyErr_SetString ( ProxyError, message.str().c_str() ); \ - return ( NULL ); \ - } \ - self->ACCESS_OBJECT->destroy(); \ - HCATCH \ - Py_RETURN_NONE; \ + if (proxy == NULL) { \ + ostringstream message; \ + message << "Trying to Delete a Hurricane object of with no Proxy attached "; \ + PyErr_SetString ( ProxyError, message.str().c_str() ); \ + return ( NULL ); \ + } \ + self->ACCESS_OBJECT->destroy(); \ + HCATCH \ + Py_RETURN_NONE; \ } // ------------------------------------------------------------------- @@ -572,7 +986,7 @@ extern "C" { if (pyObject == NULL) { return NULL; } \ \ proxy = ProxyProperty::create ( (void*)pyObject ); \ - CHECK_OFFSET ( pyObject ) \ + CHECK_OFFSET ( pyObject, SELF_TYPE ) \ \ pyObject->ACCESS_OBJECT = object; \ object->put ( proxy ); \ @@ -618,6 +1032,21 @@ extern "C" { { \ trace << "PythonOnlyObject_DeAlloc(" << hex << self << ") " \ << self->ACCESS_OBJECT << endl; \ + PyObject_DEL ( self ); \ + } + + + + +// ------------------------------------------------------------------- +// Attribute Method For Python Only Object Deletion. + +# define NoObjectDeleteMethod(SELF_TYPE) \ + static void Py##SELF_TYPE##_DeAlloc ( Py##SELF_TYPE *self ) \ + { \ + trace << "PythonOnlyObject_DeAlloc(" << hex << self << ") " \ + << "[no object]" << endl; \ + PyObject_DEL ( self ); \ } @@ -665,22 +1094,6 @@ extern "C" { #define PyTypeObjectLinkPyType(SELF_TYPE) \ PyTypeObjectLinkPyTypeWithClass(SELF_TYPE,SELF_TYPE) -// #define PyTypeObjectLinkPyType(SELF_TYPE) -// DirectReprMethod(Py##SELF_TYPE##_Repr, Py##SELF_TYPE, SELF_TYPE) -// DirectStrMethod (Py##SELF_TYPE##_Str, Py##SELF_TYPE, SELF_TYPE) -// DirectCmpMethod (Py##SELF_TYPE##_Cmp, IsPy##SELF_TYPE, Py##SELF_TYPE) -// DirectHashMethod(Py##SELF_TYPE##_Hash, Py##SELF_TYPE) -// extern void Py##SELF_TYPE##_LinkPyType() { -// trace << "Py" #SELF_TYPE "_LinkType()" << endl; -// -// PyType##SELF_TYPE.tp_dealloc = (destructor) Py##SELF_TYPE##_DeAlloc; -// PyType##SELF_TYPE.tp_compare = (cmpfunc) Py##SELF_TYPE##_Cmp; -// PyType##SELF_TYPE.tp_repr = (reprfunc) Py##SELF_TYPE##_Repr; -// PyType##SELF_TYPE.tp_str = (reprfunc) Py##SELF_TYPE##_Str; -// PyType##SELF_TYPE.tp_hash = (hashfunc) Py##SELF_TYPE##_Hash; -// PyType##SELF_TYPE.tp_methods = Py##SELF_TYPE##_Methods; -// } - // Special Initialisation Function for Locator PyTypeObject Runtime Link. #define LocatorPyTypeObjectLinkPyType(PY_SELF_TYPE, SELF_TYPE) \ @@ -725,7 +1138,34 @@ extern "C" { , "#SELF_TYPE objects" /* tp_doc. */ \ }; -# define PyTypeRootObjectDefinitions(SELF_TYPE) \ +#define PyTypeObjectDefinitionsOfModule(MODULE,SELF_TYPE) \ + PyTypeObject PyType##SELF_TYPE = \ + { PyObject_HEAD_INIT(NULL) \ + 0 /* ob_size. */ \ + , #MODULE "." #SELF_TYPE /* tp_name. */ \ + , sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \ + , 0 /* tp_itemsize. */ \ + /* methods. */ \ + , 0 /* tp_dealloc. */ \ + , 0 /* tp_print. */ \ + , 0 /* tp_getattr. */ \ + , 0 /* tp_setattr. */ \ + , 0 /* tp_compare. */ \ + , 0 /* tp_repr. */ \ + , 0 /* tp_as_number. */ \ + , 0 /* tp_as_sequence. */ \ + , 0 /* tp_as_mapping. */ \ + , 0 /* tp_hash. */ \ + , 0 /* tp_call. */ \ + , 0 /* tp_str */ \ + , 0 /* tp_getattro. */ \ + , 0 /* tp_setattro. */ \ + , 0 /* tp_as_buffer. */ \ + , Py_TPFLAGS_DEFAULT /* tp_flags */ \ + , "#SELF_TYPE objects" /* tp_doc. */ \ + }; + +#define PyTypeRootObjectDefinitions(SELF_TYPE) \ PyTypeObject PyType##SELF_TYPE = \ { PyObject_HEAD_INIT(&PyType_Type) \ 0 /* ob_size. */ \ @@ -753,7 +1193,7 @@ extern "C" { , "#SELF_TYPE objects" /* tp_doc. */ \ }; -# define PyTypeInheritedObjectDefinitions(SELF_TYPE, INHERITED_TYPE) \ +#define PyTypeInheritedObjectDefinitions(SELF_TYPE, INHERITED_TYPE) \ PyTypeObject PyType##SELF_TYPE = \ { PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType##INHERITED_TYPE)) \ 0 /* ob_size. */ \ @@ -797,7 +1237,7 @@ extern "C" { { PyObject_HEAD_INIT(NULL) \ 0 /* ob_size. */ \ , "Hurricane."#SELF_TYPE /* tp_name. */ \ - , sizeof(Py ##SELF_TYPE) /* tp_basicsize. */ \ + , sizeof(Py ##SELF_TYPE) /* tp_basicsize. */ \ , 0 /* tp_itemsize. */ \ /* methods. */ \ , 0 /* tp_dealloc. */ \ @@ -819,23 +1259,52 @@ extern "C" { , "#SELF_TYPE objects" /* tp_doc. */ \ }; + +#define PyTypeVectorObjectDefinitions(SELF_TYPE) \ + PyTypeObject PyType##SELF_TYPE = \ + { PyObject_HEAD_INIT(NULL) \ + 0 /* ob_size. */ \ + , "Hurricane."#SELF_TYPE /* tp_name. */ \ + , sizeof(Py ##SELF_TYPE) /* tp_basicsize. */ \ + , 0 /* tp_itemsize. */ \ + /* methods. */ \ + , 0 /* tp_dealloc. */ \ + , 0 /* tp_print. */ \ + , 0 /* tp_getattr. */ \ + , 0 /* tp_setattr. */ \ + , 0 /* tp_compare. */ \ + , 0 /* tp_repr. */ \ + , 0 /* tp_as_number. */ \ + , 0 /* tp_as_sequence. */ \ + , 0 /* tp_as_mapping. */ \ + , 0 /* tp_hash. */ \ + , 0 /* tp_call. */ \ + , 0 /* tp_str */ \ + , PyObject_GenericGetAttr /* tp_getattro. */ \ + , 0 /* tp_setattro. */ \ + , 0 /* tp_as_buffer. */ \ + , Py_TPFLAGS_DEFAULT /* tp_flags. */ \ + , "#SELF_TYPE objects" /* tp_doc. */ \ + }; + + // ------------------------------------------------------------------- //PyType_Ready Methods -#define PYTYPE_READY(TYPE) \ - if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ - cerr << "[ERROR]\n" \ +#define PYTYPE_READY(TYPE) \ + if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ + cerr << "[ERROR]\n" \ << " Failed to initialize ." << endl; \ - return; \ + return; \ } -#define PYTYPE_READY_SUB(TYPE, TYPE_BASE) \ - PyType##TYPE.tp_base = &PyType##TYPE_BASE; \ - if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ - cerr << "[ERROR]\n" \ +#define PYTYPE_READY_SUB(TYPE, TYPE_BASE) \ + PyType##TYPE.tp_base = &PyType##TYPE_BASE; \ + if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \ + cerr << "[ERROR]\n" \ << " Failed to initialize ." << endl; \ - return; \ + return; \ } diff --git a/hurricane/src/isobar/hurricane/isobar/PyLayer.h b/hurricane/src/isobar/hurricane/isobar/PyLayer.h index 3e25e435..82ea32e2 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyLayer.h +++ b/hurricane/src/isobar/hurricane/isobar/PyLayer.h @@ -31,23 +31,17 @@ // // License-Tag // Authors-Tag -// =================================================================== // -// $Id: PyLayer.h,v 1.4 2006/05/03 14:00:03 jpc Exp $ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | // | Author : Damien DUPUIS | -// | E-mail : Damien.Dupuis@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./PyLayer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/isobar/PyLayer.h" | +// +-----------------------------------------------------------------+ + # ifndef __PYLAYER__ # define __PYLAYER__ @@ -76,16 +70,17 @@ extern "C" { extern PyTypeObject PyTypeLayer; extern PyMethodDef PyLayer_Methods[]; - extern PyObject* PyLayer_Link ( Hurricane::Layer* object ); - extern void PyLayer_LinkPyType (); + extern PyObject* PyLayer_Link ( Hurricane::Layer* object ); + extern void PyLayer_LinkPyType (); + extern void PyLayer_postModuleInit (); # define IsPyLayer(v) ( (v)->ob_type == &PyTypeLayer ) # define PYLAYER(v) ( (PyLayer*)(v) ) # define PYLAYER_O(v) ( PYLAYER(v)->_object ) -} // End of extern "C". +} // extern "C". -} // End of Isobar namespace. +} // Isobar namespace. # endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyLayerCollection.h b/hurricane/src/isobar/hurricane/isobar/PyLayerCollection.h new file mode 100644 index 00000000..17242239 --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyLayerCollection.h @@ -0,0 +1,87 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyLayerCollection.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __PYBASICLAYER_COLLECTION__ +#define __PYBASICLAYER_COLLECTION__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/Layer.h" +#include "hurricane/Layers.h" + + +namespace Isobar { + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyLayerCollection". + + typedef struct { + PyObject_HEAD + Hurricane::Layers* _object; + } PyLayerCollection; + + + typedef struct { + PyObject_HEAD + Hurricane::Locator* _object; + PyLayerCollection* _collection; + } PyLayerCollectionLocator; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeLayerCollection; + extern PyTypeObject PyTypeLayerCollectionLocator; + + extern void PyLayerCollection_LinkPyType(); + + +} // extern "C". + +} // Isobar namespace. + +#endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyLayerMask.h b/hurricane/src/isobar/hurricane/isobar/PyLayerMask.h new file mode 100644 index 00000000..3d7cb401 --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyLayerMask.h @@ -0,0 +1,85 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyLayerMask.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __PY_LAYER_MASK__ +#define __PY_LAYER_MASK__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/Layer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyLayerMask". + + typedef struct { + PyObject_HEAD + Layer::Mask _object; + } PyLayerMask; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeLayerMask; + extern PyMethodDef PyLayerMask_Methods[]; + + extern PyObject* PyLayerMask_Link ( const Layer::Mask& object ); + extern void PyLayerMask_LinkPyType (); + +# define IsPyLayerMask(v) ( (v)->ob_type == &PyTypeLayerMask ) +# define PYLAYERMASK(v) ( (PyLayerMask*)(v) ) +# define PYLAYERMASK_O(v) ( PYLAYERMASK(v)->_object ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyMaterial.h b/hurricane/src/isobar/hurricane/isobar/PyMaterial.h new file mode 100644 index 00000000..8159ef1b --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyMaterial.h @@ -0,0 +1,86 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyMaterial.h" | +// +-----------------------------------------------------------------+ + + +# ifndef __PYMATERIAL__ +# define __PYMATERIAL__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/BasicLayer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyMaterial". + + typedef struct { + PyObject_HEAD + BasicLayer::Material* _object; + } PyMaterial; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeMaterial; + extern PyMethodDef PyMaterial_Methods[]; + + extern PyObject* PyMaterial_Link ( BasicLayer::Material* object ); + extern void PyMaterial_LinkPyType (); + extern void PyMaterial_postModuleInit (); + +# define IsPyMaterial(v) ( (v)->ob_type == &PyTypeMaterial ) +# define PYMATERIAL(v) ( (PyMaterial*)(v) ) +# define PYMATERIAL_O(v) ( PYMATERIAL(v)->_object ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyRegularLayer.h b/hurricane/src/isobar/hurricane/isobar/PyRegularLayer.h new file mode 100644 index 00000000..499f87ab --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyRegularLayer.h @@ -0,0 +1,84 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyRegularLayer.h" | +// +-----------------------------------------------------------------+ + + +# ifndef __PYREGULARLAYER__ +# define __PYREGULARLAYER__ + +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/RegularLayer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyRegularLayer". + + typedef struct { + PyLayer _baseObject; + } PyRegularLayer; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeRegularLayer; + extern PyMethodDef PyRegularLayer_Methods[]; + + extern PyObject* PyRegularLayer_Link ( Hurricane::RegularLayer* object ); + extern void PyRegularLayer_LinkPyType (); + +# define IsPyRegularLayer(v) ( (v)->ob_type == &PyTypeRegularLayer ) +# define PYREGULARLAYER(v) ( (PyRegularLayer*)(v) ) +# define PYREGULARLAYER_O(v) ( dynamic_cast(PYREGULARLAYER(v)->_baseObject._object) ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyRegularLayerCollection.h b/hurricane/src/isobar/hurricane/isobar/PyRegularLayerCollection.h new file mode 100644 index 00000000..98fe18c2 --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyRegularLayerCollection.h @@ -0,0 +1,87 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyRegularLayerCollection.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __PY_REGULARLAYER_COLLECTION__ +#define __PY_REGULARLAYER_COLLECTION__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/RegularLayer.h" +#include "hurricane/RegularLayers.h" + + +namespace Isobar { + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyRegularLayerCollection". + + typedef struct { + PyObject_HEAD + Hurricane::RegularLayers* _object; + } PyRegularLayerCollection; + + + typedef struct { + PyObject_HEAD + Hurricane::Locator* _object; + PyRegularLayerCollection* _collection; + } PyRegularLayerCollectionLocator; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeRegularLayerCollection; + extern PyTypeObject PyTypeRegularLayerCollectionLocator; + + extern void PyRegularLayerCollection_LinkPyType(); + + +} // extern "C". + +} // Isobar namespace. + +#endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyTransistorLayer.h b/hurricane/src/isobar/hurricane/isobar/PyTransistorLayer.h new file mode 100644 index 00000000..93f0db9d --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyTransistorLayer.h @@ -0,0 +1,84 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyTransistorLayer.h" | +// +-----------------------------------------------------------------+ + + +# ifndef __PYTRANSISTORLAYER__ +# define __PYTRANSISTORLAYER__ + +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/TransistorLayer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyTransistorLayer". + + typedef struct { + PyLayer _baseObject; + } PyTransistorLayer; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeTransistorLayer; + extern PyMethodDef PyTransistorLayer_Methods[]; + + extern PyObject* PyTransistorLayer_Link ( Hurricane::TransistorLayer* object ); + extern void PyTransistorLayer_LinkPyType (); + +# define IsPyTransistorLayer(v) ( (v)->ob_type == &PyTypeTransistorLayer ) +# define PYTRANSISTORLAYER(v) ( (PyTransistorLayer*)(v) ) +# define PYTRANSISTORLAYER_O(v) ( dynamic_cast(PYTRANSISTORLAYER(v)->_baseObject._object) ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyViaLayer.h b/hurricane/src/isobar/hurricane/isobar/PyViaLayer.h new file mode 100644 index 00000000..794ef023 --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyViaLayer.h @@ -0,0 +1,84 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyViaLayer.h" | +// +-----------------------------------------------------------------+ + + +# ifndef __PYVIALAYER__ +# define __PYVIALAYER__ + +#include "hurricane/isobar/PyLayer.h" +#include "hurricane/ViaLayer.h" + +namespace Isobar { + +using namespace Hurricane; + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyViaLayer". + + typedef struct { + PyLayer _baseObject; + } PyViaLayer; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeViaLayer; + extern PyMethodDef PyViaLayer_Methods[]; + + extern PyObject* PyViaLayer_Link ( Hurricane::ViaLayer* object ); + extern void PyViaLayer_LinkPyType (); + +# define IsPyViaLayer(v) ( (v)->ob_type == &PyTypeViaLayer ) +# define PYVIALAYER(v) ( (PyViaLayer*)(v) ) +# define PYVIALAYER_O(v) ( dynamic_cast(PYVIALAYER(v)->_baseObject._object) ) + + +} // extern "C". + +} // Isobar namespace. + +# endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyViaLayerCollection.h b/hurricane/src/isobar/hurricane/isobar/PyViaLayerCollection.h new file mode 100644 index 00000000..7a605db5 --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyViaLayerCollection.h @@ -0,0 +1,87 @@ + +// -*- 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 +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyViaLayerCollection.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __PY_VIALAYER_COLLECTION__ +#define __PY_VIALAYER_COLLECTION__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/ViaLayer.h" +#include "hurricane/ViaLayers.h" + + +namespace Isobar { + +extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyViaLayerCollection". + + typedef struct { + PyObject_HEAD + Hurricane::ViaLayers* _object; + } PyViaLayerCollection; + + + typedef struct { + PyObject_HEAD + Hurricane::Locator* _object; + PyViaLayerCollection* _collection; + } PyViaLayerCollectionLocator; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeViaLayerCollection; + extern PyTypeObject PyTypeViaLayerCollectionLocator; + + extern void PyViaLayerCollection_LinkPyType(); + + +} // extern "C". + +} // Isobar namespace. + +#endif diff --git a/hurricane/src/viewer/CMakeLists.txt b/hurricane/src/viewer/CMakeLists.txt index a67e47a0..550fe5ff 100644 --- a/hurricane/src/viewer/CMakeLists.txt +++ b/hurricane/src/viewer/CMakeLists.txt @@ -24,6 +24,8 @@ hurricane/viewer/SelectCommand.h hurricane/viewer/CellWidget.h hurricane/viewer/CellViewer.h + hurricane/viewer/CellPrinter.h + hurricane/viewer/CellImage.h hurricane/viewer/RecordModel.h hurricane/viewer/InspectorWidget.h hurricane/viewer/SelectionPopupModel.h @@ -54,7 +56,13 @@ hurricane/viewer/CellWidgets.h hurricane/viewer/StratusScript.h ) - set ( pyincludes hurricane/viewer/PyCellViewer.h + set ( pyincludes hurricane/viewer/PyHSVr.h + hurricane/viewer/PyDrawingStyle.h + hurricane/viewer/PyDrawingGroup.h + hurricane/viewer/PyDisplayStyle.h + hurricane/viewer/PyHApplication.h + hurricane/viewer/PyGraphics.h + hurricane/viewer/PyCellViewer.h ) set ( cpps HApplication.cpp ScreenUtilities.cpp @@ -83,6 +91,8 @@ SelectorCriterion.cpp CellWidget.cpp CellViewer.cpp + CellPrinter.cpp + CellImage.cpp RecordModel.cpp InspectorWidget.cpp SelectionPopupModel.cpp @@ -99,7 +109,13 @@ StratusScript.cpp StratusWidget.cpp ) - set ( pycpps PyViewer.cpp + set ( pycpps PyHSVr.cpp + PyDrawingStyle.cpp + PyDrawingGroup.cpp + PyDisplayStyle.cpp + PyHApplication.cpp + PyGraphics.cpp + PyViewer.cpp PyCellViewer.cpp ) # source2 & include2 for module that are *not* Python wrappers but true diff --git a/hurricane/src/viewer/CellImage.cpp b/hurricane/src/viewer/CellImage.cpp new file mode 100644 index 00000000..f2cdd794 --- /dev/null +++ b/hurricane/src/viewer/CellImage.cpp @@ -0,0 +1,181 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | 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 : "./CellImage.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include +#include +#include +#include +#include +#include "vlsisapd/configuration/Configuration.h" +#include "hurricane/DataBase.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/CellImage.h" +#include "hurricane/viewer/PaletteWidget.h" + + +namespace Hurricane { + + + CellImage::CellImage ( QWidget* parent ) : QMainWindow (parent) + , _screenCellWidget(NULL) + , _cellWidget (NULL) + , _palette (NULL) + , _image (NULL) + , _mode (Cfg::getParamEnumerate("viewer.printer.mode",1)->asInt()) + , _flags (0) + , _fitOnAbutmentBox(false) + , _drawingWidth (0) + , _drawingHeight (0) + { + setObjectName("viewer.image"); + setAttribute (Qt::WA_DontShowOnScreen); + createLayout (); + show (); + } + + + CellImage::~CellImage () + { + delete _palette; + } + + + void CellImage::createLayout () + { + if (_cellWidget) return; + + _cellWidget = new CellWidget (); + _palette = new PaletteWidget(); + + setCorner( Qt::TopLeftCorner , Qt::LeftDockWidgetArea ); + setCorner( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea ); + setCorner( Qt::TopRightCorner , Qt::RightDockWidgetArea ); + setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); + + setCentralWidget( _cellWidget ); + _palette->build (); + + _cellWidget->bindToPalette( _palette ); + _cellWidget->refresh(); + } + + + void CellImage::setScreenCellWidget ( CellWidget* cellWidget ) + { + _screenCellWidget = cellWidget; + + shared_ptr clone ( _screenCellWidget->getStateClone() ); + _cellWidget->setState ( clone ); + _cellWidget->setLayerVisible("grid" , _screenCellWidget->isLayerVisible("grid" )); + _cellWidget->setLayerVisible("text.instance" , _screenCellWidget->isLayerVisible("text.instance" )); + _cellWidget->setLayerVisible("text.component", _screenCellWidget->isLayerVisible("text.component")); + _cellWidget->setLayerVisible("rubber" , _screenCellWidget->isLayerVisible("rubber" )); + } + + + void CellImage::pageDecorate ( QPainter& painter ) + { + if ( _flags & ShowScale ) { + int xGradient = (_drawingWidth-510)/2; + painter.setPen (Qt::white); + painter.drawRect(xGradient-1, _drawingHeight+9, 512, 31); + painter.setPen (Qt::NoPen); + + for ( unsigned i = 0 ; i < 256 ; i++ ) { + painter.setBrush( Graphics::getColorScale(ColorScale::Fire).getBrush(i,100) ); + painter.drawRect( xGradient+(i*2), _drawingHeight+10, 2, 30 ); + if ( i==0 or i==51 or i==102 or i==153 or i==204 or i==255 ) { + QRect tArea ( xGradient+(i*2)-15, _drawingHeight+44, 30, 12 ); + + std::ostringstream oss; + oss << (float)(i)/255; + + painter.setPen ( Qt::white); + painter.drawLine( xGradient+(i*2) + , _drawingHeight+38 + , xGradient+(i*2) + , _drawingHeight+42 ); + painter.drawText( tArea, Qt::AlignCenter, oss.str().c_str() ); + painter.setPen ( Qt::NoPen ); + } + } + } + } + + + QImage* CellImage::toImage ( unsigned int flags ) + { + if (_image != NULL) return NULL; + if (_cellWidget->getCell() == NULL) return NULL; + + _flags = flags; + + int scale = 4 * Cfg::getParamEnumerate("viewer.printer.mode")->asInt(); + _drawingWidth = _cellWidget->width ()*scale; + _drawingHeight = _cellWidget->height()*scale; + + _image = new QImage( _drawingWidth + , _drawingHeight + ((_flags&ShowScale) ? 60 : 0) + , QImage::Format_RGB32 ); + + // Compute the delta size between CellImage and CellWidget. + cerr << "CellImage:" << geometry().width() << "x" << geometry().height() << endl; + cerr << "CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; + cerr << "resize: " << _drawingWidth << "x" << _drawingHeight << endl; + cerr << "AbutmentBox:" << _cellWidget->getCell()->getAbutmentBox() << endl; + cerr << "visibleArea:" << _cellWidget->getVisibleArea() << endl; + + resize ( _drawingWidth, _drawingHeight ); + + Box visibleArea = _screenCellWidget->getVisibleArea(); + if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) { + setFitOnAbutmentBox( true ); + _cellWidget->fitToContents(); + } else { + _cellWidget->reframe( _screenCellWidget->getVisibleArea() ); + } + + cerr << "After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; + cerr << "visibleArea(image):" << _cellWidget->getVisibleArea() << endl; + cerr << "visibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl; + + //cerr << "(xpaper,ypaper) = (" << xpaper << "," << ypaper << ")" << endl; + //cerr << "(w,h) = (" << w << "," << h << ")" << endl; + //cerr << "(dw,dh) = (" << drawingWidth << "," << drawingHeight << ")" << endl; + + CellWidget::PainterCb_t cb = boost::bind( &CellImage::pageDecorate, this, _1 ); + _cellWidget->copyToImage( _image, cb ); + + return _image; + } + + + string CellImage::_getString () const + { + ostringstream s; + s << "getState()->getCell(); + //if (cell) s << getString(cell->getName()); + //else s << "No_Cell_Loaded"; + s << ">"; + return s.str(); + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/viewer/CellPrinter.cpp b/hurricane/src/viewer/CellPrinter.cpp new file mode 100644 index 00000000..53ef93a3 --- /dev/null +++ b/hurricane/src/viewer/CellPrinter.cpp @@ -0,0 +1,362 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | 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 : "./CellPrinter.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include +#include +#include +#include +#include +#include "vlsisapd/configuration/Configuration.h" +#include "hurricane/DataBase.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/CellPrinter.h" +#include "hurricane/viewer/PaletteWidget.h" + + +namespace Hurricane { + + + CellPrinter::CellPrinter ( QWidget* parent ) : QMainWindow (parent) + , _screenCellWidget(NULL) + , _cellWidget (NULL) + , _palette (NULL) + , _printer (NULL) + , _mode (Cfg::getParamEnumerate("viewer.printer.mode",1)->asInt()) + , _paperWidth (0) + , _paperHeight (0) + , _frameMargin (50) + , _cartoucheWidth (1000) + , _cartoucheHeight (90) // 40*2 + , _titleHeight (60) // 30*2 + , _xpaper (0) + , _ypaper (0) + , _drawingWidth (0) + , _drawingHeight (0) + , _fitOnAbutmentBox(false) + { + setObjectName("viewer.printer"); + setAttribute (Qt::WA_DontShowOnScreen); + createLayout (); + show (); + } + + + CellPrinter::~CellPrinter () + { + delete _palette; + } + + + void CellPrinter::createLayout () + { + if (_cellWidget) return; + + _cellWidget = new CellWidget (); + _palette = new PaletteWidget(); + + setCorner( Qt::TopLeftCorner , Qt::LeftDockWidgetArea ); + setCorner( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea ); + setCorner( Qt::TopRightCorner , Qt::RightDockWidgetArea ); + setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); + + setCentralWidget( _cellWidget ); + _palette->build (); + + _cellWidget->bindToPalette( _palette ); + _cellWidget->refresh(); + } + + + void CellPrinter::setScreenCellWidget ( CellWidget* cellWidget ) + { + _screenCellWidget = cellWidget; + + shared_ptr clone ( _screenCellWidget->getStateClone() ); + _cellWidget->setState ( clone ); + _cellWidget->setLayerVisible("grid" , _screenCellWidget->isLayerVisible("grid" )); + _cellWidget->setLayerVisible("text.instance" , _screenCellWidget->isLayerVisible("text.instance" )); + _cellWidget->setLayerVisible("text.component", _screenCellWidget->isLayerVisible("text.component")); + _cellWidget->setLayerVisible("rubber" , _screenCellWidget->isLayerVisible("rubber" )); + } + + + QString CellPrinter::getUnitQString () + { + unsigned int mode; + DbU::UnitPower p; + + DbU::getStringMode( mode, p ); + + QString unit = "unit: "; + switch( mode ) { + case DbU::Db: unit += "db"; break; + case DbU::Grid: unit += "grid"; break; + case DbU::Symbolic: unit += (QChar)0x03BB; break; + case DbU::Physical: + switch( p ) { + case DbU::Pico: unit += (QChar)'p'; break; + case DbU::Nano: unit += (QChar)'n'; break; + case DbU::Micro: unit += (QChar)0x00B5; break; + case DbU::Milli: unit += (QChar)'m'; break; + case DbU::Unity: break; + case DbU::Kilo: unit += (QChar)'k'; break; + default: unit += (QChar)'?'; break; + } + unit += (QChar)'m'; + } + + return unit; + } + + + QString CellPrinter::dbuToPrinterString ( DbU::Unit unit ) + { + QString value = DbU::getValueString(unit).c_str(); + + if (not value[value.size()-2].isDigit()) value.chop(2); + if (not value[value.size()-1].isDigit()) value.chop(1); + + return value; + } + + + string CellPrinter::getUserName () + { + string user = getenv("USER"); + if (user.empty()) user = "unkown"; + else { + size_t equal = user.find('='); + if (equal != string::npos) + user.erase( 0, equal ); + } + return user; + } + + + string CellPrinter::getTime ( const char* format ) + { + time_t t = time(NULL); + struct tm* bt = localtime(&t); + char formatted[1024]; + + strftime ( formatted, 1024, format, bt ); + + return formatted; + } + + + void CellPrinter::pageDecorate ( QPainter& painter ) + { + int right = 0; + int bottom = 0; + int userFieldWidth = 150 * _mode; + int dateFieldWidth = 180 * _mode; + int unitFieldWidth = 150 * _mode; + int areaFieldWidth = cartoucheWidth() - userFieldWidth - dateFieldWidth - unitFieldWidth; + + QFont font ( "Bitstream Vera Sans", 18 ); + font.setWeight ( QFont::Bold ); + + // Draw frame. + QPen framePen = QPen( QBrush(QColor("black")), 1.0 ); + painter.setPen ( framePen ); + painter.drawRect( frameMargin() + , frameMargin() + , _paperWidth - (frameMargin()<<1) + , _paperHeight - (frameMargin()<<1) + ); + // Draw a rectangle around the copied area from the CellWidget buffer. + // painter.drawRect( _xpaper + // , _xpaper + // , _drawingWidth + // , _drawingHeight + // ); + + // Rotate the painter for the cartouche if in A4+Landscape mode. + if ( (_printer->paperSize () == QPrinter::A4) + and (_printer->orientation() == QPrinter::Landscape) ) { + painter.translate ( _paperWidth - frameMargin(), frameMargin() ); + painter.rotate ( -90 ); + } else + painter.translate ( _paperWidth - frameMargin(), _paperHeight - frameMargin() ); + + // Draw the cartouche. + QPen cartouchePen = QPen( QBrush(QColor("black")), 1.0 ); + painter.setPen( cartouchePen ); + + QRect cartoucheRect = QRect ( right - cartoucheWidth() + , bottom - cartoucheHeight() + , cartoucheWidth() + , cartoucheHeight() + ); + QRect titleRect = cartoucheRect; + titleRect.adjust( 0, 0, 0, titleHeight() - cartoucheHeight() ); + + // The cartouche box. + cartouchePen.setWidth( 2 ); + painter.setPen ( cartouchePen ); + painter.drawRect( cartoucheRect ); + + // The title & horizontal separator. + string title = getString(_cellWidget->getCell()->getName()); + + cartouchePen.setWidth( 1 ); + painter.setPen ( cartouchePen ); + painter.drawLine( titleRect.bottomLeft(), titleRect.bottomRight() ); + painter.setFont ( font ); + painter.drawText( titleRect, Qt::AlignVCenter|Qt::AlignHCenter, title.c_str() ); + + // The user's name. + QRect fieldRect = QRect ( cartoucheRect.x() + , cartoucheRect.y() + titleHeight() + , userFieldWidth + , cartoucheHeight() - titleHeight() + ); + font.setPointSize( 11 ); + painter.setFont ( font ); + painter.drawLine ( fieldRect.topRight(), fieldRect.bottomRight() ); + painter.drawText ( fieldRect, Qt::AlignVCenter|Qt::AlignHCenter, getUserName().c_str() ); + + // The date. + string date = getTime ( "%d %b %Y" ); + fieldRect = QRect ( cartoucheRect.x() + userFieldWidth + , cartoucheRect.y() + titleHeight() + , dateFieldWidth + , cartoucheHeight() - titleHeight() + ); + font.setWeight ( QFont::Normal ); + painter.setFont ( font ); + painter.drawLine( fieldRect.topRight(), fieldRect.bottomRight() ); + painter.drawText( fieldRect, Qt::AlignVCenter|Qt::AlignHCenter, date.c_str() ); + + // The Unit. + QString unit = getUnitQString(); + fieldRect = QRect ( cartoucheRect.x() + userFieldWidth + dateFieldWidth + , cartoucheRect.y() + titleHeight() + , unitFieldWidth + , cartoucheHeight() - titleHeight() + ); + font.setWeight ( QFont::Normal ); + painter.setFont ( font ); + painter.drawLine( fieldRect.topRight(), fieldRect.bottomRight() ); + painter.drawText( fieldRect, Qt::AlignVCenter|Qt::AlignHCenter, unit ); + + // The Area. + Box area; + QString sarea; + if (fitOnAbutmentBox()) { + area = _cellWidget->getCell()->getAbutmentBox(); + sarea += "A.Box. ("; + } else { + area = _cellWidget->getVisibleArea(); + sarea += "area ("; + } + + sarea += dbuToPrinterString( area.getXMin() ) + " " + + dbuToPrinterString( area.getYMin() ) + ") (" + + dbuToPrinterString( area.getXMax() ) + " " + + dbuToPrinterString( area.getYMax() ) + ")"; + + fieldRect = QRect ( cartoucheRect.x() + userFieldWidth + dateFieldWidth + unitFieldWidth + , cartoucheRect.y() + titleHeight() + , areaFieldWidth + , cartoucheHeight() - titleHeight() + ); + //painter.drawLine( fieldRect.topRight(), fieldRect.bottomRight() ); + painter.drawText( fieldRect, Qt::AlignVCenter|Qt::AlignHCenter, sarea ); + } + + + void CellPrinter::toPdf ( QPrinter* printer, bool imageOnly ) + { + if (printer == NULL) return; + if (_cellWidget->getCell() == NULL) return; + + _printer = printer; + _printer->setResolution ( resolution() ); + _printer->setPageMargins( 0.0, 0.0, 0.0, 0.0, QPrinter::DevicePixel ); + + _paperWidth = _printer->width (); + _paperHeight = _printer->height (); + _drawingWidth = _paperWidth - (frameMargin()<<1); + _drawingHeight = _paperHeight - (frameMargin()<<1); + _xpaper = (imageOnly) ? 0 : frameMargin(); + _ypaper = (imageOnly) ? 0 : frameMargin(); + + // Substract the cartouche size only for A4 format. + cerr << _printer->paperSize() << endl; + if ( _printer->orientation() == QPrinter::Landscape ) { + _drawingWidth -= cartoucheHeight(); + } else { + _drawingHeight -= cartoucheHeight(); + } + + // Compute the delta size between CellPrinter and CellWidget. + cerr << "(paperw,paperh) = (" << _paperWidth << "," << _paperHeight << ")" << endl; + cerr << "CellPrinter:" << geometry().width() << "x" << geometry().height() << endl; + cerr << "CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; + cerr << "resize: " << _drawingWidth << "x" << _drawingHeight << endl; + cerr << "AbutmentBox:" << _cellWidget->getCell()->getAbutmentBox() << endl; + cerr << "visibleArea:" << _cellWidget->getVisibleArea() << endl; + + // Resize the pixel window to the size of the paper usable area. + // Then redraw the same visible area (in Hurricane coordinates). + // if (_printer->orientation() == QPrinter::Landscape) { + // swap( _drawingHeight, _drawingWidth ); + // swap( _xpaper , _ypaper ); + // } + + resize ( _drawingWidth, _drawingHeight ); + + Box visibleArea = _screenCellWidget->getVisibleArea(); + if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) { + setFitOnAbutmentBox( true ); + _cellWidget->fitToContents(); + } else { + _cellWidget->reframe( _screenCellWidget->getVisibleArea() ); + } + + cerr << "After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; + cerr << "visibleArea(printer):" << _cellWidget->getVisibleArea() << endl; + cerr << "visibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl; + + //cerr << "(xpaper,ypaper) = (" << xpaper << "," << ypaper << ")" << endl; + //cerr << "(w,h) = (" << w << "," << h << ")" << endl; + //cerr << "(dw,dh) = (" << drawingWidth << "," << drawingHeight << ")" << endl; + + CellWidget::PainterCb_t cb = boost::bind( &CellPrinter::pageDecorate, this, _1 ); + _cellWidget->copyToPrinter( _xpaper, _ypaper, _printer, cb ); + + _printer = NULL; + } + + + string CellPrinter::_getString () const + { + ostringstream s; + s << "getState()->getCell(); + //if (cell) s << getString(cell->getName()); + //else s << "No_Cell_Loaded"; + s << ">"; + return s.str(); + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/viewer/CellViewer.cpp b/hurricane/src/viewer/CellViewer.cpp index 8fccf918..831529af 100644 --- a/hurricane/src/viewer/CellViewer.cpp +++ b/hurricane/src/viewer/CellViewer.cpp @@ -2,29 +2,22 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 : "./CellViewer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Module : "./CellViewer.cpp" | +// +-----------------------------------------------------------------+ #include #include +#include #include #include @@ -36,17 +29,21 @@ #include #include +#include "vlsisapd/configuration/Configuration.h" #include "hurricane/DataBase.h" #include "hurricane/Cell.h" //#include "MapView.h" #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/CellViewer.h" +#include "hurricane/viewer/CellPrinter.h" +#include "hurricane/viewer/CellImage.h" #include "hurricane/viewer/MousePositionWidget.h" #include "hurricane/viewer/ControllerWidget.h" #include "hurricane/viewer/ScriptWidget.h" #include "hurricane/viewer/StratusWidget.h" #include "hurricane/viewer/GotoWidget.h" +#include "hurricane/viewer/SelectCommand.h" namespace Hurricane { @@ -426,7 +423,7 @@ namespace Hurricane { } - Cell* CellViewer::getCell () + Cell* CellViewer::getCell () const { return getCellWidget()->getCell(); } @@ -475,6 +472,15 @@ namespace Hurricane { } + void CellViewer::setAnonNetSelectable ( bool state ) + { + SelectCommand* command = static_cast( getCellWidget()->getCommand(SelectCommand::getStaticName()) ); + unsigned int mode = (state) ? SelectCommand::NetMode : SelectCommand::NoAnonNetMode; + + if (command) command->setSelectMode( mode ); + } + + void CellViewer::changeSelectionMode () { if ( _updateState != InternalEmit ) { @@ -537,11 +543,23 @@ namespace Hurricane { } QPrinter printer ( QPrinter::ScreenResolution ); + printer.setPaperSize ( (QPrinter::PaperSize)Cfg::getParamEnumerate("viewer.printer.paper",0)->asInt() ); printer.setOutputFileName ( "unicorn-snapshot.pdf" ); QPrintDialog dialog ( &printer ); if ( dialog.exec() == QDialog::Accepted ) - _cellWidget->copyToPrinter ( &printer ); + print ( &printer ); + } + + + void CellViewer::print ( QPrinter* printer ) + { + CellPrinter* cellPrinter = new CellPrinter(); + + cellPrinter->setScreenCellWidget( _cellWidget ); + cellPrinter->toPdf ( printer, false ); + + delete cellPrinter; } @@ -553,8 +571,10 @@ namespace Hurricane { return; } - QImage image ( _cellWidget->width(), _cellWidget->height(), QImage::Format_RGB32 ); - _cellWidget->copyToImage ( &image, true ); //true for no scale (use for map congestion) + CellImage* cellImage = new CellImage(); + cellImage->setScreenCellWidget( _cellWidget ); + QImage* image = cellImage->toImage(0); + delete cellImage; char workingDirectory [1024]; getcwd ( workingDirectory, 1024 ); @@ -565,7 +585,8 @@ namespace Hurricane { , tr("Image (*.png)") ); - image.save ( filePath, "png" ); + image->save ( filePath, "png" ); + delete image; } @@ -577,4 +598,16 @@ namespace Hurricane { { StratusWidget::runScript ( this ); } + string CellViewer::_getString () const + { + ostringstream s; + s << "getName()); + else s << "No_Cell_Loaded"; + s << ">"; + return s.str(); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index 01b6c320..3fff7e1e 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -2,11 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2011, All Rights Reserved -// -// =================================================================== -// -// $Id$ +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -15,7 +11,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./CellWidget.cpp" | +// | C++ Module : "./CellWidget.cpp" | // +-----------------------------------------------------------------+ @@ -55,27 +51,6 @@ #include "hurricane/viewer/CellWidget.h" -namespace { - - - using namespace std; - - - string getTime ( const char* format ) - { - time_t t = time(NULL); - struct tm* bt = localtime(&t); - char formatted[1024]; - - strftime ( formatted, 1024, format, bt ); - - return formatted; - } - - -} // End of anonymous namespace. - - namespace Hurricane { @@ -510,165 +485,50 @@ namespace Hurricane { } - void CellWidget::DrawingPlanes::drawCartouche ( int right - , int bottom - , const string& title - , const string& area - ) + void CellWidget::DrawingPlanes::copyToPrinter ( int xpaper + , int ypaper + , int sx + , int sy + , int w + , int h + , QPrinter* printer + , CellWidget::PainterCb_t& cb ) { - QFont font ( "Bitstream Vera Sans", 18 ); - font.setWeight ( QFont::Bold ); + if (printer == NULL) return; - string user = getenv ( "USER" ); - if ( user.empty() ) user = "unkown"; - else { - size_t equal = user.find('='); - if ( equal != string::npos ) - user.erase ( 0, equal ); - } + cerr << "offsetVA:" << _cellWidget->getOffsetVA().rx() << "," << _cellWidget->getOffsetVA().ry() << endl; - string date = getTime ( "%d %b %Y" ); - - QPen cartouchePen = QPen ( QBrush(QColor("black")), 1.0 ); - _painters[PlaneId::Printer].setPen ( cartouchePen ); - - QRect cartoucheRect = QRect ( right - _cartoucheWidth - , bottom - _cartoucheHeight - , _cartoucheWidth - , _cartoucheHeight - ); - QRect titleRect = cartoucheRect; - titleRect.adjust ( 0, 0, 0, _titleHeight - _cartoucheHeight ); - - cartouchePen.setWidth ( 2 ); - _painters[PlaneId::Printer].setPen ( cartouchePen ); - _painters[PlaneId::Printer].drawRect ( cartoucheRect ); - cartouchePen.setWidth ( 1 ); - _painters[PlaneId::Printer].setPen ( cartouchePen ); - _painters[PlaneId::Printer].drawLine ( titleRect.bottomLeft(), titleRect.bottomRight() ); - _painters[PlaneId::Printer].setFont ( font ); - _painters[PlaneId::Printer].drawText ( titleRect, Qt::AlignVCenter|Qt::AlignHCenter, title.c_str() ); - - QRect fieldRect = QRect ( cartoucheRect.x() - , cartoucheRect.y() + _titleHeight - , 100 - , _cartoucheHeight - _titleHeight - ); - font.setPointSize ( 11 ); - _painters[PlaneId::Printer].setFont ( font ); - _painters[PlaneId::Printer].drawLine ( fieldRect.topRight(), fieldRect.bottomRight() ); - _painters[PlaneId::Printer].drawText ( fieldRect, Qt::AlignVCenter|Qt::AlignHCenter, user.c_str() ); - - fieldRect = QRect ( cartoucheRect.x() + 100 - , cartoucheRect.y() + _titleHeight - , 120 - , _cartoucheHeight - _titleHeight - ); - font.setWeight ( QFont::Normal ); - _painters[PlaneId::Printer].setFont ( font ); - _painters[PlaneId::Printer].drawLine ( fieldRect.topRight(), fieldRect.bottomRight() ); - _painters[PlaneId::Printer].drawText ( fieldRect, Qt::AlignVCenter|Qt::AlignHCenter, date.c_str() ); - - fieldRect = QRect ( cartoucheRect.x() + 220 - , cartoucheRect.y() + _titleHeight - , 300 - , _cartoucheHeight - _titleHeight - ); - _painters[PlaneId::Printer].setFont ( font ); - _painters[PlaneId::Printer].drawLine ( fieldRect.topRight(), fieldRect.bottomRight() ); - _painters[PlaneId::Printer].drawText ( fieldRect, Qt::AlignVCenter|Qt::AlignHCenter, area.c_str() ); - } - - - void CellWidget::DrawingPlanes::copyToPrinter ( int sx, int sy, int w, int h, QPrinter* printer, bool imageOnly ) - { - if ( !printer ) return; _printer = printer; - _printer->setPageMargins ( 0.0, 0.0, 0.0, 0.0, QPrinter::DevicePixel ); - - int paperWidth = _printer->width (); - int paperHeight = _printer->height (); - int frameMargin = 25; - int drawingWidth = paperWidth - (frameMargin<<1); - int drawingHeight = paperHeight - (frameMargin<<1); - int ximage = 0; - int yimage = 0; - - // Substract the cartouche size only for A4 format. - if ( _printer->paperSize () == QPrinter::A4 ) { - if ( _printer->orientation() == QPrinter::Landscape ) { - drawingWidth -= _cartoucheHeight; - } else { - drawingHeight -= _cartoucheHeight; - } - } - - if ( imageOnly ) { - _printer->setPaperSize ( QSizeF(w,h), QPrinter::DevicePixel ); - } else { - ximage = frameMargin + ((drawingWidth > w) ? (drawingWidth -w)/2 : 0); - yimage = frameMargin + ((drawingHeight > h) ? (drawingHeight-h)/2 : 0); - } - - begin ( PlaneId::Printer ); + begin( PlaneId::Printer ); if ( _cellWidget->showSelection() ) _painters[PlaneId::Printer].drawPixmap - ( ximage, yimage + ( xpaper, ypaper , *_planes[PlaneId::Selection] , _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy , w, h ); else _painters[PlaneId::Printer].drawPixmap - ( ximage, yimage + ( xpaper, ypaper , *_planes[PlaneId::Normal] , _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy , w, h ); - if ( !imageOnly ) { - DbU::Unit x1 = _cellWidget->displayToDbuX ( sx ); - DbU::Unit x2 = _cellWidget->displayToDbuX ( sx+w ); - DbU::Unit y1 = _cellWidget->displayToDbuY ( sy ); - DbU::Unit y2 = _cellWidget->displayToDbuY ( sy+h ); + if ( cb ) cb( _painters[PlaneId::Printer] ); - string title = getString(_cellWidget->getCell()->getName()); - string area = "Area: [" + DbU::getValueString(x1) - + " " + DbU::getValueString(y1) - + "] [" + DbU::getValueString(x2) - + " " + DbU::getValueString(y2) - + "]"; - - QPen framePen = QPen ( QBrush(QColor("black")), 1.0 ); - _painters[PlaneId::Printer].setPen ( framePen ); - _painters[PlaneId::Printer].drawRect ( frameMargin - , frameMargin - , paperWidth - (frameMargin<<1) - , paperHeight - (frameMargin<<1) - ); - - if ( (_printer->paperSize () == QPrinter::A4) - && (_printer->orientation() == QPrinter::Landscape) ) { - _painters[PlaneId::Printer].translate ( paperWidth - frameMargin, frameMargin ); - _painters[PlaneId::Printer].rotate ( -90 ); - } else - _painters[PlaneId::Printer].translate ( paperWidth - frameMargin, paperHeight - frameMargin ); - - drawCartouche ( 0, 0, title , area ); - } - - end ( PlaneId::Printer ); + end( PlaneId::Printer ); _printer = NULL; } - void CellWidget::DrawingPlanes::copyToImage ( int sx, int sy, int w, int h, QImage* image, bool noScale ) + void CellWidget::DrawingPlanes::copyToImage ( int sx, int sy, int w, int h, QImage* image, CellWidget::PainterCb_t& cb ) { - int ximage = 0; - int yimage = 0; + int ximage = 0; + int yimage = 0; - if ( !image ) return; + if (image == NULL) return; _image = image; begin ( PlaneId::Image ); @@ -691,25 +551,7 @@ namespace Hurricane { ); } - if ( !noScale ) { - int xGradient = (w-510)/2; - _painters[PlaneId::Image].setPen(Qt::white); - _painters[PlaneId::Image].drawRect(xGradient-1, h+9, 512, 31); - _painters[PlaneId::Image].setPen(Qt::NoPen); - for ( unsigned i = 0 ; i < 256 ; i++ ) { - _painters[PlaneId::Image].setBrush(Graphics::getColorScale(ColorScale::Fire).getBrush(i,100) ); - _painters[PlaneId::Image].drawRect(xGradient+(i*2), h+10, 2, 30); - if ( i==0 || i==51 || i==102 || i==153 || i==204 || i==255 ) { - QRect tArea (xGradient+(i*2)-15, h+44, 30, 12); - std::ostringstream oss; - oss << (float)(i)/255; - _painters[PlaneId::Image].setPen(Qt::white); - _painters[PlaneId::Image].drawLine(xGradient+(i*2), h+38, xGradient+(i*2), h+42); - _painters[PlaneId::Image].drawText(tArea, Qt::AlignCenter, oss.str().c_str()); - _painters[PlaneId::Image].setPen(Qt::NoPen); - } - } - } + if ( cb ) cb( _painters[PlaneId::Image] ); end ( PlaneId::Image ); _image = NULL; @@ -1095,6 +937,29 @@ namespace Hurricane { // Class : "Hurricane::CellWidget::State". + CellWidget::State* CellWidget::State::clone () const + { + State* clone = new State(); + + clone->setCell ( getCell() ); + clone->setCursorStep ( getCursorStep() ); + clone->setUnitPower ( getUnitPower() ); + clone->setDbuMode ( getDbuMode() ); + clone->setShowBoundaries ( showBoundaries() ); + clone->setShowSelection ( showSelection() ); + clone->setCumulativeSelection( cumulativeSelection() ); + clone->setScale ( getScale() ); + clone->setTopLeft ( getTopLeft() ); + clone->setQueryFilter ( getQueryFilter() ); + clone->setStartLevel ( getStartLevel() ); + clone->setStopLevel ( getStopLevel() ); + clone->setRubberShape ( getRubberShape() ); + clone->setTopLeft ( getTopLeft() ); + + return clone; + } + + void CellWidget::State::setScale ( float scale ) { _scaleHistory.erase ( _scaleHistory.begin()+_ihistory+1,_scaleHistory.end() ); @@ -1481,7 +1346,7 @@ namespace Hurricane { _cellModificated = false; } - if ( isDrawable("grid") ) drawGrid ( redrawArea ); + if ( isDrawable("grid") ) drawGrid ( redrawArea ); if ( isDrawable("text.ruler") ) drawRulers ( redrawArea ); setDarkening ( 100 ); @@ -1616,6 +1481,13 @@ namespace Hurricane { } + bool CellWidget::isLayerVisible ( const Name& name ) + { + PaletteItem* item = (_palette) ? _palette->find(name) : NULL; + return (item == NULL) ? false : item->isItemVisible(); + } + + bool CellWidget::isDrawable ( const Name& name ) { PaletteItem* item = (_palette) ? _palette->find(name) : NULL; @@ -2102,6 +1974,8 @@ namespace Hurricane { { Point center = _visibleArea.getCenter(); + cerr << "center: " << center << " + scale:" << scale << endl; + return Box ( (DbU::Unit)( center.getX() - width () / (scale*2) ) , (DbU::Unit)( center.getY() - height() / (scale*2) ) , (DbU::Unit)( center.getX() + width () / (scale*2) ) diff --git a/hurricane/src/viewer/DisplayStyle.cpp b/hurricane/src/viewer/DisplayStyle.cpp index c1e72519..012366aa 100644 --- a/hurricane/src/viewer/DisplayStyle.cpp +++ b/hurricane/src/viewer/DisplayStyle.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 | // | | @@ -17,10 +12,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./DisplayStyle.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include @@ -30,16 +22,10 @@ #include "hurricane/viewer/Graphics.h" -namespace { - - using namespace Hurricane; - - -} // End of anonymous namespace. - - namespace Hurricane { + using namespace std; + const Name DisplayStyle::UnmatchedGroup; const Name DisplayStyle::Viewer = "Viewer"; @@ -64,15 +50,15 @@ namespace Hurricane { - DrawingStyle::DrawingStyle ( const Name& name - , const string& pattern - , int red - , int green - , int blue - , int borderWidth - , float threshold - , bool goMatched - ) + RawDrawingStyle::RawDrawingStyle ( const Name& name + , const string& pattern + , int red + , int green + , int blue + , int borderWidth + , float threshold + , bool goMatched + ) : _name (name) , _red (red) , _green (green) @@ -84,23 +70,28 @@ namespace Hurricane { , _brush (NULL) , _threshold (threshold) , _goMatched (goMatched) - , _refcount (1) + { } + + + + DrawingStyle RawDrawingStyle::create ( const Name& name + , const string& pattern + , int red + , int green + , int blue + , int borderWidth + , float threshold + , bool goMatched + ) { - } - - - - DrawingStyle* DrawingStyle::create ( const Name& name - , const string& pattern - , int red - , int green - , int blue - , int borderWidth - , float threshold - , bool goMatched - ) - { - DrawingStyle* style = new DrawingStyle ( name, pattern, red, green, blue, borderWidth, threshold, goMatched ); + DrawingStyle style = DrawingStyle( new RawDrawingStyle ( name + , pattern + , red + , green + , blue + , borderWidth + , threshold + , goMatched ) ); //if ( Graphics::isEnabled() ) // style->qtAllocate (); @@ -108,7 +99,7 @@ namespace Hurricane { } - void DrawingStyle::qtAllocate () + void RawDrawingStyle::qtAllocate () { if ( !_color ) { _color = new QColor ( _red, _green, _blue ); @@ -126,7 +117,7 @@ namespace Hurricane { } - QColor DrawingStyle::getColor ( const DisplayStyle::HSVr& darkening ) const + QColor RawDrawingStyle::getColor ( const DisplayStyle::HSVr& darkening ) const { assert ( _color != NULL ); @@ -135,7 +126,7 @@ namespace Hurricane { } - QPen DrawingStyle::getPen ( const DisplayStyle::HSVr& darkening ) const + QPen RawDrawingStyle::getPen ( const DisplayStyle::HSVr& darkening ) const { assert ( _pen != NULL ); @@ -147,7 +138,7 @@ namespace Hurricane { } - QBrush DrawingStyle::getBrush ( const DisplayStyle::HSVr& darkening ) const + QBrush RawDrawingStyle::getBrush ( const DisplayStyle::HSVr& darkening ) const { assert ( _brush != NULL ); @@ -158,9 +149,8 @@ namespace Hurricane { } - DrawingStyle::~DrawingStyle () + RawDrawingStyle::~RawDrawingStyle () { - assert ( _refcount == 0 ); if ( _color ) { delete _color; delete _pen; @@ -169,29 +159,9 @@ namespace Hurricane { } - size_t DrawingStyle::unlink () - { - _refcount--; - - if ( !_refcount ) { - delete this; - return 0; - } - - return _refcount; - } - - - DrawingStyle* DrawingStyle::link () - { - _refcount++; - - return this; - } - - DrawingGroup::DrawingGroup ( const Name& name ) - : _name(name), _drawingStyles() + : _name (name) + , _drawingStyles() { } @@ -207,17 +177,14 @@ namespace Hurricane { DrawingGroup* clone = new DrawingGroup ( getName() ); for ( size_t i=0 ; i < _drawingStyles.size() ; i++ ) - clone->_drawingStyles.push_back ( _drawingStyles[i]->link() ); + clone->_drawingStyles.push_back ( _drawingStyles[i] ); return clone; } DrawingGroup::~DrawingGroup () - { - for ( size_t i=0 ; i < _drawingStyles.size() ; i++ ) - _drawingStyles[i]->unlink (); - } + { } size_t DrawingGroup::findIndex ( const Name& key ) const @@ -231,17 +198,17 @@ namespace Hurricane { } - DrawingStyle* DrawingGroup::find ( const Name& key ) const + DrawingStyle DrawingGroup::find ( const Name& key ) const { size_t i = findIndex ( key ); if ( i != InvalidIndex ) return _drawingStyles[i]; - return NULL; + return DrawingStyle(); } - DrawingStyle* DrawingGroup::addDrawingStyle ( const Name& key + DrawingStyle DrawingGroup::addDrawingStyle ( const Name& key , const string& pattern , int red , int green @@ -251,16 +218,15 @@ namespace Hurricane { , bool goMatched ) { + DrawingStyle ds = RawDrawingStyle::create ( key, pattern, red, green, blue, borderWidth, threshold, goMatched ); + size_t i = findIndex ( key ); if ( i != InvalidIndex ) { - _drawingStyles[i]->unlink (); + _drawingStyles[i] = ds; } else { - i = _drawingStyles.size (); - _drawingStyles.push_back ( NULL ); + _drawingStyles.push_back ( ds ); } - - return _drawingStyles[i] = - DrawingStyle::create ( key, pattern, red, green, blue, borderWidth, threshold, goMatched ); + return ds; } @@ -327,7 +293,7 @@ namespace Hurricane { const Name& DisplayStyle::getGroup ( const Name& key ) const { for ( size_t gi=0 ; gi < _groups.size() ; gi++ ) { - DrawingStyle* style = _groups[gi]->find ( key ); + DrawingStyle style = _groups[gi]->find ( key ); if ( style ) return _groups[gi]->getName(); } @@ -396,10 +362,10 @@ namespace Hurricane { } - DrawingStyle* DisplayStyle::find ( const Name& key ) const + DrawingStyle DisplayStyle::find ( const Name& key ) const { for ( size_t gi=0 ; gi < _groups.size() ; gi++ ) { - DrawingStyle* style = _groups[gi]->find ( key ); + DrawingStyle style = _groups[gi]->find ( key ); if ( style ) return style; } diff --git a/hurricane/src/viewer/GotoWidget.cpp b/hurricane/src/viewer/GotoWidget.cpp index 59f349de..9b98dcc8 100644 --- a/hurricane/src/viewer/GotoWidget.cpp +++ b/hurricane/src/viewer/GotoWidget.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 | // | | @@ -17,10 +12,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./GotoWidget.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include diff --git a/hurricane/src/viewer/GraphicsWidget.cpp b/hurricane/src/viewer/GraphicsWidget.cpp index 21c1b833..127e079c 100644 --- a/hurricane/src/viewer/GraphicsWidget.cpp +++ b/hurricane/src/viewer/GraphicsWidget.cpp @@ -71,9 +71,7 @@ namespace Hurricane { gLayout->addWidget ( button, istyle-hideFallback, 0 ); gLayout->addWidget ( label , istyle-hideFallback, 1 ); - - group->setId ( button, istyle ); - group->addButton ( button ); + group->addButton ( button, istyle ); } groupBox->setLayout ( gLayout ); diff --git a/hurricane/src/viewer/InspectorWidget.cpp b/hurricane/src/viewer/InspectorWidget.cpp index 27498ff0..fc970b34 100644 --- a/hurricane/src/viewer/InspectorWidget.cpp +++ b/hurricane/src/viewer/InspectorWidget.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 | // | | @@ -17,10 +12,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./InspectorWidget.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include diff --git a/hurricane/src/viewer/PaletteWidget.cpp b/hurricane/src/viewer/PaletteWidget.cpp index 584c2bf4..44fdb73e 100644 --- a/hurricane/src/viewer/PaletteWidget.cpp +++ b/hurricane/src/viewer/PaletteWidget.cpp @@ -240,7 +240,7 @@ namespace Hurricane { size_t gi = 0; const vector& groups = Graphics::getStyle()->getDrawingGroups(); - const vector& styles = groups[gi]->getDrawingStyles(); + const DrawingStyles& styles = groups[gi]->getDrawingStyles(); gridBuffer.addSection ( _createGroupItem(groups[gi]->getName()), Qt::AlignHCenter ); for ( size_t si=0 ; sigetName()), Qt::AlignHCenter ); - const vector& styles = groups[gi]->getDrawingStyles(); + const DrawingStyles& styles = groups[gi]->getDrawingStyles(); for ( size_t si=0 ; sigetBasicLayer ( styles[si]->getName() ); diff --git a/hurricane/src/viewer/PyCellViewer.cpp b/hurricane/src/viewer/PyCellViewer.cpp index fcdb00a1..a69555bf 100644 --- a/hurricane/src/viewer/PyCellViewer.cpp +++ b/hurricane/src/viewer/PyCellViewer.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | @@ -17,10 +12,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./PyCellViewer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include "hurricane/isobar/PyCell.h" @@ -38,9 +30,9 @@ extern "C" { #define METHOD_HEAD(function) GENERIC_METHOD_HEAD(CellViewer,cw,function) -// x=================================================================x +// +=================================================================+ // | "PyCellViewer" Python Module Code Part | -// x=================================================================x +// +=================================================================+ #if defined(__PYTHON_MODULE__) @@ -75,7 +67,9 @@ extern "C" { METHOD_HEAD("CellViewer.setCell()") PyCell* cell; - if ( not ParseOneArg("CellViewer.setCell()",args,CELL_ARG,(PyObject**)&cell) ) return NULL; + if ( not ParseOneArg("CellViewer.setCell()",args,CELL_ARG,(PyObject**)&cell) ) { + return NULL; + } cw->setCell ( PYCELL_O(cell) ); HCATCH @@ -84,6 +78,68 @@ extern "C" { } + static PyObject* PyCellViewer_setApplicationName ( PyCellViewer* self, PyObject* args ) + { + trace << "PyCellViewer_setApplicationName ()" << endl; + + HTRY + METHOD_HEAD("CellViewer.setApplicationName()") + + char* name = NULL; + if (not PyArg_ParseTuple(args,"s:CellViewer.setApplicationName()", &name)) { + PyErr_SetString ( ConstructorError, "CellViewer.setApplicationName(): Takes exactly one argument." ); + return NULL; + } + + cw->setApplicationName ( name ); + HCATCH + + Py_RETURN_NONE; + } + + + static PyObject* PyCellViewer_setLayerVisible ( PyCellViewer* self, PyObject* args ) + { + trace << "PyCellViewer_setLayerVisible ()" << endl; + + HTRY + METHOD_HEAD("CellViewer.setLayerVisible()") + + char* layerName = NULL; + PyObject* visible = NULL; + if (not PyArg_ParseTuple(args,"sO:CellViewer.setLayerVisible()", &layerName, &visible)) { + PyErr_SetString ( ConstructorError, "CellViewer.setLayerVisible(): Takes exactly two argument." ); + return NULL; + } + + cw->setLayerVisible ( layerName, (PyObject_IsTrue(visible) != 0) ); + HCATCH + + Py_RETURN_NONE; + } + + + static PyObject* PyCellViewer_setAnonNetSelectable ( PyCellViewer* self, PyObject* args ) + { + trace << "PyCellViewer_setAnonNetSelectable ()" << endl; + + HTRY + METHOD_HEAD("CellViewer.setAnonNetSelectable()") + + PyObject* pyState = NULL; + if (not PyArg_ParseTuple(args,"O:CellViewer.setAnonNetSelectable()", &pyState)) { + PyErr_SetString ( ConstructorError, "CellViewer.setAnonNetSelectable(): Takes exactly one argument." ); + return NULL; + } + + bool state = (PyObject_IsTrue(pyState) != 0); + cw->setAnonNetSelectable( state ); + HCATCH + + Py_RETURN_NONE; + } + + static PyObject* PyCellViewer_fit ( PyCellViewer* self ) { trace << "PyCellViewer_fit()" << endl; @@ -101,15 +157,21 @@ extern "C" { // PyCellViewer Attribute Method table. PyMethodDef PyCellViewer_Methods[] = - { { "getCell" , (PyCFunction)PyCellViewer_getCell , METH_NOARGS - , "Return the currently edited Cell." } - , { "setCell" , (PyCFunction)PyCellViewer_setCell , METH_VARARGS - , "Load a Cell into the viewer." } - , { "fit" , (PyCFunction)PyCellViewer_fit , METH_NOARGS - , "Fit the contents to the viewer's visible area." } - , { "destroy" , (PyCFunction)PyCellViewer_destroy , METH_NOARGS - , "Destroy the associated hurricane object. The python object remains." } - , {NULL, NULL, 0, NULL} /* sentinel */ + { { "getCell" , (PyCFunction)PyCellViewer_getCell , METH_NOARGS + , "Return the currently edited Cell." } + , { "setCell" , (PyCFunction)PyCellViewer_setCell , METH_VARARGS + , "Load a Cell into the viewer." } + , { "setApplicationName" , (PyCFunction)PyCellViewer_setApplicationName , METH_VARARGS + , "Sets the application (binary) name." } + , { "setAnonNetSelectable", (PyCFunction)PyCellViewer_setAnonNetSelectable, METH_VARARGS + , "Allow/disallow anonymous nets to be selectables." } + , { "setLayerVisible" , (PyCFunction)PyCellViewer_setLayerVisible , METH_VARARGS + , "Sets the visibility state of the layer ." } + , { "fit" , (PyCFunction)PyCellViewer_fit , METH_NOARGS + , "Fit the contents to the viewer's visible area." } + , { "destroy" , (PyCFunction)PyCellViewer_destroy , METH_NOARGS + , "Destroy the associated hurricane object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -120,12 +182,12 @@ extern "C" { #else // End of Python Module Code Part. -// x=================================================================x +// +=================================================================+ // | "PyCellViewer" Shared Library Code Part | -// x=================================================================x +// +=================================================================+ - PyTypeObjectDefinitions(CellViewer) + PyTypeRootObjectDefinitions(CellViewer) # endif // End of Shared Library Code Part. diff --git a/hurricane/src/viewer/PyDisplayStyle.cpp b/hurricane/src/viewer/PyDisplayStyle.cpp new file mode 100644 index 00000000..eb702be3 --- /dev/null +++ b/hurricane/src/viewer/PyDisplayStyle.cpp @@ -0,0 +1,420 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyDisplayStyle.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/PyGraphics.h" +#include "hurricane/viewer/PyDrawingStyle.h" +#include "hurricane/viewer/PyDrawingGroup.h" +#include "hurricane/viewer/PyDisplayStyle.h" +#include "hurricane/viewer/PyHSVr.h" +#include + + +namespace { + + using std::istringstream; + + + void parseInt ( const char* s, int& value ) + { istringstream is ( s ); is >> value; } + + + void parseFloat ( const char* s, float& value ) + { istringstream is ( s ); is >> value; } + + + void parseRgbColor ( const char* color, int& red, int& green, int& blue ) + { + char colon1, colon2; + + istringstream is ( color ); + is >> red >> colon1 >> green >> colon2 >> blue; + } + + + +} // Anonymous namespace. + + +namespace Hurricane { + + using std::cerr; + using std::endl; + using std::hex; + using std::ostringstream; + using Isobar::ProxyProperty; + using Isobar::ProxyError; + using Isobar::ConstructorError; + using Isobar::HurricaneError; + using Isobar::HurricaneWarning; + using Isobar::ParseOneArg; + using Isobar::ParseTwoArg; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DisplayStyle,ds,function) + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyDisplayStyle" Python Module Code Part | +// +=================================================================+ + + + static PyObject* PyDisplayStyle_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) + { + trace << "PyDisplayStyle_new()" << endl; + + DisplayStyle* ds = NULL; + PyDisplayStyle* pyDs = (PyDisplayStyle*)type->tp_alloc(type,0); + + HTRY + if ( pyDs ) { + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DisplayStyle.new", &name)) { + ds = new DisplayStyle(Name(name)); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for DisplayStyle()." ); + return NULL; + } + pyDs->_object = ds; + } + HCATCH + + return (PyObject*)pyDs; + } + + + PyObject* PyDisplayStyle_getDarkening ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_getDarkening()" << endl; + + DisplayStyle::HSVr* darkening = new DisplayStyle::HSVr(); + + HTRY + METHOD_HEAD("DisplayStyle.getDarkening()") + *darkening = ds->getDarkening(); + HCATCH + + return PyHSVr_Link(darkening); + } + + + PyObject* PyDisplayStyle_getGroup ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_getGroup()" << endl; + + const char* group = NULL; + + HTRY + METHOD_HEAD("DisplayStyle.getGroup()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DisplayStyle.getGroup", &name)) { + group = getString( ds->getPattern(Name(name)) ).c_str(); + } else { + PyErr_SetString ( ConstructorError, "DisplayStyle.getGroup(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return PyString_FromString(group); + } + + + PyObject* PyDisplayStyle_getPattern ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_getPattern()" << endl; + + const char* pattern = NULL; + + HTRY + METHOD_HEAD("DisplayStyle.getPattern()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DisplayStyle.getPattern", &name)) { + pattern = ds->getPattern (Name(name)).c_str(); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for getPattern." ); + return NULL; + } + HCATCH + + return PyString_FromString(pattern); + } + + + PyObject* PyDisplayStyle_getThreshold ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_getThreshold()" << endl; + + float threshold = 0.0; + + HTRY + METHOD_HEAD("DisplayStyle.getThreshold()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DisplayStyle.getThreshold", &name)) { + threshold = ds->getThreshold(Name(name)); + } else { + PyErr_SetString ( ConstructorError, "DisplayStyle.getThreshold(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return Py_BuildValue("f",threshold); + } + + + PyObject* PyDisplayStyle_find ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_find()" << endl; + + DrawingStyle drawingStyle; + + HTRY + METHOD_HEAD("DisplayStyle.find()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DisplayStyle.find", &name)) { + drawingStyle = ds->find(Name(name)); + } else { + PyErr_SetString ( ConstructorError, "DisplayStyle.find(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return PyRawDrawingStyle_Link(drawingStyle); + } + + + PyObject* PyDisplayStyle_setDescription ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_setDescription()" << endl; + + HTRY + METHOD_HEAD("DisplayStyle.setDescription()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DisplayStyle.setDescription", &name)) { + ds->setDescription(name); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for setDescription." ); + return NULL; + } + HCATCH + + Py_RETURN_NONE; + } + + + PyObject* PyDisplayStyle_setDarkening ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_setDarkening()" << endl; + + HTRY + METHOD_HEAD("DisplayStyle.setDarkening()") + + PyObject* darkening; + if (!ParseOneArg("DisplayStyle.setDarkening", args, ":hsvr", &darkening)) { + PyErr_SetString ( ConstructorError, "Bad parameters given to DisplayStyle.setDarkening()." ); + return NULL; + } + ds->setDarkening(*PYHSVR_O(darkening)); + HCATCH + + Py_RETURN_NONE; + } + + + PyObject* PyDisplayStyle_inheritFrom ( PyDisplayStyle* self, PyObject* args ) + { + trace << "PyDisplayStyle_inheritFrom()" << endl; + + HTRY + METHOD_HEAD("DisplayStyle.inheritFrom()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DisplayStyle.inheritFrom", &name)) { + DisplayStyle* baseStyle = Graphics::getStyle ( name ); + if ( !baseStyle ) { + ostringstream error; + error << "Base style <" << name << "> of <" << ds->getName() << "> doesn't exist (yet?)."; + PyErr_SetString ( ConstructorError, error.str().c_str() ); + return NULL; + } + ds->inheritFrom(baseStyle); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for DisplayStyle.inheritFrom." ); + return NULL; + } + HCATCH + + Py_RETURN_NONE; + } + + + PyObject* PyDisplayStyle_addDrawingStyle ( PyDisplayStyle* self, PyObject* args, PyObject* kwArgs ) + { + trace << "PyDisplayStyle_addDrawingStyle()" << endl; + + HTRY + METHOD_HEAD("DisplayStyle.addDrawingStyle()") + char* argGroupKey = "Not part of any group (error)"; + char* argKey = "No key defined (error)"; + char* argPattern = "FFFFFFFFFFFFFFFF"; + char* argColor = "255,255,255"; + int borderWidth = 0; + float threshold = 1.0; + PyObject* argGoMatched = NULL; + + static char* keywords[] = { "group", "name", "color", "pattern", "border", "threshold", "goMatched", NULL }; + + if (PyArg_ParseTupleAndKeywords( args + , kwArgs + , "ss|ssifO:DisplayStyle.addDrawingStyle" + , keywords + , &argGroupKey + , &argKey + , &argColor + , &argPattern + , &borderWidth + , &threshold + , &argGoMatched )) { + int red = 255; + int green = 255; + int blue = 255; + bool goMatched = (argGoMatched == NULL) or (PyObject_IsTrue(argGoMatched)); + + //cerr << "Adding DrawingStyle" << argGroupKey << " "<< argKey << " " << argPattern << endl; + + parseRgbColor( argColor, red, green, blue ); + ds->addDrawingStyle( Name(argGroupKey) + , Name(argKey) + , argPattern + , red + , green + , blue + , borderWidth + , threshold + , goMatched + ); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for DisplayStyle.addDrawingStyle." ); + return NULL; + } + HCATCH + + Py_RETURN_NONE; + } + + + static PyObject* PyDisplayStyle_Repr ( PyDisplayStyle* self ) + { + if ( self->ACCESS_OBJECT == NULL ) + return PyString_FromString(""); + + string s = "_object->getName()) + ">"; + return PyString_FromString(s.c_str()); + } + + + // Standart Accessors (Attributes). + GetNameMethod(DisplayStyle,ds) + DirectGetStringAttribute(PyDisplayStyle_getDescription,getDescription,PyDisplayStyle,DisplayStyle) + accessorVectorFromVoid(getDrawingGroups,PyDisplayStyle,DisplayStyle,DrawingGroup) + + + // Standart Destroy (Attribute). + // DBoDestroyAttribute(PyDisplayStyle_destroy,PyDisplayStyle) + + + PyMethodDef PyDisplayStyle_Methods[] = + { { "getName" , (PyCFunction)PyDisplayStyle_getName , METH_NOARGS + , "Returns the name (id) of the DisplayStyle." } + , { "getDescription" , (PyCFunction)PyDisplayStyle_getDescription , METH_NOARGS + , "Returns the description of the DisplayStyle (this is not the id)." } + , { "getDarkening" , (PyCFunction)PyDisplayStyle_getDarkening , METH_NOARGS + , "Returns the darkening factor, applied on unselected items." } + , { "getGroup" , (PyCFunction)PyDisplayStyle_getGroup , METH_VARARGS + , "Returns the first group containing this DrawingStyle." } + , { "getPattern" , (PyCFunction)PyDisplayStyle_getPattern , METH_VARARGS + , "Gets a pattern, by key name." } + , { "getThreshold" , (PyCFunction)PyDisplayStyle_getThreshold , METH_VARARGS + , "Returns the display threshold of the given DrawingStyle." } + , { "getDrawingGroups" , (PyCFunction)PyDisplayStyle_getDrawingGroups, METH_NOARGS + , "Returns the list of DrawingGroups (iterable only)." } + , { "find" , (PyCFunction)PyDisplayStyle_find , METH_VARARGS + , "Find a DrawingStyle, by key name." } + , { "setDescription" , (PyCFunction)PyDisplayStyle_setDescription , METH_VARARGS + , "Set the Display Style informational text." } + , { "inheritFrom" , (PyCFunction)PyDisplayStyle_inheritFrom , METH_VARARGS + , "Set the base style (erase current and clone)." } + , { "setDarkening" , (PyCFunction)PyDisplayStyle_setDarkening , METH_VARARGS + , "Set the Display Style darkning (unselected background)." } + , { "addDrawingStyle" , (PyCFunction)PyDisplayStyle_addDrawingStyle , METH_VARARGS|METH_KEYWORDS + , "Adds a new Drawing Style, or overwrite an older." } + //, { "destroy" , (PyCFunction)PyDisplayStyle_destroy , METH_NOARGS + // , "Destroy the associated hurricane object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + PythonOnlyDeleteMethod(DisplayStyle) + DirectHashMethod(PyDisplayStyle_Hash, PyDisplayStyle) + + extern void PyDisplayStyle_LinkPyType() { + trace << "PyDisplayStyle_LinkType()" << endl; + + PyTypeDisplayStyle.tp_new = PyDisplayStyle_new; + PyTypeDisplayStyle.tp_dealloc = (destructor) PyDisplayStyle_DeAlloc; + PyTypeDisplayStyle.tp_repr = (reprfunc) PyDisplayStyle_Repr; + PyTypeDisplayStyle.tp_str = (reprfunc) PyDisplayStyle_Repr; + PyTypeDisplayStyle.tp_hash = (hashfunc) PyDisplayStyle_Hash; + PyTypeDisplayStyle.tp_methods = PyDisplayStyle_Methods; + } + + + IteratorNextMethod(DisplayStyle) + VectorMethods (DisplayStyle) + + +#else // End of Python Module Code Part. + +// +=================================================================+ +// | "PyDisplayStyle" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + LinkCreateMethod(DisplayStyle) + PyTypeObjectDefinitionsOfModule(Viewer,DisplayStyle) + PyTypeVectorObjectDefinitions (DisplayStyleVector) + PyTypeVectorObjectDefinitions (DisplayStyleVectorIterator) + + + extern void PyDisplayStyle_postModuleInit () + { + PyDict_SetItemString ( PyTypeDisplayStyle.tp_dict, "HSVr", (PyObject*)&PyTypeHSVr ); + } + + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + + +} // Hurricane namespace. + diff --git a/hurricane/src/viewer/PyDrawingGroup.cpp b/hurricane/src/viewer/PyDrawingGroup.cpp new file mode 100644 index 00000000..ac251add --- /dev/null +++ b/hurricane/src/viewer/PyDrawingGroup.cpp @@ -0,0 +1,224 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyDrawingGroup.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/PyDrawingStyle.h" +#include "hurricane/viewer/PyDrawingGroup.h" +#include + + +namespace { + + using std::istringstream; + + + void parseInt ( const char* s, int& value ) + { istringstream is ( s ); is >> value; } + + + void parseFloat ( const char* s, float& value ) + { istringstream is ( s ); is >> value; } + + + void parseRgbColor ( const char* color, int& red, int& green, int& blue ) + { + char colon1, colon2; + + istringstream is ( color ); + is >> red >> colon1 >> green >> colon2 >> blue; + } + + + +} // Anonymous namespace. + + +namespace Hurricane { + + using std::cerr; + using std::endl; + using std::hex; + using std::ostringstream; + using Isobar::ProxyProperty; + using Isobar::ProxyError; + using Isobar::ConstructorError; + using Isobar::HurricaneError; + using Isobar::HurricaneWarning; + using Isobar::ParseOneArg; + using Isobar::ParseTwoArg; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DrawingGroup,dg,function) + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyDrawingGroup" Python Module Code Part | +// +=================================================================+ + + + PyObject* PyDrawingGroup_find ( PyDrawingGroup* self, PyObject* args ) + { + trace << "PyDrawingGroup_find()" << endl; + + DrawingStyle drawingStyle; + + HTRY + METHOD_HEAD("DrawingGroup.find()") + char* name = NULL; + if (PyArg_ParseTuple(args,"s:DrawingGroup.find", &name)) { + drawingStyle = dg->find(Name(name)); + } else { + PyErr_SetString ( ConstructorError, "DrawingGroup.find(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return PyRawDrawingStyle_Link(drawingStyle); + } + + + PyObject* PyDrawingGroup_addDrawingStyle ( PyDrawingGroup* self, PyObject* args, PyObject* kwArgs ) + { + trace << "PyDrawingGroup_addDrawingStyle()" << endl; + + HTRY + METHOD_HEAD("DrawingGroup.addDrawingStyle()") + char* argKey = "No key defined (error)"; + char* argPattern = "FFFFFFFFFFFFFFFF"; + char* argColor = "255,255,255"; + int borderWidth = 0; + float threshold = 1.0; + char* argGoMatched = "true"; + + static char* keywords[] = { "name", "color", "pattern", "border", "threshold", "goMatched", NULL }; + + if (PyArg_ParseTupleAndKeywords( args + , kwArgs + , "ss|ssifs:DrawingGroup.addDrawingStyle" + , keywords + , &argKey + , &argColor + , &argPattern + , &borderWidth + , &threshold + , &argGoMatched )) { + int red = 255; + int green = 255; + int blue = 255; + bool goMatched = (string(argGoMatched) == "true"); + + //cerr << "Adding DrawingStyle" << argGroupKey << " "<< argKey << " " << argPattern << endl; + + parseRgbColor( argColor, red, green, blue ); + dg->addDrawingStyle( Name(argKey) + , argPattern + , red + , green + , blue + , borderWidth + , threshold + , goMatched + ); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for DrawingGroup.addDrawingStyle." ); + return NULL; + } + HCATCH + + Py_RETURN_NONE; + } + + + static PyObject* PyDrawingGroup_Repr ( PyDrawingGroup* self ) + { + if ( self->ACCESS_OBJECT == NULL ) + return PyString_FromString(""); + + string s = "_object->getName()) + ">"; + return PyString_FromString(s.c_str()); + } + + + // Standart Accessors (Attributes). + GetNameMethod(DrawingGroup,dg) + accessorVectorFromVoid(getDrawingStyles,PyDrawingGroup,DrawingGroup,DrawingStyle) + + + // Standart Destroy (Attribute). + // DBoDestroyAttribute(PyDrawingGroup_destroy,PyDrawingGroup) + + + PyMethodDef PyDrawingGroup_Methods[] = + { { "getName" , (PyCFunction)PyDrawingGroup_getName , METH_NOARGS + , "Adds a new Drawing Style, or overwrite an older." } + , { "getDrawingStyles" , (PyCFunction)PyDrawingGroup_getDrawingStyles, METH_NOARGS + , "Returns the list of associated DrawingStyle (iterable only)." } + , { "find" , (PyCFunction)PyDrawingGroup_find , METH_VARARGS + , "Finds a DrawingStyle, by key name." } + , { "addDrawingStyle" , (PyCFunction)PyDrawingGroup_addDrawingStyle , METH_VARARGS|METH_KEYWORDS + , "Adds a new Drawing Style, or overwrite an older." } + //, { "destroy" , (PyCFunction)PyDrawingGroup_destroy , METH_NOARGS + // , "Destroy the associated hurricane object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + PythonOnlyDeleteMethod(DrawingGroup) + DirectHashMethod(PyDrawingGroup_Hash, PyDrawingGroup) + + extern void PyDrawingGroup_LinkPyType() { + trace << "PyDrawingGroup_LinkType()" << endl; + + PyTypeDrawingGroup.tp_dealloc = (destructor) PyDrawingGroup_DeAlloc; + PyTypeDrawingGroup.tp_repr = (reprfunc) PyDrawingGroup_Repr; + PyTypeDrawingGroup.tp_str = (reprfunc) PyDrawingGroup_Repr; + PyTypeDrawingGroup.tp_hash = (hashfunc) PyDrawingGroup_Hash; + PyTypeDrawingGroup.tp_methods = PyDrawingGroup_Methods; + } + + + IteratorNextMethod(DrawingGroup) + VectorMethods (DrawingGroup) + + +#else // End of Python Module Code Part. + +// +=================================================================+ +// | "PyDrawingGroup" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + LinkCreateMethod(DrawingGroup) + PyTypeObjectDefinitionsOfModule(Viewer,DrawingGroup) + PyTypeVectorObjectDefinitions (DrawingGroupVector) + PyTypeVectorObjectDefinitions (DrawingGroupVectorIterator) + + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + + +} // Hurricane namespace. + diff --git a/hurricane/src/viewer/PyDrawingStyle.cpp b/hurricane/src/viewer/PyDrawingStyle.cpp new file mode 100644 index 00000000..44db5569 --- /dev/null +++ b/hurricane/src/viewer/PyDrawingStyle.cpp @@ -0,0 +1,189 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2010, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyDrawingStyle.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/PyDrawingStyle.h" + + +namespace Hurricane { + + using std::cerr; + using std::endl; + using std::hex; + using Isobar::ProxyProperty; + using Isobar::ProxyError; + using Isobar::ConstructorError; + using Isobar::HurricaneError; + using Isobar::HurricaneWarning; + using Isobar::ParseOneArg; + using Isobar::ParseTwoArg; + + +extern "C" { + + +// #undef GENERIC_METHOD_HEAD +// #define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \ +// if ( self->ACCESS_OBJECT.get() == NULL ) { \ +// PyErr_SetString ( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \ +// return NULL; \ +// } \ +// SELF_TYPE SELF_OBJECT = self->ACCESS_OBJECT; +// +// #define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DrawingStyle,ds,function) + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(RawDrawingStyle,ds,function) + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyDrawingStyle" Python Module Code Part | +// +=================================================================+ + + + PyObject* PyRawDrawingStyle_getPattern ( PyRawDrawingStyle* self, PyObject* args ) + { + trace << "PyDrawingStyle_getPattern()" << endl; + + const char* pattern = NULL; + + HTRY + METHOD_HEAD("DrawingStyle.getPattern()") + pattern = ds->getPattern().c_str(); + HCATCH + + return PyString_FromString(pattern); + } + + + PyObject* PyRawDrawingStyle_getThreshold ( PyRawDrawingStyle* self, PyObject* args ) + { + trace << "PyRawDrawingStyle_getThreshold()" << endl; + + float threshold = 0.0; + + HTRY + METHOD_HEAD("DrawingStyle.getThreshold()") + threshold = ds->getThreshold(); + HCATCH + + return Py_BuildValue("f",threshold); + } + + + // Standart Accessors (Attributes). + GetNameMethod(RawDrawingStyle,ds) + DirectGetBoolAttribute(PyRawDrawingStyle_isGoMatched,isGoMatched,PyRawDrawingStyle,RawDrawingStyle) + + + // Standart Destroy (Attribute). + // DBoDestroyAttribute(PyRawDrawingStyle_destroy,PyRawDrawingStyle) + + + PyMethodDef PyRawDrawingStyle_Methods[] = + { { "isGoMatched" , (PyCFunction)PyRawDrawingStyle_isGoMatched , METH_NOARGS + , "Tells if this style is associated with a GO (Graphical Object)." } + , { "getName" , (PyCFunction)PyRawDrawingStyle_getName , METH_NOARGS + , "Return the name of the DrawingStyle." } + , { "getPattern" , (PyCFunction)PyRawDrawingStyle_getPattern , METH_NOARGS + , "Return the pattern of the DrawingStyle." } + , { "getThreshold" , (PyCFunction)PyRawDrawingStyle_getThreshold, METH_NOARGS + , "Returns the display threshold." } + //, { "destroy" , (PyCFunction)PyRawDrawingStyle_destroy , METH_NOARGS + // , "Destroy the associated hurricane object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + PythonOnlyDeleteMethod(RawDrawingStyle) + PyTypeObjectLinkPyType(RawDrawingStyle) + + + static PyObject* PyDrawingStyleIteratorNext(PyDrawingStyleVectorIterator* pyIterator) + { + HTRY + if (pyIterator->_iterator != pyIterator->_pyContainer->_container->end()) { + DrawingStyle object = *(pyIterator->_iterator); + ++(pyIterator->_iterator); + return PyRawDrawingStyle_Link(object); + } + HCATCH + return NULL; + } + + VectorMethods(DrawingStyle) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyDrawingStyle" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + PyObject* PyRawDrawingStyle_Link ( DrawingStyle ds ) + { + if ( ds.get() == NULL ) Py_RETURN_NONE; + + // PyDrawingStyle* pyDs = NULL; + // HTRY + // pyDs = PyObject_NEW(PyDrawingStyle, &PyTypeDrawingStyle); + // if (pyDs == NULL) return NULL; + + // // Here is a very dirty hack: + // // The Python object is a C struct, so the construtor of _object, + // // which is a shared_ptr<> never gets called (but memory is allocated). + // // So we end up with a shared_ptr<> with an internal state all garbled. + // // To set it right, we perform a direct memory copy from a fresh one + // // we allocate dynamically (so it doesn't get destructed at the function's + // // exit). + // DrawingStyle* empty = new DrawingStyle(); + // memcpy((void*)&(pyDs->_object),(void*)empty,sizeof(tr1::shared_ptr)); + + // //cerr << "ptr:" << pyDs->_object.get() + // // << " use_count:" << pyDs->_object.use_count() << endl; + + // pyDs->_object.swap(ds); + // HCATCH + + PyRawDrawingStyle* pyDs = NULL; + HTRY + pyDs = PyObject_NEW(PyRawDrawingStyle, &PyTypeRawDrawingStyle); + if (pyDs == NULL) return NULL; + pyDs->_object = ds.get(); + HCATCH + + return (PyObject*)pyDs; + } + + + PyTypeObjectDefinitions(RawDrawingStyle) + + PyTypeVectorObjectDefinitions(DrawingStyleVector) + PyTypeVectorObjectDefinitions(DrawingStyleVectorIterator) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + + +} // Hurricane namespace. + diff --git a/hurricane/src/viewer/PyGraphics.cpp b/hurricane/src/viewer/PyGraphics.cpp new file mode 100644 index 00000000..aa2c872f --- /dev/null +++ b/hurricane/src/viewer/PyGraphics.cpp @@ -0,0 +1,343 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyGraphics.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/PyGraphics.h" +#include "hurricane/viewer/PyHSVr.h" +#include "hurricane/viewer/PyDisplayStyle.h" + + +namespace Hurricane { + + using std::cerr; + using std::endl; + using std::hex; + using Isobar::ProxyProperty; + using Isobar::ProxyError; + using Isobar::ConstructorError; + using Isobar::HurricaneError; + using Isobar::HurricaneWarning; + using Isobar::ParseOneArg; + using Isobar::ParseTwoArg; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Graphics,graphics,function) + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyGraphics" Python Module Code Part | +// +=================================================================+ + + + static PyObject* PyGraphics_get ( PyObject* ) + { + trace << "PyGraphics_get()" << endl; + + Graphics* graphics = NULL; + PyGraphics* pyGraphics = NULL; + + HTRY + graphics = Graphics::getGraphics (); + + pyGraphics = PyObject_NEW ( PyGraphics, &PyTypeGraphics ); + if ( graphics == NULL ) return NULL; + + pyGraphics->_object = graphics; + HCATCH + + return (PyObject*)pyGraphics; + } + + + static PyObject* PyGraphics_setStyle ( PyObject*, PyObject* args ) + { + trace << "PyGraphics_setStyle()" << endl; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Graphics.setStyle", &name)) { + graphics->setStyle(Name(name)); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to Graphics.setStyle()." ); + return NULL; + } + HCATCH + + Py_RETURN_NONE; + } + + + PyObject* PyGraphics_getPattern ( PyGraphics* , PyObject* args ) + { + trace << "PyGraphics_getPattern()" << endl; + + const char* pattern = NULL; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Graphics.getPattern", &name)) { + pattern = graphics->getPattern (Name(name)).c_str(); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for Graphics.getPattern." ); + return NULL; + } + HCATCH + + return PyString_FromString(pattern); + } + + + PyObject* PyGraphics_getStyle ( PyGraphics* , PyObject* args ) + { + trace << "PyGraphics_getStyle()" << endl; + + DisplayStyle* style = NULL; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + char* name = NULL; + if (PyArg_ParseTuple(args,"|s:Graphics.getStyle", &name)) { + if (name != NULL) style = graphics->getStyle(Name(name)); + else style = graphics->getStyle(); + } else { + PyErr_SetString ( ConstructorError, "Graphics.getStyle(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return PyDisplayStyle_Link(style); + } + + + PyObject* PyGraphics_getGroup ( PyGraphics* , PyObject* args ) + { + trace << "PyGraphics_getGroup()" << endl; + + const char* group; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Graphics.getGroup", &name)) { + group = getString(graphics->getGroup(Name(name))).c_str(); + } else { + PyErr_SetString ( ConstructorError, "Graphics.getGroup(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return Py_BuildValue("s",group); + } + + + PyObject* PyGraphics_getThreshold ( PyGraphics* , PyObject* args ) + { + trace << "PyGraphics_getThreshold()" << endl; + + float threshold = 0.0; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Graphics.getThreshold", &name)) { + threshold = graphics->getThreshold(Name(name)); + } else { + PyErr_SetString ( ConstructorError, "Graphics.getThreshold(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return Py_BuildValue("f",threshold); + } + + + PyObject* PyGraphics_getDarkening ( PyGraphics* , PyObject* args ) + { + trace << "PyGraphics_getDarkening()" << endl; + + DisplayStyle::HSVr* darkening = new DisplayStyle::HSVr(); + + HTRY + Graphics* graphics = Graphics::getGraphics (); + *darkening = graphics->getDarkening(); + HCATCH + + return PyHSVr_Link(darkening); + } + + + PyObject* PyGraphics_toHtml ( PyGraphics* , PyObject* args ) + { + trace << "PyGraphics_toHtml()" << endl; + + string htmlText = ""; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + char* name = NULL; + if (PyArg_ParseTuple(args,"s:Graphics.toHtml", &name)) { + htmlText = graphics->toHtml(name); + } else { + PyErr_SetString ( ConstructorError, "Graphics.toHtml(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + return Py_BuildValue("s",htmlText.c_str()); + } + + + PyObject* PyGraphics_breakpointStopCb ( PyGraphics* , PyObject* args ) + { + trace << "PyGraphics_breakpointStopCb()" << endl; + + bool rvalue = false; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + char* message = NULL; + if (PyArg_ParseTuple(args,"s:Graphics.breakpointStopCb", &message)) { + rvalue = graphics->breakpointStopCb(message); + } else { + PyErr_SetString ( ConstructorError, "Graphics.breakpointStopCb(): Invalid/bad type parameters." ); + return NULL; + } + HCATCH + + if (rvalue) Py_RETURN_TRUE; + Py_RETURN_FALSE; + } + + + static PyObject* PyGraphics_addStyle ( PyObject*, PyObject* args ) + { + trace << "PyGraphics_addStyle()" << endl; + + HTRY + Graphics* graphics = Graphics::getGraphics (); + + PyObject* ds; + if (!ParseOneArg("Graphics.addStyle", args, ":displaySty", (PyObject**)&ds)) { + PyErr_SetString ( ConstructorError, "Bad parameters given to Graphics.addStyle()." ); + return NULL; + } + graphics->addStyle(PYDISPLAY_STYLE_O(ds)); + HCATCH + + Py_RETURN_NONE; + } + + + static PyObject* PyGraphics_enable ( PyObject*, PyObject* args ) + { + trace << "PyGraphics_enable()" << endl; + + HTRY + Graphics::getGraphics()->enable(); + HCATCH + + Py_RETURN_NONE; + } + + + // Standart Accessors (Attributes). + DirectGetBoolAttribute(PyGraphics_isEnabled,isEnabled,PyGraphics,Graphics) + + + static PyObject* PyGraphics_getStyles ( PyObject* ) + { + trace << "PyGraphics_getStyles()" << endl; + + PyDisplayStyleVector* pyVector = NULL; + + HTRY + pyVector = PyObject_NEW(PyDisplayStyleVector,&PyTypeDisplayStyleVector); + if (pyVector == NULL) return NULL; + pyVector->_container = &Graphics::getGraphics()->getStyles(); + HCATCH + + return (PyObject*)pyVector; + } + + + // Standart Destroy (Attribute). + // DBoDestroyAttribute(PyGraphics_destroy,PyGraphics) + + + PyMethodDef PyGraphics_Methods[] = + { { "isEnabled" , (PyCFunction)PyGraphics_isEnabled , METH_NOARGS |METH_STATIC + , "Tells if the Qt part of Graphics has been activated." } + , { "get" , (PyCFunction)PyGraphics_get , METH_NOARGS |METH_STATIC + , "Gets the Viewer Graphic Configuration." } + , { "getStyle" , (PyCFunction)PyGraphics_getStyle , METH_VARARGS|METH_STATIC + , "Get a display style (by name or the current active one)." } + , { "getGroup" , (PyCFunction)PyGraphics_getGroup , METH_VARARGS|METH_STATIC + , "Returns the group to which the key (DrawingStyle) belongs (on active style)." } + , { "getPattern" , (PyCFunction)PyGraphics_getPattern , METH_VARARGS|METH_STATIC + , "Gets a pattern, by key name (on active style)." } + , { "getThreshold" , (PyCFunction)PyGraphics_getThreshold , METH_VARARGS|METH_STATIC + , "Gets a threshold, by key name (on active style)." } + , { "getDarkening" , (PyCFunction)PyGraphics_getDarkening , METH_NOARGS|METH_STATIC + , "Return the darkening of the active style." } + , { "toHtml" , (PyCFunction)PyGraphics_toHtml , METH_VARARGS|METH_STATIC + , "Translate a string so it can be rendered in an HTML device." } + , { "breakpointStopCb" , (PyCFunction)PyGraphics_breakpointStopCb, METH_VARARGS|METH_STATIC + , "Run the breakpoint utility, with a message." } + , { "addStyle" , (PyCFunction)PyGraphics_addStyle , METH_VARARGS|METH_STATIC + , "Adds a new display style." } + , { "setStyle" , (PyCFunction)PyGraphics_setStyle , METH_VARARGS|METH_STATIC + , "Select the display style." } + , { "getStyles" , (PyCFunction)PyGraphics_getStyles , METH_NOARGS|METH_STATIC + , "Return the list of all availables styles (only iterable)." } + , { "enable" , (PyCFunction)PyGraphics_enable , METH_NOARGS|METH_STATIC + , "Bind to Qt, effectively calling Qt and allocating all objects." } + //, { "destroy" , (PyCFunction)PyGraphics_destroy , METH_NOARGS + // , "Destroy the associated hurricane object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + PythonOnlyDeleteMethod(Graphics) + PyTypeObjectLinkPyType(Graphics) + + +#else // End of Python Module Code Part. + +// +=================================================================+ +// | "PyGraphics" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + PyTypeObjectDefinitions(Graphics) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + + +} // Hurricane namespace. + diff --git a/hurricane/src/viewer/PyHApplication.cpp b/hurricane/src/viewer/PyHApplication.cpp new file mode 100644 index 00000000..8beea2d6 --- /dev/null +++ b/hurricane/src/viewer/PyHApplication.cpp @@ -0,0 +1,165 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyHApplication.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/viewer/PyHApplication.h" +#include +#include +#if (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) and not defined (__APPLE__) +# include +#endif + + +namespace Hurricane { + + using std::cerr; + using std::endl; + using std::hex; + using Isobar::ProxyProperty; + using Isobar::ProxyError; + using Isobar::ConstructorError; + using Isobar::HurricaneError; + using Isobar::HurricaneWarning; + using Isobar::ParseOneArg; + using Isobar::ParseTwoArg; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(HApplication,ha,function) + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyHApplication" Python Module Code Part | +// +=================================================================+ + + + static PyObject* PyHApplication_create ( PyObject*, PyObject* args ) + { + static int argc = 0; + static char** argv = NULL; + vector vargv; + + trace << "PyHApplication_create()" << endl; + + HApplication* ha = NULL; + PyHApplication* pyHApplication = NULL; + PyObject* pyArgv = NULL; + + HTRY + if (not PyArg_ParseTuple(args,"O:HApplication.create()", &pyArgv)) { + PyErr_SetString ( ConstructorError, "HApplication.create(): Takes exactly one argument." ); + return NULL; + } + + if (not PyList_Check(pyArgv)) { + PyErr_SetString(ConstructorError,"HApplication.create(): Argument is not a list."); + return NULL; + } + + Py_ssize_t size = PyList_Size(pyArgv); + for( Py_ssize_t i=0 ; i= QT_VERSION_CHECK(4,5,0)) and not defined (__APPLE__) + ha->setStyle ( new QGtkStyle() ); +#endif + + pyHApplication = PyObject_NEW ( PyHApplication, &PyTypeHApplication ); + if ( ha == NULL ) return NULL; + + pyHApplication->_object = ha; + HCATCH + + return (PyObject*)pyHApplication; + } + + + static PyObject* PyHApplication_qtExec ( PyHApplication* self, PyObject* args ) + { + trace << "PyHApplication_qtExec()" << endl; + + int returnCode = 0; + + HTRY + METHOD_HEAD("HApplication.qtExec()") + returnCode = ha->exec(); + HCATCH + + return Py_BuildValue("i",returnCode); + } + + + // Standart Destroy (Attribute). + // DBoDestroyAttribute(PyHApplication_destroy,PyHApplication) + + + PyMethodDef PyHApplication_Methods[] = + { { "create" , (PyCFunction)PyHApplication_create , METH_VARARGS |METH_STATIC + , "Create a new HApplication (must be done only once)." } + , { "qtExec" , (PyCFunction)PyHApplication_qtExec , METH_VARARGS + , "Launch the Qt main event loop." } + //, { "destroy" , (PyCFunction)PyHApplication_destroy , METH_NOARGS + // , "Destroy the associated hurricane object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + DirectDeleteMethod(PyHApplication_DeAlloc,PyHApplication) + PyTypeObjectLinkPyType(HApplication) + + +#else // End of Python Module Code Part. + +// +=================================================================+ +// | "PyHApplication" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + PyTypeObjectDefinitions(HApplication) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + + +} // Hurricane namespace. + diff --git a/hurricane/src/viewer/PyHSVr.cpp b/hurricane/src/viewer/PyHSVr.cpp new file mode 100644 index 00000000..ccb65e0e --- /dev/null +++ b/hurricane/src/viewer/PyHSVr.cpp @@ -0,0 +1,165 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyHSVr.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/PyGraphics.h" +#include "hurricane/viewer/PyHSVr.h" +#include + + +namespace Hurricane { + + using std::cerr; + using std::endl; + using std::hex; + using std::ostringstream; + using Isobar::ProxyProperty; + using Isobar::ProxyError; + using Isobar::ConstructorError; + using Isobar::HurricaneError; + using Isobar::HurricaneWarning; + using Isobar::ParseOneArg; + using Isobar::ParseTwoArg; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DisplayStyle::HSVr,hsvr,function) + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyHSVr" Python Module Code Part | +// +=================================================================+ + + + static PyObject* PyHSVr_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) + { + trace << "PyHSVr_new()" << endl; + + DisplayStyle::HSVr* hsvr = NULL; + PyHSVr* pyHSVr = (PyHSVr*)type->tp_alloc(type,0); + + HTRY + if ( pyHSVr ) { + float hue = 1.0; + float saturation = 1.0; + float value = 1.0; + if (PyArg_ParseTuple(args,"fff:HSVr.new", &hue, &saturation, &value)) { + hsvr = new DisplayStyle::HSVr(hue,saturation,value); + } else { + PyErr_SetString ( ConstructorError, "invalid number of parameters for HSVr()." ); + return NULL; + } + pyHSVr->_object = hsvr; + } + HCATCH + + return (PyObject*)pyHSVr; + } + + + static PyObject* PyHSVr_Repr ( PyHSVr* self ) + { + DisplayStyle::HSVr* hsvr = self->_object; + + if ( hsvr == NULL ) + return PyString_FromString(""); + + ostringstream s; + s << "getHue() + << " " << hsvr->getSaturation() + << " " << hsvr->getValue() + << ">"; + return PyString_FromString(s.str().c_str()); + } + + + // Standart Accessors (Attributes). + DirectGetDoubleAttribute(PyHSVr_GetHue ,getHue ,PyHSVr,DisplayStyle::HSVr) + DirectGetDoubleAttribute(PyHSVr_GetSaturation,getSaturation,PyHSVr,DisplayStyle::HSVr) + DirectGetDoubleAttribute(PyHSVr_GetValue ,getValue ,PyHSVr,DisplayStyle::HSVr) + DirectSetDoubleAttribute(PyHSVr_SetHue ,setHue ,"HSVr.setHue" ,PyHSVr,DisplayStyle::HSVr) + DirectSetDoubleAttribute(PyHSVr_SetSaturation,setSaturation,"HSVr.setSaturation",PyHSVr,DisplayStyle::HSVr) + DirectSetDoubleAttribute(PyHSVr_SetValue ,setValue ,"HSVr.setValue" ,PyHSVr,DisplayStyle::HSVr) + + // Standart Predicates (Attributes). + DirectGetBoolAttribute(PyHSVr_IsId,isId,PyHSVr,DisplayStyle::HSVr) + + + PyMethodDef PyHSVr_Methods[] = + { { "isId" , (PyCFunction)PyHSVr_IsId , METH_NOARGS , "Tells if the HSV is ident." } + , { "getHue" , (PyCFunction)PyHSVr_GetHue , METH_NOARGS , "Return the HSV hue." } + , { "getSaturation", (PyCFunction)PyHSVr_GetSaturation, METH_NOARGS , "Return the HSV saturation." } + , { "getValue" , (PyCFunction)PyHSVr_GetValue , METH_NOARGS , "Return the HSV value." } + , { "setHue" , (PyCFunction)PyHSVr_SetHue , METH_VARARGS, "Modify the HSV hue." } + , { "setSaturation", (PyCFunction)PyHSVr_SetSaturation, METH_VARARGS, "Modify the HSV saturation." } + , { "setValue" , (PyCFunction)PyHSVr_SetValue , METH_VARARGS, "Modify the HSV value." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + DirectDeleteMethod(PyHSVr_DeAlloc,PyHSVr) + DirectHashMethod(PyHSVr_Hash, PyHSVr) + + extern void PyHSVr_LinkPyType() { + trace << "PyHSVr_LinkType()" << endl; + + PyTypeHSVr.tp_new = PyHSVr_new; + PyTypeHSVr.tp_dealloc = (destructor) PyHSVr_DeAlloc; + PyTypeHSVr.tp_repr = (reprfunc) PyHSVr_Repr; + PyTypeHSVr.tp_str = (reprfunc) PyHSVr_Repr; + PyTypeHSVr.tp_hash = (hashfunc) PyHSVr_Hash; + PyTypeHSVr.tp_methods = PyHSVr_Methods; + } + + +#else // End of Python Module Code Part. + +// +=================================================================+ +// | "PyHSVr" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + PyObject* PyHSVr_Link ( DisplayStyle::HSVr* object ) + { + if ( object == NULL ) Py_RETURN_NONE; + + PyHSVr* pyObject = NULL; + HTRY + pyObject = PyObject_NEW(PyHSVr, &PyTypeHSVr); + if (pyObject == NULL) return NULL; + + pyObject->_object = object; + HCATCH + + return (PyObject*)pyObject; + } + + PyTypeObjectDefinitions(HSVr) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + + +} // Hurricane namespace. + diff --git a/hurricane/src/viewer/PyViewer.cpp b/hurricane/src/viewer/PyViewer.cpp index c6767a50..95572f7e 100644 --- a/hurricane/src/viewer/PyViewer.cpp +++ b/hurricane/src/viewer/PyViewer.cpp @@ -2,28 +2,26 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./PyViewer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Module : "./PyViewer.cpp" | +// +-----------------------------------------------------------------+ #include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/PyHApplication.h" +#include "hurricane/viewer/PyGraphics.h" +#include "hurricane/viewer/PyDrawingStyle.h" +#include "hurricane/viewer/PyDrawingGroup.h" +#include "hurricane/viewer/PyDisplayStyle.h" +#include "hurricane/viewer/PyHSVr.h" #include "hurricane/viewer/PyCellViewer.h" @@ -36,25 +34,24 @@ namespace Hurricane { #if !defined(__PYTHON_MODULE__) -// x=================================================================x +// +=================================================================+ // | "PyViewer" Shared Library Code Part | -// x=================================================================x +// +=================================================================+ # else // End of PyHurricane Shared Library Code Part. - -// x=================================================================x +// +=================================================================+ // | "PyViewer" Python Module Code Part | -// x=================================================================x +// +=================================================================+ extern "C" { - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ // | "PyViewer" Module Methods | - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ static PyMethodDef PyViewer_Methods[] = @@ -62,34 +59,60 @@ extern "C" { }; - - // --------------------------------------------------------------- // Module Initialization : "initViewer ()" DL_EXPORT(void) initViewer () { trace << "initViewer()" << endl; + PyHSVr_LinkPyType (); + PyRawDrawingStyle_LinkPyType (); + PyDrawingStyleVector_LinkPyType (); + PyDrawingGroup_LinkPyType (); + PyDrawingGroupVector_LinkPyType (); + PyDisplayStyle_LinkPyType (); + PyDisplayStyleVector_LinkPyType (); + PyHApplication_LinkPyType (); + PyGraphics_LinkPyType (); PyCellViewer_LinkPyType (); - + + PYTYPE_READY ( HSVr ); + PYTYPE_READY ( RawDrawingStyle ); + PYTYPE_READY ( DrawingStyleVector ); + PYTYPE_READY ( DrawingStyleVectorIterator ); + PYTYPE_READY ( DrawingGroup ); + PYTYPE_READY ( DrawingGroupVector ); + PYTYPE_READY ( DrawingGroupVectorIterator ); + PYTYPE_READY ( DisplayStyle ); + PYTYPE_READY ( DisplayStyleVector ); + PYTYPE_READY ( DisplayStyleVectorIterator ); + PYTYPE_READY ( HApplication ); + PYTYPE_READY ( Graphics ); PYTYPE_READY ( CellViewer ); - + // Identifier string can take up to 10 characters. - __cs.addType ( "cellView", &PyTypeCellViewer, "", false, "view" ); - + __cs.addType ( "hsvr" , &PyTypeHSVr , "" , false ); + __cs.addType ( "displaySty", &PyTypeDisplayStyle, "", false ); + __cs.addType ( "graphics" , &PyTypeGraphics , "" , false ); + __cs.addType ( "cellView" , &PyTypeCellViewer , "" , false, "view" ); + PyObject* module = Py_InitModule ( "Viewer", PyViewer_Methods ); if ( module == NULL ) { cerr << "[ERROR]\n" << " Failed to initialize Viewer module." << endl; return; } - + + Py_INCREF ( &PyTypeDisplayStyle ); + PyModule_AddObject ( module, "DisplayStyle", (PyObject*)&PyTypeDisplayStyle ); + Py_INCREF ( &PyTypeHApplication ); + PyModule_AddObject ( module, "HApplication", (PyObject*)&PyTypeHApplication ); + Py_INCREF ( &PyTypeGraphics ); + PyModule_AddObject ( module, "Graphics", (PyObject*)&PyTypeGraphics ); Py_INCREF ( &PyTypeCellViewer ); PyModule_AddObject ( module, "CellViewer", (PyObject*)&PyTypeCellViewer ); - - PyObject* dictionnary = PyModule_GetDict ( module ); - - //DbULoadConstants ( dictionnary ); + + PyDisplayStyle_postModuleInit(); trace << "Viewer.so loaded " << (void*)&typeid(string) << endl; } diff --git a/hurricane/src/viewer/ScreenUtilities.cpp b/hurricane/src/viewer/ScreenUtilities.cpp index 2ba200e5..3e89d954 100644 --- a/hurricane/src/viewer/ScreenUtilities.cpp +++ b/hurricane/src/viewer/ScreenUtilities.cpp @@ -1,68 +1,30 @@ // -*- 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-2012, 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 | // | 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 : "./ScreenUtilisties.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -# include - -# include "hurricane/BasicLayer.h" - -# include "hurricane/viewer/ScreenUtilities.h" +// | C++ Module : "./ScreenUtilisties.cpp" | +// +-----------------------------------------------------------------+ +#include +#include +#include "hurricane/BasicLayer.h" +#include "hurricane/viewer/ScreenUtilities.h" namespace { - inline bool charToBits ( uchar& b, char c, bool low=true ) + inline bool charToBits ( uchar& b, char c, bool isMSB=true ) { bool isValid = true; uchar value = 0xF; @@ -77,20 +39,34 @@ namespace { } } - b &= (low) ? 0xF0 : 0x0F; - b += (low) ? value : (value<<4); + b &= (isMSB) ? 0x0F : 0xF0; + b |= (isMSB) ? (value<<4) : value; return isValid; } - bool getPattern ( uchar bits[], const std::string& pattern ) + bool isSolidFill ( const std::string& pattern ) + { + for( size_t i=0 ; i 15 ) { isValid = false; break; } - isValid &= charToBits ( bits[i/2], pattern[i], i%2 ); + size = (int)sqrt((double)pattern.size()*4.0); + if ( pow((double)size,2.0) != (double)pattern.size()*4.0 ) + isValid = false; + + *bits = new uchar[pattern.size()/2]; + + for ( size_t i=0 ; i #include #include "hurricane/Error.h" #include "hurricane/Cell.h" @@ -73,13 +70,16 @@ namespace Isobar { , _pyArgs (NULL) , _pyResult (NULL) , _cellViewer (NULL) + , _globalState (NULL) + , _subInterpreter (NULL) + , _flags (0) { } Script::~Script () { _finalize(); - Py_Finalize (); + //Py_Finalize (); } @@ -195,31 +195,46 @@ namespace Isobar { void Script::_initialize () { - Py_Initialize (); - _importSys (); - _importHurricane (); + if (Py_IsInitialized()) { + // Python is already running. Launch a sub-interpreter. + _globalState = PyThreadState_Get(); + _subInterpreter = Py_NewInterpreter(); + } else + Py_Initialize(); + + _flags |= Initialized; + _importSys (); + _importHurricane(); } void Script::_finalize () { - if ( not Py_IsInitialized() ) return; + if (not Py_IsInitialized()) return; + if (not (_flags & Initialized)) return; + _flags &= ~Initialized; - if ( _pyResult != NULL ) Py_DECREF ( _pyResult ); - if ( _pyArgs != NULL ) Py_DECREF ( _pyArgs ); - if ( _pyFunction != NULL ) Py_DECREF ( _pyFunction ); - if ( _userModule != NULL ) Py_DECREF ( _userModule ); - if ( _hurricaneModule != NULL ) Py_DECREF ( _hurricaneModule ); - if ( _sysModule != NULL ) Py_DECREF ( _sysModule ); - - Py_Finalize (); - - _userModule = NULL; - _sysModule = NULL; - _hurricaneModule = NULL; - _pyFunction = NULL; - _pyArgs = NULL; - _pyResult = NULL; + if (_subInterpreter != NULL) { + Py_EndInterpreter(_subInterpreter); + PyThreadState_Swap(_globalState); + _subInterpreter = NULL; + } else { + if ( _userModule != NULL ) { Py_DECREF ( _userModule ); } + if ( _hurricaneModule != NULL ) { Py_DECREF ( _hurricaneModule ); } + if ( _sysModule != NULL ) { Py_DECREF ( _sysModule ); } + if ( _pyResult != NULL ) { Py_DECREF ( _pyResult ); } + if ( _pyArgs != NULL ) { Py_DECREF ( _pyArgs ); } + if ( _pyFunction != NULL ) { Py_DECREF ( _pyFunction ); } + + Py_Finalize (); + + _userModule = NULL; + _sysModule = NULL; + _hurricaneModule = NULL; + _pyFunction = NULL; + _pyArgs = NULL; + _pyResult = NULL; + } } diff --git a/hurricane/src/viewer/ScriptWidget.cpp b/hurricane/src/viewer/ScriptWidget.cpp index 24edb8e8..52e9544a 100644 --- a/hurricane/src/viewer/ScriptWidget.cpp +++ b/hurricane/src/viewer/ScriptWidget.cpp @@ -23,6 +23,7 @@ // x-----------------------------------------------------------------x +#include #include #include using namespace std; diff --git a/hurricane/src/viewer/StratusScript.cpp b/hurricane/src/viewer/StratusScript.cpp index 77484f3c..6700fa87 100644 --- a/hurricane/src/viewer/StratusScript.cpp +++ b/hurricane/src/viewer/StratusScript.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2011, All Rights Reserved -// -// =================================================================== -// -// $Id$ +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // // +-----------------------------------------------------------------+ -// | | // | 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 | // | | @@ -17,12 +12,10 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./StratusScript.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | // +-----------------------------------------------------------------+ +#include #include using namespace std; diff --git a/hurricane/src/viewer/StratusWidget.cpp b/hurricane/src/viewer/StratusWidget.cpp index 0a4040b6..58d72102 100644 --- a/hurricane/src/viewer/StratusWidget.cpp +++ b/hurricane/src/viewer/StratusWidget.cpp @@ -23,6 +23,7 @@ // x-----------------------------------------------------------------x +#include #include #include using namespace std; diff --git a/hurricane/src/viewer/ZoomCommand.cpp b/hurricane/src/viewer/ZoomCommand.cpp index dc1e1eb3..fa9b6c64 100644 --- a/hurricane/src/viewer/ZoomCommand.cpp +++ b/hurricane/src/viewer/ZoomCommand.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 | // | | @@ -17,10 +12,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./ZoomCommand.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ # include diff --git a/hurricane/src/viewer/hurricane/viewer/CellImage.h b/hurricane/src/viewer/hurricane/viewer/CellImage.h new file mode 100644 index 00000000..99d9d2cf --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/CellImage.h @@ -0,0 +1,94 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | 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 : "./hurricane/viewer/CellImage.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __HURRICANE_CELL_IMAGE__ +#define __HURRICANE_CELL_IMAGE__ + + +#include + +using namespace std; + +#include + +class QEvent; +class QKeyEvent; +class QAction; +class QMenu; +class QPainter; +class QImage; + +#include "hurricane/Commons.h" +#include "hurricane/Name.h" +#include "hurricane/viewer/CellWidget.h" + + +namespace Hurricane { + + + class Cell; + class PaletteWidget; + + + class CellImage : public QMainWindow { + Q_OBJECT; + + public: + enum Flags { ShowScale=0x0001 }; + public: + CellImage ( QWidget* parent=NULL ); + virtual ~CellImage (); + inline CellWidget* getCellWidget (); + inline const CellWidget* getCellWidget () const; + void setScreenCellWidget ( CellWidget* ); + inline void setMode ( int mode ); + inline void setFitOnAbutmentBox ( bool ); + void createLayout (); + inline bool fitOnAbutmentBox () const; + void pageDecorate ( QPainter& ); + QImage* toImage ( unsigned int flags=0 ); + virtual std::string _getString () const; + + protected: + CellWidget* _screenCellWidget; + CellWidget* _cellWidget; + PaletteWidget* _palette; + QImage* _image; + int _mode; + unsigned int _flags; + bool _fitOnAbutmentBox; + int _drawingWidth; + int _drawingHeight; + }; + + +// Inline Functions. + inline CellWidget* CellImage::getCellWidget () { return _cellWidget; } + inline const CellWidget* CellImage::getCellWidget () const { return _cellWidget; } + inline void CellImage::setMode ( int mode ) { _mode = mode; } + inline void CellImage::setFitOnAbutmentBox ( bool state ) { _fitOnAbutmentBox = state; } + inline bool CellImage::fitOnAbutmentBox () const { return _fitOnAbutmentBox; } + + +} // Hurricane namespace. + + +GETSTRING_POINTER_SUPPORT(Hurricane::CellImage) +IOSTREAM_POINTER_SUPPORT(Hurricane::CellImage) + + +#endif diff --git a/hurricane/src/viewer/hurricane/viewer/CellPrinter.h b/hurricane/src/viewer/hurricane/viewer/CellPrinter.h new file mode 100644 index 00000000..1c237968 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/CellPrinter.h @@ -0,0 +1,114 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | 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 : "./hurricane/viewer/CellPrinter.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __HURRICANE_CELL_PRINTER__ +#define __HURRICANE_CELL_PRINTER__ + + +#include + +using namespace std; + +#include + +class QEvent; +class QKeyEvent; +class QAction; +class QMenu; +class QPainter; +class QPrinter; + +#include "hurricane/Commons.h" +#include "hurricane/Name.h" +#include "hurricane/viewer/CellWidget.h" + + +namespace Hurricane { + + + class Cell; + class PaletteWidget; + + + class CellPrinter : public QMainWindow { + Q_OBJECT; + + public: + static std::string getUserName (); + static std::string getTime ( const char* format ); + static QString getUnitQString (); + static QString dbuToPrinterString ( DbU::Unit unit ); + public: + CellPrinter ( QWidget* parent=NULL ); + virtual ~CellPrinter (); + inline CellWidget* getCellWidget (); + inline const CellWidget* getCellWidget () const; + void setScreenCellWidget ( CellWidget* ); + inline void setMode ( int mode ); + inline void setFitOnAbutmentBox ( bool ); + void createLayout (); + inline bool fitOnAbutmentBox () const; + inline int resolution () const; + inline int frameMargin () const; + inline int cartoucheWidth () const; + inline int cartoucheHeight () const; + inline int titleHeight () const; + void pageDecorate ( QPainter& ); + void toPdf ( QPrinter* , bool imageOnly=false ); + virtual std::string _getString () const; + + protected: + CellWidget* _screenCellWidget; + CellWidget* _cellWidget; + PaletteWidget* _palette; + QPrinter* _printer; + int _mode; + int _paperWidth; + int _paperHeight; + int _frameMargin; + int _cartoucheWidth; + int _cartoucheHeight; + int _titleHeight; + int _xpaper; + int _ypaper; + int _drawingWidth; + int _drawingHeight; + bool _fitOnAbutmentBox; + }; + + +// Inline Functions. + inline CellWidget* CellPrinter::getCellWidget () { return _cellWidget; } + inline const CellWidget* CellPrinter::getCellWidget () const { return _cellWidget; } + inline void CellPrinter::setMode ( int mode ) { _mode = mode; } + inline void CellPrinter::setFitOnAbutmentBox ( bool state ) { _fitOnAbutmentBox = state; } + inline int CellPrinter::resolution () const { return (_mode == CellWidget::Res_CellMode) ? 150 : 300; } + inline bool CellPrinter::fitOnAbutmentBox () const { return _fitOnAbutmentBox; } + inline int CellPrinter::frameMargin () const { return _frameMargin*_mode; } + inline int CellPrinter::cartoucheWidth () const { return _cartoucheWidth*_mode; } + inline int CellPrinter::cartoucheHeight () const { return _cartoucheHeight*_mode; } + inline int CellPrinter::titleHeight () const { return _titleHeight*_mode; } + + +} // Hurricane namespace. + + +GETSTRING_POINTER_SUPPORT(Hurricane::CellPrinter) +IOSTREAM_POINTER_SUPPORT(Hurricane::CellPrinter) + + +#endif diff --git a/hurricane/src/viewer/hurricane/viewer/CellViewer.h b/hurricane/src/viewer/hurricane/viewer/CellViewer.h index 6db7a03f..f32a8684 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/viewer/hurricane/viewer/CellViewer.h @@ -1,25 +1,18 @@ + // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 : "./CellViewer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/CellViewer.h" | +// +-----------------------------------------------------------------+ #ifndef __HURRICANE_CELL_VIEWER__ @@ -36,6 +29,7 @@ class QEvent; class QKeyEvent; class QAction; class QMenu; +class QPrinter; #include "hurricane/Commons.h" #include "hurricane/Name.h" @@ -72,15 +66,19 @@ namespace Hurricane { QMenu* createDebugMenu (); inline void setEnableRedrawInterrupt ( bool ); inline void setApplicationName ( const QString& ); - Cell* getCell (); + Cell* getCell () const; void setCell ( Cell* ); void renameCell ( const char* ); virtual Cell* getCellFromDb ( const char* ); inline CellWidget* getCellWidget (); + inline const CellWidget* getCellWidget () const; inline ControllerWidget* getControllerWidget (); + void setAnonNetSelectable ( bool ); void select ( Occurrence& ); void unselect ( Occurrence& ); void unselectAll (); + inline void setLayerVisible ( const Name& layer, bool visible ); + virtual std::string _getString () const; public slots: void doGoto (); void changeSelectionMode (); @@ -88,6 +86,7 @@ namespace Hurricane { void setState ( shared_ptr& ); void openHistoryCell (); void printDisplay (); + void print ( QPrinter* ); void imageDisplay (); void raiseToolInterrupt (); void clearToolInterrupt (); @@ -151,16 +150,22 @@ namespace Hurricane { // Inline Functions. - inline void CellViewer::setEnableRedrawInterrupt ( bool state ) - { _cellWidget->setEnableRedrawInterrupt(state); } - inline bool CellViewer::isToolInterrupted () const { return _toolInterrupt; } inline CellWidget* CellViewer::getCellWidget () { return _cellWidget; } + inline const CellWidget* CellViewer::getCellWidget () const { return _cellWidget; } inline ControllerWidget* CellViewer::getControllerWidget () { return _controller; } inline void CellViewer::setApplicationName ( const QString& name ) { _applicationName = name; } + inline void CellViewer::setLayerVisible ( const Name& layer, bool visible ) { _cellWidget->setLayerVisible(layer,visible); } + + inline void CellViewer::setEnableRedrawInterrupt ( bool state ) + { _cellWidget->setEnableRedrawInterrupt(state); } -} // End of Hurricane namespace. +} // Hurricane namespace. + + +GETSTRING_POINTER_SUPPORT(Hurricane::CellViewer) +IOSTREAM_POINTER_SUPPORT(Hurricane::CellViewer) #endif diff --git a/hurricane/src/viewer/hurricane/viewer/CellWidget.h b/hurricane/src/viewer/hurricane/viewer/CellWidget.h index 2f84c851..408a678b 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/CellWidget.h @@ -2,11 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2011, All Rights Reserved -// -// =================================================================== -// -// $Id$ +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -15,7 +11,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./CellWidget.h" | +// | C++ Header : "./hurricane/viewer/CellWidget.h" | // +-----------------------------------------------------------------+ @@ -27,6 +23,7 @@ #include #include #include +#include #include #include @@ -107,17 +104,20 @@ namespace Hurricane { , const Transformation& ); typedef void ( InitExtensionGo_t )( CellWidget* ); - enum RubberShape { Centric=1, Barycentric, Steiner }; - enum TextFlag { Bold =0x001 - , BigFont =0x002 - , Reverse =0x004 - , Frame =0x008 - , Rounded =0x010 - , Center =0x020 - , Left =0x040 - , Right =0x080 - , Top =0x100 - }; + typedef boost::function< void(QPainter&) > PainterCb_t; + enum RubberShape { Centric=1, Barycentric, Steiner }; + enum TextFlag { Bold =0x001 + , BigFont =0x002 + , Reverse =0x004 + , Frame =0x008 + , Rounded =0x010 + , Center =0x020 + , Left =0x040 + , Right =0x080 + , Top =0x100 + }; + public: + enum ResolutionMode { Res_CellMode=1, Res_DesignMode=2 }; public: // Constructor & Destructor. CellWidget ( QWidget* parent=NULL ); @@ -127,6 +127,7 @@ namespace Hurricane { void setCell ( Cell* ); inline Cell* getCell () const; inline shared_ptr& getState (); + inline shared_ptr getStateClone (); inline PaletteWidget* getPalette (); inline Occurrences getOccurrencesUnder ( const QRect& ) const; Occurrences getOccurrencesUnder ( const Box& ) const; @@ -165,13 +166,14 @@ namespace Hurricane { inline void setEnableRedrawInterrupt ( bool ); inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* ); inline QPainter& getPainter ( size_t plane=PlaneId::Working ); - inline const DisplayStyle::HSVr& getDarkening () const; - inline void copyToPrinter ( QPrinter*, bool imageOnly = false ); - inline void copyToImage ( QImage*, bool noScale = false ); + inline const DisplayStyle::HSVr& getDarkening () const; + inline void copyToPrinter ( int xpaper, int ypaper, QPrinter*, PainterCb_t& ); + inline void copyToImage ( QImage*, PainterCb_t& ); inline const float& getScale () const; inline const QPoint& getMousePosition () const; inline void updateMousePosition (); void setLayerVisible ( const Name& layer, bool visible ); + bool isLayerVisible ( const Name& ); bool isDrawable ( const Name& ); bool isDrawableLayer ( const Name& ); bool isDrawableExtension ( const Name& ); @@ -413,20 +415,15 @@ namespace Hurricane { void shiftRight ( int dx ); void shiftUp ( int dy ); void shiftDown ( int dy ); - void drawCartouche ( int right - , int bottom - , const string& title - , const string& area - ); inline void copyToSelect (); inline void copyToSelect ( const QRect& ); void copyToSelect ( int sx, int sy, int h, int w ); inline void copyToScreen (); void copyToScreen ( int sx, int sy, int h, int w ); - inline void copyToPrinter ( QPrinter*, bool imageOnly ); - void copyToPrinter ( int sx, int sy, int h, int w, QPrinter*, bool imageOnly ); - inline void copyToImage ( QImage*, bool noScale ); - void copyToImage ( int sx, int sy, int h, int w, QImage*, bool noScale ); + inline void copyToPrinter ( int xpaper, int ypaper, QPrinter*, CellWidget::PainterCb_t& ); + void copyToPrinter ( int xpaper, int ypaper, int sx, int sy, int h, int w, QPrinter*, CellWidget::PainterCb_t& ); + inline void copyToImage ( QImage*, CellWidget::PainterCb_t& ); + void copyToImage ( int sx, int sy, int h, int w, QImage*, CellWidget::PainterCb_t& ); private: static const int _cartoucheWidth; static const int _cartoucheHeight; @@ -552,6 +549,7 @@ namespace Hurricane { class State { public: inline State ( Cell* cell=NULL ); + State* clone () const; inline void setCell ( Cell* ); inline void setCellWidget ( CellWidget* ); inline void setCursorStep ( DbU::Unit ); @@ -856,26 +854,28 @@ namespace Hurricane { { copyToScreen ( 0, 0, width(), height() ); } - inline void CellWidget::DrawingPlanes::copyToPrinter ( QPrinter* printer, bool imageOnly ) + inline void CellWidget::DrawingPlanes::copyToPrinter ( int xpaper, int ypaper, QPrinter* printer, CellWidget::PainterCb_t& cb ) { - copyToPrinter ( 0 + copyToPrinter ( xpaper + , ypaper + , 0 , 0 , _cellWidget->geometry().width() , _cellWidget->geometry().height() , printer - , imageOnly + , cb ); } - inline void CellWidget::DrawingPlanes::copyToImage ( QImage* image, bool noScale ) + inline void CellWidget::DrawingPlanes::copyToImage ( QImage* image, CellWidget::PainterCb_t& cb ) { copyToImage ( 0 , 0 , _cellWidget->geometry().width() , _cellWidget->geometry().height() , image - , noScale + , cb ); } @@ -1107,6 +1107,13 @@ namespace Hurricane { _state->setTopLeft ( getTopLeft() ); return _state; } + + + inline shared_ptr CellWidget::getStateClone () + { + _state->setTopLeft ( getTopLeft() ); + return shared_ptr( _state->clone() ); + } inline void CellWidget::addDrawExtensionGo ( const Name& name @@ -1182,12 +1189,12 @@ namespace Hurricane { { redrawSelection ( QRect(QPoint(0,0),_drawingPlanes.size()) ); } - inline void CellWidget::copyToPrinter ( QPrinter* printer, bool imageOnly ) - { _drawingPlanes.copyToPrinter ( printer, imageOnly ); } + inline void CellWidget::copyToPrinter ( int xpaper, int ypaper, QPrinter* printer, CellWidget::PainterCb_t& cb ) + { _drawingPlanes.copyToPrinter( xpaper, ypaper, printer, cb ); } - inline void CellWidget::copyToImage ( QImage* image, bool noScale ) - { _drawingPlanes.copyToImage ( image, noScale ); } + inline void CellWidget::copyToImage ( QImage* image, PainterCb_t& cb ) + { _drawingPlanes.copyToImage ( image, cb ); } inline DbU::Unit CellWidget::toDbu ( float d ) const diff --git a/hurricane/src/viewer/hurricane/viewer/Command.h b/hurricane/src/viewer/hurricane/viewer/Command.h index 8432aa02..eef67714 100644 --- a/hurricane/src/viewer/hurricane/viewer/Command.h +++ b/hurricane/src/viewer/hurricane/viewer/Command.h @@ -2,25 +2,17 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 : "./Command.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/Command.h" | +// +-----------------------------------------------------------------+ #ifndef __HURRICANE_COMMAND_H__ diff --git a/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h b/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h index 8738654f..1710a7cc 100644 --- a/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h +++ b/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h @@ -2,33 +2,25 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 : "./DisplayStyle.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/DisplayStyle.h" | +// +-----------------------------------------------------------------+ #ifndef __HURRICANE_DISPLAYSTYLE_H__ #define __HURRICANE_DISPLAYSTYLE_H__ +#include #include -#include #include #include #include @@ -39,47 +31,42 @@ namespace Hurricane { - class DrawingStyle; + class RawDrawingStyle; + typedef std::tr1::shared_ptr DrawingStyle; + typedef std::vector DrawingStyles; class DrawingGroup { - public: // Constructors & Destructors. - DrawingGroup ( const Name& name ); - ~DrawingGroup (); - DrawingGroup* getClone (); - void qtAllocate (); - - // Methods. - inline const Name& getName () const; - inline const vector& getDrawingStyles () const; - size_t findIndex ( const Name& key ) const; - DrawingStyle* find ( const Name& key ) const; - DrawingStyle* addDrawingStyle ( const Name& key - , const string& pattern - , int red - , int green - , int blue - , int borderWidth - , float threshold - , bool goMatched - ); - + DrawingGroup ( const Name& name ); + ~DrawingGroup (); + DrawingGroup* getClone (); + void qtAllocate (); + // Methods. + inline const Name& getName () const; + inline const DrawingStyles& getDrawingStyles () const; + size_t findIndex ( const Name& key ) const; + DrawingStyle find ( const Name& key ) const; + DrawingStyle addDrawingStyle ( const Name& key + , const std::string& pattern + , int red + , int green + , int blue + , int borderWidth + , float threshold + , bool goMatched + ); protected: - // Internal - Attributes. - const Name _name; - vector _drawingStyles; - - // Internal - Constructors & Destructors. - DrawingGroup ( const DrawingGroup& ); - DrawingGroup& operator= ( const DrawingGroup& ); + const Name _name; + DrawingStyles _drawingStyles; + protected: + DrawingGroup ( const DrawingGroup& ); + DrawingGroup& operator= ( const DrawingGroup& ); }; - - class DisplayStyle { public: class HSVr { @@ -100,68 +87,68 @@ namespace Hurricane { public: // Static Members. - static const Name Viewer; - static const Name Fallback; - static const Name Background; - static const Name Foreground; - static const Name Rubber; - static const Name Phantom; - static const Name Boundaries; - static const Name Marker; - static const Name SelectionDraw; - static const Name SelectionFill; - static const Name Grid; - static const Name Spot; - static const Name Ghost; - static const Name TextRuler; - static const Name TextCell; - static const Name TextInstance; - static const Name TextComponent; - static const Name TextReference; - static const Name Undef; - static const Name UnmatchedGroup; - - static QColor darken ( const QColor& color, const DisplayStyle::HSVr& darkening ); - // Constructor & Destructor. - DisplayStyle ( const Name& name ); - ~DisplayStyle (); - - // Accessors. - const Name& getName () const; - inline const string& getDescription () const; - inline const HSVr& getDarkening () const; - const Name& getGroup ( const Name& key ) const; - const string& getPattern ( const Name& key ) const; - QColor getColor ( const Name& key, const HSVr& ) const; - QPen getPen ( const Name& key, const HSVr& ) const; - QBrush getBrush ( const Name& key, const HSVr& ) const; - float getThreshold ( const Name& key ) const; - inline const vector& getDrawingGroups () const; - DrawingStyle* find ( const Name& key ) const; - - // Modifiers. - void qtAllocate (); - inline void setDescription ( const string& description ); - inline void setDescription ( const char* description ); - void inheritFrom ( const DisplayStyle* base ); - void setDarkening ( const HSVr& ); - void addDrawingStyle ( const Name& groupKey - , const Name& key - , const string& pattern - , int red - , int green - , int blue - , int borderWidth - , float threshold - , bool goMatched =true - ); - - protected: - // Internals - Attributes. - const Name _name; - string _description; - vector _groups; - HSVr _darkening; + static const Name Viewer; + static const Name Fallback; + static const Name Background; + static const Name Foreground; + static const Name Rubber; + static const Name Phantom; + static const Name Boundaries; + static const Name Marker; + static const Name SelectionDraw; + static const Name SelectionFill; + static const Name Grid; + static const Name Spot; + static const Name Ghost; + static const Name TextRuler; + static const Name TextCell; + static const Name TextInstance; + static const Name TextComponent; + static const Name TextReference; + static const Name Undef; + static const Name UnmatchedGroup; + + static QColor darken ( const QColor& color, const DisplayStyle::HSVr& darkening ); + // Constructor & Destructor. + DisplayStyle ( const Name& name ); + ~DisplayStyle (); + + // Accessors. + const Name& getName () const; + inline const std::string& getDescription () const; + inline const HSVr& getDarkening () const; + const Name& getGroup ( const Name& key ) const; + const std::string& getPattern ( const Name& key ) const; + QColor getColor ( const Name& key, const HSVr& ) const; + QPen getPen ( const Name& key, const HSVr& ) const; + QBrush getBrush ( const Name& key, const HSVr& ) const; + float getThreshold ( const Name& key ) const; + inline const std::vector& getDrawingGroups () const; + DrawingStyle find ( const Name& key ) const; + + // Modifiers. + void qtAllocate (); + inline void setDescription ( const std::string& description ); + inline void setDescription ( const char* description ); + void inheritFrom ( const DisplayStyle* base ); + void setDarkening ( const HSVr& ); + void addDrawingStyle ( const Name& groupKey + , const Name& key + , const std::string& pattern + , int red + , int green + , int blue + , int borderWidth + , float threshold + , bool goMatched =true + ); + + protected: + // Internals - Attributes. + const Name _name; + std::string _description; + std::vector _groups; + HSVr _darkening; // Internals - Methods. void findOrCreate ( const Name& groupKey @@ -174,83 +161,77 @@ namespace Hurricane { }; - class DrawingStyle { + class RawDrawingStyle { public: // Constructors & Destructors. - static DrawingStyle* create ( const Name& name - , const string& pattern ="FFFFFFFFFFFFFFFF" - , int red =0 - , int green =0 - , int blue =0 - , int borderWidth=0 - , float threshold =1.0 - , bool goMatched =true - ); - DrawingStyle* link (); - size_t unlink (); + static DrawingStyle create ( const Name& name + , const std::string& pattern ="FFFFFFFFFFFFFFFF" + , int red =0 + , int green =0 + , int blue =0 + , int borderWidth=0 + , float threshold =1.0 + , bool goMatched =true + ); public: // Accessors. - void qtAllocate (); - inline bool isGoMatched () const; - inline const Name& getName () const; - inline const string& getPattern () const; - QColor getColor ( const DisplayStyle::HSVr& ) const; - QPen getPen ( const DisplayStyle::HSVr& ) const; - QBrush getBrush ( const DisplayStyle::HSVr& ) const; - inline float getThreshold () const; + void qtAllocate (); + inline bool isGoMatched () const; + inline const Name& getName () const; + inline const std::string& getPattern () const; + QColor getColor ( const DisplayStyle::HSVr& ) const; + QPen getPen ( const DisplayStyle::HSVr& ) const; + QBrush getBrush ( const DisplayStyle::HSVr& ) const; + inline float getThreshold () const; private: // Internal - Attributes. - const Name _name; - int _red; - int _green; - int _blue; - int _borderWidth; - string _pattern; - QColor *_color; - QPen *_pen; - QBrush *_brush; - float _threshold; - bool _goMatched; - size_t _refcount; - private: + const Name _name; + int _red; + int _green; + int _blue; + int _borderWidth; + std::string _pattern; + QColor* _color; + QPen* _pen; + QBrush* _brush; + float _threshold; + bool _goMatched; + public: // Internal - Constructors & Destructors. - DrawingStyle ( const Name& name - , const string& pattern - , int red - , int green - , int blue - , int borderWidth - , float threshold - , bool goMatched - ); - DrawingStyle ( const DrawingStyle& ); - ~DrawingStyle (); - DrawingStyle& operator= ( const DrawingStyle& ); + RawDrawingStyle ( const Name& name + , const std::string& pattern + , int red + , int green + , int blue + , int borderWidth + , float threshold + , bool goMatched + ); + RawDrawingStyle ( const RawDrawingStyle& ); + ~RawDrawingStyle (); + private: + RawDrawingStyle& operator= ( const RawDrawingStyle& ); }; - - - - // Functions. - inline bool DrawingStyle::isGoMatched () const { return _goMatched; } - inline const Name& DrawingStyle::getName () const { return _name; } - inline const string& DrawingStyle::getPattern () const { return _pattern; } - inline float DrawingStyle::getThreshold () const { return _threshold; } - - inline const Name& DrawingGroup::getName () const { return _name; } - inline const vector& DrawingGroup::getDrawingStyles () const { return _drawingStyles; } - - inline const Name& DisplayStyle::getName () const { return _name; } - inline const vector& DisplayStyle::getDrawingGroups () const { return _groups; } - inline const DisplayStyle::HSVr& DisplayStyle::getDarkening () const { return _darkening; } - inline const string& DisplayStyle::getDescription () const { return _description; } - inline void DisplayStyle::setDescription ( const string& description ) { _description = description; } - inline void DisplayStyle::setDescription ( const char* description ) { _description = description; } + inline bool RawDrawingStyle::isGoMatched () const { return _goMatched; } + inline const Name& RawDrawingStyle::getName () const { return _name; } + inline const std::string& RawDrawingStyle::getPattern () const { return _pattern; } + inline float RawDrawingStyle::getThreshold () const { return _threshold; } + + inline const Name& DisplayStyle::getName () const { return _name; } + inline const std::vector& DisplayStyle::getDrawingGroups () const { return _groups; } + inline const DisplayStyle::HSVr& DisplayStyle::getDarkening () const { return _darkening; } + inline const std::string& DisplayStyle::getDescription () const { return _description; } + inline void DisplayStyle::setDescription ( const std::string& description ) { _description = description; } + inline void DisplayStyle::setDescription ( const char* description ) { _description = description; } inline DisplayStyle::HSVr::HSVr ( float hue, float saturation, float value ) : _hue(hue), _saturation(saturation), _value(value) { } + + inline const Name& DrawingGroup::getName () const { return _name; } + inline const DrawingStyles& DrawingGroup::getDrawingStyles () const { return _drawingStyles; } inline bool DisplayStyle::HSVr::isId () const { return (_hue==1.0) and (_saturation==1.0) and (_value==1.0); } inline float DisplayStyle::HSVr::getHue () const { return _hue; } diff --git a/hurricane/src/viewer/hurricane/viewer/Graphics.h b/hurricane/src/viewer/hurricane/viewer/Graphics.h index c0c68f96..635f189c 100644 --- a/hurricane/src/viewer/hurricane/viewer/Graphics.h +++ b/hurricane/src/viewer/hurricane/viewer/Graphics.h @@ -2,25 +2,17 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 : "./Graphics.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/Graphics.h" | +// +-----------------------------------------------------------------+ #ifndef __HURRICANE_GRAPHICS__ diff --git a/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h b/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h index 0920f05f..a97cc383 100644 --- a/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h @@ -2,25 +2,17 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 : "./InspectorWidget.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/InspectorWidget.h" | +// +-----------------------------------------------------------------+ #ifndef __HURRICANE_INSPECTOR_WIDGET__ diff --git a/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h b/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h index c274ed3e..16d8b0b7 100644 --- a/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h +++ b/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h @@ -2,25 +2,17 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./PyCellViewer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/PyCellViewer.cpp" | +// +-----------------------------------------------------------------+ #ifndef __PY_HURRICANE_CELL_VIEWER__ diff --git a/hurricane/src/viewer/hurricane/viewer/PyDisplayStyle.h b/hurricane/src/viewer/hurricane/viewer/PyDisplayStyle.h new file mode 100644 index 00000000..8cebcc40 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/PyDisplayStyle.h @@ -0,0 +1,66 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/PyDisplayStyle.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __VIEWER_PY_DISPLAY_STYLE__ +#define __VIEWER_PY_DISPLAY_STYLE__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/DisplayStyle.h" + + +namespace Hurricane { + + +extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyDisplayStyle". + + typedef struct { + PyObject_HEAD + DisplayStyle* _object; + } PyDisplayStyle; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyViewer.ccp". + + extern PyTypeObject PyTypeDisplayStyle; + extern PyMethodDef PyDisplayStyle_Methods[]; + + extern PyObject* PyDisplayStyle_Link ( DisplayStyle* ); + extern void PyDisplayStyle_LinkPyType (); + extern void PyDisplayStyle_postModuleInit (); + + +#define IsPyDisplayStyle(v) ( (v)->ob_type == &PyTypeDisplayStyle ) +#define PYDISPLAY_STYLE(v) ( (PyDisplayStyle*)(v) ) +#define PYDISPLAY_STYLE_O(v) ( PYDISPLAY_STYLE(v)->_object ) + + +// Vector of DrawingStyles. + declareVectorObject(DisplayStyle); + + +} // extern "C". + + +} // Hurricane namespace. + + +#endif // __VIEWER_PY_DISPLAY_STYLE__ diff --git a/hurricane/src/viewer/hurricane/viewer/PyDrawingGroup.h b/hurricane/src/viewer/hurricane/viewer/PyDrawingGroup.h new file mode 100644 index 00000000..d38adff8 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/PyDrawingGroup.h @@ -0,0 +1,65 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/PyDrawingGroup.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __VIEWER_PY_DRAWINGGROUP__ +#define __VIEWER_PY_DRAWINGGROUP__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/DisplayStyle.h" + + +namespace Hurricane { + + +extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyDrawingGroup". + + typedef struct { + PyObject_HEAD + DrawingGroup* _object; + } PyDrawingGroup; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyViewer.ccp". + + extern PyTypeObject PyTypeDrawingGroup; + extern PyMethodDef PyDrawingGroup_Methods[]; + + extern PyObject* PyDrawingGroup_Link ( DrawingGroup* ); + extern void PyDrawingGroup_LinkPyType (); + + +#define IsPyDrawingGroup(v) ( (v)->ob_type == &PyTypeDrawingGroup ) +#define PYDRAWINGGROUP(v) ( (PyDrawingGroup*)(v) ) +#define PYDRAWINGGROUP_O(v) ( PYDRAWINGGROUP(v)->_object ) + + +// Vector of DrawingStyles. + declareVectorObject(DrawingGroup); + + +} // extern "C". + + +} // Hurricane namespace. + + +#endif // __VIEWER_PY_DRAWINGGROUP__ diff --git a/hurricane/src/viewer/hurricane/viewer/PyDrawingStyle.h b/hurricane/src/viewer/hurricane/viewer/PyDrawingStyle.h new file mode 100644 index 00000000..16adfcb4 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/PyDrawingStyle.h @@ -0,0 +1,65 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/PyDrawingStyle.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __VIEWER_PY_DRAWINGSTYLE__ +#define __VIEWER_PY_DRAWINGSTYLE__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/DisplayStyle.h" + + +namespace Hurricane { + + +extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyRawDrawingStyle". + + typedef struct { + PyObject_HEAD + RawDrawingStyle* _object; + } PyRawDrawingStyle; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyViewer.ccp". + + extern PyTypeObject PyTypeRawDrawingStyle; + extern PyMethodDef PyRawDrawingStyle_Methods[]; + + extern PyObject* PyRawDrawingStyle_Link ( DrawingStyle ); + extern void PyRawDrawingStyle_LinkPyType (); + + +#define IsPyRawDrawingStyle(v) ( (v)->ob_type == &PyTypeRawDrawingStyle ) +#define PYRAWDRAWINGSTYLE(v) ( (PyRawDrawingStyle*)(v) ) +#define PYRAWDRAWINGSTYLE_O(v) ( PYRAWDRAWINGSTYLE(v)->_object ) + + +// Vector of DrawingStyles. + declareVectorValObject(DrawingStyle); + + +} // extern "C". + + +} // Hurricane namespace. + + +#endif // __VIEWER_PY_DRAWINGSTYLE__ diff --git a/hurricane/src/viewer/hurricane/viewer/PyGraphics.h b/hurricane/src/viewer/hurricane/viewer/PyGraphics.h new file mode 100644 index 00000000..397bcbc8 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/PyGraphics.h @@ -0,0 +1,61 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/PyGraphics.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __VIEWER_PY_GRAPHICS__ +#define __VIEWER_PY_GRAPHICS__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/Graphics.h" + + +namespace Hurricane { + + +extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyGraphics". + + typedef struct { + PyObject_HEAD + Graphics* _object; + } PyGraphics; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyViewer.ccp". + + extern PyTypeObject PyTypeGraphics; + extern PyMethodDef PyGraphics_Methods[]; + + extern PyObject* PyGraphics_Link ( Graphics* ); + extern void PyGraphics_LinkPyType (); + + +#define IsPyGraphics(v) ( (v)->ob_type == &PyTypeGraphics ) +#define PYGRAPHICS(v) ( (PyGraphics*)(v) ) +#define PYGRAPHICS_O(v) ( PYGRAPHICS(v)->_object ) + + +} // extern "C". + + +} // Hurricane namespace. + + +#endif // __VIEWER_PY_GRAPHICS__ diff --git a/hurricane/src/viewer/hurricane/viewer/PyHApplication.h b/hurricane/src/viewer/hurricane/viewer/PyHApplication.h new file mode 100644 index 00000000..7f7ac32e --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/PyHApplication.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/PyHApplication.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __VIEWER_PY_HAPPLICATION__ +#define __VIEWER_PY_HAPPLICATION__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/HApplication.h" + + +namespace Hurricane { + +extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyHApplication". + + typedef struct { + PyObject_HEAD + HApplication* _object; + } PyHApplication; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyViewer.ccp". + + extern PyTypeObject PyTypeHApplication; + extern PyMethodDef PyHApplication_Methods[]; + + extern PyObject* PyHApplication_Link ( HApplication* ); + extern void PyHApplication_LinkPyType (); + + +#define IsPyHApplication(v) ( (v)->ob_type == &PyTypeHApplication ) +#define PY_HAPPLICATION(v) ( (PyHApplication*)(v) ) +#define PY_HAPPLICATION_O(v) ( PY_HAPPLICATION(v)->_object ) + + +} // extern "C". + +} // Hurricane namespace. + +#endif // __VIEWER_PY_HAPPLICATION__ diff --git a/hurricane/src/viewer/hurricane/viewer/PyHSVr.h b/hurricane/src/viewer/hurricane/viewer/PyHSVr.h new file mode 100644 index 00000000..b19baf86 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/PyHSVr.h @@ -0,0 +1,61 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/PyHSVr.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __VIEWER_PY_HSVR__ +#define __VIEWER_PY_HSVR__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/DisplayStyle.h" + + +namespace Hurricane { + + +extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyHSVr". + + typedef struct { + PyObject_HEAD + DisplayStyle::HSVr* _object; + } PyHSVr; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyViewer.ccp". + + extern PyTypeObject PyTypeHSVr; + extern PyMethodDef PyHSVr_Methods[]; + + extern PyObject* PyHSVr_Link ( DisplayStyle::HSVr* ); + extern void PyHSVr_LinkPyType (); + + +#define IsPyHSVr(v) ( (v)->ob_type == &PyTypeHSVr ) +#define PYHSVR(v) ( (PyHSVr*)(v) ) +#define PYHSVR_O(v) ( PYHSVR(v)->_object ) + + +} // extern "C". + + +} // Hurricane namespace. + + +#endif // __VIEWER_PY_HSVR__ diff --git a/hurricane/src/viewer/hurricane/viewer/Script.h b/hurricane/src/viewer/hurricane/viewer/Script.h index 3ac4ad41..0963e440 100644 --- a/hurricane/src/viewer/hurricane/viewer/Script.h +++ b/hurricane/src/viewer/hurricane/viewer/Script.h @@ -2,11 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2011, All Rights Reserved -// -// =================================================================== -// -// $Id$ +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -23,7 +19,7 @@ # define __ISOBAR_SCRIPT__ #include -#include + namespace Hurricane { class Cell; class CellViewer; @@ -35,7 +31,7 @@ namespace Isobar { class Script { public: - enum Flags { NoScriptArgs=0x1 }; + enum Flags { NoScriptArgs=0x1, Initialized=0x10 }; public: static void addPath ( const std::string& path ); static void removePath ( const std::string& path ); @@ -56,6 +52,9 @@ namespace Isobar { PyObject* _pyArgs; PyObject* _pyResult; Hurricane::CellViewer* _cellViewer; + PyThreadState* _globalState; + PyThreadState* _subInterpreter; + long _flags; protected: Script ( const std::string& name ); ~Script (); diff --git a/hurricane/src/viewer/hurricane/viewer/StratusScript.h b/hurricane/src/viewer/hurricane/viewer/StratusScript.h index 3852a672..f5b8cdca 100644 --- a/hurricane/src/viewer/hurricane/viewer/StratusScript.h +++ b/hurricane/src/viewer/hurricane/viewer/StratusScript.h @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, 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 | // | | @@ -17,10 +12,7 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/viewer/StratusScript.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #ifndef __VIEWER_STRATUS_SCRIPT__ @@ -47,7 +39,6 @@ namespace Hurricane { }; -} // End of Hurricane namespace. - +} // Hurricane namespace. #endif // __VIEWER_STRATUS_SCRIPT__