Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

FPcommon.cxx

Go to the documentation of this file.
00001 /**************************************************************************
00002 ***    
00003 *** Copyright (c) 1995-2000 Regents of the University of California,
00004 ***               Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov
00005 *** Copyright (c) 2000-2004 Regents of the University of Michigan,
00006 ***               Saurabh N. Adya, Jarrod A. Roy and Igor L. Markov
00007 ***
00008 ***  Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu
00009 ***  Original Affiliation:   UCLA, Computer Science Department,
00010 ***                          Los Angeles, CA 90095-1596 USA
00011 ***
00012 ***  Permission is hereby granted, free of charge, to any person obtaining 
00013 ***  a copy of this software and associated documentation files (the
00014 ***  "Software"), to deal in the Software without restriction, including
00015 ***  without limitation 
00016 ***  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
00017 ***  and/or sell copies of the Software, and to permit persons to whom the 
00018 ***  Software is furnished to do so, subject to the following conditions:
00019 ***
00020 ***  The above copyright notice and this permission notice shall be included
00021 ***  in all copies or substantial portions of the Software.
00022 ***
00023 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
00024 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00025 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
00026 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00027 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
00028 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
00029 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00030 ***
00031 ***
00032 ***************************************************************************/
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 #include "FPcommon.h"
00041 using namespace parquetfp;
00042 
00043 ostream& operator<<(ostream& out, const ORIENT& orient)
00044 {
00045   if(orient == N)
00046     out<<"N";
00047   else if(orient == E)
00048     out<<"E";
00049   else if(orient == S)
00050     out<<"S";
00051   else if(orient == W)
00052     out<<"W";
00053   else if(orient == FN)
00054     out<<"FN";
00055   else if(orient == FE)
00056     out<<"FE";
00057   else if(orient == FS)
00058     out<<"FS";
00059   else if(orient == FW)
00060     out<<"FW";
00061   else
00062     cout<<"ERROR in outputting orientations"<<endl;
00063   return out;
00064 }
00065 
00066 BBox::BBox()
00067 {
00068   _minX=(1e306);
00069   _maxX=(-1e306);
00070   _minY=(1e306);
00071   _maxY=(-1e306);
00072   _valid=0;
00073 }
00074 
00075 void BBox::clear(void)
00076 {
00077   _minX=(1e306);
00078   _maxX=(-1e306);
00079   _minY=(1e306);
00080   _maxY=(-1e306);
00081   _valid=0;
00082 }
00083 void BBox::put(Point& point)
00084 {
00085   if(point.x < _minX)
00086     _minX = point.x;
00087   if(point.x > _maxX)
00088     _maxX = point.x;
00089   if(point.y < _minY)
00090     _minY = point.y;
00091   if(point.y > _maxY)
00092     _maxY = point.y;
00093   _valid = 1;
00094 }
00095 
00096 double BBox::getHPWL(void)
00097 {
00098   return((_maxX-_minX)+(_maxY-_minY));
00099 }
00100 
00101 double BBox::getXSize(void)
00102 { return(_maxX-_minX); }
00103 
00104 double BBox::getYSize(void)
00105 { return(_maxY-_minY); }
00106 
00107 bool BBox::isValid(void)
00108 {
00109   return _valid;
00110 }
00111 void parquetfp::eatblank(ifstream& i)
00112 {
00113   while (i.peek()==' ' || i.peek()=='\t') i.get();
00114 }
00115 
00116 void parquetfp::skiptoeol(ifstream& i)
00117 {
00118   while (!i.eof() && i.peek()!='\n' && i.peek()!='\r') i.get();
00119   i.get();
00120 }
00121 
00122 bool parquetfp::needCaseChar(ifstream& i, char character)
00123 {
00124   while(!i.eof() && i.peek() != character) i.get();
00125   if(i.eof())
00126     return 0;
00127   else
00128     return 1;
00129 }
00130 void parquetfp::eathash(ifstream& i)
00131 {
00132   skiptoeol(i);
00133 }
00134 
00135 ORIENT parquetfp::toOrient(char* orient)
00136 {
00137   if(!strcmp(orient, "N"))
00138     return N;
00139   if(!strcmp(orient, "E"))
00140     return E;
00141   if(!strcmp(orient, "S"))
00142     return S;
00143   if(!strcmp(orient, "W"))
00144     return W;
00145   if(!strcmp(orient, "FN"))
00146     return FN;
00147   if(!strcmp(orient, "FE"))
00148     return FE;
00149   if(!strcmp(orient, "FS"))
00150     return FS;
00151   if(!strcmp(orient, "FW"))
00152     return FW;
00153 
00154   cout<<"ERROR: in converting char* to ORIENT"<<endl;
00155   return N;
00156 }
00157 
00158 char* parquetfp::toChar(ORIENT orient)
00159 {
00160   if(orient == N)
00161    { return("N"); }
00162   if(orient == E)
00163    { return("E"); }
00164   if(orient == S)
00165    { return("S"); }
00166   if(orient == W)
00167    { return("W"); }
00168   if(orient == FN)
00169    { return("FN"); }
00170   if(orient == FE)
00171    { return("FE"); }
00172   if(orient == FS)
00173    { return("FS"); }
00174   if(orient == FW)
00175    { return("FW"); }
00176   cout<<"ERROR: in converting ORIENT to char* "<<endl;
00177   return "N";
00178 }

Generated on Mon Apr 25 01:09:24 2005 for Parquete by doxygen 1.3.2