* ./hurricane :

- Unit evolution to allow Symbolic (lamda) and Real (grid founder) mixing.
       All functions related to Unit translations are now grouped under
       the "DbU" class (another tribute to OpenAccess). "DbU" contains
       only static attributes (constants) and methods. Unit itself becomes
       a typedef inside this class, hence the file renaming from Unit.{h,cpp}
       to DbU.{h.cpp}. Have to replace all instances of "Unit" by "DbU::Unit".
   - Doc will be updated shortly.
This commit is contained in:
Jean-Paul Chaput 2008-06-09 16:41:46 +00:00
parent 1e0622a450
commit 5a7ddb8188
80 changed files with 1346 additions and 1183 deletions

View File

@ -13,7 +13,7 @@
*/
// \{
/*! \function BasicLayer* BasicLayer::create(Technology* technology,const Name& name,const BasicLayer::Material& material,unsigned extractNumber,const Unit& minimalSize = 0,const Unit& minimalSpacing = 0);
/*! \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 \<name\>, of
* type \c \<material\> for the given technology (some geometrical
* characteristics can also be specified).

View File

@ -42,7 +42,7 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* Default constructor : the returned box is empty.
*/
/*! \function Box::Box(const Unit& x, const Unit& y);
/*! \function Box::Box(const DbU::Unit& x, const DbU::Unit& y);
* Builds a box of null size centered on the point defined by
* \c \<x\> and \c \<y\>.
*/
@ -51,7 +51,7 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* Builds a box of null size centered on the point.
*/
/*! \function Box::Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2);
/*! \function Box::Box(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2);
* Builds the minimal box enclosing the two points defined by
* the coordinates \c \<x1\>, \c \<y1\> and \c \<x2\>,
* \c \<y2\>.
@ -93,28 +93,28 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
*/
// \{
/*! \function const Unit& Box::getXMin() const;
/*! \function const DbU::Unit& Box::getXMin() const;
* \Return the XMin value : meaningful only for a non empty box.
*/
/*! \function const Unit& Box::getYMin() const;
/*! \function const DbU::Unit& Box::getYMin() const;
* \Return the YMin value : meaningful only for a non empty box.
*/
/*! \function const Unit& Box::getXMax() const;
/*! \function const DbU::Unit& Box::getXMax() const;
* \Return the XMax value : meaningful only for a non empty box.
*/
/*! \function const Unit& Box::getYMax() const;
/*! \function const DbU::Unit& Box::getYMax() const;
* \Return the YMax value : meaningful only for a non empty box.
*/
/*! \function Unit Box::getXCenter() const;
/*! \function DbU::Unit Box::getXCenter() const;
* \Return the abscissa of the box center : meaningful only for a non
* empty box.
*/
/*! \function Unit Box::getYCenter() const;
/*! \function DbU::Unit Box::getYCenter() const;
* \Return the ordinate of the box center : meaningful only for a non
* empty box.
*/
@ -123,19 +123,19 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* \Return the box center point : meaningful only for a non empty box.
*/
/*! \function Unit Box::getWidth() const;
/*! \function DbU::Unit Box::getWidth() const;
* \Return the box width : meaningful only for a non empty box.
*/
/*! \function Unit Box::getHalfWidth() const;
/*! \function DbU::Unit Box::getHalfWidth() const;
* \Return the half box width : meaningful only for a non empty box.
*/
/*! \function Unit Box::getHeight() const;
/*! \function DbU::Unit Box::getHeight() const;
* \Return the box height : meaningful only for a non empty box.
*/
/*! \function Unit Box::getHalfHeight() const;
/*! \function DbU::Unit Box::getHalfHeight() const;
* \Return the half box height : meaningful only for a non empty box.
*/
@ -170,7 +170,7 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* \Return \true if the box is reduced to a point, else \false.
*/
/*! \function bool Box::contains(const Unit& x, const Unit& y) const;
/*! \function bool Box::contains(const DbU::Unit& x, const DbU::Unit& y) const;
* \Return \true if the box is non empty and contains the point defined
* by the coordinates \c \<x\>, \c \<y\> else \false.
*/
@ -207,20 +207,20 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* Transforms the box into an empty one.
*/
/*! \function Box& Box::inflate(const Unit& d);
/*! \function Box& Box::inflate(const DbU::Unit& d);
* Expands (or contracts) the box, if not empty, in each
* direction of the quantity \c \<d\>. This quantity might be
* negative enough to transform it into an empty box.
*/
/*! \function Box& Box::inflate(const Unit& dx, const Unit& dy);
/*! \function Box& Box::inflate(const DbU::Unit& dx, const DbU::Unit& dy);
* Expands (or contracts) the box, if not empty, horizontaly of
* the quantity \c \<dx\> and vertically of the quatity
* \c \<dy\>. Those quantities might be negative enough to
* transform it into an empty box.
*/
/*! \function Box& Box::inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax);
/*! \function Box& Box::inflate(const DbU::Unit& dxMin, const DbU::Unit& dyMin, const DbU::Unit& dxMax, const DbU::Unit& dyMax);
* Expands (or contracts) the box, if not empty, on the left of
* the quantity \c \<dxMin\>, on the bottom of the quantity
* \c \<dyMin\>, on the right of the quantity \c \<dxMax\> and
@ -228,7 +228,7 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* might be negative enough to transform it into an empty box.
*/
/*! \function Box& Box::merge(const Unit& x, const Unit& y);
/*! \function Box& Box::merge(const DbU::Unit& x, const DbU::Unit& y);
* Expands the box in order that it encloses the point defined
* by coordinates \c \<x\> and \c \<y\>. If the box was
* initially empty it becomes reduced to the enclosed point.
@ -240,7 +240,7 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* reduced to the enclosed point.
*/
/*! \function Box& Box::merge(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2);
/*! \function Box& Box::merge(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2);
* Expands the box in order that it encloses the points defined
* by coordinates \c \<x1\>, \c \<y1\> and \c \<x2\>, \c \<y2\>.
*/
@ -251,7 +251,7 @@ if (box1.inflate(3).merge(box2.translate(10, 10).inflate(-1, 1)).contains(20, 20
* becomes reduced to the enclosed box.
*/
/*! \function Box& Box::translate(const Unit& dx, const Unit& dy);
/*! \function Box& Box::translate(const DbU::Unit& dx, const DbU::Unit& dy);
* translates the box, if not empty, of the quantities \c \<dx\>
* and \c \<dy\>.
*/

View File

@ -42,7 +42,7 @@
*/
// \{
/*! \function Contact* Contact::create(Net* net, Layer* layer, const Unit& x, const Unit& y,const Unit& width = 0, const Unit& height = 0);
/*! \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
* \c \<net\>, on the layer \c \<layer\>, of size \c \<width\>
* and \c \<height\> and located at the absolute coordinates
@ -51,7 +51,7 @@
* \caution Throws an exception if the layer or the net is null.
*/
/*! \function Contact* Contact::create(Component* anchor, Layer* layer, const Unit& dx, const Unit& dy,const Unit& width = 0, const Unit& height = 0);
/*! \function Contact* Contact::create(Component* anchor, const Layer* layer, const DbU::Unit& dx, const DbU::Unit& dy,const DbU::Unit& width = 0, const DbU::Unit& height = 0);
* creates and returns a new contact on the layer \c \<layer\>,
* of size \c \<width\> and \c \<height\> attached upon the
* component \c \<anchor\> through an offset defined by
@ -85,33 +85,33 @@
* transitory)).
*/
/*! \function const Unit& Contact::getDx() const;
/*! \function const DbU::Unit& Contact::getDx() const;
* \Return the relative abscissa of the contact.
*
* \remark If you want to get the absolute one use the member function
* getX() defined at the Component level.
*/
/*! \function const Unit& Contact::getDy() const;
/*! \function const DbU::Unit& Contact::getDy() const;
* \Return the relative ordinate of the contact.
*
* \remark If you want to get the absolute one use the member function
* getY() defined at the Component level.
*/
/*! \function const Unit& Contact::getWidth() const;
/*! \function const DbU::Unit& Contact::getWidth() const;
* \Return the contact width.
*/
/*! \function Unit Contact::getHalfWidth() const;
/*! \function DbU::Unit Contact::getHalfWidth() const;
* \Return the contact half width.
*/
/*! \function const Unit& Contact::getHeight() const;
/*! \function const DbU::Unit& Contact::getHeight() const;
* \Return the contact height.
*/
/*! \function Unit Contact::getHalfHeight() const;
/*! \function DbU::Unit Contact::getHalfHeight() const;
* \Return the contact half height.
*/
@ -122,35 +122,35 @@
*/
// \{
/*! \function void Contact::setLayer(Layer* layer);
/*! \function void Contact::setLayer(const Layer* layer);
* sets the contact layer.
*/
/*! \function void Contact::setWidth(const Unit& width);
/*! \function void Contact::setWidth(const DbU::Unit& width);
* sets the contact width.
*/
/*! \function void Contact::setHeight(const Unit& height);
/*! \function void Contact::setHeight(const DbU::Unit& height);
* sets the contact height.
*/
/*! \function void Contact::setSizes(const Unit& width, const Unit& height);
/*! \function void Contact::setSizes(const DbU::Unit& width, const DbU::Unit& height);
* sets both contact width and height.
*/
/*! \function void Contact::setX(const Unit& x);
/*! \function void Contact::setX(const DbU::Unit& x);
* Allows to change the absolute abscissa of the contact (if it
* has a location relative to an other component, only relative
* position to this last is accordingly changed).
*/
/*! \function void Contact::setY(const Unit& y);
/*! \function void Contact::setY(const DbU::Unit& y);
* Allows to change the absolute ordinate of the contact (if it
* has a location relative to an other component, only relative
* position to this last is accordingly changed).
*/
/*! \function void Contact::setPosition(const Unit& x, const Unit& y);
/*! \function void Contact::setPosition(const DbU::Unit& x, const DbU::Unit& y);
* No description.
*/
@ -160,21 +160,21 @@
* position to this last is accordingly changed).
*/
/*! \function void Contact::setDx(const Unit& dx);
/*! \function void Contact::setDx(const DbU::Unit& dx);
* Allows to change the horizontal offset of the contact.
*
* \remark If the contact is absolute, this amounts to change its
* absolute abscissa.
*/
/*! \function void Contact::setDy(const Unit& dy);
/*! \function void Contact::setDy(const DbU::Unit& dy);
* Allows to change the vertical offset of the contact.
*
* \remark If the contact is absolute, this amounts to change its
* absolute ordinate.
*/
/*! \function void Contact::setOffset(const Unit& dx, const Unit& dy);
/*! \function void Contact::setOffset(const DbU::Unit& dx, const DbU::Unit& dy);
* Allows to change the offset of the contact.
*
* \remark If the contact is absolute, this amounts to change its

View File

@ -4,9 +4,9 @@
namespace Hurricane {
/*! \defgroup Unit Unit description
/*! \defgroup DbU DbU/Unit description
*
* \section secUnitIntro Introduction
* \section secDbUIntro Introduction
*
* Those objects are used to model a geometric lengths, that is
* abscissas, ordinates, widths, offsets ...
@ -16,7 +16,7 @@
* order to avoid floating point round errors.
*
*
* \section secUnitPrecision Precision
* \section secDbUPrecision Precision
*
* It is possible to choose (once for all) the precision with
* which unit values are stored.
@ -28,47 +28,47 @@
* unit equal to 23540.
*
* <ul>
* <li><b>Unit::getPrecision</b>
* <li><b>Unit::getMaximalPrecisionAllowed</b>
* <li><b>Unit::setPrecision</b>
* <li><b>DbU::getPrecision</b>
* <li><b>DbU::getMaximalPrecisionAllowed</b>
* <li><b>DbU::setPrecision</b>
* </ul>
*
*
* \section secUnitResolution Resolution
* \section secDbUResolution Resolution
*
* The resolution is associated to the precision. Indeed it
* represents the external value associated to the smallest
* unit, that is the value returned by getValue(getUnit(1)).
*
* <b>Unit::getResolution</b>
* <b>DbU::getResolution</b>
*
*
* \section secUnitGrid Grid
* \section secDbUGrid Grid
*
* <ul>
* <li><b>Unit::getGridStep</b>
* <li><b>Unit::setGridStep</b>
* <li><b>Unit::isOnGrid</b>
* <li><b>Unit::getOnGridUnit</b>
* <li><b>DbU::getGridStep</b>
* <li><b>DbU::setGridStep</b>
* <li><b>DbU::isOnGrid</b>
* <li><b>DbU::getOnGridUnit</b>
* </ul>
*
*
* \section secUnitTranslators Translators
* \section secDbUTranslators Translators
*
* <ul>
* <li><b>Unit::getUnit</b>
* <li><b>Unit::getValue</b>
* <li><b>Unit::getValueString</b>
* <li><b>DbU::getUnit</b>
* <li><b>DbU::getValue</b>
* <li><b>DbU::getValueString</b>
* </ul>
*/
/*! \ingroup Unit
/*! \ingroup DbU
*/
// \{
/*! \function bool Unit::isOnGrid(const Unit& unit, int n = 1);
/* \function bool DbU::isOnGrid(const Unit& unit, int n = 1);
* \Return \true if the unit is on grid, else \false. The argument
* \c \<n\> allows to consider on grid only multiples of
* \c \<n\> grid steps. So if n=1 all grid steps are considered,
@ -76,23 +76,23 @@
*/
/*! \function unsigned Unit::getPrecision();
/* \function unsigned DbU::getPrecision();
* \Return the current precision (whose default is fixed to 0).
*/
/*! \function unsigned Unit::getMaximalPrecisionAllowed();
/* \function unsigned DbU::getMaximalPrecisionAllowed();
* \Return the maximal precision allowed (currently fixed to 3).
*/
/*! \function double Unit::getResolution();
/* \function double DbU::getResolution();
* \Return the current resolution.
*/
/*! \function const Unit& Unit::getGridStep();
/* \function const DbU::Unit& DbU::getGridStep();
* \Return the grid step.
*/
/*! \function Unit Unit::getOnGridUnit(const Unit& unit, int s = 0);
/* \function DbU::Unit DbU::getOnGridUnit(const Unit& unit, int s = 0);
* \Return the closest location on grid if the argument \c \<s\> equals
* 0, the closest inferior location on grid if the argument
* \c \<s\> equals -1 and the closest superior location on grid
@ -101,17 +101,17 @@
* \remark Throw an exception for any other \c \<s\> argument value.
*/
/*! \function Unit getUnit(double value);
/* \function DbU::Unit getUnit(double value);
* \Return the unit corresponding to the value \c \<value\> according to
* the current precision.
*/
/*! \function double getValue(const Unit& unit);
/* \function double DbU::getValue(const Unit& unit);
* \Return the external value associated to the unit \c \<unit\>
* according to the current precision.
*/
/*! \function string getValueString(const Unit& unit);
/* \function string DbU::getValueString(const Unit& unit);
* \Return a character string representing the external value of
* \c \<unit\>.
*
@ -121,7 +121,7 @@
*/
/*! \function void setPrecision(unsigned precision);
/* \function void DbU::setPrecision(unsigned 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
@ -132,7 +132,7 @@
* is greater than the maximal one.
*/
/*! \function void setGridStep(const Unit& gridStep);
/* \function void DbU::setGridStep(const Unit& gridStep);
* Allows to change the grid step.
*/

View File

@ -38,11 +38,11 @@
*/
// \{
/*! \function Horizontal* Horizontal::create(Component* source, Component* target, Layer* layer,const Unit& y, const Unit& width = 0,const Unit& dxSource = 0, const Unit& dxTarget = 0);
/*! \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.
*/
/*! \function Horizontal* Horizontal::create(Net* net, Layer* layer, const Unit& y, const Unit& width = 0,const Unit& dxSource = 0, const Unit& dxTarget = 0);
/*! \function Horizontal* Horizontal::create(Net* net, const Layer* layer, const DbU::Unit& y, const DbU::Unit& width = 0,const DbU::Unit& dxSource = 0, const DbU::Unit& dxTarget = 0);
* creates and returns an absolute horizontal segment with layer
* \c \<layer\>, located at ordinate \c \<y\> and of width
* \c \<width\>. The differents extremities abscissas are given
@ -59,7 +59,7 @@
*/
// \{
/*! \function const Unit& Horizontal::getDxSource() const;
/*! \function const DbU::Unit& Horizontal::getDxSource() const;
* \Return the relative source abscissa of the segment (may be absolute
* if the source extremity isn't anchored).
*
@ -67,7 +67,7 @@
* getSourceY() defined at the Segment level.
*/
/*! \function const Unit& Horizontal::getDxTarget() const;
/*! \function const DbU::Unit& Horizontal::getDxTarget() const;
* \Return the relative target abscissa of the segment (may be absolute
* if the target extremity isn't anchored).
*
@ -82,11 +82,11 @@
*/
// \{
/*! \function void Horizontal::setY(const Unit& x);
/*! \function void Horizontal::setY(const DbU::Unit& x);
* sets the ordinate of the segment.
*/
/*! \function void Horizontal::translate(const Unit& dy);
/*! \function void Horizontal::translate(const DbU::Unit& dy);
* translate verticaly the horizontal segment of the quantity
* \c \<dy\>.
*/

View File

@ -36,12 +36,12 @@
* otherwise.
*/
/*! \function Interval::Interval(const Unit& v);
/*! \function Interval::Interval(const DbU::Unit& v);
* Builds an interval of null size centered on the value defined
* by \c \<v\>.
*/
/*! \function Interval::Interval(const Unit& v1, const Unit& v2);
/*! \function Interval::Interval(const DbU::Unit& v1, const DbU::Unit& v2);
* Builds the minimal interval enclosing the two values defined
* by \c \<v1\> and \c \<v2\>.
*/
@ -78,24 +78,24 @@
*/
// \{
/*! \function const Unit& Interval::getVMin() const;
/*! \function const DbU::Unit& Interval::getVMin() const;
* \Return the VMin value : meaningful only for a non empty interval.
*/
/*! \function const Unit& Interval::getVMax() const;
/*! \function const DbU::Unit& Interval::getVMax() const;
* \Return the VMax value : meaningful only for a non empty interval.
*/
/*! \function Unit Interval::getCenter() const;
/*! \function DbU::Unit Interval::getCenter() const;
* \Return the interval center value : meaningful only for a non empty
* interval.
*/
/*! \function Unit Interval::getSize() const;
/*! \function DbU::Unit Interval::getSize() const;
* \Return the interval size : meaningful only for a non empty interval.
*/
/*! \function Unit Interval::getHalfSize() const;
/*! \function DbU::Unit Interval::getHalfSize() const;
* \Return the half interval width : meaningful only for a non empty
* interval.
*/
@ -127,7 +127,7 @@
* \Return \true if the interval is reduced to a value, else \false.
*/
/*! \function bool Interval::contains(const Unit& v) const;
/*! \function bool Interval::contains(const DbU::Unit& v) const;
* \Return \true if the interval is non empty and contains the value
* defined by \c \<v\> else \false.
*/
@ -154,20 +154,20 @@
* Transforms the interval into an empty one.
*/
/*! \function Interval& Interval::inflate(const Unit& dv);
/*! \function Interval& Interval::inflate(const DbU::Unit& dv);
* Expands (or contracts) the interval, if not empty, in each
* direction of the quantity \c \<dv\>. This quantity might be
* negative enough to transform it into an empty interval.
*/
/*! \function Interval& Interval::inflate(const Unit& dvMin, const Unit& dvMax);
/*! \function Interval& Interval::inflate(const DbU::Unit& dvMin, const DbU::Unit& dvMax);
* Expands (or contracts) the interval, if not empty, on the
* left of the quantity \c \<dvMin\> and on the right of the
* quantity \c \<dvMax\>. Those quantities might be negative
* enough to transform it into an empty interval.
*/
/*! \function Interval& Interval::merge(const Unit& v);
/*! \function Interval& Interval::merge(const DbU::Unit& v);
* Expands the interval in order that it encloses the value
* defined \c \<v\>. If the interval was initially empty it
* becomes reduced to the enclosed value.
@ -179,7 +179,7 @@
* initially empty it becomes reduced to the enclosed interval.
*/
/*! \function Interval& Interval::intersection(const Unit& vMin, const Unit& vMax);
/*! \function Interval& Interval::intersection(const DbU::Unit& vMin, const DbU::Unit& vMax);
* The interval becomes the intersection of itself and
* <b>[vMin,vMax]</b>.
*/
@ -189,7 +189,7 @@
* <b>interval</b>.
*/
/*! \function Interval& Interval::translate(const Unit& dv);
/*! \function Interval& Interval::translate(const DbU::Unit& dv);
* translates the interval, if not empty, of the quantity
* \c \<dv\>.
*

View File

@ -53,12 +53,12 @@
* CPG which represent poly used to realize transistor gates).
*/
/*! \function const Unit& Layer::getMinimalSize() const;
/*! \function const DbU::Unit& Layer::getMinimalSize() const;
* \Return the minimal size allowed for a rectangular layout pad on this
* layer.
*/
/*! \function const Unit& Layer::getMinimalSpacing() const;
/*! \function const DbU::Unit& Layer::getMinimalSpacing() const;
* \Return the minimal spacing between two pads on this layer.
*/
@ -100,11 +100,11 @@
* other layer with that name.
*/
/*! \function void Layer::setMinimalSize(const Unit& minimalSize);
/*! \function void Layer::setMinimalSize(const DbU::Unit& minimalSize);
* sets the minimal size of a pad on this layer.
*/
/*! \function void Layer::setMinimalSpacing(const Unit& minimalSpacing);
/*! \function void Layer::setMinimalSpacing(const DbU::Unit& minimalSpacing);
* sets the minimal spacing between two pads on this layer.
*/

View File

@ -18,7 +18,7 @@
* Default constructor.
*/
/*! \function Point::Point(const Unit& x, const Unit& y);
/*! \function Point::Point(const DbU::Unit& x, const DbU::Unit& y);
* Creates the point defined by x and y coordinates.
*/
@ -52,15 +52,15 @@
*/
// \{
/*! \function void Point::setX(const Unit& x);
/*! \function void Point::setX(const DbU::Unit& x);
* Modifies point abscissa.
*/
/*! \function void Point::setY(const Unit& y);
/*! \function void Point::setY(const DbU::Unit& y);
* Modifies point ordinate.
*/
/*! \function Point& Point::translate(const Unit& dx, const Unit& dy);
/*! \function Point& Point::translate(const DbU::Unit& dx, const DbU::Unit& dy);
* Translates the point of dx and dy.
*/

View File

@ -96,19 +96,19 @@
* aren't anchored).
*/
/*! \function const Unit& Segment::getWidth() const;
/*! \function const DbU::Unit& Segment::getWidth() const;
* \Return the segment width.
*/
/*! \function Unit Segment::getHalfWidth() const;
/*! \function DbU::Unit Segment::getHalfWidth() const;
* \Return the segment half width.
*/
/*! \function Unit Segment::getSourceX() const;
/*! \function DbU::Unit Segment::getSourceX() const;
* \Return the abscissa of the segment origin.
*/
/*! \function Unit Segment::getSourceY() const;
/*! \function DbU::Unit Segment::getSourceY() const;
* \Return the ordinate of the segment origin.
*/
@ -116,11 +116,11 @@
* \Return the point location of the segment origin.
*/
/*! \function Unit Segment::getTargetX() const;
/*! \function DbU::Unit Segment::getTargetX() const;
* \Return the abscissa of the segment extremity.
*/
/*! \function Unit Segment::getTargetY() const;
/*! \function DbU::Unit Segment::getTargetY() const;
* \Return the ordinate of the segment extremity.
*/
@ -128,7 +128,7 @@
* \Return the point location of the segment extremity.
*/
/*! \function Unit Segment::getLength() const;
/*! \function DbU::Unit Segment::getLength() const;
* \Return the segment length.
*/
@ -139,11 +139,11 @@
*/
// \{
/*! \function void Segment::setLayer(Layer* layer);
/*! \function void Segment::setLayer(const Layer* layer);
* sets the segment layer.
*/
/*! \function void Segment::setWidth(const Unit& width);
/*! \function void Segment::setWidth(const DbU::Unit& width);
* sets the segment width.
*/

View File

@ -78,7 +78,7 @@ TO::R1
* <b>ID</b>.
*/
/*! \function Transformation::Transformation(const Unit& tx, const Unit& ty, const Transformation::Orientation& orientation=Orientation::ID);
/*! \function Transformation::Transformation(const DbU::Unit& tx, const DbU::Unit& ty, const Transformation::Orientation& orientation=Orientation::ID);
* Builds a transformation whose translation part is defined by
* the arguments \c \<xt\> and \c \<ty\> and whose orientation
* is defined by \c \<orientation\> (\c \<ID\> by default).
@ -122,11 +122,11 @@ TO::R1
*/
// \{
/*! \function const Unit& Transformation::getTx() const;
/*! \function const DbU::Unit& Transformation::getTx() const;
* \Return the horizontal component of the translation.
*/
/*! \function const Unit& Transformation::getTy() const;
/*! \function const DbU::Unit& Transformation::getTy() const;
* \Return the vertical component of the translation.
*/
@ -139,39 +139,39 @@ TO::R1
* switch).
*/
/*! \function Unit Transformation::getX(const Unit& x, const Unit& y) const;
/*! \function DbU::Unit Transformation::getX(const DbU::Unit& x, const DbU::Unit& y) const;
* \Return the point abscissa resulting of the transformation
* application on the point defined by \c \<x\> et \c \<y\>.
*/
/*! \function Unit Transformation::getY(const Unit& x, const Unit& y) const;
/*! \function DbU::Unit Transformation::getY(const DbU::Unit& x, const DbU::Unit& y) const;
* \Return the point ordinate resulting of the transformation
* application on the point defined by \c \<x\> et \c \<y\>.
*/
/*! \function Unit Transformation::getX(const Point& point) const;
/*! \function DbU::Unit Transformation::getX(const Point& point) const;
* \Return the point abscissa resulting of the transformation
* application on \c \<point\>.
*/
/*! \function Unit Transformation::getY(const Point& point) const;
/*! \function DbU::Unit Transformation::getY(const Point& point) const;
* \Return the point ordinate resulting of the transformation
* application on \c \<point\>.
*/
/*! \function Unit Transformation::getDx(const Unit& dx, const Unit& dy) const;
/*! \function DbU::Unit Transformation::getDx(const DbU::Unit& dx, const DbU::Unit& dy) const;
* \Return the horizontal component of the vector resulting from the
* application of the transformation on the vector defined by
* \c \<dx\> et \c \<dy\>.
*/
/*! \function Unit Transformation::getDy(const Unit& dx, const Unit& dy) const;
/*! \function DbU::Unit Transformation::getDy(const DbU::Unit& dx, const DbU::Unit& dy) const;
* \Return the vertical component of the vector resulting from the
* application of the transformation on the vector defined by
* \c \<dx\> et \c \<dy\>.
*/
/*! \function Point Transformation::getPoint(const Unit& x, const Unit& y) const;
/*! \function Point Transformation::getPoint(const DbU::Unit& x, const DbU::Unit& y) const;
* \Return the point resulting from the application of the
* transformation on the point defined by \c \<dx\> et
* \c \<dy\>.
@ -182,7 +182,7 @@ TO::R1
* transformation on \c \<point\>.
*/
/*! \function Box Transformation::getBox(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) const;
/*! \function Box Transformation::getBox(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2) const;
* \Return the box resulting from the application of the transformation
* on the box defined by \c \<x1\>, \c \<y1\>, \c \<x2\> et
* \c \<y2\>.
@ -240,7 +240,7 @@ TO::R1
*/
// \{
/*! \function void Transformation::applyOn(Unit& x, Unit& y) const;
/*! \function void Transformation::applyOn(DbU::Unit& x, DbU::Unit& y) const;
* Applies the transformation on the coordinates given in
* arguments.
*/

View File

@ -39,7 +39,7 @@
*/
// \{
/*! \function Vertical* Vertical::create(Component* source, Component* target, Layer* layer,const Unit& x,const Unit& width = 0,const Unit& dySource = 0, const Unit& dyTarget = 0);
/*! \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
* (through an offset equal to \c \<dySource\>) on
* \c \<source\>, whose extremity lies (through an offset equal
@ -52,7 +52,7 @@
* same net.
*/
/*! \function Vertical* Vertical::create(Net* net, Layer* layer, const Unit& x, const Unit& width = 0,const Unit& dySource = 0, const Unit& dyTarget = 0);
/*! \function Vertical* Vertical::create(Net* net, 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 an absolute vertical segment with layer
* \c \<layer\>, located at abscissa \c \<x\> and of width
* \c \<width\>. The differents extremities ordinates are given
@ -69,7 +69,7 @@
*/
// \{
/*! \function const Unit& Vertical::getDySource() const;
/*! \function const DbU::Unit& Vertical::getDySource() const;
* \Return the relative source ordinate of the segment (may be absolute
* if the source extremity isn't anchored).
*
@ -77,7 +77,7 @@
* getSourceX() defined at the Segment level.
*/
/*! \function const Unit& Vertical::getDyTarget() const;
/*! \function const DbU::Unit& Vertical::getDyTarget() const;
* \Return the relative target ordinate of the segment (may be absolute
* if the target extremity isn't anchored).
*
@ -92,11 +92,11 @@
*/
// \{
/*! \function void Vertical::setX(const Unit& x);
/*! \function void Vertical::setX(const DbU::Unit& x);
* sets the abscissa of the segment.
*/
/*! \function void Vertical::translate(const Unit& dx);
/*! \function void Vertical::translate(const DbU::Unit& dx);
* translate horizontaly the vertical segment of the quantity
* \c \<dx\>.
*/

View File

@ -122,8 +122,8 @@ INPUT = \
Relation.dox \
../../src/hurricane/hurricane/Tabulation.h \
Tabulation.dox \
../../src/hurricane/hurricane/Unit.h \
Unit.dox \
../../src/hurricane/hurricane/DbU.h \
DbU.dox \
../../src/hurricane/hurricane/Points.h \
../../src/hurricane/hurricane/Point.h \
Point.dox \

View File

@ -162,8 +162,8 @@ namespace Hurricane {
, const Name& name
, const Material& material
, unsigned extractNumber
, const Unit& minimalSize
, const Unit& minimalSpacing
, const DbU::Unit& minimalSize
, const DbU::Unit& minimalSpacing
) : Layer(technology
,name
,minimalSize
@ -178,8 +178,8 @@ namespace Hurricane {
, const Name& name
, const Material& material
, unsigned extractNumber
, const Unit& minimalSize
, const Unit& minimalSpacing
, const DbU::Unit& minimalSize
, const DbU::Unit& minimalSpacing
)
{
BasicLayer* basicLayer =

View File

@ -24,7 +24,7 @@ Box::Box()
_yMax(-1)
{}
Box::Box(const Unit& x, const Unit& y)
Box::Box(const DbU::Unit& x, const DbU::Unit& y)
// ***********************************
: _xMin(x),
_yMin(y),
@ -40,7 +40,7 @@ Box::Box(const Point& point)
_yMax(point.getY())
{}
Box::Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2)
Box::Box(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2)
// *********************************************************************
: _xMin(min(x1, x2)),
_yMin(min(y1, y2)),
@ -116,10 +116,10 @@ Box Box::getIntersection(const Box& box) const
min(_yMax, box._yMax));
}
Unit Box::manhattanDistance(const Point& pt) const
DbU::Unit Box::manhattanDistance(const Point& pt) const
// ***********************************************
{
Unit dist = 0;
DbU::Unit dist = 0;
if (isEmpty())
throw Error("Can't compute distance to an empty Box");
if (pt.getX() < _xMin) dist = _xMin - pt.getX();
@ -131,12 +131,12 @@ Unit Box::manhattanDistance(const Point& pt) const
return dist;
}
Unit Box::manhattanDistance(const Box& box) const
DbU::Unit Box::manhattanDistance(const Box& box) const
// **********************************************
{
if (isEmpty() || box.isEmpty())
throw Error("Can't compute distance to an empty Box");
Unit dx, dy;
DbU::Unit dx, dy;
if ((dx=box.getXMin() - _xMax) < 0)
if ((dx=_xMin-box.getXMax()) < 0) dx=0;
if ((dy=box.getYMin() - _yMax) < 0)
@ -164,7 +164,7 @@ bool Box::isPonctual() const
return (!isEmpty() && (_xMax == _xMin) && (_yMax == _yMin));
}
bool Box::contains(const Unit& x, const Unit& y) const
bool Box::contains(const DbU::Unit& x, const DbU::Unit& y) const
// ***************************************************
{
return (!isEmpty() &&
@ -216,26 +216,26 @@ bool Box::isConstrainedBy(const Box& box) const
Box& Box::makeEmpty()
// ******************
{
_xMin = 1;
_xMin = 1;
_yMin = 1;
_xMax = -1;
_yMax = -1;
return *this;
}
Box& Box::inflate(const Unit& d)
Box& Box::inflate(const DbU::Unit& d)
// *****************************
{
return inflate(d, d, d, d);
}
Box& Box::inflate(const Unit& dx, const Unit& dy)
Box& Box::inflate(const DbU::Unit& dx, const DbU::Unit& dy)
// **********************************************
{
return inflate(dx, dy, dx, dy);
}
Box& Box::inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax)
Box& Box::inflate(const DbU::Unit& dxMin, const DbU::Unit& dyMin, const DbU::Unit& dxMax, const DbU::Unit& dyMax)
// ******************************************************************************************
{
if (!isEmpty()) {
@ -247,20 +247,23 @@ Box& Box::inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const
return *this;
}
Box Box::getInflated(const Unit& d) const {
Box Box::getInflated(const DbU::Unit& d) const {
return Box(*this).inflate(d);
}
Box& Box::shrinkByFactor(double factor)
// **************************************
{
assert((0 <= factor) && (factor <= 1));
Unit dx=getUnit(0.5*(1- factor) * (getValue(_xMax) - getValue(_xMin)));
Unit dy=getUnit(0.5*(1- factor) * (getValue(_yMax) - getValue(_yMin)));
assert((0.0 <= factor) && (factor <= 1.0));
DbU::Unit dx = DbU::real ( 0.5 * (1-factor) * (DbU::getReal(_xMax) - DbU::getReal(_xMin)) );
DbU::Unit dy = DbU::real ( 0.5 * (1-factor) * (DbU::getReal(_yMax) - DbU::getReal(_yMin)) );
//DbU::Unit dx=getUnit(0.5*(1- factor) * (getValue(_xMax) - getValue(_xMin)));
//DbU::Unit dy=getUnit(0.5*(1- factor) * (getValue(_yMax) - getValue(_yMin)));
return inflate(-dx, -dy);
}
Box& Box::merge(const Unit& x, const Unit& y)
Box& Box::merge(const DbU::Unit& x, const DbU::Unit& y)
// ******************************************
{
if (isEmpty()) {
@ -284,7 +287,7 @@ Box& Box::merge(const Point& point)
return merge(point.getX(), point.getY());
}
Box& Box::merge(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2)
Box& Box::merge(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2)
// ****************************************************************************
{
merge(x1, y1);
@ -302,7 +305,7 @@ Box& Box::merge(const Box& box)
return *this;
}
Box& Box::translate(const Unit& dx, const Unit& dy)
Box& Box::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// ************************************************
{
if (!isEmpty()) {
@ -317,13 +320,12 @@ Box& Box::translate(const Unit& dx, const Unit& dy)
string Box::_getString() const
// ***************************
{
if (isEmpty())
return "<" + _TName("Box") + " empty>";
else
return "<" + _TName("Box") + " " +
getValueString(_xMin) + " " + getValueString(_yMin) + " " +
getValueString(_xMax) + " " + getValueString(_yMax) +
">";
if (isEmpty())
return "<" + _TName("Box") + " empty>";
else
return "<" + _TName("Box") + " "
+ DbU::getValueString(_xMin) + " " + DbU::getValueString(_yMin) + " "
+ DbU::getValueString(_xMax) + " " + DbU::getValueString(_yMax) + ">";
}
Record* Box::_getRecord() const

View File

@ -70,7 +70,7 @@
hurricane/Technology.h
hurricane/Timer.h
hurricane/Transformation.h
hurricane/Unit.h
hurricane/DbU.h
hurricane/UpdateSession.h
hurricane/UserGo.h hurricane/UserGos.h
hurricane/VectorCollection.h
@ -136,7 +136,7 @@
Technology.cpp
Timer.cpp
Transformation.cpp
Unit.cpp
DbU.cpp
UpdateSession.cpp
UserGo.cpp
Vertical.cpp

View File

@ -484,7 +484,7 @@ void Component::_setRubber(Rubber* rubber)
}
}
//bool Component::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const
//bool Component::_IsInterceptedBy(View* view, const Point& point, const DbU::Unit& aperture) const
//// *****************************************************************************************
//{
// Box area(point);
@ -924,7 +924,7 @@ double getArea ( Component* component )
{
Box bb = component->getBoundingBox ();
return getValue(bb.getWidth()) * getValue(bb.getHeight());
return DbU::getReal(bb.getWidth()) * DbU::getReal(bb.getHeight());
}

View File

@ -86,7 +86,7 @@ class Contact_Hooks : public Collection<Hook*> {
// Contact implementation
// ****************************************************************************************************
Contact::Contact(Net* net, const Layer* layer, const Unit& x, const Unit& y, const Unit& width, const Unit& height)
Contact::Contact(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& height)
// ****************************************************************************************************
: Inherit(net),
_anchorHook(this),
@ -103,7 +103,7 @@ Contact::Contact(Net* net, const Layer* layer, const Unit& x, const Unit& y, con
if ( _height < _layer->getMinimalSize() ) _height = _layer->getMinimalSize();
}
Contact::Contact(Net* net, Component* anchor, const Layer* layer, const Unit& dx, const Unit& dy, const Unit& width, const Unit& height)
Contact::Contact(Net* net, Component* anchor, const Layer* layer, const DbU::Unit& dx, const DbU::Unit& dy, const DbU::Unit& width, const DbU::Unit& height)
// ****************************************************************************************************
: Inherit(net),
_anchorHook(this),
@ -131,7 +131,7 @@ Contact::Contact(Net* net, Component* anchor, const Layer* layer, const Unit& dx
if ( _height < _layer->getMinimalSize() ) _height = _layer->getMinimalSize();
}
Contact* Contact::create(Net* net, const Layer* layer, const Unit& x, const Unit& y, const Unit& width, const Unit& height)
Contact* Contact::create(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& height)
// ****************************************************************************************************
{
Contact* contact = new Contact(net, layer, x, y, width, height);
@ -141,7 +141,7 @@ Contact* Contact::create(Net* net, const Layer* layer, const Unit& x, const Unit
return contact;
}
Contact* Contact::create(Component* anchor, const Layer* layer, const Unit& dx, const Unit& dy, const Unit& width, const Unit& height)
Contact* Contact::create(Component* anchor, const Layer* layer, const DbU::Unit& dx, const DbU::Unit& dy, const DbU::Unit& width, const DbU::Unit& height)
// ****************************************************************************************************
{
if (!anchor)
@ -160,14 +160,14 @@ Hooks Contact::getHooks() const
return Contact_Hooks(this);
}
Unit Contact::getX() const
DbU::Unit Contact::getX() const
// ***********************
{
Component* anchor = getAnchor();
return (!anchor) ? _dx : anchor->getX() + _dx;
}
Unit Contact::getY() const
DbU::Unit Contact::getY() const
// ***********************
{
Component* anchor = getAnchor();
@ -184,7 +184,7 @@ Point Contact::getPosition() const
Box Contact::getBoundingBox() const
// ********************************
{
Unit size = getLayer()->getEnclosure();
DbU::Unit size = getLayer()->getEnclosure();
return Box(getPosition()).inflate(getHalfWidth() + size, getHalfHeight() + size);
}
@ -194,7 +194,7 @@ Box Contact::getBoundingBox(const BasicLayer* basicLayer) const
{
if (!_layer->contains(basicLayer)) return Box();
Unit size = getLayer()->getEnclosure(basicLayer);
DbU::Unit size = getLayer()->getEnclosure(basicLayer);
return Box(getPosition()).inflate(getHalfWidth() + size, getHalfHeight() + size);
}
@ -206,7 +206,7 @@ Component* Contact::getAnchor() const
return (masterHook) ? masterHook->getComponent() : NULL;
}
void Contact::translate(const Unit& dx, const Unit& dy)
void Contact::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// ****************************************************
{
if ((dx != 0) || (dy != 0)) {
@ -228,7 +228,7 @@ void Contact::setLayer(const Layer* layer)
}
}
void Contact::setWidth(const Unit& width)
void Contact::setWidth(const DbU::Unit& width)
// **************************************
{
if (width != _width) {
@ -237,7 +237,7 @@ void Contact::setWidth(const Unit& width)
}
}
void Contact::setHeight(const Unit& height)
void Contact::setHeight(const DbU::Unit& height)
// ****************************************
{
if (height != _height) {
@ -246,7 +246,7 @@ void Contact::setHeight(const Unit& height)
}
}
void Contact::setSizes(const Unit& width, const Unit& height)
void Contact::setSizes(const DbU::Unit& width, const DbU::Unit& height)
// **********************************************************
{
if ((width != _width) || (height != _height)) {
@ -256,19 +256,19 @@ void Contact::setSizes(const Unit& width, const Unit& height)
}
}
void Contact::setX(const Unit& x)
void Contact::setX(const DbU::Unit& x)
// ******************************
{
setPosition(x, getY());
}
void Contact::setY(const Unit& y)
void Contact::setY(const DbU::Unit& y)
// ******************************
{
setPosition(getX(), y);
}
void Contact::setPosition(const Unit& x, const Unit& y)
void Contact::setPosition(const DbU::Unit& x, const DbU::Unit& y)
// ****************************************************
{
Component* anchor = getAnchor();
@ -284,19 +284,19 @@ void Contact::setPosition(const Point& position)
setPosition(position.getX(), position.getY());
}
void Contact::setDx(const Unit& dx)
void Contact::setDx(const DbU::Unit& dx)
// ********************************
{
setOffset(dx, _dy);
}
void Contact::setDy(const Unit& dy)
void Contact::setDy(const DbU::Unit& dy)
// ********************************
{
setOffset(_dx, dy);
}
void Contact::setOffset(const Unit& dx, const Unit& dy)
void Contact::setOffset(const DbU::Unit& dx, const DbU::Unit& dy)
// ****************************************************
{
if ((dx != _dx) || (dy != _dy)) {
@ -325,10 +325,10 @@ string Contact::_getString() const
{
string s = Inherit::_getString();
s.insert(s.length() - 1, " " + getString(_layer->getName()));
s.insert(s.length() - 1, " [" + getValueString(getX()));
s.insert(s.length() - 1, " " + getValueString(getY()));
s.insert(s.length() - 1, "] " + getValueString(_width));
s.insert(s.length() - 1, "x" + getValueString(_height));
s.insert(s.length() - 1, " [" + DbU::getValueString(getX()));
s.insert(s.length() - 1, " " + DbU::getValueString(getY()));
s.insert(s.length() - 1, "] " + DbU::getValueString(_width));
s.insert(s.length() - 1, "x" + DbU::getValueString(_height));
return s;
}

View File

@ -156,11 +156,11 @@ namespace Hurricane {
{ return getCollection(_basicLayers); }
Unit ContactLayer::getEnclosure () const
DbU::Unit ContactLayer::getEnclosure () const
{ return _maximalEnclosure; }
Unit ContactLayer::getEnclosure ( const BasicLayer* layer ) const
DbU::Unit ContactLayer::getEnclosure ( const BasicLayer* layer ) const
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer )
@ -171,7 +171,7 @@ namespace Hurricane {
}
void ContactLayer::setEnclosure ( const BasicLayer* layer, Unit enclosure )
void ContactLayer::setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure )
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer ) {

View File

@ -40,7 +40,7 @@ DRCError* DRCError::create(Cell* cell, const Name& name, const Box& boundingBox)
return drcError;
}
void DRCError::translate(const Unit& dx, const Unit& dy)
void DRCError::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// *****************************************************
{
if ((dx != 0) || (dy != 0)) {

View File

@ -76,9 +76,9 @@ Record* DataBase::_getRecord() const
if (record) {
record->add(getSlot("Technology", _technology));
record->add(getSlot("RootLibrary", _rootLibrary));
record->add(getSlot("Precision", getPrecision()));
record->add(getSlot("Resolution", getValueString(1)));
record->add(getSlot("GridStep", getValueString(getGridStep())));
record->add(getSlot("Precision", DbU::getPrecision()));
record->add(getSlot("Resolution", DbU::getValueString(DbU::db(1))));
//record->add(getSlot("GridStep", getValueString(getGridStep())));
}
return record;
}

View File

@ -0,0 +1,176 @@
// -*- C++ -*-
//
// This file is part of the Hurricane Software.
// Copyright (c) BULL S.A. 2000-2004, 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 : Remy Escassut |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./DbU.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include <climits>
# include "hurricane/DbU.h"
# include "hurricane/Error.h"
namespace Hurricane {
const unsigned int DbU::_maximalPrecision = 3;
unsigned int DbU::_precision = 1;
double DbU::_resolution = 0.1;
double DbU::_unitsPerLambda = 10.0;
unsigned int DbU::_stringMode = DbU::Symbolic;
const DbU::Unit DbU::Min = LONG_MIN;
const DbU::Unit DbU::Max = LONG_MAX;
// -------------------------------------------------------------------
// Class : "Hurricane::DbU".
unsigned int DbU::getPrecision ()
{ return _precision; }
unsigned int DbU::getMaximalPrecision ()
{ return _maximalPrecision; }
double DbU::getResolution ()
{ return _resolution; }
void DbU::setPrecision ( unsigned int precision )
{
if ( _maximalPrecision < precision)
throw Error ( "DbU::Unit::setPrecision(): Precision %ud exceed maximal precision %ud."
, precision
, _maximalPrecision
);
_precision = precision;
_resolution = 1;
while ( precision-- ) _resolution /= 10;
//setGridStep(getUnit(1));
}
void DbU::setUnitsPerLambda ( double unitsPerLambda )
{
if ( ( rint(unitsPerLambda) != unitsPerLambda )
|| ( remainder(unitsPerLambda,2.0) != 0.0 ) )
throw Error ( "DbU::Unit::setUnitPerLambdas(): \"unitsPerLambda\" (%f) must be an even integer."
, unitsPerLambda
);
_unitsPerLambda = unitsPerLambda;
}
double DbU::getUnitsPerLambda ()
{ return _unitsPerLambda; }
void DbU::setStringMode ( unsigned int mode )
{ _stringMode = mode; }
// ****************************************************************************************************
// Grid managers
// ****************************************************************************************************
// const DbU::Unit& getGridStep()
// // **********************
// {
// return GRID_STEP;
// }
// void setGridStep(const DbU::Unit& gridStep)
// // ***********************************
// {
// if (!gridStep) throw Error("Can't set grid step : invalid value");
// GRID_STEP = gridStep;
// }
// bool isOnGrid(const DbU::Unit& unit, int n)
// // ***********************************
// {
// if (n <= 0) throw Error("Can't compute : invalid value");
// n *= GRID_STEP;
// return (((abs(unit) / n) * n) == abs(unit));
// }
// DbU::Unit getOnGridUnit(const DbU::Unit& unit, int s)
// // ****************************************
// {
// switch (s) {
// case -1 : {
// if (0 < unit) return (unit / GRID_STEP) * GRID_STEP;
// else if (unit < 0) return ((unit / GRID_STEP) - 1) * GRID_STEP;
// return unit;
// }
// case 0 : {
// int g1 = (unit / GRID_STEP) * GRID_STEP;
// int g2 = ((g1 < unit) ? (g1 + GRID_STEP) : (g1 - GRID_STEP));
// return (abs(g1 - unit) <= abs(g2 - unit)) ? g1 : g2;
// }
// case +1 : {
// if (0 < unit) return ((unit / GRID_STEP) + 1) * GRID_STEP;
// else if (unit < 0) return (unit / GRID_STEP) * GRID_STEP;
// return unit;
// }
// }
// throw Error("Can't get on grid unit : invalid parameter s (should be -1, 0 or +1)");
// return 0;
// }
string DbU::getValueString ( DbU::Unit u )
{
char buffer[1024];
if ( _stringMode == Db ) {
if ( u == 0 ) return "0u";
snprintf ( buffer, 1024, "%ldu", u );
} else if ( _stringMode == Real ) {
if ( u == 0 ) return "0g";
snprintf ( buffer, 1024, "%.1fg", getReal(u) );
} else if ( _stringMode == Symbolic ) {
if ( u == 0 ) return "0g";
snprintf ( buffer, 1024, "%.1flbd", getLambda(u) );
}
return buffer;
}
} // End of Hurricane namespace.

View File

@ -145,15 +145,15 @@ namespace Hurricane {
{ return getCollection(_basicLayers); }
Unit DiffusionLayer::getExtentionCap () const
DbU::Unit DiffusionLayer::getExtentionCap () const
{ return _maximalExtentionCap; }
Unit DiffusionLayer::getExtentionWidth () const
DbU::Unit DiffusionLayer::getExtentionWidth () const
{ return _maximalExtentionWidth; }
Unit DiffusionLayer::getExtentionCap ( const BasicLayer* layer ) const
DbU::Unit DiffusionLayer::getExtentionCap ( const BasicLayer* layer ) const
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer ) {
@ -166,7 +166,7 @@ namespace Hurricane {
}
Unit DiffusionLayer::getExtentionWidth ( const BasicLayer* layer ) const
DbU::Unit DiffusionLayer::getExtentionWidth ( const BasicLayer* layer ) const
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer ) {
@ -179,7 +179,7 @@ namespace Hurricane {
}
void DiffusionLayer::setExtentionCap ( const BasicLayer* layer, Unit cap )
void DiffusionLayer::setExtentionCap ( const BasicLayer* layer, DbU::Unit cap )
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer ) {
@ -191,7 +191,7 @@ namespace Hurricane {
}
void DiffusionLayer::setExtentionWidth ( const BasicLayer* layer, Unit width )
void DiffusionLayer::setExtentionWidth ( const BasicLayer* layer, DbU::Unit width )
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer ) {

View File

@ -20,7 +20,7 @@ namespace Hurricane {
// Horizontal implementation
// ****************************************************************************************************
Horizontal::Horizontal(Net* net, Component* source, Component* target, const Layer* layer, const Unit& y, const Unit& width, const Unit& dxSource, const Unit& dxTarget)
Horizontal::Horizontal(Net* net, Component* source, Component* target, const Layer* layer, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& dxSource, const DbU::Unit& dxTarget)
// ****************************************************************************************************
: Inherit(net, source, target, layer, width),
_y(y),
@ -29,7 +29,7 @@ Horizontal::Horizontal(Net* net, Component* source, Component* target, const Lay
{
}
Horizontal* Horizontal::create(Net* net, const Layer* layer, const Unit& y, const Unit& width, const Unit& dxSource, const Unit& dxTarget)
Horizontal* Horizontal::create(Net* net, const Layer* layer, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& dxSource, const DbU::Unit& dxTarget)
// ****************************************************************************************************
{
if (!net)
@ -42,7 +42,7 @@ Horizontal* Horizontal::create(Net* net, const Layer* layer, const Unit& y, cons
return horizontal;
}
Horizontal* Horizontal::create(Component* source, Component* target, const Layer* layer, const Unit& y, const Unit& width, const Unit& dxSource, const Unit& dxTarget)
Horizontal* Horizontal::create(Component* source, Component* target, const Layer* layer, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& dxSource, const DbU::Unit& dxTarget)
// ****************************************************************************************************
{
if (!source)
@ -62,8 +62,8 @@ Horizontal* Horizontal::create(Component* source, Component* target, const Layer
Box Horizontal::getBoundingBox() const
// ***********************************
{
Unit size = getLayer()->getExtentionWidth() + getHalfWidth();
Unit extention = getLayer()->getExtentionCap ();
DbU::Unit size = getLayer()->getExtentionWidth() + getHalfWidth();
DbU::Unit extention = getLayer()->getExtentionCap ();
return Box(getSourceX(), _y, getTargetX(), _y).inflate(extention, size);
}
@ -73,27 +73,27 @@ Box Horizontal::getBoundingBox(const BasicLayer* basicLayer) const
{
if (!getLayer()->contains(basicLayer)) return Box();
Unit size = getLayer()->getExtentionWidth(basicLayer) + getHalfWidth();
Unit extention = getLayer()->getExtentionCap (basicLayer);
DbU::Unit size = getLayer()->getExtentionWidth(basicLayer) + getHalfWidth();
DbU::Unit extention = getLayer()->getExtentionCap (basicLayer);
return Box(getSourceX(), _y, getTargetX(), _y).inflate(extention, size);
}
Unit Horizontal::getSourceX() const
DbU::Unit Horizontal::getSourceX() const
// ********************************
{
Component* source = getSource();
return (source) ? source->getX() + _dxSource : _dxSource;
}
Unit Horizontal::getTargetX() const
DbU::Unit Horizontal::getTargetX() const
// ********************************
{
Component* target = getTarget();
return (target) ? target->getX() + _dxTarget : _dxTarget;
}
Unit Horizontal::getLength() const
DbU::Unit Horizontal::getLength() const
// *******************************
{
return abs(getSourceX() - getTargetX());
@ -105,7 +105,7 @@ Point Horizontal::getCenter() const
return Point ( (getSourceX()+getTargetX())/2, getY() );
}
void Horizontal::translate(const Unit& dx, const Unit& dy)
void Horizontal::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// *******************************************************
{
if (dy != 0) {
@ -114,7 +114,7 @@ void Horizontal::translate(const Unit& dx, const Unit& dy)
}
}
void Horizontal::setY(const Unit& y)
void Horizontal::setY(const DbU::Unit& y)
// *********************************
{
if (y != _y) {
@ -123,7 +123,7 @@ void Horizontal::setY(const Unit& y)
}
}
void Horizontal::setDxSource(const Unit& dxSource)
void Horizontal::setDxSource(const DbU::Unit& dxSource)
// ***********************************************
{
if (dxSource != _dxSource) {
@ -132,7 +132,7 @@ void Horizontal::setDxSource(const Unit& dxSource)
}
}
void Horizontal::setDxTarget(const Unit& dxTarget)
void Horizontal::setDxTarget(const DbU::Unit& dxTarget)
// ***********************************************
{
if (dxTarget != _dxTarget) {
@ -141,7 +141,7 @@ void Horizontal::setDxTarget(const Unit& dxTarget)
}
}
void Horizontal::translate(const Unit& dy)
void Horizontal::translate(const DbU::Unit& dy)
// ***************************************
{
if (dy != 0) {

View File

@ -323,13 +323,13 @@ void Instance::invalidate(bool propagateFlag)
}
}
void Instance::translate(const Unit& dx, const Unit& dy)
void Instance::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// *****************************************************
{
if ((dx != 0) || (dy !=0)) {
Point translation = _transformation.getTranslation();
Unit x = translation.getX() + dx;
Unit y = translation.getY() + dy;
DbU::Unit x = translation.getX() + dx;
DbU::Unit y = translation.getY() + dy;
Transformation::Orientation orientation = _transformation.getOrientation();
setTransformation(Transformation(x, y, orientation));
}
@ -472,8 +472,8 @@ Record* Instance::_getRecord() const
record->add(getSlot("MasterCell", _masterCell));
record->add(getSlot("Transformation", &_transformation));
record->add(getSlot("PlacementStatus", _placementStatus));
record->add(getSlot("XCenter", getValue(getAbutmentBox().getXCenter())));
record->add(getSlot("YCenter", getValue(getAbutmentBox().getYCenter())));
record->add(getSlot("XCenter", DbU::getValueString(getAbutmentBox().getXCenter())));
record->add(getSlot("YCenter", DbU::getValueString(getAbutmentBox().getYCenter())));
record->add(getSlot("Plugs", &_plugMap));
record->add(getSlot("SharedPathes", &_sharedPathMap));
}
@ -537,7 +537,7 @@ Record* Instance::_getRecord() const
// _masterCell->_DrawDisplaySlots(view, area, masterArea, masterTransformation);
//}
//
//bool Instance::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const
//bool Instance::_IsInterceptedBy(View* view, const Point& point, const DbU::Unit& aperture) const
//// ****************************************************************************************
//{
// Symbol* symbol = _masterCell->getSymbol();

View File

@ -20,19 +20,19 @@ Interval::Interval(bool makeEmpty)
_vMax(-1)
{
if (!makeEmpty) {
_vMin = UNIT_MIN;
_vMax = UNIT_MAX;
_vMin = DbU::Min;
_vMax = DbU::Max;
}
}
Interval::Interval(const Unit& value)
Interval::Interval(const DbU::Unit& value)
// **********************************
: _vMin(value),
_vMax(value)
{
}
Interval::Interval(const Unit& v1, const Unit& v2)
Interval::Interval(const DbU::Unit& v1, const DbU::Unit& v2)
// ***********************************************
: _vMin(min(v1, v2)),
_vMax(max(v1, v2))
@ -92,7 +92,7 @@ bool Interval::isPonctual() const
return (_vMax == _vMin);
}
bool Interval::contains(const Unit& v) const
bool Interval::contains(const DbU::Unit& v) const
// *****************************************
{
return !isEmpty() && (_vMin <= v) && (v <= _vMax);
@ -135,18 +135,18 @@ bool Interval::isConstrainedBy(const Interval& interval) const
Interval& Interval::makeEmpty()
// ****************************
{
_vMin = 1;
_vMax = -1;
_vMin = 1;
_vMax = -1;
return *this;
}
Interval& Interval::inflate(const Unit& dv)
Interval& Interval::inflate(const DbU::Unit& dv)
// ****************************************
{
return inflate(dv, dv);
}
Interval& Interval::inflate(const Unit& dvMin, const Unit& dvMax)
Interval& Interval::inflate(const DbU::Unit& dvMin, const DbU::Unit& dvMax)
// **************************************************************
{
if (!isEmpty()) {
@ -156,7 +156,7 @@ Interval& Interval::inflate(const Unit& dvMin, const Unit& dvMax)
return *this;
}
Interval& Interval::merge(const Unit& v)
Interval& Interval::merge(const DbU::Unit& v)
// *************************************
{
if (isEmpty()) {
@ -180,7 +180,7 @@ Interval& Interval::merge(const Interval& interval)
return *this;
}
Interval& Interval::intersection(const Unit& vMin, const Unit& vMax)
Interval& Interval::intersection(const DbU::Unit& vMin, const DbU::Unit& vMax)
// *****************************************************************
{
return intersection(Interval(vMin,vMax));
@ -198,7 +198,7 @@ Interval& Interval::intersection(const Interval& interval)
return *this;
}
Interval& Interval::translate(const Unit& dv)
Interval& Interval::translate(const DbU::Unit& dv)
// ******************************************
{
if (!isEmpty()) {
@ -211,7 +211,7 @@ Interval& Interval::translate(const Unit& dv)
string Interval::_getString() const
// ********************************
{
return "<" + _TName("Interval") + " " + getValueString(_vMin) + " " + getValueString(_vMax) + ">";
return "<" + _TName("Interval") + " " + DbU::getValueString(_vMin) + " " + DbU::getValueString(_vMax) + ">";
}
Record* Interval::_getRecord() const

View File

@ -39,9 +39,9 @@ namespace Hurricane {
Layer::Layer ( Technology* technology
, const Name& name
, const Unit& minimalSize
, const Unit& minimalSpacing
, const Unit& pitch
, const DbU::Unit& minimalSize
, const DbU::Unit& minimalSpacing
, const DbU::Unit& pitch
) : DBo()
, _technology(technology)
, _name(name)
@ -71,27 +71,27 @@ namespace Hurricane {
{ return NULL; }
Unit Layer::getEnclosure () const
DbU::Unit Layer::getEnclosure () const
{ return 0; }
Unit Layer::getExtentionCap () const
DbU::Unit Layer::getExtentionCap () const
{ return 0; }
Unit Layer::getExtentionWidth () const
DbU::Unit Layer::getExtentionWidth () const
{ return 0; }
Unit Layer::getEnclosure ( const BasicLayer* layer ) const
DbU::Unit Layer::getEnclosure ( const BasicLayer* layer ) const
{ return 0; }
Unit Layer::getExtentionCap ( const BasicLayer* layer ) const
DbU::Unit Layer::getExtentionCap ( const BasicLayer* layer ) const
{ return 0; }
Unit Layer::getExtentionWidth ( const BasicLayer* layer ) const
DbU::Unit Layer::getExtentionWidth ( const BasicLayer* layer ) const
{ return 0; }
@ -123,39 +123,39 @@ namespace Hurricane {
}
void Layer::setMinimalSize ( const Unit& minimalSize )
void Layer::setMinimalSize ( const DbU::Unit& minimalSize )
{
_minimalSize = minimalSize;
}
void Layer::setMinimalSpacing ( const Unit& minimalSpacing )
void Layer::setMinimalSpacing ( const DbU::Unit& minimalSpacing )
{
_minimalSpacing = minimalSpacing;
}
void Layer::setPitch ( const Unit& pitch )
void Layer::setPitch ( const DbU::Unit& pitch )
{
_pitch = pitch;
}
void Layer::setEnclosure ( const BasicLayer* layer, Unit )
void Layer::setEnclosure ( const BasicLayer* layer, DbU::Unit )
{
cerr << "[WARNING] Layer::setEnclosure() musn't be called on "
<< _getTypeName() << ": dummy implementation." << endl;
}
void Layer::setExtentionCap ( const BasicLayer* layer, Unit )
void Layer::setExtentionCap ( const BasicLayer* layer, DbU::Unit )
{
cerr << "[WARNING] Layer::setExtentionCap() musn't be called on "
<< _getTypeName() << ": dummy implementation." << endl;
}
void Layer::setExtentionWidth ( const BasicLayer* layer, Unit )
void Layer::setExtentionWidth ( const BasicLayer* layer, DbU::Unit )
{
cerr << "[WARNING] Layer::setExtentionWidth() musn't be called on "
<< _getTypeName() << ": dummy implementation." << endl;

View File

@ -246,7 +246,7 @@ Net::Net(Cell* cell, const Name& name)
_isExternal(false),
_type(),
_direction(),
_position(0, 0),
_position(0,0),
_componentSet(),
_rubberSet(),
_nextOfCellNetMap(NULL)
@ -450,7 +450,7 @@ void Net::setExternal(bool isExternal)
_isExternal = isExternal;
if (_isExternal) {
UpdateSession::open();
setPosition(Point(0, 0));
setPosition(Point(0,0));
for_each_instance(instance, _cell->getSlaveInstances()) {
Plug::_create(instance, this);
end_for;

View File

@ -42,13 +42,13 @@ Pad* Pad::create(Net* net, const Layer* layer, const Box& boundingBox)
return pad;
}
Unit Pad::getX() const
DbU::Unit Pad::getX() const
// *******************
{
return 0;
return 0;
}
Unit Pad::getY() const
DbU::Unit Pad::getY() const
// *******************
{
return 0;
@ -72,7 +72,7 @@ Box Pad::getBoundingBox(const BasicLayer* basicLayer) const
return boundingBox;
}
void Pad::translate(const Unit& dx, const Unit& dy)
void Pad::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// ************************************************
{
if ((dx != 0) || (dy != 0)) {

View File

@ -19,7 +19,7 @@ namespace Hurricane {
// Pin implementation
// ****************************************************************************************************
Pin::Pin(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const Unit& x, const Unit& y, const Unit& width, const Unit& height)
Pin::Pin(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& height)
// ****************************************************************************************************
: Inherit(net, layer, x, y, width, height),
_name(name),
@ -32,7 +32,7 @@ Pin::Pin(Net* net, const Name& name, const AccessDirection& accessDirection, con
}
Pin* Pin::create(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const Unit& x, const Unit& y, const Unit& width, const Unit& height)
Pin* Pin::create(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& height)
// ****************************************************************************************************
{
if (!net)

View File

@ -76,13 +76,13 @@ Cell* Plug::getCell() const
return _instance->getCell();
}
Unit Plug::getX() const
DbU::Unit Plug::getX() const
// ********************
{
return _instance->getTransformation().getX(_masterNet->getPosition());
}
Unit Plug::getY() const
DbU::Unit Plug::getY() const
// ********************
{
return _instance->getTransformation().getY(_masterNet->getPosition());

View File

@ -22,7 +22,7 @@ Point::Point()
{
}
Point::Point(const Unit& x, const Unit& y)
Point::Point(const DbU::Unit& x, const DbU::Unit& y)
// ***************************************
: _x(x),
_y(y)
@ -84,7 +84,7 @@ Point& Point::operator-=(const Point &point)
return *this;
}
Point& Point::translate(const Unit& dx, const Unit& dy)
Point& Point::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// ****************************************************
{
_x += dx;
@ -92,14 +92,14 @@ Point& Point::translate(const Unit& dx, const Unit& dy)
return *this;
}
Point Point::getTranslated(const Unit& dx, const Unit& dy) const {
Point Point::getTranslated(const DbU::Unit& dx, const DbU::Unit& dy) const {
return Point(*this).translate(dx, dy);
}
string Point::_getString() const
// *****************************
{
return "<" + _TName("Point") + " " + getValueString(_x) + " " + getValueString(_y) + ">";
return "<" + _TName("Point") + " " + DbU::getValueString(_x) + " " + DbU::getValueString(_y) + ">";
}
Record* Point::_getRecord() const

View File

@ -21,22 +21,22 @@ namespace Hurricane {
// ****************
Unit Reference::_extend = 0;
DbU::Unit Reference::_extend = 0;
Reference::Reference(Cell* cell, const Name& name, Unit x, Unit y)
Reference::Reference(Cell* cell, const Name& name, DbU::Unit x, DbU::Unit y)
// ***************************************************************
: Inherit(cell),
_name(name),
_point(x,y)
{
if ( !_extend ) _extend = getUnit(0.5);
if ( !_extend ) _extend = DbU::real(0.5);
if (_name.isEmpty())
throw Error("Can't create " + _TName("Reference") + " : empty name");
}
Reference* Reference::create(Cell* cell, const Name& name, Unit x, Unit y)
Reference* Reference::create(Cell* cell, const Name& name, DbU::Unit x, DbU::Unit y)
// ***********************************************************************
{
Reference* reference = new Reference(cell, name, x, y);
@ -58,7 +58,7 @@ Box Reference::getBoundingBox() const
return Box(_point).inflate(_extend);
}
void Reference::translate(const Unit& dx, const Unit& dy)
void Reference::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// *****************************************************
{
if ((dx != 0) || (dy != 0)) {

View File

@ -84,18 +84,18 @@ class Region_Tile {
public: const Box& getBoundingBox() const {return _boundingBox;};
public: const Unit& getXMin() const {return _boundingBox.getXMin();};
public: const Unit& getYMin() const {return _boundingBox.getYMin();};
public: const Unit& getXMax() const {return _boundingBox.getXMax();};
public: const Unit& getYMax() const {return _boundingBox.getYMax();};
public: const DbU::Unit& getXMin() const {return _boundingBox.getXMin();};
public: const DbU::Unit& getYMin() const {return _boundingBox.getYMin();};
public: const DbU::Unit& getXMax() const {return _boundingBox.getXMax();};
public: const DbU::Unit& getYMax() const {return _boundingBox.getYMax();};
public: Region_Tile* getTileAt(const Point& point) const;
public: Region_Tile* getNonVoidTileAt(const Point& point) const;
public: Region_Tile* getLeftTile(const Unit& y) const;
public: Region_Tile* getBottomTile(const Unit& x) const;
public: Region_Tile* getTopTile(const Unit& x) const;
public: Region_Tile* getRightTile(const Unit& y) const;
public: Region_Tile* getLeftTile(const DbU::Unit& y) const;
public: Region_Tile* getBottomTile(const DbU::Unit& x) const;
public: Region_Tile* getTopTile(const DbU::Unit& x) const;
public: Region_Tile* getRightTile(const DbU::Unit& y) const;
// Filters
// *******
@ -111,8 +111,8 @@ class Region_Tile {
// Updators
// ********
public: void splitVertical(Region* region, const Unit& x);
public: void splitHorizontal(Region* region, const Unit& y);
public: void splitVertical(Region* region, const DbU::Unit& x);
public: void splitHorizontal(Region* region, const DbU::Unit& y);
public: bool mergeLeftTile(Region* region);
public: bool mergeBottomTile(Region* region);
public: bool mergeTopTile(Region* region);
@ -133,14 +133,14 @@ class Region_Tile {
private: bool _IsBottomFull() const;
private: bool _IsLeftFull() const;
private: bool _IsRightFull() const;
private: Unit _TopSplitAtVerticalSize (Region* region);
private: Unit _BottomSplitAtVerticalSize (Region* region);
private: Unit _LeftSplitAtHorizontalSize (Region* region);
private: Unit _RightSplitAtHorizontalSize (Region* region);
private: bool _TopSplitAtHorizontalSize (Region* region, const Unit height);
private: bool _BottomSplitAtHorizontalSize (Region* region, const Unit height);
private: bool _LeftSplitAtVerticalSize (Region* region, const Unit width);
private: bool _RightSplitAtVerticalSize (Region* region, const Unit width);
private: DbU::Unit _TopSplitAtVerticalSize (Region* region);
private: DbU::Unit _BottomSplitAtVerticalSize (Region* region);
private: DbU::Unit _LeftSplitAtHorizontalSize (Region* region);
private: DbU::Unit _RightSplitAtHorizontalSize (Region* region);
private: bool _TopSplitAtHorizontalSize (Region* region, const DbU::Unit height);
private: bool _BottomSplitAtHorizontalSize (Region* region, const DbU::Unit height);
private: bool _LeftSplitAtVerticalSize (Region* region, const DbU::Unit width);
private: bool _RightSplitAtVerticalSize (Region* region, const DbU::Unit width);
public: Interval _getTopNeighbour () const;
public: Interval _getBottomNeighbour () const;
@ -208,7 +208,7 @@ Region_Tile* Region_Tile::getNonVoidTileAt(const Point& point) const
return NULL;
}
Region_Tile* Region_Tile::getLeftTile(const Unit& y) const
Region_Tile* Region_Tile::getLeftTile(const DbU::Unit& y) const
// *******************************************************
{
Region_Tile* tile = _leftTile;
@ -216,7 +216,7 @@ Region_Tile* Region_Tile::getLeftTile(const Unit& y) const
return tile;
}
Region_Tile* Region_Tile::getBottomTile(const Unit& x) const
Region_Tile* Region_Tile::getBottomTile(const DbU::Unit& x) const
// *********************************************************
{
Region_Tile* tile = _bottomTile;
@ -224,7 +224,7 @@ Region_Tile* Region_Tile::getBottomTile(const Unit& x) const
return tile;
}
Region_Tile* Region_Tile::getTopTile(const Unit& x) const
Region_Tile* Region_Tile::getTopTile(const DbU::Unit& x) const
// ******************************************************
{
Region_Tile* tile = _topTile;
@ -232,7 +232,7 @@ Region_Tile* Region_Tile::getTopTile(const Unit& x) const
return tile;
}
Region_Tile* Region_Tile::getRightTile(const Unit& y) const
Region_Tile* Region_Tile::getRightTile(const DbU::Unit& y) const
// ********************************************************
{
Region_Tile* tile = _rightTile;
@ -246,7 +246,7 @@ GenericFilter<Region_Tile*> Region_Tile::getIsVoidFilter()
return Region_Tile::IsVoidFilter();
}
void Region_Tile::splitVertical(Region* region, const Unit& x)
void Region_Tile::splitVertical(Region* region, const DbU::Unit& x)
// ***********************************************************
{
if ((getXMin() < x) && (x < getXMax())) {
@ -287,7 +287,7 @@ void Region_Tile::splitVertical(Region* region, const Unit& x)
}
}
void Region_Tile::splitHorizontal(Region* region, const Unit& y)
void Region_Tile::splitHorizontal(Region* region, const DbU::Unit& y)
// *************************************************************
{
if ((getYMin() < y) && (y < getYMax())) {
@ -618,7 +618,7 @@ Region_Tile::_IsRightFull() const
rightTile->getYMin() <= getYMin());
}; // Region_Tile::_IsRightFull
Unit
DbU::Unit
Region_Tile::_TopSplitAtVerticalSize (Region* region)
// **************************************************
// Decoupe les tuiles top-left et top-right a la taille de this
@ -626,12 +626,12 @@ Region_Tile::_TopSplitAtVerticalSize (Region* region)
// Doit etre appele apres verif _IsTopFull()
{
Region_Tile* upTile = _topTile;
Unit height = upTile->getYMax() - getYMax();
DbU::Unit height = upTile->getYMax() - getYMax();
if (upTile && upTile->getXMax() != getXMax()) {
upTile->splitVertical (region, getXMax());
upTile = _topTile;
}
Unit ht;
DbU::Unit ht;
while (upTile && upTile->getXMin() > getXMin()) {
ht = upTile->getYMax() - getYMax();
if (height > ht) height = ht;
@ -645,7 +645,7 @@ Region_Tile::_TopSplitAtVerticalSize (Region* region)
return height;
}; // Region_Tile::_TopSplitAtVerticalSize
Unit
DbU::Unit
Region_Tile::_BottomSplitAtVerticalSize (Region* region)
// *****************************************************
// Decoupe les tuiles bottom-left et bottom-right a la taille de this
@ -653,12 +653,12 @@ Region_Tile::_BottomSplitAtVerticalSize (Region* region)
// Doit etre appele apres verif _IsBottomFull()
{
Region_Tile* downTile = _bottomTile;
Unit height = getYMin() - downTile->getYMin();
DbU::Unit height = getYMin() - downTile->getYMin();
if (downTile && downTile->getXMin() != getXMin()) {
downTile->splitVertical (region, getXMin());
downTile = _bottomTile;
}
Unit ht;
DbU::Unit ht;
while (downTile && downTile->getXMax() < getXMax()) {
ht = getYMin() - downTile->getYMin();
if (height > ht) height = ht;
@ -673,7 +673,7 @@ Region_Tile::_BottomSplitAtVerticalSize (Region* region)
}; // Region_Tile::_BottomSplitAtVerticalSize
Unit
DbU::Unit
Region_Tile::_LeftSplitAtHorizontalSize (Region* region)
// *****************************************************
// Decoupe les tuiles left-top et left-bottom a la taille de this
@ -681,12 +681,12 @@ Region_Tile::_LeftSplitAtHorizontalSize (Region* region)
// Doit etre appele apres verif _IsLeftFull()
{
Region_Tile* leftTile = _leftTile;
Unit width = getXMin() - leftTile->getXMin();
DbU::Unit width = getXMin() - leftTile->getXMin();
if (leftTile && leftTile->getYMin() != getYMin()) {
leftTile->splitHorizontal (region, getYMin());
leftTile = _leftTile;
}
Unit wt;
DbU::Unit wt;
while (leftTile && leftTile->getYMax() < getYMax()) {
wt = getXMin() - leftTile->getXMin();
if (width > wt) width = wt;
@ -701,7 +701,7 @@ Region_Tile::_LeftSplitAtHorizontalSize (Region* region)
}; // Region_Tile::_LeftSplitAtHorizontalSize
Unit
DbU::Unit
Region_Tile::_RightSplitAtHorizontalSize (Region* region)
// ******************************************************
// Decoupe les tuiles right-bottom et right-top a la taille de this
@ -709,12 +709,12 @@ Region_Tile::_RightSplitAtHorizontalSize (Region* region)
// Doit etre appele apres verif _IsRightFull()
{
Region_Tile* rightTile = _rightTile;
Unit width = rightTile->getXMax() - getXMax();
DbU::Unit width = rightTile->getXMax() - getXMax();
if (rightTile && rightTile->getYMax() != getYMax()) {
rightTile->splitHorizontal (region, getYMax());
rightTile = _rightTile;
}
Unit wt;
DbU::Unit wt;
while (rightTile && rightTile->getYMin() > getYMin()) {
wt = rightTile->getXMax() - getXMax();
if (width > wt) width = wt;
@ -730,7 +730,7 @@ Region_Tile::_RightSplitAtHorizontalSize (Region* region)
bool
Region_Tile::_TopSplitAtHorizontalSize (Region* region, const Unit height)
Region_Tile::_TopSplitAtHorizontalSize (Region* region, const DbU::Unit height)
// ***********************************************************************
// Retaille la hauteur de toutes les tuiles sur this a la hauteur height
// Retourne true si une modif a ete faite
@ -755,7 +755,7 @@ Region_Tile::_TopSplitAtHorizontalSize (Region* region, const Unit height)
bool
Region_Tile::_BottomSplitAtHorizontalSize (Region* region, const Unit height)
Region_Tile::_BottomSplitAtHorizontalSize (Region* region, const DbU::Unit height)
// **************************************************************************
// Retaille la hauteur de toutes les tuiles sous this a la hauteur height
// Retourne true si une modif a ete faite
@ -779,7 +779,7 @@ Region_Tile::_BottomSplitAtHorizontalSize (Region* region, const Unit height)
}; // Region_Tile::_BottomSplitAtHorizontalSize
bool
Region_Tile::_LeftSplitAtVerticalSize (Region* region, const Unit width)
Region_Tile::_LeftSplitAtVerticalSize (Region* region, const DbU::Unit width)
// **************************************************************************
// Retaille la largeur de toutes les tuiles a gauche de this a la largeur width
// Retourne true si une modif a ete faite
@ -804,7 +804,7 @@ Region_Tile::_LeftSplitAtVerticalSize (Region* region, const Unit width)
bool
Region_Tile::_RightSplitAtVerticalSize (Region* region, const Unit width)
Region_Tile::_RightSplitAtVerticalSize (Region* region, const DbU::Unit width)
// **************************************************************************
// Retaille la hauteur de toutes les tuiles a droite de this a la largeur width
// Retourne true si une modif a ete faite
@ -899,12 +899,12 @@ Region_Tile::VerticalEnhancement(Region* region)
bool modif = false;
while (_IsTopFull ()) {
Unit height = _TopSplitAtVerticalSize (region);
DbU::Unit height = _TopSplitAtVerticalSize (region);
modif = _TopSplitAtHorizontalSize (region, height);
modif = mergeTopTile (region) || modif;
}
while (_IsBottomFull ()) {
Unit height = _BottomSplitAtVerticalSize (region);
DbU::Unit height = _BottomSplitAtVerticalSize (region);
modif = _BottomSplitAtHorizontalSize (region, height);
modif = mergeBottomTile (region) || modif;
}
@ -918,12 +918,12 @@ Region_Tile::HorizontalEnhancement(Region* region)
bool modif = false;
while (_IsLeftFull ()) {
Unit width = _LeftSplitAtHorizontalSize (region);
DbU::Unit width = _LeftSplitAtHorizontalSize (region);
modif = _LeftSplitAtVerticalSize (region, width);
modif = mergeLeftTile (region) || modif;
}
while (_IsRightFull ()) {
Unit width = _RightSplitAtHorizontalSize (region);
DbU::Unit width = _RightSplitAtHorizontalSize (region);
modif = _RightSplitAtVerticalSize (region, width);
modif = mergeRightTile (region) || modif;
}
@ -1171,8 +1171,8 @@ void Region_Tiles::Locator::progress()
if (!_tileStack.empty()) {
Region_Tile* tile = _tileStack.top();
_tileStack.pop();
Unit xMin = tile->getXMin();
Unit xMax = tile->getXMax();
DbU::Unit xMin = tile->getXMin();
DbU::Unit xMax = tile->getXMax();
Region_Tile* topTile = tile->_topTile;
while (topTile && (xMin < topTile->getXMax())) {
if (topTile->getXMax() <= xMax) _tileStack.push(topTile);
@ -1414,8 +1414,8 @@ void Region_TilesUnder::Locator::progress()
if (!_tileStack.empty()) {
Region_Tile* tile = _tileStack.top();
_tileStack.pop();
Unit xMin = max(tile->getXMin(), _area.getXMin());
Unit xMax = tile->getXMax();
DbU::Unit xMin = max(tile->getXMin(), _area.getXMin());
DbU::Unit xMax = tile->getXMax();
Region_Tile* topTile = tile->_topTile;
while (topTile && (xMin < topTile->getXMax())) {
if ((topTile->getXMin() <= _area.getXMax()) &&
@ -2010,8 +2010,8 @@ Region_Intervals::Locator::Locator(const Region::SwapLine* swapLine)
if (_swapLine) {
switch (_swapLine->getType()) {
case Region::SwapLine::Type::VERTICAL : {
Unit x = _swapLine->getPosition();
Unit yMax = _swapLine->getExtention().getVMax();
DbU::Unit x = _swapLine->getPosition();
DbU::Unit yMax = _swapLine->getExtention().getVMax();
_lowerTile = _swapLine->_getBaseTile();
while (_lowerTile && _lowerTile->isVoid())
_lowerTile = _lowerTile->getTopTile(x);
@ -2027,8 +2027,8 @@ Region_Intervals::Locator::Locator(const Region::SwapLine* swapLine)
break;
}
case Region::SwapLine::Type::HORIZONTAL : {
Unit y = _swapLine->getPosition();
Unit xMax = _swapLine->getExtention().getVMax();
DbU::Unit y = _swapLine->getPosition();
DbU::Unit xMax = _swapLine->getExtention().getVMax();
_lowerTile = _swapLine->_getBaseTile();
while (_lowerTile && _lowerTile->isVoid())
_lowerTile = _lowerTile->getRightTile(y);
@ -2103,8 +2103,8 @@ void Region_Intervals::Locator::progress()
if (isValid()) {
switch (_swapLine->getType()) {
case Region::SwapLine::Type::VERTICAL : {
Unit x = _swapLine->getPosition();
Unit yMax = _swapLine->getExtention().getVMax();
DbU::Unit x = _swapLine->getPosition();
DbU::Unit yMax = _swapLine->getExtention().getVMax();
_lowerTile = _upperTile->getTopTile(x);
while (_lowerTile && _lowerTile->isVoid())
_lowerTile = _lowerTile->getTopTile(x);
@ -2121,8 +2121,8 @@ void Region_Intervals::Locator::progress()
break;
}
case Region::SwapLine::Type::HORIZONTAL : {
Unit y = _swapLine->getPosition();
Unit xMax = _swapLine->getExtention().getVMax();
DbU::Unit y = _swapLine->getPosition();
DbU::Unit xMax = _swapLine->getExtention().getVMax();
_lowerTile = _upperTile->getRightTile(y);
while (_lowerTile && _lowerTile->isVoid())
_lowerTile = _lowerTile->getRightTile(y);
@ -2239,7 +2239,7 @@ Region::SwapLine::SwapLine(Region* region, const Type& type, const Interval& ext
}
}
Region::SwapLine::SwapLine(Region* region, const Type& type, const Unit& position, const Interval& extention)
Region::SwapLine::SwapLine(Region* region, const Type& type, const DbU::Unit& position, const Interval& extention)
// ****************************************************************************************************
: _region(region),
_type(type),
@ -2306,9 +2306,9 @@ void Region::SwapLine::progress(int n)
switch (_type) {
case Type::VERTICAL : {
while (n--) {
Unit yMin = getExtention().getVMin();
Unit yMax = getExtention().getVMax();
Unit x = _region->getXMax() + 1;
DbU::Unit yMin = getExtention().getVMin();
DbU::Unit yMax = getExtention().getVMax();
DbU::Unit x = _region->getXMax() + 1;
Region::Tile* tile = _baseTile;
while (tile) {
if (_position < tile->getXMax())
@ -2334,9 +2334,9 @@ void Region::SwapLine::progress(int n)
}
case Type::HORIZONTAL : {
while (n--) {
Unit xMin = getExtention().getVMin();
Unit xMax = getExtention().getVMax();
Unit y = _region->getYMax() + 1;
DbU::Unit xMin = getExtention().getVMin();
DbU::Unit xMax = getExtention().getVMax();
DbU::Unit y = _region->getYMax() + 1;
Region::Tile* tile = _baseTile;
while (tile) {
if (_position < tile->getYMax())
@ -2368,13 +2368,13 @@ void Region::SwapLine::progress(int n)
}
}
void Region::SwapLine::translate(const Unit& quantity)
void Region::SwapLine::translate(const DbU::Unit& quantity)
// ***************************************************
{
if (quantity) setPosition(getPosition() + quantity);
if (quantity) setPosition(getPosition() + quantity);
}
void Region::SwapLine::setPosition(const Unit& position)
void Region::SwapLine::setPosition(const DbU::Unit& position)
// *****************************************************
{
if (position != _position) {
@ -2485,28 +2485,28 @@ Box Region::getBoundingBox() const
return boundingBox;
}
Unit Region::getXMin() const
DbU::Unit Region::getXMin() const
// *************************
{
return (_topLeftTile) ? _topLeftTile->getXMin() : Unit();
return (_topLeftTile) ? _topLeftTile->getXMin() : DbU::Unit();
}
Unit Region::getYMin() const
DbU::Unit Region::getYMin() const
// *************************
{
return (_bottomRightTile) ? _bottomRightTile->getYMin() : Unit();
return (_bottomRightTile) ? _bottomRightTile->getYMin() : DbU::Unit();
}
Unit Region::getXMax() const
DbU::Unit Region::getXMax() const
// *************************
{
return (_bottomRightTile) ? _bottomRightTile->getXMax() : Unit();
return (_bottomRightTile) ? _bottomRightTile->getXMax() : DbU::Unit();
}
Unit Region::getYMax() const
DbU::Unit Region::getYMax() const
// *************************
{
return (_topLeftTile) ? _topLeftTile->getYMax() : Unit();
return (_topLeftTile) ? _topLeftTile->getYMax() : DbU::Unit();
}
Boxes Region::getBoxes() const
@ -2539,7 +2539,7 @@ Region::SwapLine Region::getVerticalSwapLine(const Interval& extention) const
return SwapLine((Region*)this, Region::SwapLine::Type::VERTICAL, extention);
}
Region::SwapLine Region::getVerticalSwapLine(const Unit& x, const Interval& extention) const
Region::SwapLine Region::getVerticalSwapLine(const DbU::Unit& x, const Interval& extention) const
// *****************************************************************************************
{
return SwapLine((Region*)this, Region::SwapLine::Type::VERTICAL, x, extention);
@ -2551,7 +2551,7 @@ Region::SwapLine Region::getHorizontalSwapLine(const Interval& extention) const
return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, extention);
}
Region::SwapLine Region::getHorizontalSwapLine(const Unit& y, const Interval& extention) const
Region::SwapLine Region::getHorizontalSwapLine(const DbU::Unit& y, const Interval& extention) const
// *******************************************************************************************
{
return SwapLine((Region*)this, Region::SwapLine::Type::HORIZONTAL, y, extention);
@ -2574,7 +2574,7 @@ bool Region::contains(const Box& box) const
{
if (box.isPonctual()) return contains(box.getCenter());
return getBoundingBox().contains(box) &&
Region_TilesUnder (this, Box(box).inflate(-1))
Region_TilesUnder (this, Box(box).inflate(-1))
.getSubSet(Tile::getIsVoidFilter()).IsEmpty();
}
@ -2627,8 +2627,8 @@ Region& Region::clear()
while (!tileStack.empty()) {
tile = tileStack.top();
tileStack.pop();
Unit xMin = tile->getXMin();
Unit xMax = tile->getXMax();
DbU::Unit xMin = tile->getXMin();
DbU::Unit xMax = tile->getXMax();
Tile* topTile = tile->_topTile;
while (topTile && (xMin < topTile->getXMax())) {
@ -2651,7 +2651,7 @@ Region& Region::clear()
Region& Region::fill(const Box& box)
// *********************************
{
if (box.isEmpty() || !box.getWidth() || !box.getHeight()) return *this;
if (box.isEmpty() || !box.getWidth() || !box.getHeight()) return *this;
if (!_bottomRightTile) {
_bottomRightTile = new Tile(box);
@ -2663,7 +2663,7 @@ Region& Region::fill(const Box& box)
_update(box, false);
else {
Tile* startTile = _getStartTile(_getTileAt(Point(box.getXMax(), box.getYMin())));
GenericCollection<Tile*> tiles = _getTilesUnder(Box(box).inflate(0, 0, -1, -1), startTile);
GenericCollection<Tile*> tiles = _getTilesUnder(Box(box).inflate(0,0,-1,-1), startTile);
if (!tiles.getSubSet(Tile::getIsVoidFilter()).IsEmpty()) _update(box, false, startTile);
}
@ -2696,7 +2696,7 @@ Region& Region::groove(const Box& box)
if (correctedBox.isEmpty() || !correctedBox.getWidth() || !correctedBox.getHeight()) return *this;
Tile* startTile = _getStartTile(_getTileAt(Point(correctedBox.getXMax(), correctedBox.getYMin())));
GenericCollection<Tile*> tiles = _getTilesUnder(Box(correctedBox).inflate(0, 0, -1, -1), startTile);
GenericCollection<Tile*> tiles = _getTilesUnder(Box(correctedBox).inflate(0,0,-1,-1), startTile);
if (!tiles.getSubSet(!Tile::getIsVoidFilter()).IsEmpty()) _update(box, true, startTile);
return *this;
@ -2726,11 +2726,11 @@ Region& Region::getIntersection (const Region& region)
return *this;
}
Region& Region::Inflate(const Unit& quantity)
Region& Region::Inflate(const DbU::Unit& quantity)
// ******************************************
{
if (!isEmpty()) {
if (0 < quantity) {
if (0 < quantity) {
list<Box> boxList;
for_each_object(Tile*, tile, Region_Tiles(this).getSubSet(!Tile::getIsVoidFilter())) {
boxList.push_back(tile->getBoundingBox());
@ -2741,8 +2741,8 @@ Region& Region::Inflate(const Unit& quantity)
end_for;
}
}
else if (quantity < 0) {
_growthToFit(getBoundingBox().inflate(getUnit(1)));
else if (quantity < 0) {
_growthToFit(getBoundingBox().inflate(DbU::real(1.0)));
list<Box> boxList;
for_each_object(Tile*, tile, Region_Tiles(this).getSubSet(Tile::getIsVoidFilter())) {
boxList.push_back(tile->getBoundingBox());
@ -2758,7 +2758,7 @@ Region& Region::Inflate(const Unit& quantity)
return *this;
}
Region& Region::translate(const Unit& dx, const Unit& dy)
Region& Region::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// ******************************************************
{
if ((dx != 0) || (dy != 0)) {
@ -2813,12 +2813,12 @@ Region_Tile* Region::_getStartTile(Tile* tile) const
if (tile) {
if (!startTile && tile->_rightTile) {
Unit y = tile->getYMin();
DbU::Unit y = tile->getYMin();
startTile = tile->_rightTile;
while (startTile && (y <= startTile->getYMax())) startTile = startTile->_bottomTile;
}
if (!startTile && tile->_bottomTile) {
Unit x = tile->getXMax();
DbU::Unit x = tile->getXMax();
startTile = tile->_bottomTile;
while (startTile && (startTile->getXMin() <= x)) startTile = startTile->_rightTile;
}
@ -2941,7 +2941,7 @@ void Region::_growthToFit(const Box& box)
void Region::_update(const Box& box, bool isVoid, Tile* startTile)
// **************************************************************
{
if (box.isEmpty() || !_bottomRightTile || !box.getWidth() || !box.getHeight()) return;
if (box.isEmpty() || !_bottomRightTile || !box.getWidth() || !box.getHeight()) return;
if (!getBoundingBox().contains(box)) _growthToFit(box);
@ -2950,7 +2950,7 @@ void Region::_update(const Box& box, bool isVoid, Tile* startTile)
Tile* newTile = new Tile(box, isVoid);
list<Tile*> tileList;
_getTilesUnder(Box(box).inflate(0, 0, -1, -1), startTile).fill(tileList);
_getTilesUnder(Box(box).inflate(0,0,-1,-1), startTile).fill(tileList);
for_each_object(Tile*, tile, getCollection(tileList)) {
if (_topLeftTile == tile) _topLeftTile = newTile;
if (_bottomRightTile == tile) _bottomRightTile = newTile;
@ -3007,14 +3007,15 @@ Region::verticalEnhancement()
{
bool modif = false;
Region result;
double minArea = 1.*getUnit(5)*getUnit(5);
double minSide = DbU::getReal(DbU::real(5.0));
double minArea = minSide*minSide;
do {
// Rechercher la box de plus grande surface
Box maxBox = Box();
double area = minArea;
for_each_box (box, getBoxes()) {
if (! box.isEmpty()) {
double a = 1. * box.getWidth() * box.getHeight();
double a = DbU::getReal(box.getWidth()) * DbU::getReal(box.getHeight());
if (area < a) {
area = a;
maxBox = box;
@ -3024,7 +3025,7 @@ Region::verticalEnhancement()
}
if (maxBox.isEmpty()) break;
Tile* tile = _getTileAt (maxBox.getCenter());
if (maxBox.getWidth() >= getUnit(2)) {
if (maxBox.getWidth() >= DbU::real(2.0)) {
modif = tile->VerticalEnhancement (this);
}
result.fill (tile->getBoundingBox());
@ -3053,14 +3054,15 @@ Region::horizontalEnhancement()
{
bool modif = false;
Region result;
double minArea = 1.*getUnit(5)*getUnit(5);
const double minSide = DbU::getReal(DbU::real(5.0));
double minArea = minSide*minSide;
do {
// Rechercher la box de plus grande surface
Box maxBox = Box();
double area = minArea;
for_each_box (box, getBoxes()) {
if (! box.isEmpty()) {
double a = 1. * box.getWidth() * box.getHeight();
double a = DbU::getReal(box.getWidth()) * DbU::getReal(box.getHeight());
if (area < a) {
area = a;
maxBox = box;
@ -3070,7 +3072,7 @@ Region::horizontalEnhancement()
}
if (maxBox.isEmpty()) break;
Tile* tile = _getTileAt (maxBox.getCenter());
if (maxBox.getWidth() >= getUnit(2)) {
if (maxBox.getWidth() >= DbU::real(2.0)) {
modif = tile->HorizontalEnhancement (this);
}
result.fill (tile->getBoundingBox());

View File

@ -231,31 +231,31 @@ namespace Hurricane {
{ return RegularLayer_RegularLayers(this); }
Unit RegularLayer::getEnclosure () const
DbU::Unit RegularLayer::getEnclosure () const
{ return _enclosure; }
Unit RegularLayer::getExtentionCap () const
DbU::Unit RegularLayer::getExtentionCap () const
{ return _extentionCap; }
Unit RegularLayer::getExtentionWidth () const
DbU::Unit RegularLayer::getExtentionWidth () const
{ return _extentionWidth; }
Unit RegularLayer::getEnclosure ( const BasicLayer* layer ) const
DbU::Unit RegularLayer::getEnclosure ( const BasicLayer* layer ) const
{
return (layer == _basicLayer) ? _enclosure : 0;
}
Unit RegularLayer::getExtentionCap ( const BasicLayer* layer ) const
DbU::Unit RegularLayer::getExtentionCap ( const BasicLayer* layer ) const
{
return (layer == _basicLayer) ? _extentionCap : 0;
}
Unit RegularLayer::getExtentionWidth ( const BasicLayer* layer ) const
DbU::Unit RegularLayer::getExtentionWidth ( const BasicLayer* layer ) const
{
return (layer == _basicLayer) ? _extentionWidth : 0;
}
@ -276,19 +276,19 @@ namespace Hurricane {
}
void RegularLayer::setEnclosure ( const BasicLayer* layer, Unit enclosure )
void RegularLayer::setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure )
{
if ( _basicLayer == layer ) _enclosure = enclosure;
}
void RegularLayer::setExtentionCap ( const BasicLayer* layer, Unit cap )
void RegularLayer::setExtentionCap ( const BasicLayer* layer, DbU::Unit cap )
{
if ( _basicLayer == layer ) _extentionCap = cap;
}
void RegularLayer::setExtentionWidth ( const BasicLayer* layer, Unit width )
void RegularLayer::setExtentionWidth ( const BasicLayer* layer, DbU::Unit width )
{
if ( _basicLayer == layer ) _extentionWidth = width;
}

View File

@ -78,13 +78,13 @@ void RoutingPad::_postCreate()
_occurrence.getMasterCell()->_addSlaveEntity(_occurrence.getEntity(),this);
}
Unit RoutingPad::getX() const
DbU::Unit RoutingPad::getX() const
// ***********************
{
return _x;
}
Unit RoutingPad::getY() const
DbU::Unit RoutingPad::getY() const
// ***********************
{
return _y;
@ -140,25 +140,25 @@ Point RoutingPad::getTargetPosition() const
return getPosition();
}
Unit RoutingPad::getSourceX() const
DbU::Unit RoutingPad::getSourceX() const
// ********************************
{
return getSourcePosition().getX();
}
Unit RoutingPad::getSourceY() const
DbU::Unit RoutingPad::getSourceY() const
// ********************************
{
return getSourcePosition().getY();
}
Unit RoutingPad::getTargetX() const
DbU::Unit RoutingPad::getTargetX() const
// ********************************
{
return getTargetPosition().getX();
}
Unit RoutingPad::getTargetY() const
DbU::Unit RoutingPad::getTargetY() const
// ********************************
{
return getTargetPosition().getY();
@ -175,7 +175,7 @@ Point RoutingPad::getCenter() const
}
void RoutingPad::translate(const Unit& dx, const Unit& dy)
void RoutingPad::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// ****************************************************
{
if ((dx != 0) || (dy != 0)) {
@ -185,19 +185,19 @@ void RoutingPad::translate(const Unit& dx, const Unit& dy)
}
}
void RoutingPad::setX(const Unit& x)
void RoutingPad::setX(const DbU::Unit& x)
// ******************************
{
setPosition(x, getY());
}
void RoutingPad::setY(const Unit& y)
void RoutingPad::setY(const DbU::Unit& y)
// ******************************
{
setPosition(getX(), y);
}
void RoutingPad::setPosition(const Unit& x, const Unit& y)
void RoutingPad::setPosition(const DbU::Unit& x, const DbU::Unit& y)
// ****************************************************
{
setOffset(x, y);
@ -209,7 +209,7 @@ void RoutingPad::setPosition(const Point& position)
setPosition(position.getX(), position.getY());
}
void RoutingPad::setOffset(const Unit& x, const Unit& y)
void RoutingPad::setOffset(const DbU::Unit& x, const DbU::Unit& y)
// ****************************************************
{
invalidate(true);
@ -236,8 +236,8 @@ string RoutingPad::_getString() const
// *******************************
{
string s = Inherit::_getString();
s.insert(s.length() - 1, " [" + getValueString(getX()));
s.insert(s.length() - 1, " " + getValueString(getY()));
s.insert(s.length() - 1, " [" + DbU::getValueString(getX()));
s.insert(s.length() - 1, " " + DbU::getValueString(getY()));
s.insert(s.length() - 1, "] ");
s.insert(s.length() - 1, getString(_occurrence));
return s;

View File

@ -63,8 +63,8 @@ Point Rubber::getBarycenter() const
// ********************************
{
int n = getHooks().getSize();
Unit x = 0;
Unit y = 0;
DbU::Unit x = 0;
DbU::Unit y = 0;
for_each_hook(hook, getHooks()) {
Point position = hook->getComponent()->getBoundingBox().getCenter();
x += position.getX() / n;
@ -117,7 +117,7 @@ void Rubber::unmaterialize()
}
}
void Rubber::translate(const Unit& dx, const Unit& dy)
void Rubber::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// ***************************************************
{
}

View File

@ -151,7 +151,7 @@ class Segment_Anchors : public Collection<Component*> {
// Segment implementation
// ****************************************************************************************************
Segment::Segment(Net* net, Component* source, Component* target, const Layer* layer, const Unit& width)
Segment::Segment(Net* net, Component* source, Component* target, const Layer* layer, const DbU::Unit& width)
// **********************************************************************************************
: Inherit(net),
_sourceHook(this),
@ -252,7 +252,7 @@ void Segment::setLayer(const Layer* layer)
}
}
void Segment::setWidth(const Unit& width)
void Segment::setWidth(const DbU::Unit& width)
// **************************************
{
if (width != _width) {
@ -294,9 +294,9 @@ string Segment::_getString() const
{
string s = Inherit::_getString();
s.insert(s.length() - 1, " " + getString(_layer->getName()));
s.insert(s.length() - 1, " [" + getValueString(getSourceX()) + " " + getValueString(getSourceY()) + "]");
s.insert(s.length() - 1, " [" + getValueString(getTargetX()) + " " + getValueString(getTargetY()) + "]");
s.insert(s.length() - 1, " " + getValueString(_width));
s.insert(s.length() - 1, " [" + DbU::getValueString(getSourceX()) + " " + DbU::getValueString(getSourceY()) + "]");
s.insert(s.length() - 1, " [" + DbU::getValueString(getTargetX()) + " " + DbU::getValueString(getTargetY()) + "]");
s.insert(s.length() - 1, " " + DbU::getValueString(_width));
return s;
}

View File

@ -51,7 +51,7 @@ Transformation::Transformation()
{
}
Transformation::Transformation(const Unit& tx, const Unit& ty, const Orientation& orientation)
Transformation::Transformation(const DbU::Unit& tx, const DbU::Unit& ty, const Orientation& orientation)
// *******************************************************************************************
: _tx(tx),
_ty(ty),
@ -100,43 +100,43 @@ bool Transformation::operator!=(const Transformation& transformation) const
(_orientation != transformation._orientation));
}
Unit Transformation::getX(const Unit& x, const Unit& y) const
DbU::Unit Transformation::getX(const DbU::Unit& x, const DbU::Unit& y) const
// **********************************************************
{
return (x * A[_orientation]) + (y * B[_orientation]) + _tx;
}
Unit Transformation::getY(const Unit& x, const Unit& y) const
DbU::Unit Transformation::getY(const DbU::Unit& x, const DbU::Unit& y) const
// **********************************************************
{
return (x * C[_orientation]) + (y * D[_orientation]) + _ty;
}
Unit Transformation::getX(const Point& point) const
DbU::Unit Transformation::getX(const Point& point) const
// ************************************************
{
return getX(point.getX(), point.getY());
}
Unit Transformation::getY(const Point& point) const
DbU::Unit Transformation::getY(const Point& point) const
// ************************************************
{
return getY(point.getX(), point.getY());
}
Unit Transformation::getDx(const Unit& dx, const Unit& dy) const
DbU::Unit Transformation::getDx(const DbU::Unit& dx, const DbU::Unit& dy) const
// *************************************************************
{
return (dx * A[_orientation]) + (dy * B[_orientation]);
}
Unit Transformation::getDy(const Unit& dx, const Unit& dy) const
DbU::Unit Transformation::getDy(const DbU::Unit& dx, const DbU::Unit& dy) const
// *************************************************************
{
return (dx * C[_orientation]) + (dy * D[_orientation]);
}
Point Transformation::getPoint(const Unit& x, const Unit& y) const
Point Transformation::getPoint(const DbU::Unit& x, const DbU::Unit& y) const
// ***************************************************************
{
return Point(getX(x, y), getY(x, y));
@ -148,7 +148,7 @@ Point Transformation::getPoint(const Point& point) const
return getPoint(point.getX(), point.getY());
}
Box Transformation::getBox(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) const
Box Transformation::getBox(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2) const
// *********************************************************************************************
{
return Box(getX(x1, y1), getY(x1, y1), getX(x2, y2), getY(x2, y2));
@ -170,8 +170,8 @@ Box Transformation::getBox(const Box& box) const
Transformation Transformation::getTransformation(const Transformation& transformation) const
// *****************************************************************************************
{
Unit x = transformation._tx;
Unit y = transformation._ty;
DbU::Unit x = transformation._tx;
DbU::Unit y = transformation._ty;
return Transformation(
(x * A[_orientation]) + (y * B[_orientation]) + _tx,
@ -196,10 +196,10 @@ Transformation& Transformation::invert()
INVERT[_orientation]));
}
void Transformation::applyOn(Unit& x, Unit& y) const
void Transformation::applyOn(DbU::Unit& x, DbU::Unit& y) const
// *************************************************
{
Unit xi = x, yi = y;
DbU::Unit xi = x, yi = y;
x = getX(xi, yi);
y = getY(xi, yi);
}
@ -226,10 +226,10 @@ string Transformation::_getString() const
// **************************************
{
return "<" + _TName("Transformation") + " " +
getValueString(_tx) + " " +
getValueString(_ty) + " " +
getString(_orientation) +
">";
DbU::getValueString(_tx) + " " +
DbU::getValueString(_ty) + " " +
getString(_orientation) +
">";
}
Record* Transformation::_getRecord() const

View File

@ -154,15 +154,15 @@ namespace Hurricane {
{ return getCollection(_basicLayers); }
Unit TransistorLayer::getExtentionCap () const
DbU::Unit TransistorLayer::getExtentionCap () const
{ return _maximalExtentionCap; }
Unit TransistorLayer::getExtentionWidth () const
DbU::Unit TransistorLayer::getExtentionWidth () const
{ return _maximalExtentionWidth; }
Unit TransistorLayer::getExtentionCap ( const BasicLayer* layer ) const
DbU::Unit TransistorLayer::getExtentionCap ( const BasicLayer* layer ) const
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer )
@ -173,7 +173,7 @@ namespace Hurricane {
}
Unit TransistorLayer::getExtentionWidth ( const BasicLayer* layer ) const
DbU::Unit TransistorLayer::getExtentionWidth ( const BasicLayer* layer ) const
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer )
@ -184,7 +184,7 @@ namespace Hurricane {
}
void TransistorLayer::setExtentionCap ( const BasicLayer* layer, Unit cap )
void TransistorLayer::setExtentionCap ( const BasicLayer* layer, DbU::Unit cap )
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer ) {
@ -195,7 +195,7 @@ namespace Hurricane {
}
void TransistorLayer::setExtentionWidth ( const BasicLayer* layer, Unit width )
void TransistorLayer::setExtentionWidth ( const BasicLayer* layer, DbU::Unit width )
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( _basicLayers[i] == layer )

View File

@ -1,186 +0,0 @@
// ****************************************************************************************************
// File: Unit.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "hurricane/Unit.h"
#include "hurricane/Error.h"
#include <math.h>
namespace Hurricane {
// ****************************************************************************************************
// Constants & Variables
// ****************************************************************************************************
static const unsigned MAXIMAL_PRECISION_ALLOWED = 3;
static unsigned PRECISION = 0;
static double RESOLUTION = 1;
static Unit GRID_STEP = 1;
// ****************************************************************************************************
// Precision managers
// ****************************************************************************************************
unsigned getPrecision()
// ********************
{
return PRECISION;
}
unsigned getMaximalPrecisionAllowed()
// **********************************
{
return MAXIMAL_PRECISION_ALLOWED;
}
void setPrecision(unsigned precision)
// **********************************
{
if (MAXIMAL_PRECISION_ALLOWED < precision)
throw Error("Can't set precision : not allowed");
PRECISION = precision;
RESOLUTION = 1;
while (precision--) RESOLUTION /= 10;
setGridStep(getUnit(1));
}
// ****************************************************************************************************
// Resolution managers
// ****************************************************************************************************
double getResolution()
// *******************
{
return RESOLUTION;
}
// ****************************************************************************************************
// Grid managers
// ****************************************************************************************************
const Unit& getGridStep()
// **********************
{
return GRID_STEP;
}
void setGridStep(const Unit& gridStep)
// ***********************************
{
if (!gridStep) throw Error("Can't set grid step : invalid value");
GRID_STEP = gridStep;
}
bool isOnGrid(const Unit& unit, int n)
// ***********************************
{
if (n <= 0) throw Error("Can't compute : invalid value");
n *= GRID_STEP;
return (((abs(unit) / n) * n) == abs(unit));
}
Unit getOnGridUnit(const Unit& unit, int s)
// ****************************************
{
switch (s) {
case -1 : {
if (0 < unit) return (unit / GRID_STEP) * GRID_STEP;
else if (unit < 0) return ((unit / GRID_STEP) - 1) * GRID_STEP;
return unit;
}
case 0 : {
int g1 = (unit / GRID_STEP) * GRID_STEP;
int g2 = ((g1 < unit) ? (g1 + GRID_STEP) : (g1 - GRID_STEP));
return (abs(g1 - unit) <= abs(g2 - unit)) ? g1 : g2;
}
case +1 : {
if (0 < unit) return ((unit / GRID_STEP) + 1) * GRID_STEP;
else if (unit < 0) return (unit / GRID_STEP) * GRID_STEP;
return unit;
}
}
throw Error("Can't get on grid unit : invalid parameter s (should be -1, 0 or +1)");
return 0;
}
// ****************************************************************************************************
// Others
// ****************************************************************************************************
Unit getUnit(double value)
// ***********************
{
return (int)rint(value / RESOLUTION);
}
double getValue(const Unit& unit)
// ******************************
{
return (unit * RESOLUTION);
}
string getValueString(const Unit& unit)
// ************************************
{
if (unit == 0) return "0";
char buffer[32];
unsigned length = sprintf(buffer, "%ld", abs(unit));
if (length <= PRECISION) {
unsigned offset = PRECISION - length + 1;
for (int i = length; 0 <= i; i--) buffer[i + offset] = buffer[i];
for (unsigned i = 0; i < offset; i++) buffer[i] = '0';
length += offset;
}
for (unsigned i = 0; i <= PRECISION; i++)
buffer[length - i + 1] = buffer[length - i];
buffer[length - PRECISION] = '.';
while (buffer[length] == '0') buffer[length--] = '\0';
if (buffer[length] == '.') buffer[length--] = '\0';
if (0 < unit)
return buffer;
else
return "-" + string(buffer);
}
} // End of Hurricane namespace.
bool Scan(const string& s, Hurricane::Unit& unit)
// ***********************************
{
double d;
if (Scan(s, d)) {
unit = Hurricane::getUnit(d);
return true;
}
return false;
}
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -19,7 +19,7 @@ namespace Hurricane {
// Vertical implementation
// ****************************************************************************************************
Vertical::Vertical(Net* net, Component* source, Component* target, const Layer* layer, const Unit& x, const Unit& width, const Unit& dySource, const Unit& dyTarget)
Vertical::Vertical(Net* net, Component* source, Component* target, const Layer* layer, const DbU::Unit& x, const DbU::Unit& width, const DbU::Unit& dySource, const DbU::Unit& dyTarget)
// ****************************************************************************************************
: Inherit(net, source, target, layer, width),
_x(x),
@ -28,7 +28,7 @@ Vertical::Vertical(Net* net, Component* source, Component* target, const Layer*
{
}
Vertical* Vertical::create(Net* net, const Layer* layer, const Unit& x, const Unit& width, const Unit& dySource, const Unit& dyTarget)
Vertical* Vertical::create(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Unit& width, const DbU::Unit& dySource, const DbU::Unit& dyTarget)
// ****************************************************************************************************
{
if (!net)
@ -41,7 +41,7 @@ Vertical* Vertical::create(Net* net, const Layer* layer, const Unit& x, const Un
return vertical;
}
Vertical* Vertical::create(Component* source, Component* target, const Layer* layer, const Unit& x, const Unit& width, const Unit& dySource, const Unit& dyTarget)
Vertical* Vertical::create(Component* source, Component* target, const Layer* layer, const DbU::Unit& x, const DbU::Unit& width, const DbU::Unit& dySource, const DbU::Unit& dyTarget)
// ****************************************************************************************************
{
if (!source)
@ -61,8 +61,8 @@ Vertical* Vertical::create(Component* source, Component* target, const Layer* la
Box Vertical::getBoundingBox() const
// *********************************
{
Unit size = getLayer()->getExtentionWidth() + getHalfWidth();
Unit extention = getLayer()->getExtentionCap ();
DbU::Unit size = getLayer()->getExtentionWidth() + getHalfWidth();
DbU::Unit extention = getLayer()->getExtentionCap ();
return Box(_x, getSourceY(), _x, getTargetY()).inflate(size, extention);
}
@ -73,8 +73,8 @@ Box Vertical::getBoundingBox(const BasicLayer* basicLayer) const
if (!getLayer()->contains(basicLayer)) return Box();
Unit size = getLayer()->getExtentionWidth(basicLayer) + getHalfWidth();
Unit extention = getLayer()->getExtentionCap (basicLayer);
DbU::Unit size = getLayer()->getExtentionWidth(basicLayer) + getHalfWidth();
DbU::Unit extention = getLayer()->getExtentionCap (basicLayer);
//cerr << this << " on: " << basicLayer << " " << size << " " << extention << endl;
//cerr << Box(_x, getSourceY(), _x, getTargetY()).inflate(size, extention) << endl;
@ -82,21 +82,21 @@ Box Vertical::getBoundingBox(const BasicLayer* basicLayer) const
return Box(_x, getSourceY(), _x, getTargetY()).inflate(size, extention);
}
Unit Vertical::getSourceY() const
DbU::Unit Vertical::getSourceY() const
// ******************************
{
Component* source = getSource();
return (source) ? source->getY() + _dySource : _dySource;
}
Unit Vertical::getTargetY() const
DbU::Unit Vertical::getTargetY() const
// ******************************
{
Component* target = getTarget();
return (target) ? target->getY() + _dyTarget : _dyTarget;
}
Unit Vertical::getLength() const
DbU::Unit Vertical::getLength() const
// *****************************
{
return abs(getSourceY() - getTargetY());
@ -108,7 +108,7 @@ Point Vertical::getCenter() const
return Point ( getX(), (getSourceY()+getTargetY())/2 );
}
void Vertical::translate(const Unit& dx, const Unit& dy)
void Vertical::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// *****************************************************
{
if (dx != 0) {
@ -117,7 +117,7 @@ void Vertical::translate(const Unit& dx, const Unit& dy)
}
}
void Vertical::setX(const Unit& x)
void Vertical::setX(const DbU::Unit& x)
// *******************************
{
if (x != _x) {
@ -126,7 +126,7 @@ void Vertical::setX(const Unit& x)
}
}
void Vertical::setDySource(const Unit& dySource)
void Vertical::setDySource(const DbU::Unit& dySource)
// *********************************************
{
if (dySource != _dySource) {
@ -135,7 +135,7 @@ void Vertical::setDySource(const Unit& dySource)
}
}
void Vertical::setDyTarget(const Unit& dyTarget)
void Vertical::setDyTarget(const DbU::Unit& dyTarget)
// *********************************************
{
if (dyTarget != _dyTarget) {
@ -144,7 +144,7 @@ void Vertical::setDyTarget(const Unit& dyTarget)
}
}
void Vertical::translate(const Unit& dx)
void Vertical::translate(const DbU::Unit& dx)
// *************************************
{
if (dx != 0) {

View File

@ -146,13 +146,13 @@ namespace Hurricane {
{ return getCollection(_basicLayers); }
Unit ViaLayer::getEnclosure () const
DbU::Unit ViaLayer::getEnclosure () const
{
return _maximalEnclosure;
}
Unit ViaLayer::getEnclosure ( const BasicLayer* layer ) const
DbU::Unit ViaLayer::getEnclosure ( const BasicLayer* layer ) const
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( layer == _basicLayers[i] ) return _enclosures[i];
@ -162,7 +162,7 @@ namespace Hurricane {
}
void ViaLayer::setEnclosure ( const BasicLayer* layer, Unit enclosure )
void ViaLayer::setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure )
{
for ( size_t i=0 ; i<_basicLayers.size() ; i++ ) {
if ( layer == _basicLayers[i] ) {

View File

@ -75,8 +75,8 @@ namespace Hurricane {
, const Name& name
, const Material& material
, unsigned extractNumber
, const Unit& minimalSize = 0
, const Unit& minimalSpacing = 0
, const DbU::Unit& minimalSize = 0
, const DbU::Unit& minimalSpacing = 0
);
// Accessors.
inline const Material& getMaterial () const;
@ -111,8 +111,8 @@ namespace Hurricane {
, const Name& name
, const Material& material
, unsigned extractNumber
, const Unit& minimalSize = 0
, const Unit& minimalSpacing = 0
, const DbU::Unit& minimalSize = 0
, const DbU::Unit& minimalSpacing = 0
);
virtual void _postCreate ();
virtual void _preDestroy ();

View File

@ -24,19 +24,19 @@ class Box {
// **********
private: Unit _xMin;
private: Unit _yMin;
private: Unit _xMax;
private: Unit _yMax;
private: DbU::Unit _xMin;
private: DbU::Unit _yMin;
private: DbU::Unit _xMax;
private: DbU::Unit _yMax;
// constructors
// ************
public: Box();
public: Box(const Unit& x, const Unit& y);
public: Box(const DbU::Unit& x, const DbU::Unit& y);
public: Box(const Point& point);
public: Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2);
public: Box(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2);
public: Box(const Point& point1, const Point& point2);
public: Box(const Box& box);
@ -52,25 +52,25 @@ class Box {
// Accessors
// *********
public: const Unit& getXMin() const {return _xMin;};
public: const Unit& getYMin() const {return _yMin;};
public: const Unit& getXMax() const {return _xMax;};
public: const Unit& getYMax() const {return _yMax;};
public: const DbU::Unit& getXMin() const {return _xMin;};
public: const DbU::Unit& getYMin() const {return _yMin;};
public: const DbU::Unit& getXMax() const {return _xMax;};
public: const DbU::Unit& getYMax() const {return _yMax;};
public: Unit getXCenter() const {return ((_xMin + _xMax) / 2);};
public: Unit getYCenter() const {return ((_yMin + _yMax) / 2);};
public: DbU::Unit getXCenter() const {return ((_xMin + _xMax) / 2);};
public: DbU::Unit getYCenter() const {return ((_yMin + _yMax) / 2);};
public: Point getCenter() const {return Point(getXCenter(), getYCenter());};
public: Unit getWidth() const {return (_xMax - _xMin);};
public: Unit getHalfWidth() const {return (getWidth() / 2);};
public: Unit getHeight() const {return (_yMax - _yMin);};
public: Unit getHalfHeight() const {return (getHeight() / 2);};
public: DbU::Unit getWidth() const {return (_xMax - _xMin);};
public: DbU::Unit getHalfWidth() const {return (getWidth() / 2);};
public: DbU::Unit getHeight() const {return (_yMax - _yMin);};
public: DbU::Unit getHalfHeight() const {return (getHeight() / 2);};
public: Box getUnion(const Box& box) const;
public: Box getIntersection(const Box& box) const;
public: Unit manhattanDistance(const Point& pt) const;
public: Unit manhattanDistance(const Box& box) const;
public: DbU::Unit manhattanDistance(const Point& pt) const;
public: DbU::Unit manhattanDistance(const Box& box) const;
// Predicates
// **********
@ -79,7 +79,7 @@ class Box {
public: bool isFlat() const;
public: bool isPonctual() const;
public: bool contains(const Unit& x, const Unit& y) const;
public: bool contains(const DbU::Unit& x, const DbU::Unit& y) const;
public: bool contains(const Point& point) const;
public: bool contains(const Box& box) const;
@ -92,18 +92,18 @@ class Box {
public: Box& makeEmpty();
public: Box& inflate(const Unit& d);
public: Box& inflate(const Unit& dx, const Unit& dy);
public: Box& inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax);
public: Box getInflated(const Unit& d) const;
public: Box& inflate(const DbU::Unit& d);
public: Box& inflate(const DbU::Unit& dx, const DbU::Unit& dy);
public: Box& inflate(const DbU::Unit& dxMin, const DbU::Unit& dyMin, const DbU::Unit& dxMax, const DbU::Unit& dyMax);
public: Box getInflated(const DbU::Unit& d) const;
public: Box& shrinkByFactor(double factor); // 0 <= factor <= 1
public: Box& merge(const Unit& x, const Unit& y);
public: Box& merge(const DbU::Unit& x, const DbU::Unit& y);
public: Box& merge(const Point& point);
public: Box& merge(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2);
public: Box& merge(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2);
public: Box& merge(const Box& box);
public: Box& translate(const Unit& dx, const Unit& dy);
public: Box& translate(const DbU::Unit& dx, const DbU::Unit& dy);
// Others
// ******

View File

@ -72,8 +72,8 @@ class Component : public Go {
public: Rubber* getRubber() const {return _rubber;};
public: Hook* getBodyHook() {return &_bodyHook;};
public: virtual Hooks getHooks() const;
public: virtual Unit getX() const = 0;
public: virtual Unit getY() const = 0;
public: virtual DbU::Unit getX() const = 0;
public: virtual DbU::Unit getY() const = 0;
public: virtual Point getPosition() const {return Point(getX(), getY());};
public: virtual Point getCenter() const {return getPosition();};
public: virtual const Layer* getLayer() const = 0;

View File

@ -48,55 +48,80 @@ class Contact : public Component {
private: AnchorHook _anchorHook;
private: const Layer* _layer;
private: Unit _dx;
private: Unit _dy;
protected: Unit _width;
protected: Unit _height;
private: DbU::Unit _dx;
private: DbU::Unit _dy;
protected: DbU::Unit _width;
protected: DbU::Unit _height;
// Constructors
// ************
protected: Contact(Net* net, const Layer* layer, const Unit& x, const Unit& y, const Unit& width = 0, const Unit& height = 0);
protected: Contact(Net* net, Component* anchor, const Layer* layer, const Unit& dx, const Unit& dy, const Unit& width = 0, const Unit& height = 0);
protected: Contact( Net* net
, const Layer* layer
, const DbU::Unit& x
, const DbU::Unit& y
, const DbU::Unit& width = 0
, const DbU::Unit& height = 0
);
protected: Contact( Net* net
, Component* anchor
, const Layer* layer
, const DbU::Unit& dx
, const DbU::Unit& dy
, const DbU::Unit& width = 0
, const DbU::Unit& height = 0
);
public: static Contact* create(Net* net, const Layer* layer, const Unit& x, const Unit& y, const Unit& width = 0, const Unit& height = 0);
public: static Contact* create(Component* anchor, const Layer* layer, const Unit& dx, const Unit& dy, const Unit& width = 0, const Unit& height = 0);
public: static 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
);
public: static Contact* create( Component* anchor
, const Layer* layer
, const DbU::Unit& dx
, const DbU::Unit& dy
, const DbU::Unit& width = 0
, const DbU::Unit& height = 0
);
// Accessors
// *********
public: virtual Hooks getHooks() const;
public: virtual Unit getX() const;
public: virtual Unit getY() const;
public: virtual DbU::Unit getX() const;
public: virtual DbU::Unit getY() const;
public: virtual Point getPosition() const;
public: virtual Box getBoundingBox() const;
public: virtual const Layer* getLayer() const {return _layer;};
public: virtual Box getBoundingBox(const BasicLayer* basicLayer) const;
public: Hook* getAnchorHook() {return &_anchorHook;};
public: Component* getAnchor() const;
public: const Unit& getDx() const {return _dx;};
public: const Unit& getDy() const {return _dy;};
public: const Unit& getWidth() const {return _width;};
public: Unit getHalfWidth() const {return (_width / 2);};
public: const Unit& getHeight() const {return _height;};
public: Unit getHalfHeight() const {return (_height / 2);};
public: const DbU::Unit& getDx() const {return _dx;};
public: const DbU::Unit& getDy() const {return _dy;};
public: const DbU::Unit& getWidth() const {return _width;};
public: DbU::Unit getHalfWidth() const {return (_width / 2);};
public: const DbU::Unit& getHeight() const {return _height;};
public: DbU::Unit getHalfHeight() const {return (_height / 2);};
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: void setLayer(const Layer* layer);
public: void setWidth(const Unit& width);
public: void setHeight(const Unit& height);
public: void setSizes(const Unit& width, const Unit& height);
public: void setX(const Unit& x);
public: void setY(const Unit& y);
public: void setPosition(const Unit& x, const Unit& y);
public: void setWidth(const DbU::Unit& width);
public: void setHeight(const DbU::Unit& height);
public: void setSizes(const DbU::Unit& width, const DbU::Unit& height);
public: void setX(const DbU::Unit& x);
public: void setY(const DbU::Unit& y);
public: void setPosition(const DbU::Unit& x, const DbU::Unit& y);
public: void setPosition(const Point& position);
public: void setDx(const Unit& dx);
public: void setDy(const Unit& dy);
public: void setOffset(const Unit& dx, const Unit& dy);
public: void setDx(const DbU::Unit& dx);
public: void setDy(const DbU::Unit& dy);
public: void setOffset(const DbU::Unit& dx, const DbU::Unit& dy);
// Others
// ******

View File

@ -77,10 +77,10 @@ namespace Hurricane {
);
// Accessors.
virtual BasicLayers getBasicLayers () const;
virtual Unit getEnclosure () const;
virtual Unit getEnclosure ( const BasicLayer* layer ) const;
virtual DbU::Unit getEnclosure () const;
virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const;
// Updators.
virtual void setEnclosure ( const BasicLayer* layer, Unit enclosure );
virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure );
// Hurricane Managment.
virtual string _getTypeName () const;
virtual string _getString () const;
@ -89,8 +89,8 @@ namespace Hurricane {
private:
// Internal: Attributes
vector<BasicLayer*> _basicLayers;
vector<Unit> _enclosures;
Unit _maximalEnclosure;
vector<DbU::Unit> _enclosures;
DbU::Unit _maximalEnclosure;
protected:
// Internal: Constructors & Destructors.

View File

@ -47,7 +47,7 @@ class DRCError : public Marker {
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
// Others
// ******

View File

@ -8,7 +8,7 @@
#define HURRICANE_DATA_BASE
#include "hurricane/DBo.h"
#include "hurricane/Unit.h"
#include "hurricane/DbU.h"
namespace Hurricane {

View File

@ -0,0 +1,99 @@
// -*- C++ -*-
//
// This file is part of the Hurricane Software.
// Copyright (c) BULL S.A. 2000-2004, 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 : Remy Escassut |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./DbU.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __HURRICANE_DBU__
# define __HURRICANE_DBU__
# include <cmath>
# include "hurricane/Commons.h"
namespace Hurricane {
class DbU {
public:
typedef long Unit;
public:
enum StringMode { Db = 1
, Real = 2
, Symbolic = 4
};
public:
// User to DB Converters.
static inline Unit db ( long value );
static inline Unit real ( double value );
static inline Unit lambda ( double value );
// Precision & Resolution Managment.
static unsigned int getPrecision ();
static unsigned int getMaximalPrecision ();
static double getResolution ();
static void setPrecision ( unsigned int precision );
// Lamba Managment.
static void setUnitsPerLambda ( double unitsPerLambda );
static double getUnitsPerLambda ();
// Grid Managment.
//static void setGridStep ( const Unit& gridStep );
//static const Unit getGridStep ();
//static Unit getOnGridUnit ( const DbU::Unit& unit, int s=0 );
//static bool isOnGrid ( const Unit& unit, int n=1 );
// Conversions.
static inline long getDb ( Unit u );
static inline double getReal ( Unit u );
static inline double getLambda ( Unit u );
static string getValueString ( Unit u );
inline void setStringMode ( unsigned int mode );
public:
// Static Attributes: constants.
static const Unit Min;
static const Unit Max;
private:
// Internal: Static Attributes.
static const unsigned int _maximalPrecision;
static unsigned int _precision;
static double _resolution;
static double _unitsPerLambda;
static unsigned int _stringMode;
};
// Inline Functions.
inline DbU::Unit DbU::db ( long value ) { return value; }
inline DbU::Unit DbU::real ( double value ) { return (long)rint( value/_resolution ); }
inline DbU::Unit DbU::lambda ( double value ) { return real(value*_unitsPerLambda); }
inline long DbU::getDb ( DbU::Unit u ) { return u; }
inline double DbU::getReal ( DbU::Unit u ) { return _resolution*(double)u; }
inline double DbU::getLambda ( DbU::Unit u ) { return getReal(u)/_unitsPerLambda; }
} // End of Hurricane namespace.
# endif // __HURRICANE_DBU__

View File

@ -75,13 +75,13 @@ namespace Hurricane {
);
// Accessors.
virtual BasicLayers getBasicLayers () const;
virtual Unit getExtentionCap () const;
virtual Unit getExtentionWidth () const;
virtual Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual Unit getExtentionWidth ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionCap () const;
virtual DbU::Unit getExtentionWidth () const;
virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const;
// Updators.
virtual void setExtentionCap ( const BasicLayer* layer, Unit cap );
virtual void setExtentionWidth ( const BasicLayer* layer, Unit width );
virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap );
virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width );
// Hurricane Managment.
virtual string _getTypeName () const;
virtual string _getString () const;
@ -90,10 +90,10 @@ namespace Hurricane {
private:
// Internal: Attributes
vector<BasicLayer*> _basicLayers;
vector<Unit> _extentionCaps;
vector<Unit> _extentionWidths;
Unit _maximalExtentionCap;
Unit _maximalExtentionWidth;
vector<DbU::Unit> _extentionCaps;
vector<DbU::Unit> _extentionWidths;
DbU::Unit _maximalExtentionCap;
DbU::Unit _maximalExtentionWidth;
protected:
// Internal: Constructors & Destructors.

View File

@ -63,7 +63,7 @@ class Go : public Entity {
public: virtual void invalidate(bool propagateFlag = true);
// implementation located on file UpdateSession.cpp to access local variables
public: virtual void translate(const Unit& dx, const Unit& dy) = 0;
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy) = 0;
// Others
// ******

View File

@ -31,42 +31,62 @@ class Horizontal : public Segment {
// Attributes
// **********
private: Unit _y;
private: Unit _dxSource;
private: Unit _dxTarget;
private: DbU::Unit _y;
private: DbU::Unit _dxSource;
private: DbU::Unit _dxTarget;
// Constructors
// ************
protected: Horizontal(Net* net, Component* source, Component* target, const Layer* layer, const Unit& y, const Unit& width = 0, const Unit& dxSource = 0, const Unit& dxTarget = 0);
public: static Horizontal* create(Net* net, const Layer* layer, const Unit& y, const Unit& width = 0, const Unit& dxSource = 0, const Unit& dxTarget = 0);
public: static Horizontal* create(Component* source, Component* target, const Layer* layer, const Unit& y, const Unit& width = 0, const Unit& dxSource = 0, const Unit& dxTarget = 0);
protected: Horizontal ( Net* net
, 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
);
public: static Horizontal* create ( Net* net
, const Layer* layer
, const DbU::Unit& y
, const DbU::Unit& width = 0
, const DbU::Unit& dxSource = 0
, const DbU::Unit& dxTarget = 0
);
public: static 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
);
// Accessors
// *********
public: virtual Unit getY() const {return _y;};
public: virtual DbU::Unit getY() const {return _y;};
public: virtual Point getCenter() const;
public: virtual Box getBoundingBox() const;
public: virtual Box getBoundingBox(const BasicLayer* basicLayer) const;
public: virtual Unit getSourceX() const;
public: virtual Unit getSourceY() const {return getY();};
public: virtual Unit getTargetX() const;
public: virtual Unit getTargetY() const {return getY();};
public: virtual Unit getLength() const;
public: const Unit& getDxSource() const {return _dxSource;};
public: const Unit& getDxTarget() const {return _dxTarget;};
public: virtual DbU::Unit getSourceX() const;
public: virtual DbU::Unit getSourceY() const {return getY();};
public: virtual DbU::Unit getTargetX() const;
public: virtual DbU::Unit getTargetY() const {return getY();};
public: virtual DbU::Unit getLength() const;
public: const DbU::Unit& getDxSource() const {return _dxSource;};
public: const DbU::Unit& getDxTarget() const {return _dxTarget;};
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: void setY(const Unit& y);
public: void setDxSource(const Unit& dxSource);
public: void setDxTarget(const Unit& dxSource);
public: void translate(const Unit& dy);
public: void setY(const DbU::Unit& y);
public: void setDxSource(const DbU::Unit& dxSource);
public: void setDxTarget(const DbU::Unit& dxSource);
public: void translate(const DbU::Unit& dy);
// Others
// ******

View File

@ -142,7 +142,7 @@ class Instance : public Go {
public: virtual void materialize();
public: virtual void unmaterialize();
public: virtual void invalidate(bool propagateFlag = true);
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: void setName(const Name& name);
public: void setTransformation(const Transformation& transformation);

View File

@ -7,7 +7,7 @@
#ifndef HURRICANE_INTERVAL
#define HURRICANE_INTERVAL
#include "hurricane/Unit.h"
#include "hurricane/DbU.h"
namespace Hurricane {
@ -23,15 +23,15 @@ class Interval {
// Attributes
// **********
private: Unit _vMin;
private: Unit _vMax;
private: DbU::Unit _vMin;
private: DbU::Unit _vMax;
// Constructors
// ************
public: Interval(bool makeEmpty=true);
public: Interval(const Unit& v);
public: Interval(const Unit& v1, const Unit& v2);
public: Interval(const DbU::Unit& v);
public: Interval(const DbU::Unit& v1, const DbU::Unit& v2);
public: Interval(const Interval& interval);
// Operators
@ -45,13 +45,13 @@ class Interval {
// Accessors
// *********
public: const Unit& getVMin() const {return _vMin;};
public: const Unit& getVMax() const {return _vMax;};
public: Unit& getVMin() {return _vMin;};
public: Unit& getVMax() {return _vMax;};
public: Unit getCenter() const {return ((_vMin + _vMax) / 2);};
public: Unit getSize() const {return (_vMax - _vMin);};
public: Unit getHalfSize() const {return (getSize() / 2);};
public: const DbU::Unit& getVMin() const {return _vMin;};
public: const DbU::Unit& getVMax() const {return _vMax;};
public: DbU::Unit& getVMin() {return _vMin;};
public: DbU::Unit& getVMax() {return _vMax;};
public: DbU::Unit getCenter() const {return ((_vMin + _vMax) / 2);};
public: DbU::Unit getSize() const {return (_vMax - _vMin);};
public: DbU::Unit getHalfSize() const {return (getSize() / 2);};
public: Interval getUnion(const Interval& interval) const;
public: Interval getIntersection(const Interval& interval) const;
@ -60,7 +60,7 @@ class Interval {
public: bool isEmpty() const;
public: bool isPonctual() const;
public: bool contains(const Unit& v) const;
public: bool contains(const DbU::Unit& v) const;
public: bool contains(const Interval& interval) const;
public: bool intersect(const Interval& interval) const;
public: bool inferior(const Interval& interval, bool strict=true) const;
@ -71,13 +71,13 @@ class Interval {
// ********
public: Interval& makeEmpty();
public: Interval& inflate(const Unit& dv);
public: Interval& inflate(const Unit& dvMin, const Unit& dvMax);
public: Interval& merge(const Unit& v);
public: Interval& inflate(const DbU::Unit& dv);
public: Interval& inflate(const DbU::Unit& dvMin, const DbU::Unit& dvMax);
public: Interval& merge(const DbU::Unit& v);
public: Interval& merge(const Interval& interval);
public: Interval& intersection(const Unit& vMin, const Unit& vMax);
public: Interval& intersection(const DbU::Unit& vMin, const DbU::Unit& vMax);
public: Interval& intersection(const Interval& interval);
public: Interval& translate(const Unit& dv);
public: Interval& translate(const DbU::Unit& dv);
// Others
// ******

View File

@ -29,7 +29,7 @@
# include "hurricane/DBo.h"
# include "hurricane/Layers.h"
# include "hurricane/Unit.h"
# include "hurricane/DbU.h"
# include "hurricane/BasicLayers.h"
@ -49,29 +49,29 @@ namespace Hurricane {
inline const Name& getName () const;
inline const Mask& getMask () const;
inline const Mask& getExtractMask () const;
inline const Unit& getMinimalSize () const;
inline const Unit& getMinimalSpacing () const;
inline Unit getPitch () 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 Layer* getObstructionLayer () const;
virtual Unit getEnclosure () const;
virtual Unit getExtentionCap () const;
virtual Unit getExtentionWidth () const;
virtual Unit getEnclosure ( const BasicLayer* layer ) const;
virtual Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual Unit getExtentionWidth ( const BasicLayer* layer ) const;
virtual DbU::Unit getEnclosure () const;
virtual DbU::Unit getExtentionCap () const;
virtual DbU::Unit getExtentionWidth () const;
virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const;
// Predicates
bool contains ( const Layer* layer ) const;
bool intersect ( const Layer* layer ) const;
// Updators
void setName ( const Name& name );
void setMinimalSize ( const Unit& minimalSize );
void setMinimalSpacing ( const Unit& minimalSpacing );
void setPitch ( const Unit& pitch );
virtual void setEnclosure ( const BasicLayer* layer, Unit );
virtual void setExtentionCap ( const BasicLayer* layer, Unit );
virtual void setExtentionWidth ( const BasicLayer* layer, Unit );
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 );
// Hurricane Managment.
virtual string _getString () const;
virtual Record* _getRecord () const;
@ -87,18 +87,18 @@ namespace Hurricane {
Name _name;
Mask _mask;
Mask _extractMask;
Unit _minimalSize;
Unit _minimalSpacing;
Unit _pitch;
DbU::Unit _minimalSize;
DbU::Unit _minimalSpacing;
DbU::Unit _pitch;
Layer* _nextOfTechnologyLayerMap;
protected:
// Internal: Constructors & Destructors.
Layer ( Technology* technology
, const Name& name
, const Unit& minimalSize = 0
, const Unit& minimalSpacing = 0
, const Unit& pitch = 0
, const DbU::Unit& minimalSize = 0
, const DbU::Unit& minimalSpacing = 0
, const DbU::Unit& pitch = 0
);
virtual void _postCreate ();
virtual void _preDestroy ();
@ -110,9 +110,9 @@ namespace Hurricane {
inline const Name& Layer::getName () const { return _name; }
inline const Layer::Mask& Layer::getMask () const { return _mask; }
inline const Layer::Mask& Layer::getExtractMask () const { return _extractMask; }
inline const Unit& Layer::getMinimalSize () const { return _minimalSize; }
inline const Unit& Layer::getMinimalSpacing () const { return _minimalSpacing; }
inline Unit Layer::getPitch () const { return (_pitch==0?(_minimalSize + _minimalSpacing):_pitch); }
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 Layer* Layer::_getNextOfTechnologyLayerMap () const { return _nextOfTechnologyLayerMap; }
inline void Layer::_setMask ( const Mask& mask ) { _mask = mask; }
inline void Layer::_setExtractMask ( const Mask& extractMask ) { _extractMask = extractMask; }

View File

@ -143,8 +143,8 @@ class Net : public Entity {
public: const Type& getType() const {return _type;};
public: const Direction& getDirection() const {return _direction;};
public: const Point& getPosition() const {return _position;};
public: const Unit& getX() const {return _position.getX();};
public: const Unit& getY() const {return _position.getY();};
public: const DbU::Unit& getX() const {return _position.getX();};
public: const DbU::Unit& getY() const {return _position.getY();};
public: Components getComponents() const {return _componentSet.getElements();};
public: Rubbers getRubbers() const {return _rubberSet.getElements();};
public: RoutingPads getRoutingPads() const;

View File

@ -44,8 +44,8 @@ class Pad : public Component {
// Accessors
// *********
public: virtual Unit getX() const;
public: virtual Unit getY() const;
public: virtual DbU::Unit getX() const;
public: virtual DbU::Unit getY() const;
public: virtual Box getBoundingBox() const;
public: virtual Box getBoundingBox(const BasicLayer* basicLayer) const;
public: virtual const Layer* getLayer() const {return _layer;};
@ -53,7 +53,7 @@ class Pad : public Component {
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: void setBoundingBox(const Box& boundingBox);
// Others

View File

@ -85,9 +85,26 @@ class Pin : public Contact {
// Constructors
// ************
protected: Pin(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const Unit& x, const Unit& y, const Unit& width = 0, const Unit& height = 0);
public: static Pin* create(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const Unit& x, const Unit& y, const Unit& width = 0, const Unit& height = 0);
protected: Pin( Net* net
, const Name& name
, const AccessDirection& accessDirection
, const PlacementStatus& placementStatus
, const Layer* layer
, const DbU::Unit& x
, const DbU::Unit& y
, const DbU::Unit& width = 0
, const DbU::Unit& height = 0
);
public: static Pin* create( Net* net
, const Name& name
, const AccessDirection& accessDirection
, const PlacementStatus& placementStatus
, const Layer* layer
, const DbU::Unit& x
, const DbU::Unit& y
, const DbU::Unit& width = 0
, const DbU::Unit& height = 0
);
// Accessors
// *********

View File

@ -50,8 +50,8 @@ class Plug : public Component {
// *********
public: virtual Cell* getCell() const;
public: virtual Unit getX() const;
public: virtual Unit getY() const;
public: virtual DbU::Unit getX() const;
public: virtual DbU::Unit getY() const;
public: virtual Point getPosition() const;
public: virtual Box getBoundingBox() const;
public: virtual const Layer* getLayer() const {return NULL;};
@ -73,7 +73,7 @@ class Plug : public Component {
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy) {};
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy) {};
public: void setNet(Net* net);

View File

@ -7,7 +7,7 @@
#ifndef HURRICANE_POINT
#define HURRICANE_POINT
#include "hurricane/Unit.h"
#include "hurricane/DbU.h"
namespace Hurricane {
@ -23,15 +23,15 @@ class Point {
// Attributes
// **********
private: Unit _x;
private: Unit _y;
private: DbU::Unit _x;
private: DbU::Unit _y;
// Constructors
// ************
public: Point();
public: Point(const Unit& x, const Unit& y);
public: Point(const DbU::Unit& x, const DbU::Unit& y);
public: Point(const Point& point);
@ -51,18 +51,18 @@ class Point {
// Accessors
// *********
public: const Unit& getX() const {return _x;};
public: const Unit& getY() const {return _y;};
public: Unit manhattanDistance(const Point pt) const
public: const DbU::Unit& getX() const {return _x;};
public: const DbU::Unit& getY() const {return _y;};
public: DbU::Unit manhattanDistance(const Point pt) const
{ return abs(_x - pt.getX()) + abs(_y - pt.getY()); }
// Updators
// ********
public: void setX(const Unit& x) {_x = x;};
public: void setY(const Unit& y) {_y = y;};
public: Point& translate(const Unit& dx, const Unit& dy);
public: Point getTranslated(const Unit& dx, const Unit& dy) const;
public: void setX(const DbU::Unit& x) {_x = x;};
public: void setY(const DbU::Unit& y) {_y = y;};
public: Point& translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: Point getTranslated(const DbU::Unit& dx, const DbU::Unit& dy) const;
// Others
// ******

View File

@ -40,8 +40,8 @@ class QuadTree {
// **********
private: QuadTree* _parent;
private: Unit _x;
private: Unit _y;
private: DbU::Unit _x;
private: DbU::Unit _y;
private: Box _boundingBox;
private: unsigned _size;
private: GoSet _goSet;

View File

@ -31,14 +31,14 @@ class Reference : public Marker {
public: Name _name;
public: Point _point;
public: static Unit _extend;
public: static DbU::Unit _extend;
// Constructors
// ************
protected: Reference(Cell* cell, const Name& name, Unit x, Unit y);
protected: Reference(Cell* cell, const Name& name, DbU::Unit x, DbU::Unit y);
public: static Reference* create(Cell* cell, const Name& name, Unit x, Unit y );
public: static Reference* create(Cell* cell, const Name& name, DbU::Unit x, DbU::Unit y );
public: static Reference* create(Cell* cell, const Name& name, const Point& point );
// Accessors
@ -51,7 +51,7 @@ class Reference : public Marker {
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
// Others
// ******

View File

@ -58,7 +58,7 @@ class Region {
private: Region* _region;
private: Type _type;
private: Unit _position;
private: DbU::Unit _position;
private: Interval _extention;
private: Tile* _baseTile;
@ -67,7 +67,7 @@ class Region {
public: SwapLine();
public: SwapLine(Region* region, const Type& type, const Interval& extention = Interval());
public: SwapLine(Region* region, const Type& type, const Unit& position, const Interval& extention = Interval());
public: SwapLine(Region* region, const Type& type, const DbU::Unit& position, const Interval& extention = Interval());
public: SwapLine(const SwapLine& swapLine);
// Destructor
@ -85,7 +85,7 @@ class Region {
public: Region* getRegion() const {return _region;};
public: Type getType() const {return _type;};
public: const Unit& getPosition() const {return _position;};
public: const DbU::Unit& getPosition() const {return _position;};
public: const Interval& getExtention() const {return _extention;};
public: Intervals getIntervals() const;
@ -99,8 +99,8 @@ class Region {
// ********
public: void progress(int n = 1);
public: void translate(const Unit& quantity);
public: void setPosition(const Unit& position);
public: void translate(const DbU::Unit& quantity);
public: void setPosition(const DbU::Unit& position);
// Others
// ******
@ -140,10 +140,10 @@ class Region {
public: Box getBoundingBox() const;
public: Unit getXMin() const;
public: Unit getYMin() const;
public: Unit getXMax() const;
public: Unit getYMax() const;
public: DbU::Unit getXMin() const;
public: DbU::Unit getYMin() const;
public: DbU::Unit getXMax() const;
public: DbU::Unit getYMax() const;
public: Boxes getBoxes() const;
public: Boxes getBoxesUnder(const Box& area) const;
@ -152,10 +152,10 @@ class Region {
public: Boxes getVoidBoxesUnder(const Box& area) const;
public: SwapLine getVerticalSwapLine(const Interval& extention = Interval()) const;
public: SwapLine getVerticalSwapLine(const Unit& x, const Interval& extention = Interval()) const;
public: SwapLine getVerticalSwapLine(const DbU::Unit& x, const Interval& extention = Interval()) const;
public: SwapLine getHorizontalSwapLine(const Interval& extention = Interval()) const;
public: SwapLine getHorizontalSwapLine(const Unit& y, const Interval& extention = Interval()) const;
public: SwapLine getHorizontalSwapLine(const DbU::Unit& y, const Interval& extention = Interval()) const;
// Predicates
// **********
@ -183,8 +183,8 @@ class Region {
public: Region& groove(const Region& region);
public: Region& getIntersection(const Region& region);
public: Region& Inflate(const Unit& quantity);
public: Region& translate(const Unit& dx, const Unit& dy);
public: Region& Inflate(const DbU::Unit& quantity);
public: Region& translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: bool verticalEnhancement();
public: bool verticalEnhancement(Point point);

View File

@ -72,17 +72,17 @@ namespace Hurricane {
// Accessors.
virtual BasicLayers getBasicLayers () const;
inline BasicLayer* getBasicLayer () const;
virtual Unit getEnclosure () const;
virtual Unit getExtentionCap () const;
virtual Unit getExtentionWidth () const;
virtual Unit getEnclosure ( const BasicLayer* layer ) const;
virtual Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual Unit getExtentionWidth ( const BasicLayer* layer ) const;
virtual DbU::Unit getEnclosure () const;
virtual DbU::Unit getExtentionCap () const;
virtual DbU::Unit getExtentionWidth () const;
virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const;
// Updators
void setBasicLayer ( BasicLayer* layer );
virtual void setEnclosure ( const BasicLayer* layer, Unit enclosure );
virtual void setExtentionCap ( const BasicLayer* layer, Unit cap );
virtual void setExtentionWidth ( const BasicLayer* layer, Unit width );
virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure );
virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap );
virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width );
// Hurricane Managment.
virtual string _getTypeName () const;
virtual string _getString () const;
@ -91,9 +91,9 @@ namespace Hurricane {
private:
// Internal: Attributes
BasicLayer* _basicLayer;
Unit _enclosure;
Unit _extentionCap;
Unit _extentionWidth;
DbU::Unit _enclosure;
DbU::Unit _extentionCap;
DbU::Unit _extentionWidth;
protected:
// Internal: Constructors & Destructors.

View File

@ -37,8 +37,8 @@ class RoutingPad : public Component {
// Attributes
// **********
private: Unit _x;
private: Unit _y;
private: DbU::Unit _x;
private: DbU::Unit _y;
private: Occurrence _occurrence;
@ -53,8 +53,8 @@ class RoutingPad : public Component {
// *********
//public: virtual Hooks getHooks() const;
public: virtual Unit getX() const;
public: virtual Unit getY() const;
public: virtual DbU::Unit getX() const;
public: virtual DbU::Unit getY() const;
public: virtual Box getBoundingBox() const;
public: virtual const Layer* getLayer() const;
public: virtual Box getBoundingBox(const BasicLayer* basicLayer) const;
@ -63,21 +63,21 @@ class RoutingPad : public Component {
public: Occurrence getPlugOccurrence();
public: Point getSourcePosition() const;
public: Point getTargetPosition() const;
public: Unit getSourceX() const;
public: Unit getSourceY() const;
public: Unit getTargetX() const;
public: Unit getTargetY() const;
public: DbU::Unit getSourceX() const;
public: DbU::Unit getSourceY() const;
public: DbU::Unit getTargetX() const;
public: DbU::Unit getTargetY() const;
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: void setX(const Unit& x);
public: void setY(const Unit& y);
public: void setPosition(const Unit& x, const Unit& y);
public: void setX(const DbU::Unit& x);
public: void setY(const DbU::Unit& y);
public: void setPosition(const DbU::Unit& x, const DbU::Unit& y);
public: void setPosition(const Point& position);
public: void setOffset(const Unit& x, const Unit& y);
public: void setOffset(const DbU::Unit& x, const DbU::Unit& y);
public: void setExternalComponent(Component* component);
public: void restorePlugOccurrence();

View File

@ -66,7 +66,7 @@ class Rubber : public Go {
public: virtual void materialize();
public: virtual void unmaterialize();
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: virtual void invalidate(bool propagateFlag = true);
// Others

View File

@ -66,19 +66,24 @@ class Segment : public Component {
private: SourceHook _sourceHook;
private: TargetHook _targetHook;
private: const Layer* _layer;
private: Unit _width;
private: DbU::Unit _width;
// Constructors
// ************
protected: Segment(Net* net, Component* source, Component* target, const Layer* layer, const Unit& width = 0);
protected: Segment ( Net* net
, Component* source
, Component* target
, const Layer* layer
, const DbU::Unit& width = 0
);
// Accessors
// *********
public: virtual Hooks getHooks() const;
public: virtual Unit getX() const {return 0;};
public: virtual Unit getY() const {return 0;};
public: virtual DbU::Unit getX() const {return 0;};
public: virtual DbU::Unit getY() const {return 0;};
public: virtual const Layer* getLayer() const {return _layer;};
public: Hook* getSourceHook() {return &_sourceHook;};
public: Hook* getTargetHook() {return &_targetHook;};
@ -87,21 +92,21 @@ class Segment : public Component {
public: Component* getTarget() const;
public: Components getAnchors() const;
public: Component* getOppositeAnchor(Component* anchor) const;
public: const Unit& getWidth() const {return _width;};
public: Unit getHalfWidth() const {return (_width / 2);};
public: virtual Unit getSourceX() const = 0;
public: virtual Unit getSourceY() const = 0;
public: const DbU::Unit& getWidth() const {return _width;};
public: DbU::Unit getHalfWidth() const {return (_width / 2);};
public: virtual DbU::Unit getSourceX() const = 0;
public: virtual DbU::Unit getSourceY() const = 0;
public: virtual Point getSourcePosition() const;
public: virtual Unit getTargetX() const = 0;
public: virtual Unit getTargetY() const = 0;
public: virtual DbU::Unit getTargetX() const = 0;
public: virtual DbU::Unit getTargetY() const = 0;
public: virtual Point getTargetPosition() const;
public: virtual Unit getLength() const = 0;
public: virtual DbU::Unit getLength() const = 0;
// Updators
// ********
public: void setLayer(const Layer* layer);
public: void setWidth(const Unit& width);
public: void setWidth(const DbU::Unit& width);
public: void invert();
// Others

View File

@ -47,8 +47,8 @@ class Transformation {
// Attributes
// **********
private: Unit _tx;
private: Unit _ty;
private: DbU::Unit _tx;
private: DbU::Unit _ty;
private: Orientation _orientation;
// Constructors
@ -56,7 +56,7 @@ class Transformation {
public: Transformation();
public: Transformation(const Unit& tx, const Unit& ty, const Orientation& orientation = Orientation::ID);
public: Transformation(const DbU::Unit& tx, const DbU::Unit& ty, const Orientation& orientation = Orientation::ID);
public: Transformation(const Point& translation, const Orientation& orientation = Orientation::ID);
public: Transformation(const Transformation& transformation);
@ -72,24 +72,24 @@ class Transformation {
// Accessors
// *********
public: const Unit& getTx() const {return _tx;};
public: const Unit& getTy() const {return _ty;};
public: const DbU::Unit& getTx() const {return _tx;};
public: const DbU::Unit& getTy() const {return _ty;};
public: Point getTranslation() const {return Point(_tx, _ty);};
public: const Orientation& getOrientation() const {return _orientation;};
public: Unit getX(const Unit& x, const Unit& y) const;
public: Unit getY(const Unit& x, const Unit& y) const;
public: DbU::Unit getX(const DbU::Unit& x, const DbU::Unit& y) const;
public: DbU::Unit getY(const DbU::Unit& x, const DbU::Unit& y) const;
public: Unit getX(const Point& point) const;
public: Unit getY(const Point& point) const;
public: DbU::Unit getX(const Point& point) const;
public: DbU::Unit getY(const Point& point) const;
public: Unit getDx(const Unit& dx, const Unit& dy) const;
public: Unit getDy(const Unit& dx, const Unit& dy) const;
public: DbU::Unit getDx(const DbU::Unit& dx, const DbU::Unit& dy) const;
public: DbU::Unit getDy(const DbU::Unit& dx, const DbU::Unit& dy) const;
public: Point getPoint(const Unit& x, const Unit& y) const;
public: Point getPoint(const DbU::Unit& x, const DbU::Unit& y) const;
public: Point getPoint(const Point& point) const;
public: Box getBox(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2) const;
public: Box getBox(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2) const;
public: Box getBox(const Point& point1, const Point& point2) const;
public: Box getBox(const Box& box) const;
@ -111,7 +111,7 @@ class Transformation {
// Manipulators
// ************
public: void applyOn(Unit& x, Unit& y) const;
public: void applyOn(DbU::Unit& x, DbU::Unit& y) const;
public: void applyOn(Point& point) const;
public: void applyOn(Box& box) const;
public: void applyOn(Transformation& transformation) const;

View File

@ -77,13 +77,13 @@ namespace Hurricane {
);
// Accessors.
virtual BasicLayers getBasicLayers () const;
virtual Unit getExtentionCap () const;
virtual Unit getExtentionWidth () const;
virtual Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual Unit getExtentionWidth ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionCap () const;
virtual DbU::Unit getExtentionWidth () const;
virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const;
// Updators.
virtual void setExtentionCap ( const BasicLayer* layer, Unit cap );
virtual void setExtentionWidth ( const BasicLayer* layer, Unit width );
virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap );
virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width );
// Hurricane Managment.
virtual string _getTypeName () const;
virtual string _getString () const;
@ -92,10 +92,10 @@ namespace Hurricane {
private:
// Internal: Attributes
vector<BasicLayer*> _basicLayers;
vector<Unit> _extentionCaps;
vector<Unit> _extentionWidths;
Unit _maximalExtentionCap;
Unit _maximalExtentionWidth;
vector<DbU::Unit> _extentionCaps;
vector<DbU::Unit> _extentionWidths;
DbU::Unit _maximalExtentionCap;
DbU::Unit _maximalExtentionWidth;
protected:
// Internal: Constructors & Destructors.

View File

@ -1,106 +0,0 @@
// ****************************************************************************************************
// File: Unit.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_UNIT
#define HURRICANE_UNIT
#include "hurricane/Commons.h"
namespace Hurricane {
// ****************************************************************************************************
// Unit declaration
// ****************************************************************************************************
typedef long Unit;
# define UNIT_MAX LONG_MAX
# define UNIT_MIN LONG_MIN
// ****************************************************************************************************
// Precision managers (precision defines the maximal number of decimals allowed)
// ****************************************************************************************************
unsigned getPrecision();
unsigned getMaximalPrecisionAllowed();
void setPrecision(unsigned precision);
// Should be called only once at the beginning of the program
// ****************************************************************************************************
// Resolution managers (the value associate to the unit 1)
// ****************************************************************************************************
double getResolution();
// ****************************************************************************************************
// Grid managers
// ****************************************************************************************************
const Unit& getGridStep();
void setGridStep(const Unit& gridStep);
bool isOnGrid(const Unit& unit, int n = 1);
Unit getOnGridUnit(const Unit& unit, int s = 0);
// ****************************************************************************************************
// Others
// ****************************************************************************************************
Unit getUnit(double value);
double getValue(const Unit& unit);
string getValueString(const Unit& unit);
// -------------------------------------------------------------------
// Class : "Proxy...<const Unit*>".
/* template<> */
/* inline string ProxyTypeName<Unit> ( const Unit* object ) */
/* { return "<PointerSlotAdapter<Unit>>"; } */
/* template<> */
/* inline string ProxyString<Unit> ( const Unit* object ) */
/* { return getValueString(); } */
/* template<> */
/* inline Record* ProxyRecord<Unit> ( const Unit* object ) */
/* { */
/* Record* record = new Record(getString(object)); */
/* record->Add(getSlot("Unit", (unsigned int*)_object)); */
/* return record; */
/* } */
} // End of Hurricane namespace.
bool Scan(const string& s, Hurricane::Unit& unit);
#endif // HURRICANE_UNIT
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -31,42 +31,63 @@ class Vertical : public Segment {
// Attributes
// **********
private: Unit _x;
private: Unit _dySource;
private: Unit _dyTarget;
private: DbU::Unit _x;
private: DbU::Unit _dySource;
private: DbU::Unit _dyTarget;
// Constructors
// ************
protected: Vertical(Net* net, Component* source, Component* target, const Layer* layer, const Unit& x, const Unit& width = 0, const Unit& dySource = 0, const Unit& dyTarget = 0);
protected: Vertical ( Net* net
, 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
);
public: static Vertical* create(Net* net, const Layer* layer, const Unit& x, const Unit& width = 0, const Unit& dySource = 0, const Unit& dyTarget = 0);
public: static Vertical* create(Component* source, Component* target, const Layer* layer, const Unit& x, const Unit& width = 0, const Unit& dySource = 0, const Unit& dyTarget = 0);
public: static Vertical* create ( Net* net
, const Layer* layer
, const DbU::Unit& x
, const DbU::Unit& width = 0
, const DbU::Unit& dySource = 0
, const DbU::Unit& dyTarget = 0
);
public: static 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
);
// Accessors
// *********
public: virtual Unit getX() const {return _x;};
public: virtual DbU::Unit getX() const {return _x;};
public: virtual Point getCenter() const;
public: virtual Box getBoundingBox() const;
public: virtual Box getBoundingBox(const BasicLayer* basicLayer) const;
public: virtual Unit getSourceX() const {return getX();};
public: virtual Unit getSourceY() const;
public: virtual Unit getTargetX() const {return getX();};
public: virtual Unit getTargetY() const;
public: virtual Unit getLength() const;
public: const Unit& getDySource() const {return _dySource;};
public: const Unit& getDyTarget() const {return _dyTarget;};
public: virtual DbU::Unit getSourceX() const {return getX();};
public: virtual DbU::Unit getSourceY() const;
public: virtual DbU::Unit getTargetX() const {return getX();};
public: virtual DbU::Unit getTargetY() const;
public: virtual DbU::Unit getLength() const;
public: const DbU::Unit& getDySource() const {return _dySource;};
public: const DbU::Unit& getDyTarget() const {return _dyTarget;};
// Updators
// ********
public: virtual void translate(const Unit& dx, const Unit& dy);
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy);
public: void setX(const Unit& x);
public: void setDySource(const Unit& dySource);
public: void setDyTarget(const Unit& dyTarget);
public: void translate(const Unit& dx);
public: void setX(const DbU::Unit& x);
public: void setDySource(const DbU::Unit& dySource);
public: void setDyTarget(const DbU::Unit& dyTarget);
public: void translate(const DbU::Unit& dx);
// Others
// ******

View File

@ -76,10 +76,10 @@ namespace Hurricane {
);
// Accessors.
virtual BasicLayers getBasicLayers () const;
virtual Unit getEnclosure () const;
virtual Unit getEnclosure ( const BasicLayer* layer ) const;
virtual DbU::Unit getEnclosure () const;
virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const;
// Updators.
virtual void setEnclosure ( const BasicLayer* layer, Unit enclosure );
virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure );
// Hurricane Managment.
virtual string _getTypeName () const;
virtual string _getString () const;
@ -88,8 +88,8 @@ namespace Hurricane {
private:
// Internal: Attributes
vector<BasicLayer*> _basicLayers;
vector<Unit> _enclosures;
Unit _maximalEnclosure;
vector<DbU::Unit> _enclosures;
DbU::Unit _maximalEnclosure;
protected:
// Internal: Constructors & Destructors.

View File

@ -164,7 +164,8 @@ void CellWidget::drawBoundaries ( const Instance* instance
bool CellWidget::isDrawable ( PaletteEntry* entry )
{
return entry->isChecked() && ( Graphics::getThreshold(entry->getName()) < _scale*100 );
return entry->isChecked()
&& ( Graphics::getThreshold(entry->getName())/DbU::lambda(1.0) < _scale );
}
@ -333,10 +334,10 @@ void CellWidget::screenReframe ()
_offsetVA.rx() = _stripWidth;
_offsetVA.ry() = _stripWidth;
Unit xmin = (Unit)( _visibleArea.getXMin() - ((float)_offsetVA.x()/_scale) );
Unit xmax = (Unit)( xmin + ((float)_drawingBuffer.width()/_scale) ) ;
Unit ymax = (Unit)( _visibleArea.getYMax() + ((float)_offsetVA.y()/_scale) );
Unit ymin = (Unit)( ymax - ((float)_drawingBuffer.height()/_scale) ) ;
DbU::Unit xmin = (DbU::Unit)( _visibleArea.getXMin() - ((float)_offsetVA.x()/_scale) );
DbU::Unit xmax = (DbU::Unit)( xmin + ((float)_drawingBuffer.width()/_scale) ) ;
DbU::Unit ymax = (DbU::Unit)( _visibleArea.getYMax() + ((float)_offsetVA.y()/_scale) );
DbU::Unit ymin = (DbU::Unit)( ymax - ((float)_drawingBuffer.height()/_scale) ) ;
_displayArea = Box ( xmin, ymin, xmax, ymax );
@ -351,10 +352,10 @@ void CellWidget::setScale ( float scale )
Point center = _visibleArea.getCenter();
_visibleArea.makeEmpty ();
_visibleArea.merge ( (Unit)( center.getX() - width () / (_scale*2) )
, (Unit)( center.getY() - height() / (_scale*2) )
, (Unit)( center.getX() + width () / (_scale*2) )
, (Unit)( center.getY() + height() / (_scale*2) )
_visibleArea.merge ( (DbU::Unit)( center.getX() - width () / (_scale*2) )
, (DbU::Unit)( center.getY() - height() / (_scale*2) )
, (DbU::Unit)( center.getX() + width () / (_scale*2) )
, (DbU::Unit)( center.getY() + height() / (_scale*2) )
);
//cerr << "_visibleArea: " << _visibleArea << " (offset: " << _offsetVA.x() << ")" << endl;
@ -376,17 +377,15 @@ void CellWidget::reframe ( const Box& box )
float scaleY = height / (float)box.getHeight();
_scale = min ( scaleX, scaleY );
//cerr << " _scale := " << _scale << endl;
Point center = box.getCenter();
width /= 2;
height /= 2;
_visibleArea = Box ( (Unit)( center.getX() - width / _scale )
, (Unit)( center.getY() - height / _scale )
, (Unit)( center.getX() + width / _scale )
, (Unit)( center.getY() + height / _scale )
_visibleArea = Box ( (DbU::Unit)( center.getX() - width / _scale )
, (DbU::Unit)( center.getY() - height / _scale )
, (DbU::Unit)( center.getX() + width / _scale )
, (DbU::Unit)( center.getY() + height / _scale )
);
screenReframe ();
@ -406,8 +405,8 @@ void CellWidget::shiftLeft ( int dx )
int leftShift = ( 1 + ( dx - _offsetVA.rx() ) / _stripWidth ) * _stripWidth;
_displayArea.translate ( - (Unit)( leftShift / _scale ) , 0 );
_visibleArea.translate ( - (Unit)( leftShift / _scale ) , 0 );
_displayArea.translate ( - (DbU::Unit)( leftShift / _scale ) , 0 );
_visibleArea.translate ( - (DbU::Unit)( leftShift / _scale ) , 0 );
_offsetVA.rx() -= dx - leftShift;
if ( leftShift >= _drawingBuffer.width() ) {
@ -436,8 +435,8 @@ void CellWidget::shiftRight ( int dx )
int rightShift = ( ( _offsetVA.rx() + dx ) / _stripWidth ) * _stripWidth;
_displayArea.translate ( (Unit)( rightShift / _scale ) , 0 );
_visibleArea.translate ( (Unit)( rightShift / _scale ) , 0 );
_displayArea.translate ( (DbU::Unit)( rightShift / _scale ) , 0 );
_visibleArea.translate ( (DbU::Unit)( rightShift / _scale ) , 0 );
_offsetVA.rx() += dx - rightShift;
//cerr << " _displayArea: " << _displayArea << endl;
@ -468,8 +467,8 @@ void CellWidget::shiftUp ( int dy )
int upShift = ( 1 + ( dy - _offsetVA.ry() ) / _stripWidth ) * _stripWidth;
_displayArea.translate ( 0, (Unit)( upShift / _scale ) );
_visibleArea.translate ( 0, (Unit)( upShift / _scale ) );
_displayArea.translate ( 0, (DbU::Unit)( upShift / _scale ) );
_visibleArea.translate ( 0, (DbU::Unit)( upShift / _scale ) );
_offsetVA.ry() -= dy - upShift;
if ( upShift >= _drawingBuffer.height() ) {
@ -498,8 +497,8 @@ void CellWidget::shiftDown ( int dy )
int downShift = ( ( _offsetVA.ry() + dy ) / _stripWidth ) * _stripWidth;
_displayArea.translate ( 0, - (Unit)( downShift / _scale ) );
_visibleArea.translate ( 0, - (Unit)( downShift / _scale ) );
_displayArea.translate ( 0, - (DbU::Unit)( downShift / _scale ) );
_visibleArea.translate ( 0, - (DbU::Unit)( downShift / _scale ) );
_offsetVA.ry() += dy - downShift;
if ( downShift >= _drawingBuffer.height() ) {
@ -548,8 +547,8 @@ void CellWidget::resizeEvent ( QResizeEvent* )
//cerr << "New UA widget size: " << uaSize.width() << "x" << uaSize.height() << endl;
if ( uaDelta.width() || uaDelta.height() ) {
_displayArea.inflate ( 0, 0, (Unit)(uaDelta.width()/_scale), (Unit)(uaDelta.height()/_scale) );
_visibleArea.inflate ( 0, 0, (Unit)(uaDelta.width()/_scale), (Unit)(uaDelta.height()/_scale) );
_displayArea.inflate ( 0, 0, (DbU::Unit)(uaDelta.width()/_scale), (DbU::Unit)(uaDelta.height()/_scale) );
_visibleArea.inflate ( 0, 0, (DbU::Unit)(uaDelta.width()/_scale), (DbU::Unit)(uaDelta.height()/_scale) );
//cerr << "new " << _displayArea << endl;
//cerr << "Previous buffer size: " << _drawingBuffer.width () << "x"
@ -620,7 +619,7 @@ void CellWidget::mouseReleaseEvent ( QMouseEvent* event )
}
QPoint CellWidget::getScreenPoint ( Unit x, Unit y ) const
QPoint CellWidget::getScreenPoint ( DbU::Unit x, DbU::Unit y ) const
{
return QPoint ( getScreenX(x), getScreenY(y) );
}
@ -632,7 +631,7 @@ QPoint CellWidget::getScreenPoint ( const Point& point ) const
}
QRect CellWidget::getScreenRect ( Unit x1, Unit y1, Unit x2, Unit y2 ) const
QRect CellWidget::getScreenRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const
{
return QRect ( getScreenX(x1)
, getScreenY(y2)

View File

@ -104,16 +104,16 @@ namespace Hurricane {
// Geometric conversions.
public:
QRect getScreenRect ( Unit x1, Unit y1, Unit x2, Unit y2 ) const;
QRect getScreenRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
QRect getScreenRect ( const Box& box ) const;
QPoint getScreenPoint ( Unit x, Unit y ) const;
QPoint getScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
QPoint getScreenPoint ( const Point& point ) const;
inline int getScreenX ( Unit x ) const;
inline int getScreenY ( Unit y ) const;
inline int getScreenLength ( Unit length ) const;
inline Unit getX ( int x ) const;
inline Unit getY ( int y ) const;
inline Unit getLength ( int length ) const;
inline int getScreenX ( DbU::Unit x ) const;
inline int getScreenY ( DbU::Unit y ) const;
inline int getScreenLength ( DbU::Unit length ) const;
inline DbU::Unit getX ( int x ) const;
inline DbU::Unit getY ( int y ) const;
inline DbU::Unit getLength ( int length ) const;
inline Box getBox ( const QRect& rect ) const;
// Painter control & Hurricane objects drawing primitives.
@ -150,37 +150,37 @@ inline void CellWidget::redraw ()
}
inline int CellWidget::getScreenX ( Unit x ) const
inline int CellWidget::getScreenX ( DbU::Unit x ) const
{
return (int)rint ( (float)( x - _displayArea.getXMin() ) * _scale );
}
inline int CellWidget::getScreenY ( Unit y ) const
inline int CellWidget::getScreenY ( DbU::Unit y ) const
{
return (int)rint ( (float)( _displayArea.getYMax() - y ) * _scale );
}
inline int CellWidget::getScreenLength ( Unit length ) const
inline int CellWidget::getScreenLength ( DbU::Unit length ) const
{
return (int)rint ( (float)length * _scale );
}
inline Unit CellWidget::getX ( int x ) const
inline DbU::Unit CellWidget::getX ( int x ) const
{
return (Unit)(x/_scale) + _displayArea.getXMin();
return (DbU::Unit)(x/_scale) + _displayArea.getXMin();
}
inline Unit CellWidget::getY ( int y ) const
inline DbU::Unit CellWidget::getY ( int y ) const
{
return _displayArea.getYMax() - (Unit)(y/_scale);
return _displayArea.getYMax() - (DbU::Unit)(y/_scale);
}
inline Unit CellWidget::getLength ( int length ) const
inline DbU::Unit CellWidget::getLength ( int length ) const
{
return (int)( (float)length / _scale );
}

View File

@ -36,7 +36,7 @@
PySegmentLocator.cpp
PyTechnology.cpp
PyTransformation.cpp
PyUnit.cpp
PyDbU.cpp
PyUpdateSession.cpp
PyVertical.cpp
@ -74,7 +74,7 @@
hurricane/isobar/PySegmentLocator.h
hurricane/isobar/PyTechnology.h
hurricane/isobar/PyTransformation.h
hurricane/isobar/PyUnit.h
hurricane/isobar/PyDbU.h
hurricane/isobar/PyUpdateSession.h
hurricane/isobar/PyVertical.h
)

View File

@ -0,0 +1,221 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// 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
// | |
// | 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
#include "hurricane/isobar/PyDbU.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyDbU" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// 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 ) );
}
// ---------------------------------------------------------------
// Module Method : "PyDbU_real ()"
extern PyObject* PyDbU_real ( PyObject* module, PyObject* args )
{
trace << "PyDbU_real ()" << endl;
PyObject* arg0;
DbU::Unit result = 0;
HTRY
__cs.Init ( "DbU.real" );
if ( ! PyArg_ParseTuple(args,"|O&:DbU.real",Converter,&arg0) )
return ( NULL );
if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::real ( PyFloat_AsDouble ( arg0 ) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.real 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 {
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_getReal ()"
extern PyObject* PyDbU_getReal ( PyObject* module, PyObject* args )
{
trace << "PyDbU_getReal ()" << endl;
PyObject* arg0;
if ( ! ParseOneArg ( "Dbu.getReal", args,INT_ARG, &arg0 ) ) return ( NULL );
return ( Py_BuildValue("d",DbU::getReal(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_getResolution ()"
extern PyObject* PyDbU_getResolution ( PyObject* module )
{
trace << "PyDbU_getResolution ()" << endl;
return ( Py_BuildValue("d",DbU::getResolution()) );
}
#endif // End of Python Module Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -54,7 +54,7 @@
#include "hurricane/isobar/PyHurricane.h"
#include "hurricane/isobar/PyUpdateSession.h"
#include "hurricane/isobar/PyUnit.h"
#include "hurricane/isobar/PyDbU.h"
#include "hurricane/isobar/PyPoint.h"
#include "hurricane/isobar/PyBox.h"
#include "hurricane/isobar/PyTransformation.h"
@ -523,11 +523,15 @@ extern "C" {
// x-------------------------------------------------------------x
static PyMethodDef PyHurricane_Methods[] =
{ { "getUnit" , PyUnit_getUnit , METH_VARARGS, "Convert to Unit." }
, { "getValue" , PyUnit_getValue , METH_VARARGS, "Convert a Unit to a value." }
{ { "DbU_db" , PyDbU_db , METH_VARARGS, "Convert an integer to DbU::Unit (no scale factor)." }
, { "DbU_real" , PyDbU_real , METH_VARARGS, "Convert a real (founder grid) to DbU::Unit." }
, { "DbU_lambda" , PyDbU_lambda , METH_VARARGS, "Convert a symbolic (lambda) to DbU::Unit." }
, { "DbU_getDb" , PyDbU_getDb , METH_VARARGS, "Convert a DbU::Unit to an integer value (no scale factor)." }
, { "DbU_getReal" , PyDbU_getReal , METH_VARARGS, "Convert a DbU::Unit to a real value (to grid founder)." }
, { "DbU_getLambda" , PyDbU_getLambda , METH_VARARGS, "Convert a DbU::Unit to a symbolic value (to lambda)." }
, { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Get the current DataBase." }
//, { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." }
//, { "closeUpdateSession" , (PyCFunction)PyUpdateSession_closeUpdateSession, METH_NOARGS , "Close an UpdateSession." }
//, { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." }
//, { "closeUpdateSession" , (PyCFunction)PyUpdateSession_closeUpdateSession, METH_NOARGS , "Close an UpdateSession." }
, { "getExternalComponents" , (PyCFunction)PyNetExternalComponents_getExternalComponents, METH_VARARGS, "Returns the components collection of an external net" }
, {NULL, NULL, 0, NULL} /* sentinel */
};

View File

@ -1,141 +0,0 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// 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: PyUnit.cpp,v 1.11 2006/05/03 14:00:05 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 |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyUnit.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "hurricane/isobar/PyUnit.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyUnit" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyUnit" General Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyUnit_getUnit ()"
extern PyObject* PyUnit_getUnit ( PyObject* module, PyObject* args )
{
trace << "PyUnit_getUnit ()" << endl;
PyObject* arg0;
Unit result = 0;
HTRY
__cs.Init ( "Unit.getUnit" );
if ( ! PyArg_ParseTuple(args,"|O&:Unit.getUnit",Converter,&arg0) )
return ( NULL );
if ( __cs.getObjectIds() == INT_ARG ) { result = getUnit ( PyInt_AsLong ( arg0 ) ); }
else if ( __cs.getObjectIds() == FLOAT_ARG ) { result = getUnit ( PyFloat_AsDouble ( arg0 ) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Unit.getUnit constructor." );
return ( NULL );
}
HCATCH
return ( Py_BuildValue ( "i", result ) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyUnit_getValue ()"
extern PyObject* PyUnit_getValue ( PyObject* module, PyObject* args )
{
trace << "PyUnit_getValue ()" << endl;
PyObject* arg0;
if ( ! ParseOneArg ( "getValue", args,INT_ARG, &arg0 ) ) return ( NULL );
return ( Py_BuildValue("d",getValue(PyInt_AsLong(arg0))) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyUnit_getResolution ()"
extern PyObject* PyUnit_getResolution ( PyObject* module )
{
trace << "PyUnit_getResolution ()" << endl;
return ( Py_BuildValue("d",getResolution()) );
}
#endif // End of Python Module Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -33,7 +33,7 @@
// Authors-Tag
// ===================================================================
//
// $Id: PyUnit.h,v 1.6 2006/04/24 14:11:48 jpc Exp $
// $Id$
//
// x-----------------------------------------------------------------x
// | |
@ -43,7 +43,7 @@
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyUnit.h" |
// | C++ Header : "./PyDbU.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
@ -59,7 +59,7 @@
#include "hurricane/isobar/PyHurricane.h"
#include "hurricane/Unit.h"
#include "hurricane/DbU.h"
namespace Isobar {
@ -69,7 +69,7 @@ extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyUnit".
// Python Object : "PyDbU".
@ -77,8 +77,13 @@ extern "C" {
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyObject* PyUnit_getUnit ( PyObject* module, PyObject* args );
extern PyObject* PyUnit_getValue ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_db ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_real ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_lambda ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getDb ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getReal ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getLambda ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getResolution ( PyObject* module );
} // End of extern "C".