first commit

This commit is contained in:
The Coriolis Project 2007-12-26 22:33:51 +00:00
parent b88b10988a
commit 2c80b6000e
238 changed files with 48203 additions and 1 deletions

View File

@ -0,0 +1,13 @@
project(HURRICANE)
cmake_minimum_required(VERSION 2.4.0)
set(CMAKE_MODULE_PATH "cmake_modules/")
find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
FIND_PACKAGE(BISON REQUIRED)
FIND_PACKAGE(FLEX REQUIRED)
add_subdirectory(hurricane)
add_subdirectory(analogic)
add_subdirectory(figures)

View File

@ -0,0 +1,45 @@
// ****************************************************************************************************
// File: AnalogicalCommons.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_ANALOGICALCOMMONS
#define HURRICANE_ANALOGICALCOMMONS
// *********************************************************************
// Macros Declaration.
// *********************************************************************
# define TRANSN 'N'
# define TRANSP 'P'
# define MAXNBCONTACT 8
# define IF_DEBUG_HUR_ANALOG \
if(getenv("DEBUG_HUR_ANALOG")) {
# ifndef END_IF
# define END_IF \
}
# endif
// *********************************************************************
// Analogical Unit declaration.
// *********************************************************************
# if !defined(__DOXYGEN_PROCESSOR__)
typedef double Micro;
typedef double MicroPower2;
typedef long Nano;
# endif
#include "TwoSpaces.h"
#endif // HURRICANE_ANALOGICALCOMMONS

View File

@ -0,0 +1,43 @@
set(includes RdsUnit.h)
include_directories(${HURRICANE_SOURCE_DIR}/hurricane)
add_custom_target(DTRParser echo "Creating DTRParser")
add_custom_command(
SOURCE ${HURRICANE_SOURCE_DIR}/analogic/ParserDtrScan.ll
COMMAND ${FLEX_EXECUTABLE}
ARGS -Pdtr -o${HURRICANE_BINARY_DIR}/analogic/ParserDtrScan.cpp
${HURRICANE_SOURCE_DIR}/analogic/ParserDtrScan.ll
TARGET DTRParser
OUTPUTS ${HURRICANE_BINARY_DIR}/analogic/ParserDtrScan.cpp)
add_custom_command(
SOURCE ${HURRICANE_SOURCE_DIR}/analogic/ParserDtrGram.yy
COMMAND ${BISON_EXECUTABLE}
ARGS -d -v -p dtr -y ${HURRICANE_SOURCE_DIR}/analogic/ParserDtrGram.yy
-o ${HURRICANE_BINARY_DIR}/analogic/ParserDtrGram.cpp
TARGET DSTParser
DEPENDS ${HURRICANE_BINARY_DIR}/analogic/ParserDtrScan.cpp
OUTPUTS ${HURRICANE_BINARY_DIR}/analogic/ParserDtrGram.cpp)
set(DST_SRCS ${DST_SRCS} ${HURRICANE_BINARY_DIR}/analogic/ParserDtrGram.cpp
${HURRICANE_BINARY_DIR}/analogic/ParserDtrScan.cpp)
SET_SOURCE_FILES_PROPERTIES(${HURRICANE_BINARY_DIR}/analogic/ParserDtrGram.cpp GENERATED)
SET_SOURCE_FILES_PROPERTIES(${HURRICANE_BINARY_DIR}/analogic/ParserDtrScan.cpp GENERATED)
INCLUDE_DIRECTORIES(${HURRICANE_BINARY_DIR}/analogic/)
add_library(analogic SHARED
${DST_SRCS}
DtrAccess.cpp
GenericDtrAccess.cpp
GenV1Trans.cpp
MetaTransistor.cpp
RdsUnit.cpp
Transistor.cpp
TwoSpaces.cpp)
install(FILES ${includes} DESTINATION /include/hurricane)
install(TARGETS analogic DESTINATION /lib)

View File

@ -0,0 +1,307 @@
// ****************************************************************************************************
// File: DtrAccess.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "DtrAccess.h"
#include "RdsUnit.h"
#include "Error.h"
#include "DataBase.h"
#include "Technology.h"
extern void ParseDtr(const char*, Hurricane::DtrAccess*);
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// DtrAccess implementation
// ****************************************************************************************************
// static data defintion
// *********************
DtrAccess* DtrAccess::_instance = NULL;
map<string, DtrAccess*> DtrAccess::_registry;
DtrAccess::DtrAccess()
// *******************
{
}
DtrAccess * DtrAccess::Create()
// *****************************
{
DtrAccess * dtraccess = new DtrAccess();
dtraccess->_PostCreate();
return dtraccess;
}
void DtrAccess::_PostCreate()
// **************************
{
const char * dtrfilename = getenv("DTR_FILE");
if(!dtrfilename) {
throw Error("Can't not get Macro DTR_FILE.");
}
// Use API of DtrParser for get technology informations
// ****************************************************
ParseDtr(dtrfilename, this);
// Traduit Micro to RdsUnit
// ************************
map<string, list<double> >::iterator it_rulemap = _label2ruleMap.begin(),
it_end_rulemap = _label2ruleMap.end();
while(it_rulemap!=it_end_rulemap) {
list<double>::iterator m = ((*it_rulemap).second).begin()
, n = ((*it_rulemap).second).end();
while(m!=n) {
_label2RdsRuleMap[(*it_rulemap).first].push_back(ConvertRealToRdsUnit(*m));
m++;
}
it_rulemap++;
}
// Get Objet Layer from Technology with its name.
// **********************************************
DataBase * db = GetDataBase();
if(!db) throw Error("In GetV1Trans::Generate : can't find DataBase.");
Technology * tech = db->GetTechnology();
map<string, list<string> >::iterator it_layermap = _label2layerNameMap.begin(),
it_end_layermap = _label2layerNameMap.end();
while(it_layermap != it_end_layermap) {
list<string>::iterator m = (*it_layermap).second.begin(),
n = (*it_layermap).second.end();
while(m!=n) {
Layer * layer = tech->GetLayer(Name(*m));
if(!layer) {
throw Error("Error : in function DtrAccess::_PostCreate , Can't find Layer "
+ GetString(*m) + " in technology file when parser DtrFile.");
// cerr << Warning("In function DtrAccess::_PostCreate , Can't find Layer "
// + GetString(*m) + " in technology file when parser DtrFile");
}
_label2layerMap[(*it_layermap).first].push_back(layer);
m++;
}
it_layermap++;
}
}
DtrAccess * DtrAccess::Instance()
// *****************************
{
// User or environnement supplies this at startup
// **********************************************
const char * singleton_name = getenv("DTRACCESS_SINGLETON");
if(!singleton_name) { // if MACRO IS INVALID
if(!_instance) {
_instance = DtrAccess::Create();
}
}
else {
if(!_instance){
if( !(_instance=LookUp(string(singleton_name))) ) // if singleton hasn't been registered
_instance = DtrAccess::Create();
}
}
return _instance;
}
void DtrAccess::_PreDelete()
// ***********************
{
// Do something
// ************
}
void DtrAccess::Delete()
// ********************
{
_PreDelete();
delete this;
}
GenericCollection<double> DtrAccess::GetRuleByLabel(const string& label) const
// ***************************************************************************
{
map<string, list<double> >::const_iterator i = _label2ruleMap.find(label);
if(i==_label2ruleMap.end())
throw Error("Can't find in DtrFile rule the label : " + GetString(label));
return GetCollection((*i).second);
}
GenericCollection<long> DtrAccess::GetRdsRuleByLabel(const string& label) const
// ******************************************************************************
{
map<string, list<long> >::const_iterator i = _label2RdsRuleMap.find(label);
if(i==_label2RdsRuleMap.end())
throw Error("Can't find in DtrFile The Rds Value of Rule by label : " + GetString(label));
return GetCollection((*i).second);
}
GenericCollection<string> DtrAccess::GetLayerNamesByLabel(const string& label) const
// *********************************************************************************
{
map<string, list<string> >::const_iterator i = _label2layerNameMap.find(label);
if(i==_label2layerNameMap.end())
throw Error("Can't find in DtrFile layers the label : " + label);
return GetCollection((*i).second);
}
GenericCollection<Layer*> DtrAccess::GetLayersByLabel(const string& label) const
// ******************************************************************************
{
map<string, list<Layer*> >::const_iterator i = _label2layerMap.find(label);
if(i==_label2layerMap.end())
throw Error("Can't find in DtrFile objet Layer by label : " + label );
return GetCollection((*i).second);
}
GenericCollection<double> DtrAccess::GetElectricalsByLabel(const string& label) const
// **********************************************************************************
{
map<string, list<double> >::const_iterator i = _label2electricalMap.find(label);
if(i==_label2electricalMap.end())
throw Error("Can't find in DtrFile electricals by label : " + label);
return GetCollection((*i).second);
}
int DtrAccess::GetModellingByLabel(const string& label) const
// **********************************************************
{
map<string, int>::const_iterator i = _label2modellingMap.find(label);
if(i==_label2modellingMap.end())
throw Error("Can't find in DtrFile modelling by label : " + GetString(label));
return (*i).second;
}
double DtrAccess::GetSimpleCapaMimByLabel(const string& label) const
// ****************************************************************
{
map<string, double>::const_iterator i = _label2simplecapamimMap.find(label);
if(i==_label2simplecapamimMap.end())
throw Error("Can't find in DtrFile simple capa mim by label : " + GetString(label));
return (*i).second;
}
// ------------------------------------------------------
// Function "DtrAccess::LookUp(const string&)".
//
/* \static DtrAccess* DtrAccess::LookUp(const string& singletonname)
* \param singletonname normally the name of derive class of DtrAccess.
* \return addresse of objet singleton of derive class if success.
* NULL if failure.
*
* Find the singleton objet if it exist according to the singletonname.
*
*/
DtrAccess* DtrAccess::LookUp(const string& singletonname)
// ******************************************************
{
map<string, DtrAccess*>::iterator i = _registry.find(singletonname);
if(i==_registry.end())
return NULL;
return (*i).second;
}
// ------------------------------------------------------------------------
// Function Register(const string&, DtrAccess*)
/* \void DtrAccess::Register(const string& singletonname, DtrAccess* dtraccess)
* \param singletonname the name of derive class.
* \param dtraccess addresse of objet singleton of derive class.
*
*
* This function is to be called when the singleton objet of derive class is
* created.
*
*/
void DtrAccess::Register(const string& singletonname, DtrAccess* dtraccess)
// *************************************************************************
{
_registry[singletonname]=dtraccess;
}
string DtrAccess::_GetString() const
// **********************************
{
string s("Singleton DtrAccess");
return s;
}
Record* DtrAccess::_GetRecord() const
// **********************************
{
Record* record = new Record(_GetString());
return record;
}
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::DtrAccess& access)
// **********************************************
{
return access._GetString();
}

View File

@ -0,0 +1,187 @@
// ****************************************************************************************************
// File: DtrAccess.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_DTRACCESS
#define HURRICANE_DTRACCESS
#include "Layer.h"
#include "Layers.h"
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class DtrAccess {
// **************
// Types
// *****
# if !defined(__DOXYGEN_PROCESSOR__)
// Attributes
// **********
private : static DtrAccess * _instance;
private : map<string, list<double> > _label2ruleMap;
private : map<string, list<string> > _label2layerNameMap;
private : map<string, list<double> > _label2electricalMap;
private : map<string, int> _label2modellingMap;
private : map<string, double> _label2simplecapamimMap;
private : map<string, list<long> > _label2RdsRuleMap;
private : map<string, list<Layer*> > _label2layerMap;
// For reusability of software
// ***************************
private : static map<string, DtrAccess*> _registry;
// Constructors
// ************
protected : DtrAccess();
private : DtrAccess(const DtrAccess&);
private : DtrAccess& operator=(const DtrAccess&);
protected : static DtrAccess * Create();
protected : virtual void _PostCreate();
# endif
public : static DtrAccess* Instance();
// Destructors
// ***********
# if !defined(__DOXYGEN_PROCESSOR__)
protected : virtual ~DtrAccess() {};
protected : virtual void _PreDelete();
# endif
public : virtual void Delete();
// Accessors
// *********
// If can't find data , throw Hurricane::Error
// *******************************************
public : GenericCollection<double> GetRuleByLabel(const string&) const;
public : GenericCollection<long> GetRdsRuleByLabel(const string&) const;
public : GenericCollection<string> GetLayerNamesByLabel(const string&) const;
public : Layers GetLayersByLabel(const string&) const;
public : GenericCollection<double> GetElectricalsByLabel(const string& ) const;
public : int GetModellingByLabel(const string&) const;
public : double GetSimpleCapaMimByLabel(const string&) const;
# if !defined(__DOXYGEN_PROCESSOR__)
public : double GetSingleRealRuleByLabel(const string& s) const
// *************************************************
{
GenericLocator<double> locator = GetRuleByLabel(s).GetLocator();
return locator.GetElement();
}
public : long GetSingleRdsRuleByLabel(const string& s) const
// ************************************************
{
GenericLocator<long> locator = GetRdsRuleByLabel(s).GetLocator();
return locator.GetElement();
}
public : string GetSingleLayerNameByLabel(const string& s) const
// ****************************************************
{
GenericLocator<string> locator = GetLayerNamesByLabel(s).GetLocator();
return locator.GetElement();
}
public : Layer* GetSingleLayerByLabel(const string& s) const
// ************************************************
{
LayerLocator locator = GetLayersByLabel(s).GetLocator();
return locator.GetElement();
}
public : double GetSingleRealRuleByLabel(char* prefix, const string& type, char* suffix) const
// **********************************************************************************
{
return GetSingleRealRuleByLabel(prefix + type + suffix);
}
public : long GetSingleRdsRuleByLabel(char* prefix, const string& type, char* suffix) const
// *******************************************************************************
{
return GetSingleRdsRuleByLabel(prefix + type + suffix);
}
public : string GetSingleLayerNameByLabel(char* prefix, const string& type, const string& suffix) const
// ************************************************************************************
{
return GetSingleLayerNameByLabel(prefix + type + suffix);
}
public : Layer* GetSingleLayerByLabel(char* prefix, const string& type, const string& suffix) const
// ***************************************************************************************
{
return GetSingleLayerByLabel(prefix + type + suffix);
}
# endif
// Updators
// ********
public : void AddRuleByLabel(const string& label, const list<double>& rule){ _label2ruleMap[label]=rule; };
public : void AddLayersByLabel(const string& label, const list<string>& layers) { _label2layerNameMap[label]=layers; };
public : void AddElectricalsByLabel(const string& label, const list<double>& electricals)
{ _label2electricalMap[label]=electricals; };
public : void AddModellingByLabel(const string& label, const int modelling) { _label2modellingMap[label]=modelling; };
public : void AddSimpleCapaMimByLabel(const string& label, const double capamim) { _label2simplecapamimMap[label]=capamim; };
// Operations
// **********
// For reusability of software
// ***************************
protected : static DtrAccess* LookUp(const string&);
protected : static void Register(const string& , DtrAccess* );
# if !defined(__DOXYGEN_PROCESSOR__)
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("DtrAccess");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: map<string, list<double> >& _GetLabel2RuleMap() { return _label2ruleMap; };
public: map<string, list<string> >& _GetLabel2LayerNameMap() { return _label2layerNameMap; };
public: map<string, list<double> >& _GetLabel2ElectricalMap()
{ return _label2electricalMap; };
public: map<string, int>& _GetLabel2ModellingMap() { return _label2modellingMap; };
public: map<string, double>& _GetLabel2SimpleCapaMimMap()
{ return _label2simplecapamimMap; };
# endif
};
}
//END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::DtrAccess&);
#endif // HURRICANE_DTRACCESS

View File

@ -0,0 +1,220 @@
// ****************************************************************************************************
// File: GenTrans.h
// Authors: Wu YiFei
// Date : 04/04/2007
// ****************************************************************************************************
#ifndef HURRICANE_GENTRANS
#define HURRICANE_GENTRANS
#include "Transistor.h"
#include "Box.h"
// --------------------------------------------------------------------
// Macro Method : "MAXLONG(a,b), MINLONG(a,b)"
// Comparaison Method Macro For Calculate Rectangles.
# define MAXLONG(a,b) (a>b?a:b)
# define MINLONG(a,b) (a>b?b:a)
// --------------------------------------------------------------------
// Macro Method : "GET_RULE(s)"
// This Method Macro is For Geting The Value in RdsUnit of a DRM Rule.
// To Use This Macro, you must predefine Pointeur dtraccess.
# define GET_RULE(s) \
dtraccess->GetSingleRdsRuleByLabel(string(s))
// --------------------------------------------------------------------
// Macro Method "GET_RULE_BYNP(prefix, type, suffix)"
// This Method Macro is For Geting The Value in RdsUnit of a DRM Rule
// selected by string type which is mostype .
/* \prefix must be a chain character.
* \type mos type('N'/'P'), must be a string.
* \suffix must be a chain character.
*/
// To Use This Macro, you must Predefine Pointeur dtraccess.
# define GET_RULE_BYNP(prefix, type, suffix) \
dtraccess->GetSingleRdsRuleByLabel(prefix, type, suffix)
// --------------------------------------------------------------------
// Macro Method : "Get_LAYER_BYNP(prefix, type, suffix)"
// This Method Macro is For Geting the Layer of a Layer Rule Selected
// by string type which is mostype. To Use This Macro, you must predefine
// Pointeur dtraccess.
/* \prefix must be a chain of character.
* \type mos type('N'/'P'), must be a string.
* \suffix must be a string.
*/
// To Use This Macro, you must Predefine Pointeur dtraccess.
# define GET_LAYER_BYNP(prefix, type, suffix) \
dtraccess->GetSingleLayerByLabel(prefix, type, suffix)
// --------------------------------------------------------------------
// Macro Method : "SAVE_RECTANGLE(S, x, y, dx, dy)"
// This Method Macro is For Saving A Rectangle in a map .
/* \s name of rectangle, must be a chain of character.
* \x xmin, must be a long.
* \y ymin, must be a long.
* \dx width, must be a long.
* \dy height, must be a long.
*/
// This Method Macro must be used in Membre Function Calculate.
# define SAVE_RECTANGLE(s, x, y, dx, dy) \
_mapString2Box[string(s)] = Box(GetUnit(x), GetUnit(y), GetUnit(x+dx), GetUnit(y+dy)); \
xmin = MINLONG(xmin, GetUnit(x)); \
ymin = MINLONG(ymin, GetUnit(y));
// --------------------------------------------------------------------
// Macro Method : "GET_BOX(s)"
// This Method Macro is For Get the box According to the its name.
/*
* \s name of rectangle, must be a string.
*/
// This Method Macro must be used in member function of Class GenTrans.
//
# define GET_BOX(s) \
_mapString2Box[s]
// ---------------------------------------------------------------------
// Macro Method : "CREATE_CONTACT_MATRIX_UNDER(boxname, nbcolumn, layer, net)"
// This Method Macro is For Create a matrix of Contact under a zone for
// a net specified.
/* \underbox A rectangle under which contacts will be placed, must be a objet Box.
* \nbcolumn the number of column, must be a integer.
* \layer the layer of contact, must be a pointer of type Layer*.
* \net the net to be hooked, must be a pointer of type Net*.
*/
// To use this Macro Function. You Must also définir variable nbcontact,
// tmp_xcenter, tmp_ycenter, rw_cont, rd_cont.
//
# define CREATE_CONTACT_MATRIX_UNDER(underbox, nbcolumn, layer, net) \
\
if(underbox.GetHeight()<rw_cont) \
nbcontact = 0; \
else \
nbcontact = (underbox.GetHeight()-rw_cont)/(rw_cont + rd_cont) + 1 ;\
\
\
tmp_xcenter = underbox.GetXMin() + (rw_cont/2); \
tmp_ycenter = underbox.GetYMin() + (rw_cont/2); \
\
\
for(unsigned i=0; i<nbcolumn; i++) { \
\
for(unsigned j=0; j<nbcontact; j++) { \
Contact::Create(net, layer \
, tmp_xcenter \
, tmp_ycenter \
, rw_cont \
, rw_cont \
); \
\
tmp_ycenter += (rw_cont + rd_cont); \
} \
\
tmp_xcenter += (rw_cont + rd_cont); \
tmp_ycenter = underbox.GetYMin() + (rw_cont/2); \
}
// ------------------------------------------------------------------
// Macro Function : "BOX_IS_VALID(box)"
// This Macro Function is for check if the box is correctly in the
// grille of fondor. It will check if the value of x,y,dx,dy are all
// pair.
/*
* box the box is to check. must be a objet Box.
*/
# define BOX_IS_VALID(box) \
( (long)(GetValue(box.GetXMin()))%2==0 )&& \
( (long)(GetValue(box.GetXMax()))%2==0 )&& \
( (long)(GetValue(box.GetYMin()))%2==0 )&& \
( (long)(GetValue(box.GetYMax()))%2==0 )
BEGIN_NAMESPACE_HURRICANE
class GenTrans {
// *************
// Attributes
// **********
protected : map<string, Box> _mapString2Box;
// Constructors
// *************
public : GenTrans() {};
// Destructors
// ***********
public : virtual ~GenTrans() {};
// Operators
// **********
public : virtual void Calculate(Transistor*) = 0;
public : virtual void Generate(Transistor*) = 0;
};
class GenV1Trans : public GenTrans {
// *********************************
// Types
// *****
public : typedef GenTrans Inherit;
// Attributs
// *********
public : const Transistor::MaskV1Info* _masqueV1Info;
// Constructors
// ************
public : GenV1Trans(Transistor::MaskV1Info*);
// Destructors
// ************
public : virtual ~GenV1Trans() {};
// Operators
// *********
public : virtual void Calculate(Transistor*) ;
public : virtual void Generate(Transistor*) ;
};
END_NAMESPACE_HURRICANE
#endif

View File

@ -0,0 +1,539 @@
// ****************************************************************************************************
// File: GenV1Trans.cpp
// Authors: Wu YiFei
// Date : 04/04/2007
// ****************************************************************************************************
#include "Collection.h"
#include "RdsUnit.h"
#include "GenTrans.h"
#include "DtrAccess.h"
#include "GenericDtrAccess.h"
#include "Technology.h"
#include "UpdateSession.h"
#include "DataBase.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Globals Datas
// ****************************************************************************************************
string segsforsource[] = {string("20"), string("23")};
string segsfordrain[] = {string("40"), string("43")};
string segsforgrid[] = {string("00"), string("01"), string("30"), string("31")};
//string segsforgrid[] = {string("00"), string("30") };
string segsforanonym[] = {string("10"), string("11"), string("12"), string("50")};
// ****************************************************************************************************
// Class GetV1Trans implementation
// ****************************************************************************************************
GenV1Trans::GenV1Trans(Transistor::MaskV1Info* masqueinfo)
// *********************************************************
: _masqueV1Info(masqueinfo)
{
}
void GenV1Trans::Calculate(Transistor* transistor)
// **********************************************
{
DtrAccess * dtraccess = DtrAccess::Instance();
// Check out mask param.
// *********************
if(_masqueV1Info->GetL() < dtraccess->GetSingleRealRuleByLabel("L_TRANS") ||
_masqueV1Info->GetL() > dtraccess->GetSingleRealRuleByLabel("L_TRANS_MAX") ||
_masqueV1Info->GetW() < dtraccess->GetSingleRealRuleByLabel("W_TRANS") ||
_masqueV1Info->GetW() > dtraccess->GetSingleRealRuleByLabel("W_TRANS_MAX") )
throw Error("Can't launch function GenV1Trans::Calculate for " + GetString(transistor)
+ " the L " + GetString(_masqueV1Info->GetL())
+ " or the W " + GetString(_masqueV1Info->GetW())
+ " of this transistor is invalid."
);
if(_masqueV1Info->GetNbSourceColumn() < 1 || _masqueV1Info->GetNbSourceColumn() > MAXNBCONTACT ||
_masqueV1Info->GetNbDrainColumn() < 1 || _masqueV1Info->GetNbDrainColumn() > MAXNBCONTACT )
throw Error("Can't launch function GenV1Trans::Calculate for " + GetString(transistor)
+ " the nbsourcecolumn " + GetString(_masqueV1Info->GetNbSourceColumn())
+ " or the nbdraincolumn " + GetString(_masqueV1Info->GetNbDrainColumn())
+ " of this transistor is invalid."
);
IF_DEBUG_HUR_ANALOG
cout << ts << GetString(transistor) + " 's masqueinfo is " + GetString(_masqueV1Info)
<< endl;
END_IF
// Tempory Variable.
// **************************
long x00, y00, dx00, dy00;
long x10, y10, dx10, dy10;
long x11, y11, dx11, dy11;
long x12, y12, dx12, dy12;
long x20, y20, dx20, dy20;
long x23, y23, dx23, dy23;
long x30, y30, dx30, dy30;
long x31, y31, dx31, dy31;
long x01, y01, dx01, dy01;
long x40, y40, dx40, dy40;
long x43, y43, dx43, dy43;
long x50, y50, dx50, dy50;
long xmin = 999999L, ymin = 999999L;
long realw = 0;
// Tempory Variable.
// **************************
long extension1 = 0;
long extension2 = 0;
long extension3 = 0;
long extension4 = 0;
long ymax = 0;
string mostype; // Get Mos Type (N/P).
if(transistor->IsNmos())
mostype='N';
else
mostype='P';
//string mostype; // Get Mos Type (N/P).
//mostype=transistor->GetType();
// -------------------------------------------------------------
// Begin Calculate.
//long re_imp_acti = GET_RULE_BYNP("RE_", mostype, "IMP_ACTI");
long re_imp_acti = GET_RULE_BYNP("RE_", mostype, "IMP_ACTI");
long re_imp_poly = GET_RULE_BYNP("RE_", mostype, "IMP_POLY");
long re_imp_cont = GET_RULE_BYNP("RE_", mostype, "IMP_CONT");
long re_imp_gate = GET_RULE_BYNP("RE_", mostype, "IMP_GATE");
//long re_well_acti = GET_RULE_BYNP("RE_", mostype, "WELL_ACTI");
// Calculate Rectangle 00
// **********************
x00 = 0;
y00 = -( GET_RULE("RE_GATE_ACTI") );
dx00 = ConvertRealToRdsUnit(_masqueV1Info->GetL());
realw = ConvertRealToRdsUnit(_masqueV1Info->GetW());
dy00 = realw + 2*(-y00);
SAVE_RECTANGLE("00", x00, y00, dx00, dy00)
// Calculate Rectangle 30
// **********************
// cout << "RD_ACTI_CONT is " << GET_RULE("RD_ACTI_CONT")<<endl;
// cout << "RD_ACTI_POLY is " << GET_RULE("RD_ACTI_POLY")<<endl;
// cout << "RE_POLY_CONT is " << GET_RULE("RE_POLY_CONT")<<endl;
// cout << "MAX RD_ACTI_POLY is " << (MAXLONG(GET_RULE("RD_ACTI_CONT"), GET_RULE("RD_ACTI_POLY") + GET_RULE("RE_POLY_CONT"))) <<endl;
//
dx31 = GET_RULE("RW_CONT") + 2*GET_RULE("RE_POLY_CONT");
if (dx31 >= dx00) {
dx30 = GET_RULE("RW_CONT");
dy30 = dx30;
y30 = 0 + realw + MAXLONG(GET_RULE("RD_ACTI_CONT"), GET_RULE("RD_ACTI_POLY") + GET_RULE("RE_POLY_CONT"));
}
else {
dx30 = dx00 - 2*GET_RULE("RE_POLY_CONT");
dy30 = GET_RULE("RW_CONT");
y30 = 0 + realw + GET_RULE("RD_ACTI_CONT");
}
x30 = x00 + dx00/2 - dx30/2;
SAVE_RECTANGLE("30", x30, y30, dx30, dy30)
// Calculate Rectangle 31
// **********************
dx31 = dx30 + 2*GET_RULE("RE_POLY_CONT");
dy31 = dy30 + 2*GET_RULE("RE_POLY_CONT");
x31 = x30 - GET_RULE("RE_POLY_CONT");
y31 = y30 - GET_RULE("RE_POLY_CONT");
SAVE_RECTANGLE("31", x31, y31, dx31, dy31)
// Calculate Rectangle 01
// **********************
if ( y31 <= (y00+dy00) ) {
x01 = 0; y01 = 0; dx01 = 0; dy01 = 0;
}
else {
x01 = x00;
y01 = y00 + dy00;
dx01 = dx00;
dy01 = y31 - (y00 + dy00);
}
SAVE_RECTANGLE("01", x01, y01, dx01, dy01)
// Calculate Rectangle 12
// **********************
x12 = MINLONG(x31, x00) - re_imp_poly;
y12 = MINLONG(0 - re_imp_acti, y00 - re_imp_poly);
dx12 = MAXLONG(dx31, dx00) + 2 * re_imp_poly;
ymax = MAXLONG( MAXLONG( y30 + dy30 + re_imp_cont
, MAXLONG(y31 + dy31, y00 + dy00) + re_imp_poly )
, realw + re_imp_acti );
dy12 = ymax - y12 ;
SAVE_RECTANGLE("12", x12, y12, dx12, dy12)
// Calculate Rectangle 20
// **********************
y20 = 0 + GET_RULE("RE_ACTI_CONT");
dy20 = realw - 2 * GET_RULE("RE_ACTI_CONT");
dx20 = (_masqueV1Info->GetNbSourceColumn()) * GET_RULE("RW_CONT") +
((_masqueV1Info->GetNbSourceColumn()) - 1) * GET_RULE("RD_CONT");
x20 = 0 - ( dx20 + GET_RULE("RD_CONT_GATE") );
SAVE_RECTANGLE("20", x20, y20, dx20, dy20)
// Calculate Rectangle 40
// **********************
y40 = y20;
x40 = x00 + dx00 + GET_RULE("RD_CONT_GATE");
dx40 = (_masqueV1Info->GetNbDrainColumn()) * GET_RULE("RW_CONT") +
((_masqueV1Info->GetNbDrainColumn()) - 1) * GET_RULE("RD_CONT");
dy40 = dy20;
SAVE_RECTANGLE("40", x40, y40, dx40, dy40)
// Calculate Rectangle 10
// **********************
y10 = 0;
x10 = MINLONG(x20 - GET_RULE("RE_ACTI_CONT"), 0 - GET_RULE("RE_ACTI_GATE"));
dy10 = realw;
extension1 = MAXLONG(0 + x40 + dx40 + GET_RULE("RE_ACTI_CONT"), dx00 + GET_RULE("RE_ACTI_GATE"));
dx10 = 0 - x10 + extension1;
SAVE_RECTANGLE("10", x10, y10, dx10, dy10)
// Calculate Rectangle 23
// ***********************
x23 = x10;
y23 = y10;
dx23 = 0 - x10;
dy23 = realw;
SAVE_RECTANGLE("23", x23, y23, dx23, dy23)
// Calculate Rectangle 43
// **********************
x43 = x00 + dx00 ;
y43 = y10;
dx43 = x10 + dx10 - (x00 + dx00);
dy43 = realw;
SAVE_RECTANGLE("43", x43, y43, dx43, dy43)
// Calculate Rectangle 11
// **********************
extension1 = re_imp_gate;
extension2 = re_imp_cont + 0 - x20;
extension3 = re_imp_acti + 0 - x10;
extension4 = MAXLONG(MAXLONG(extension1, extension2), extension3);
x11 = 0 - extension4;
extension1 = re_imp_gate + x00 + dx00;
extension2 = re_imp_cont + x40 + dx40;
extension3 = re_imp_acti + x10 + dx10;
extension4 = MAXLONG(MAXLONG(extension1, extension2), extension3);
dx11 = 0 - x11 + extension4;
y11 = MINLONG(y20 - re_imp_cont, y23 - re_imp_acti);
ymax = MAXLONG(y20 + dy20 + re_imp_cont, y23 + dy23 + re_imp_acti);
dy11 = ymax - y11;
SAVE_RECTANGLE("11", x11, y11, dx11, dy11);
// Calculate Rectangle 50 just for PMOS.
// -------------------------------------------------------------
if (transistor->IsPmos()) { // Calculate Rectangle 50 for PMos.
x50 = x10 - GET_RULE("RE_NWELL_ACTI");
y50 = y10 - GET_RULE("RE_NWELL_ACTI");
dx50 = dx10 + 2 * GET_RULE("RE_NWELL_ACTI");
dy50 = dy10 + 2 * GET_RULE("RE_NWELL_ACTI");
SAVE_RECTANGLE("50", x50, y50, dx50, dy50);
}
// End Calculate.
// -------------------------------------------------------------
// Translate rectangles.
// *********************
map<string, Box>::iterator i = _mapString2Box.begin(),
j = _mapString2Box.end();
while(i!=j) {
_mapString2Box[(*i).first] = (*i).second.Translate(-xmin, -ymin);
IF_DEBUG_HUR_ANALOG
cout << ts << (*i).first <<" " << GetString((*i).second) << endl;
END_IF
assert(BOX_IS_VALID((*i).second));
i++;
}
}
void GenV1Trans::Generate(Transistor* transistor)
// *********************************************
{
OpenUpdateSession();
Net* source = transistor->GetNet(Name(transistor->GetSourceName()));
Net* drain = transistor->GetNet(Name(transistor->GetDrainName()) );
Net* grid = transistor->GetNet(Name(transistor->GetGridName()) );
DtrAccess * dtraccess = DtrAccess::Instance();
//string mostype(1, transistor->GetType()); // Get Mos Type (N/P).
string mostype; // Get Mos Type (N/P).
if(transistor->IsNmos())
mostype='N';
else
mostype='P';
long rw_cont = GetUnit(GET_RULE("RW_CONT"));
long rd_cont = GetUnit(GET_RULE("RD_CONT"));
unsigned nbcontact = 0;
long tmp_xcenter = 0;
long tmp_ycenter = 0;
DataBase * db = GetDataBase();
if(!db) throw Error("In GetV1Trans::Generate : can't find DataBase");
//Technology * tech = db->GetTechnology();
Layer * layer_20 = GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_20");
Layer * layer_30 = GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_30");
Layer * layer_40 = GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_40");
// -------------------------------------------------------------
// Begin Generation.
// Cenerate Components For Net Source.
// ***********************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Source of " << GetString(transistor) << endl;
END_IF
for(size_t i=0; i<sizeof(segsforsource)/sizeof(string); i++) {
if(segsforsource[i]=="20") {
//cout << ts << " Begin create contact for source , Under Box is " << GetString(GET_BOX(segsforsource[i])) <<endl;
Box underbox = GET_BOX(segsforsource[i]);
CREATE_CONTACT_MATRIX_UNDER(underbox, transistor->GetNbSourceColumn(), layer_20, source)
//cout << ts << " Finish create contact for source " <<endl;
}
else {
Contact::Create(source, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforsource[i])
, GET_BOX(segsforsource[i]).GetXCenter()
, GET_BOX(segsforsource[i]).GetYCenter()
, GET_BOX(segsforsource[i]).GetWidth()
, GET_BOX(segsforsource[i]).GetHeight()
);
}
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Source of " << GetString(transistor) << endl;
END_IF
// Generate Components For Net Grid.
// *********************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Grid of " << GetString(transistor) << endl;
END_IF
for(size_t i=0; i<sizeof(segsforgrid)/sizeof(string); i++) {
if(segsforgrid[i]=="30"){
if( GET_BOX(segsforgrid[i]).GetWidth()==GET_RULE("RW_CONT") ) {
Contact::Create(grid, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforgrid[i])
, GET_BOX(segsforgrid[i]).GetXCenter()
, GET_BOX(segsforgrid[i]).GetYCenter()
, GET_BOX(segsforgrid[i]).GetWidth()
, GET_BOX(segsforgrid[i]).GetHeight()
);
}
else {
unsigned int nbcolumn = (GET_BOX(segsforgrid[i]).GetWidth()-rw_cont)/(rw_cont + rd_cont) + 1;
IF_DEBUG_HUR_ANALOG
cout << ts << "nbcolumn in rectangle 30 is " << nbcolumn <<endl;
END_IF
Box underbox = GET_BOX(segsforgrid[i]);
CREATE_CONTACT_MATRIX_UNDER(underbox, nbcolumn, layer_30, grid)
}
}
else {
if(GET_BOX(segsforgrid[i]).GetXMin() < GET_BOX(segsforgrid[i]).GetXMax()) {
Contact::Create(grid, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforgrid[i])
, GET_BOX(segsforgrid[i]).GetXCenter()
, GET_BOX(segsforgrid[i]).GetYCenter()
, GET_BOX(segsforgrid[i]).GetWidth()
, GET_BOX(segsforgrid[i]).GetHeight()
);
}
}
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Grid of " << GetString(transistor) << endl;
END_IF
// Generate Components For Net Drain.
// **********************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Drain of " << GetString(transistor) << endl;
END_IF
for(size_t i=0; i<sizeof(segsfordrain)/sizeof(string); i++) {
if(segsfordrain[i]=="40") {
//cout << ts << " Begin create contact for drain, Under Box is " << GetString(GET_BOX(segsforsource[i])) <<endl;
Box underbox = GET_BOX(segsfordrain[i]);
CREATE_CONTACT_MATRIX_UNDER(underbox, transistor->GetNbDrainColumn(), layer_40, drain)
//cout << ts << " Finish create contact for drain" <<endl;
}
else {
Contact::Create(drain, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsfordrain[i])
, GET_BOX(segsfordrain[i]).GetXCenter()
, GET_BOX(segsfordrain[i]).GetYCenter()
, GET_BOX(segsfordrain[i]).GetWidth()
, GET_BOX(segsfordrain[i]).GetHeight()
);
}
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Drain of " << GetString(transistor) << endl;
END_IF
// Generate Components For Anonyms Nets.
// *************************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Anonyme of " << GetString(transistor) << endl;
END_IF
Net * anonym = Net::Create(transistor, Name("anonym"));
for(size_t i=0; i<sizeof(segsforanonym)/sizeof(string);i++) {
if(transistor->IsNmos() && segsforanonym[i]=="50")
continue;
Contact::Create(anonym, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforanonym[i])
, GET_BOX(segsforanonym[i]).GetXCenter()
, GET_BOX(segsforanonym[i]).GetYCenter()
, GET_BOX(segsforanonym[i]).GetWidth()
, GET_BOX(segsforanonym[i]).GetHeight()
);
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Anonyme of " << GetString(transistor) << endl;
END_IF
// End Generation.
// -------------------------------------------------------------
CloseUpdateSession();
// Set Transistor::_mapNet2Box.
// ****************************
(*(transistor->_GetMapNet2Box()))[grid] = _mapString2Box[string("30")];
(*(transistor->_GetMapNet2Box()))[source] = _mapString2Box[string("20")];
(*(transistor->_GetMapNet2Box()))[drain] = _mapString2Box[string("40")];
cout<< GetString(_mapString2Box[string("30")]) <<endl;
cout<< GetString(_mapString2Box[string("20")]) <<endl;
cout<< GetString(_mapString2Box[string("40")]) <<endl;
// Set Abutment Box.
// *****************
switch(transistor->GetAbutmentType().GetCode()) {
case Transistor::Type::INTERNAL :
transistor->SetAbutmentBox( Box(GET_BOX(string("20")).GetXCenter()
, transistor->GetBoundingBox().GetYMin()
, GET_BOX(string("40")).GetXCenter()
, transistor->GetBoundingBox().GetYMax()
)
);
break;
case Transistor::Type::LEFT:
transistor->SetAbutmentBox( Box(GET_BOX(string("11")).GetXMin()
, transistor->GetBoundingBox().GetYMin()
, GET_BOX(string("40")).GetXCenter()
, transistor->GetBoundingBox().GetYMax()
)
);
break ;
case Transistor::Type::RIGHT:
transistor->SetAbutmentBox( Box(GET_BOX(string("20")).GetXCenter()
, transistor->GetBoundingBox().GetYMin()
, GET_BOX(string("11")).GetXMax()
, transistor->GetBoundingBox().GetYMax()
)
);
break ;
case Transistor::Type::SINGLE:
transistor->SetAbutmentBox( Box(GET_BOX(string("11")).GetXMin()
, transistor->GetBoundingBox().GetYMin()
, GET_BOX(string("11")).GetXMax()
, transistor->GetBoundingBox().GetYMax()
)
);
break ;
default :
break;
}
}
END_NAMESPACE_HURRICANE

View File

@ -0,0 +1,61 @@
// ****************************************************************************************************
// File: GenericDtrAccess.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "DtrAccess.h"
#include "GenericDtrAccess.h"
//#include "DtrAccess.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// GenericDtrAccess implementation
// ****************************************************************************************************
GenericDtrAccess GenericDtrAccess::instance(NULL);
GenericDtrAccess::GenericDtrAccess(DtrAccess* dtraccess):_dtrAccess(dtraccess)
// **************************************************************************
{
}
void GenericDtrAccess::Instance(DtrAccess* dtraccess)
// **************************************************
{
if(!(instance._dtrAccess))
instance._dtrAccess = dtraccess;
}
GenericDtrAccess::~GenericDtrAccess()
// *********************************
{
if(_dtrAccess) { cout<<GetString(_dtrAccess)<<" is delete "<<endl; _dtrAccess->Delete();}
}
string GenericDtrAccess::_GetString() const
// ****************************************
{
string s("Singleton GenericDtrAccess");
return s;
}
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::GenericDtrAccess& access)
// ************************************************
{
return access._GetString();
}

View File

@ -0,0 +1,80 @@
// ****************************************************************************************************
// File: GenericDtrAccess.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_GENERICDTRACCESS
#define HURRICANE_GENERICDTRACCESS
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class DtrAccess;
class GenericDtrAccess {
// *********************
// Types
// *****
# if !defined(__DOXYGEN_PROCESSOR__)
// Attributes
// **********
private : static GenericDtrAccess instance;
private : DtrAccess * _dtrAccess;
// Constructors
// ************
protected : GenericDtrAccess(DtrAccess*);
private : GenericDtrAccess(const GenericDtrAccess&);
private : GenericDtrAccess& operator=(const GenericDtrAccess&);
# endif
public : static void Instance(DtrAccess*);
// Destructors
// ***********
protected : virtual ~GenericDtrAccess();
// Accessors
// *********
// Updators
// ********
// Operations
// **********
# if !defined(__DOXYGEN_PROCESSOR__)
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("GenericDtrAccess");};
public: virtual string _GetString() const;
# endif
};
//END_NAMESPACE_HURRICANE
}
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::GenericDtrAccess&);
#endif // HURRICANE_GENERICDTRACCESS

View File

@ -0,0 +1,184 @@
// ****************************************************************************************************
// File: MetaTransistor.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "MetaTransistor.h"
#include "Transistor.h"
#include "Instances.h"
#include "UpdateSession.h"
#include "Vertical.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// MetaTransistor implementation
// ****************************************************************************************************
MetaTransistor::MetaTransistor(Library* library, const Name& name, char type)
// **************************************************************************
: Inherit(library, name),
_type(type),
_m(1),
_le(0.0),
_we(0.0)
{
}
MetaTransistor* MetaTransistor::Create(Library* library, const Name& name, char type)
// **********************************************************************************
{
MetaTransistor* metatransistor = new MetaTransistor(library, name, type);
metatransistor->_PostCreate();
return metatransistor;
}
void MetaTransistor::_PreDelete()
// ******************************
{
// do something
// ************
Inherit::_PreDelete();
}
void MetaTransistor::_PostCreate()
// *******************************
{
Inherit::_PostCreate();
(Net::Create(this, Name("DRAIN")))->SetExternal(true);
(Net::Create(this, Name("SOURCE")))->SetExternal(true);
(Net::Create(this, Name("GRID")))->SetExternal(true);
(Net::Create(this, Name("BULK")))->SetExternal(true);
}
void MetaTransistor::CreateConnection()
// ***********************************
{
for_each_instance(instance, this->GetInstances())
Cell * mastercell = instance->GetMasterCell();
// Assurance of unique instanciation
// *********************************
if(mastercell->_GetSlaveInstanceSet()._GetSize()!=1) {
string err_msg = "Can't create connection : " + GetString(mastercell) + " hasn't only one slave instance";
assert(err_msg.c_str());
}
instance->GetPlug(mastercell->GetNet(Name("DRAIN")))->SetNet(GetNet(Name("DRAIN")));
instance->GetPlug(mastercell->GetNet(Name("SOURCE")))->SetNet(GetNet(Name("SOURCE")));
instance->GetPlug(mastercell->GetNet(Name("GRID")))->SetNet(GetNet(Name("GRID")));
instance->GetPlug(mastercell->GetNet(Name("BULK")))->SetNet(GetNet(Name("BULK")));
end_for
}
void MetaTransistor::CreateLayout()
// ********************************
{
// OpenUpdateSession();
if((_le == 0.0) || (_we == 0.0)) {
throw Error("Can't generate layout : " + GetString(this) + " hasn't been dimensionned");
}
SetTerminal(false);
Transistor * internal_ref = NULL;
Transistor * left_ref = NULL;
Transistor * right_ref = NULL;
for_each_instance(instance, this->GetInstances())
Cell * mastercell = instance->GetMasterCell();
// Assurance of unique instanciation
// *********************************
if(mastercell->_GetSlaveInstanceSet()._GetSize()!=1) {
string err_msg = "Can't generate layout : " + GetString(mastercell) + " hasn't only one slave instance";
assert(err_msg.c_str());
}
Transistor * trans = dynamic_cast<Transistor*>(mastercell);
if(!trans){
string err_msg = "Can't genrate layout : " + GetString(mastercell) + " isn't a Transistor";
}
if(trans->IsInternal()) {
if(!internal_ref) {
trans->CreateLayout();
internal_ref = trans;
}
else {
trans->DuplicateLayout(internal_ref);
}
}
else if(trans->IsLeft()) {
if(!left_ref) {
trans->CreateLayout();
left_ref=trans;
}
else
trans->DuplicateLayout(left_ref);
}
else if(trans->IsRight()) {
if(!right_ref) {
trans->CreateLayout();
right_ref=trans;
}
else
trans->DuplicateLayout(right_ref);
}
else
trans->CreateLayout();
end_for
Materialize();
// CloseUpdateSession();
}
void MetaTransistor::Flush()
// *************************
{
OpenUpdateSession();
for_each_instance(instance, this->GetInstances())
Cell * mastercell = instance->GetMasterCell();
instance->Delete();
mastercell->Delete();
end_for
CloseUpdateSession();
}
string MetaTransistor::_GetString() const
// ***************************************
{
string s= Inherit::_GetString();
s.insert(s.length()-1, " " + GetString(GetType()) );
s.insert(s.length()-1, " " + GetString(GetM()) );
return s;
}
Record* MetaTransistor::_GetRecord() const
// ***************************************
{
Record* record = Inherit::_GetRecord();
return record;
}
END_NAMESPACE_HURRICANE

View File

@ -0,0 +1,133 @@
// ****************************************************************************************************
// File: MetaTransistor.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_METATRANSISTOR
#define HURRICANE_METATRANSISTOR
#include "Cell.h"
#include "AnalogicalCommons.h"
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class Library;
class Name;
class Symbol;
class Record;
class MetaTransistor: public Cell {
// ********************************
// Types
// *****
public : typedef Cell Inherit;
# if !defined(__DOXYGEN_PROCESSOR__)
// Logicals Attributes
// *******************
private : char _type;
private : unsigned _m;
private : Micro _le, _we; // length and width expected
private : Micro _lr, _wr; // real length and real width
private : unsigned _nSex, _nDex, nSin, _nDin, _nSsh, _nDsh;
private : Micro _dgg, _de;
private : MicroPower2 _as, _ad;
private : Micro _ps, _pd;
private : double _capaDrain, _capaGate, _capaSource;
private : double _cgb, _cgs, _cdb, _cds, _csb, _cgd;
// Behaviorals attributes
// **********************
private : double _temp, _vds, _vgs; // DC
private : double _vg, _vd, _vs, _vb;
private : char _region;
private : double _ids;
private : double _vth, _vdsat; // AC
# endif
// Constructors
// ************
# if !defined(__DOXYGEN_PROCESSOR__)
protected : MetaTransistor(Library* library, const Name& name, char type);
# endif
public : static MetaTransistor* Create(Library* library, const Name& name, char type);
# if !defined(__DOXYGEN_PROCESSOR__)
protected : virtual void _PostCreate();
// Destructors
// ***********
protected : ~MetaTransistor() {};
protected : virtual void _PreDelete();
# endif
// Operations
// **********
// Create the connection between all instances.
// ********************************************
public : void CreateConnection();
// Create the layout of all motifs in this metatransistor.
// *******************************************************
public : void CreateLayout();
# if !defined(__DOXYGEN_PROCESSOR__)
// Get all paramters after generation of Layout (capa..).
// *****************************************************
public : void GetParameterOfGeneration() { /* to do */};
// Delete all instances and all motifs in this metatransistor.
// ***********************************************************
public : void Flush();
# endif
// Accessors
// *********
public : const Micro& GetLe() const { return _le; };
public : const Micro& GetWe() const { return _we; };
public : const char GetType() const { return _type; };
public : const unsigned GetM() const { return _m; };
// Updators
// ********
public : void SetLe (const Micro le) { _le=le; };
public : void SetWe (const Micro we) { _we=we; };
public : void SetType(const char type) { _type=type; };
public : void SetM (const unsigned m) { _m=m; };
//#endif
# if !defined(__DOXYGEN_PROCESSOR__)
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("MetaTransistor");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
# endif
};
}
//END_NAMESPACE_HURRICANE
#endif // HURRICANE_METATRANSISTOR

View File

@ -0,0 +1,59 @@
// ****************************************************************************************************
// File: MetaTransistors.h
// Authors: YIFEI WU
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_METATRANSISTORS
#define HURRICANE_METATRANSISTORS
#include "Collection.h"
BEGIN_NAMESPACE_HURRICANE
class MetaTransistor;
// ****************************************************************************************************
// MetaTransistors declaration
// ****************************************************************************************************
typedef GenericCollection<MetaTransistor*> MetaTransistors;
// ****************************************************************************************************
// MetaTransistorLocator declaration
// ****************************************************************************************************
typedef GenericLocator<MetaTransistor*> MetaTransistorLocator;
// ****************************************************************************************************
// MetaTransistorFilter declaration
// ****************************************************************************************************
typedef GenericFilter<MetaTransistor*> MetaTransistorFilter;
// ****************************************************************************************************
// for_each_metatransistor declaration
// ****************************************************************************************************
#define for_each_metatransistor(metatransistor, metatransistors)\
/******************************/\
{\
MetaTransistorLocator _locator = metatransistors.GetLocator();\
while (_locator.IsValid()) {\
MetaTransistor* metatransistor = _locator.GetElement();\
_locator.Progress();
END_NAMESPACE_HURRICANE
#endif // HURRICANE_METATRANSISTORS

View File

@ -0,0 +1,72 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program 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, or (at your option)
any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
T_TABLE = 258,
T_TABLE_END = 259,
T_DOUBLE = 260,
T_ID = 261
};
#endif
/* Tokens. */
#define T_TABLE 258
#define T_TABLE_END 259
#define T_DOUBLE 260
#define T_ID 261
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 47 "/home/xtof/workspace/hurricane/src/analogic/ParserDtrGram.yy"
{ double _value;
char * _text;
}
/* Line 1489 of yacc.c. */
#line 65 "/home/xtof/workspace/hurricane/src/analogic/ParserDtrGram.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE dtrlval;

View File

@ -0,0 +1,202 @@
%{
#include <stdio.h>
#include <map>
#include <list>
#include <string>
#include "Error.h"
#include "DtrAccess.h"
using namespace Hurricane;
#include "ParserDtrGram.hpp"
extern FILE * dtrin;
extern int dtrlex(void);
extern char * dtrtext;
extern int DTRlineno;
// *************************************************************************
// Static Function&Data
// *************************************************************************
static int dtrerror( char * message)
// *********************************
{
char * str = (char*)malloc(200*sizeof(char));
sprintf(str, "ParserDtr():\n %s before %s at line %d.\n", message, dtrtext, DTRlineno);
string errmsg = str;
throw Error (errmsg);
return 0;
}
static DtrAccess * dtraccess = NULL;
static char* table_name = NULL;
static list<double> doubleList;
static list<string> stringList;
%}
%union { double _value;
char * _text;
};
%token T_TABLE T_TABLE_END T_DOUBLE T_ID
%type < _value > T_DOUBLE
%type < _text > T_ID
%start file
%%
file: lines tables
;
lines : '\n'
| lines '\n'
;
tables: table
|tables table
;
table: T_TABLE T_ID '\n'
{ table_name = $2; }
items T_TABLE_END lines
;
items: item
|items item
;
item: T_ID elems '\n'
{
string label = $1;
delete $1;
if( strcmp(table_name, "RULES")==0 ) {
if ( doubleList.empty() ) {
dtrerror("ParserDtr detect no data in a line of table RULES : Please check it");
}
list<double>::iterator i = doubleList.begin()
, j = doubleList.end();
while(i!=j) {
(dtraccess->_GetLabel2RuleMap())[label].push_back(*i);
i++;
}
}
else if( strcmp(table_name, "LAYERS")==0 ) {
if ( stringList.empty() ) {
dtrerror("ParserDtr detect no data in a line of table LAYERS : Please check it");
}
list<string>::iterator i = stringList.begin()
, j = stringList.end();
while(i!=j) {
(dtraccess->_GetLabel2LayerNameMap())[label].push_back(*i);;
i++;
}
}
else if( strcmp(table_name, "ELECTRICAL") == 0 ) {
if ( doubleList.empty() ) {
dtrerror("ParserDtr detect no data in a line of table ELECTRICAL : Please check it");
}
list<double>::iterator i = doubleList.begin()
, j = doubleList.end();
while(i!=j) {
(dtraccess->_GetLabel2ElectricalMap())[label].push_back(*i);
i++;
}
}
else if( strcmp(table_name, "MODELLING") == 0 ) {
if ( (doubleList.empty()) || (doubleList.size()!=1) ) {
dtrerror("ParserDtr detect no data or mutli datas in a line of table MODELLING: Please check it");
}
list<double>::iterator i = doubleList.begin();
(dtraccess->_GetLabel2ModellingMap())[label] = (int)(*i);
}
else if( strcmp(table_name, "SIMPLE_CAPA_MIM")==0 ) {
if( (doubleList.empty()) || (doubleList.size()!=1) ) {
dtrerror("ParserDtr detect no data or mutli datas in a line of table SIMPLE_CAPA_MIM : Please check it");
}
list<double>::iterator i = doubleList.begin();
(dtraccess->_GetLabel2SimpleCapaMimMap())[label] = (*i);
}
else {
throw Error("ParserDtr detect unknown table name " + string(table_name));
}
// Vide temporary list
// ********************
doubleList.clear();
stringList.clear();
}
| lines
;
elems: elem
|elems elem
;
elem: T_ID
{
if(!(doubleList.empty())) {
dtrerror("ParserDtr detect incompatibles datas : Please check it");
}
stringList.push_back(string($1));
delete $1;
}
| T_DOUBLE
{
if(!(stringList.empty())) {
dtrerror("ParserDtr detect incompatibles datas : Please check it");
}
doubleList.push_back($1);
}
;
%%
// *************************************************************************
// Generic Function
// *************************************************************************
void ParseDtr(const char* dtrfilename, DtrAccess* dtr)
// ***************************************************
{
dtraccess = dtr;
if((dtrin=fopen(dtrfilename, "r"))==NULL)
{
throw Error("Can't open dtr file : " + string(dtrfilename));
}
dtrparse();
}

View File

@ -0,0 +1,27 @@
%{
#include <map>
#include <vector>
#include <iostream>
using namespace std;
#include "ParserDtrGram.hpp"
#define YY_NO_UNPUT
int DTRlineno = 1;
%}
%%
([ \t]+|#.*) {/* nothing to do */}
\n { DTRlineno++; return '\n'; }
TABLE_1DM { return T_TABLE;}
END_TABLE_1DM { return T_TABLE_END;}
[1-9]?[0-9]*(\.)?[0-9]+ { dtrlval._value=atof(dtrtext); return T_DOUBLE;}
[a-zA-Z0-9]+(_?[a-zA-Z0-9]+)* {dtrlval._text=strdup(dtrtext); return T_ID;}
. { return *dtrtext; }
%%
int dtrwrap() {return 1;}

View File

@ -0,0 +1,260 @@
// ****************************************************************************************************
// File: RdsUnit.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "Error.h"
#include "stdio.h"
#include "regex.h"
#include "math.h"
#include "Commons.h"
#include "RdsUnit.h"
// ****************************************************************************************************
// Static data&function
// ****************************************************************************************************
static long RDS_UNIT = -1;
static long RDS_PHYSICAL_GRID = 2;
static long RDS_LAMBDA = -1;
// -----------------------------------------------------------------------
// Function : "GetPattern()".
/* \static char * GetPattern (const string& str, const char* pattern)
* \param str the string to check for regex.
* \param pattern the pattern to find.
*
* Get and return the march substring from str according to the pattern.
*
* \return NULL if Failure.
* \return the according substring if Success.
*/
static char* GetPattern(const string& str, const char* pattern)
// ************************************************************
{
int err;
regex_t preg;
const char *str_request = str.c_str();
const char *str_regex = pattern;
/* (1) */
err = regcomp (&preg, str_regex, REG_EXTENDED);
if (err == 0)
{
int match;
size_t nmatch = 0;
regmatch_t *pmatch = NULL;
nmatch= 1;
pmatch = (regmatch_t*)malloc (sizeof (*pmatch) * nmatch);
if (pmatch)
{
/* (2) */
match = regexec (&preg, str_request, nmatch, pmatch, 0);
/* (3) */
regfree (&preg);
/* (4) */
if (match == 0)
{
char *site = NULL;
int start = pmatch[0].rm_so;
int end = pmatch[0].rm_eo;
size_t size = end - start;
site = (char*)malloc (sizeof (*site) * (size + 1));
if (site)
{
strncpy (site, &str_request[start], size);
site[size] = '\0';
return site;
}
else {
fprintf (stderr, "Memoire insuffisante\n");
exit (EXIT_FAILURE);
}
}
/* (5) */
else if (match == REG_NOMATCH)
{
printf ("%s doesn't accord to %s\n", str_request, str_regex);
return NULL;
}
/* (6) */
else
{
char *text;
size_t size;
/* (7) */
size = regerror (err, &preg, NULL, 0);
text = (char*)malloc (sizeof (*text) * size);
if (text)
{
/* (8) */
regerror (err, &preg, text, size);
fprintf (stderr, "%s\n", text);
free (text);
}
else
{
fprintf (stderr, "Memoire insuffisante\n");
}
exit (EXIT_FAILURE);
}
}
else
{
fprintf (stderr, "Memoire insuffisante\n");
exit (EXIT_FAILURE);
}
}
else {
fprintf (stderr, "Regcomp fail\n");
exit (EXIT_FAILURE);
}
}
// -------------------------------------------------------------------
// Function : "CalculateRdsUnit()".
/* static void CalculateRdsUnit()
*
* Open rds techno file who's name is MACRO RDS_TECHNO_FILE,
* and get values technology : rds_physical_grid, rds_lambda.
* Calculate the RDS_UNIT according to these values.
*
* If RDS_TECHNO_FILE is invalid or operaton of reading values technologys
* fail, a Hurricane Error will be throwed to explain the reason of failure.
*/
static void CalculateRdsUnit()
// ***************************
{
using Hurricane::Error;
const char * rdsfilename = getenv("RDS_TECHNO_NAME");
FILE * rdstechnofile;
if(!rdsfilename) {
throw Error("Can't not find macro RDS_TECHNO_FILE");
}
if( !(rdstechnofile = fopen(rdsfilename, "r")) ) {
throw Error("Can't not open rds techno file : " + GetString(rdsfilename));
}
char buffer[80]; // For stock a line of the rds techno file
double rds_physical_grid = -0.1; // For stock value of physical_grid
double rds_lambda = -0.1; // For stock value of lamba
while(fgets(buffer, 80, rdstechnofile )!=NULL){
string tmp = buffer;
if( tmp.find("define physical_grid")!=string::npos) { // Find the ligne begin with "define physical_grid"
string pattern;
if( (pattern = GetPattern(tmp, "[[:digit:]\\.]+")).size()==0 ) { // Get the value behind
throw Error("Can't get rds_physical_grid : GetPattern(string&, char*) return NULL");
}
if(!Scan(pattern, rds_physical_grid)){ // Convert from string to double
throw Error("Can't get rds_physical_grid " + pattern + " : Hurricane::Scan(string&, double&) return false");
}
}
if( tmp.find("define lambda")!=string::npos ) {
string pattern;
if( (pattern = GetPattern(tmp, "[[:digit:]\\.]+")).size()==0 ) {
throw Error("Can't get rds_lambda : GetPattern(string&, char*) return NULL");
}
if(!Scan(pattern, rds_lambda)){
throw Error("Can't get rds_lambda " + pattern + " : Hurricane::Scan(string&, double&) return false");
}
}
// if rds_physical_grid and rds_lambda are finded, break the loop
// **************************************************************
if( (rds_physical_grid!=-0.1) && (rds_lambda!=-0.1) )
break;
} // end of while
if( (rds_physical_grid==-0.1) && (rds_lambda==-0.1) ) {
throw Error("Can't get rds_physical_grid and rds_lambda from rds techno file : \n" + string(rdsfilename));
}
long rds_physical_grid_nano = (long)rint(rds_physical_grid*(double)1000);
rds_physical_grid_nano = (long)rint( (double)1000/(double)rds_physical_grid_nano );
RDS_UNIT = rds_physical_grid_nano << 1;
long rds_lambda_nano = (long)rint( rds_lambda*(double)1000 );
RDS_LAMBDA = rds_lambda_nano * RDS_UNIT / 1000 ;
fclose(rdstechnofile);
}
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Utilitarians
// ****************************************************************************************************
const long& GetRdsUnit()
// *********************
{
if ( RDS_UNIT == -1)
CalculateRdsUnit();
return RDS_UNIT;
}
const long& GetRdsPhysicalGrid()
// *****************************
{
return RDS_PHYSICAL_GRID;
}
const long& GetRdsLambda()
// ***********************
{
if ( RDS_LAMBDA == -1)
CalculateRdsUnit();
return RDS_LAMBDA;
}
END_NAMESPACE_HURRICANE

View File

@ -0,0 +1,54 @@
// ****************************************************************************************************
// File: RdsUnit.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_RDSUNIT
#define HURRICANE_RDSUNIT
#include <math.h>
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
// ****************************************************************************************************
// Utilitarians
// ****************************************************************************************************
const long& GetRdsUnit();
const long& GetRdsPhysicalGrid();
const long& GetRdsLambda();
// ------------------------------------------------------------------------
// Function : "ConvertRealToRdsUnit(const double&)".
//
/* \inline long ConvertRealToRdsUnit(const double& value)
* \param value the value en Micro to convert to RdsUnit.
*
* Get and return the value en RdsUnit.
*
*/
inline long ConvertRealToRdsUnit(const double& value)
// *******************************************************
{
long tmp_value = (long)rint(value*GetRdsUnit());
return (tmp_value%2)==0?tmp_value:(tmp_value+1);
}
//END_NAMESPACE_HURRICANE
}
#endif // HURRICANE_RDSUNIT

View File

@ -0,0 +1,505 @@
// ****************************************************************************************************
// File: Transistor.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "AnalogicalCommons.h"
#include "Transistor.h"
#include "GenTrans.h"
#include "Vertical.h"
#include "Horizontal.h"
#include "UpdateSession.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Transistor::MaskVersion implementation
// ****************************************************************************************************
Transistor::MaskVersion::MaskVersion(const Code& code)
// *******************************************************
:_code(code)
{
}
Transistor::MaskVersion::MaskVersion(const MaskVersion& version)
// *******************************************************************
:_code(version._code)
{
}
Transistor::MaskVersion& Transistor::MaskVersion::operator=(const MaskVersion& version)
// ******************************************************************************************
{
_code = version._code;
return *this;
}
bool Transistor::MaskVersion::operator==(const MaskVersion& version) const
// ***************************************************************************
{
return _code==version._code;
}
string Transistor::MaskVersion::_GetString() const
// *************************************************
{
switch(_code) {
case VERSION1 : return "VERSION1";
}
return "ABNORMAL";
}
Record* Transistor::MaskVersion::_GetRecord() const
// **************************************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", _code));
return record;
}
// ****************************************************************************************************
// Transistor::Type implementation
// ****************************************************************************************************
Transistor::Type::Type(const Code& code)
// *************************************
:_code(code)
{
}
Transistor::Type::Type(const Type& type)
// *************************************
:_code(type._code)
{
}
Transistor::Type& Transistor::Type::operator=(const Type& type)
// ************************************************************
{
_code = type._code;
return *this;
}
string Transistor::Type::_GetString() const
// *****************************************
{
switch(_code) {
case INTERNAL : return "INTERNAL";
case LEFT : return "LEFT";
case RIGHT : return "RIGHT";
case SINGLE : return "SINGLE";
}
return "ABNORMAL";
}
Record* Transistor::Type::_GetRecord() const
// *****************************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", _code));
return record;
}
// ****************************************************************************************************
// Transistor::MaskInfo implementation
// ****************************************************************************************************
Transistor::MaskInfo::MaskInfo(const double& l, const double& w, const Type::Code& type
, const unsigned& nbDrainColumn
, const unsigned& nbSourceColumn)
// ****************************************************************************************************
: _l(l)
, _w(w)
, _type(type)
, _nbDrainColumn(nbDrainColumn)
, _nbSourceColumn(nbSourceColumn)
{};
Transistor::MaskInfo& Transistor::MaskInfo::operator=(const MaskInfo& masqueinfo)
// ************************************************************************************
{
_l = masqueinfo.GetL();
_w = masqueinfo.GetW();
_type= masqueinfo.GetType();
_nbDrainColumn = masqueinfo.GetNbDrainColumn();
_nbSourceColumn = masqueinfo.GetNbSourceColumn();
return *this;
}
void Transistor::MaskInfo::_PostCreate()
// ***************************************
{
}
void Transistor::MaskInfo::_PreDelete()
// **************************************
{
}
void Transistor::MaskInfo::Delete()
// **********************************
{
_PreDelete();
delete this;
}
bool Transistor::MaskInfo::operator==(const MaskInfo& masqueinfo)
// ******************************************************************
{
if(_l == masqueinfo.GetL() &&
_w == masqueinfo.GetW() &&
_type== masqueinfo.GetType() &&
_nbDrainColumn == masqueinfo.GetNbDrainColumn() &&
_nbSourceColumn == masqueinfo.GetNbSourceColumn()
)
return true;
return false;
}
string Transistor::MaskInfo::_GetString() const
// **********************************************
{
string s = "<" + _GetTypeName() + " "
+ GetString(_l) + " "
+ GetString(_w) + " "
+ _type._GetString() + " "
+ GetString(_nbSourceColumn) + " "
+ GetString(_nbDrainColumn)
+ ">";
return s;
}
Record* Transistor::MaskInfo::_GetRecord() const
// ***********************************************
{
Record * record = new Record(_GetString());
return record;
}
// ****************************************************************************************************
// Transistor::MaskV1Info implementation
// ****************************************************************************************************
Transistor::MaskV1Info::MaskV1Info(const double& l, const double& w, const Type::Code& type
, const unsigned& nbDrainColumn
, const unsigned& nbSourceColumn)
// ****************************************************************************************************
: Inherit(l
, w
, type
, nbDrainColumn
, nbSourceColumn
)
{}
Transistor::MaskV1Info* Transistor::MaskV1Info::Create(const double& l, const double& w
, const Type::Code& type
, const unsigned& nbDrainColumn
, const unsigned& nbSourceColumn)
// **********************************************************************************************
{
MaskV1Info* masquev1info = new MaskV1Info(l, w, type, nbDrainColumn, nbSourceColumn);
masquev1info->_PostCreate();
return masquev1info;
}
Transistor::MaskInfo& Transistor::MaskV1Info::operator=(const MaskInfo& masqueinfo)
// **************************************************************************************
{
// (*(static_cast<Inherit*>(this)))=masqueinfo;
Inherit::operator=(masqueinfo);
return *this;
}
void Transistor::MaskV1Info::_PostCreate()
// *****************************************
{
Inherit::_PostCreate();
}
void Transistor::MaskV1Info::_PreDelete()
// ****************************************
{
Inherit::_PreDelete();
}
bool Transistor::MaskV1Info::operator == (const MaskInfo& masqueinfo)
// **********************************************************************
{
//return (*(static_cast<Inherit*>(this)))==masqueinfo;
return Inherit::operator==(masqueinfo);
}
string Transistor::MaskV1Info::_GetString() const
// ************************************************
{
string s = Inherit::_GetString();
return s;
}
Record* Transistor::MaskV1Info::_GetRecord() const
// *************************************************
{
Record* record = Inherit::_GetRecord();
return record;
}
// ****************************************************************************************************
// Transistor implementation
// ****************************************************************************************************
Transistor::Transistor(Library* library, const Name& name, char type)
// *******************************************************************
: Inherit(library, name),
_type(type),
_masqueInfo(NULL),
_genTrans(NULL)
{
}
Transistor* Transistor::Create(Library* library, const Name& name, char type)
// **************************************************************************
{
Transistor* transistor = new Transistor(library, name, type);
transistor->_PostCreate();
return transistor;
}
void Transistor::_PreDelete()
// ******************************
{
// Delete aggregated objets.
// *************************
if(_masqueInfo)
_masqueInfo->Delete();
if(_genTrans)
delete _genTrans;
Inherit::_PreDelete();
}
void Transistor::_PostCreate()
// *******************************
{
Inherit::_PostCreate();
(Net::Create(this, Name("DRAIN")))->SetExternal(true);
(Net::Create(this, Name("SOURCE")))->SetExternal(true);
(Net::Create(this, Name("GRID")))->SetExternal(true);
(Net::Create(this, Name("BULK")))->SetExternal(true);
// By default, transistor's length and heigth is NULL, and is internal.
// ********************************************************************
_masqueInfo = new MaskV1Info(0.0, 0.0);
}
string Transistor::_GetString() const
// ***********************************
{
string s = Inherit::_GetString();
s.insert(s.length()-1, " " + GetString(_type));
s.insert(s.length()-1, " " + GetAbutmentType()._GetString());
return s;
}
Record* Transistor::_GetRecord() const
// ************************************
{
Record* record = Inherit::_GetRecord();
return record;
}
Transistor::MaskVersion Transistor::_GetMaskInfoVersion(MaskInfo* masqueinfo)
// ***************************************************************************************
{
if(!masqueinfo)
throw Error("Error : In Transistor::_GetMaskInfoVersion, param masqueinfo is NULL");
if(dynamic_cast<MaskV1Info*>(masqueinfo))
return MaskVersion(MaskVersion::VERSION1);
throw Error("Error : In Transistor::_GetMaskInfoVersion, can't dynamic cast param masqueinfo");
return MaskVersion(MaskVersion::VERSION1);
}
Transistor::MaskInfo* Transistor::_CreateMaskInfo(const MaskVersion& version)
// *******************************************************************************
{
switch((const MaskVersion::Code&)version) {
case MaskVersion::VERSION1 :
return MaskV1Info::Create(0.0, 0.0);
default :
throw Error ("Error : In Transistor::_CreateMaskInfoBy, unknown param version");
return NULL;
}
}
void Transistor::SetMaskInfo(MaskInfo* masqueinfo)
// ***************************************************
{
if(!masqueinfo)
throw Error("Error : In Transistor::CreateLayout : masqueinfo is NULL");
// Set new Param.
// ***************
MaskVersion newversion = _GetMaskInfoVersion(masqueinfo);
MaskVersion oldversion = _GetMaskInfoVersion(_masqueInfo);
if(newversion == oldversion) { // If they are the same version.
if((*_masqueInfo)==(*masqueinfo)) // If they are identical.
return;
else
(*_masqueInfo)=(*masqueinfo);
}
else { // If change the version.
_masqueInfo->Delete();
_masqueInfo = _CreateMaskInfo(newversion);
(*_masqueInfo) == (*masqueinfo);
}
}
void Transistor::CreateLayout()
// ****************************
{
MaskVersion version = _GetMaskInfoVersion(_masqueInfo);
MaskV1Info* masquev1info = NULL;
// Select algorithme with technology and masque version.
// *****************************************************
switch((const MaskVersion::Code&)version) {
case MaskVersion::VERSION1 :
masquev1info = dynamic_cast<MaskV1Info*>(_masqueInfo);
_genTrans = new GenV1Trans(masquev1info);
break;
default :
break;
}
SetTerminal(false);
// Launch the selected algorithme.
// ******************************
_genTrans->Calculate(this);
_genTrans->Generate(this);
Materialize();
delete _genTrans;
_genTrans = NULL;
}
void Transistor::DuplicateLayout(Transistor* transistor)
// *****************************************************
{
OpenUpdateSession();
SetTerminal(false);
Net * tmp = NULL;
Contact * con = NULL;
Segment * seg = NULL;
for_each_net(net, transistor->GetNets())
if( !( tmp=GetNet(net->GetName()) ) ) { //
tmp = Net::Create(this, net->GetName());
tmp->SetExternal(net->IsExternal());
}
for_each_component(component, net->GetComponents())
if( (con=dynamic_cast<Contact*>(component)) ){
Contact::Create(tmp, component->GetLayer(), con->GetX(), con->GetY(), con->GetWidth(), con->GetHeight());
}
else if( (seg=dynamic_cast<Vertical*>(component)) ) {
Vertical::Create(tmp, component->GetLayer(), seg->GetSourceX(), seg->GetWidth(), seg->GetSourceY(),
seg->GetTargetY());
}
else if( (seg=dynamic_cast<Horizontal*>(component)) ){
Horizontal::Create(tmp, component->GetLayer(), seg->GetSourceY(), seg->GetWidth(), seg->GetSourceX(),
seg->GetTargetX());
}
else
throw Error ("Error : In Transistor::DuplicateLayout, find illegal elem : " + GetString(component) +
"In Transistor, all component must be contact or segment" ) ;
end_for
end_for
SetAbutmentBox(transistor->GetAbutmentBox());
_mapNet2Box.clear();
map<Net*, Box>::iterator i = transistor->_GetMapNet2Box()->begin(),
j = transistor->_GetMapNet2Box()->end();
while(i!=j) {
_mapNet2Box[GetNet((*i).first->GetName())]=(*i).second;
i++;
}
Materialize();
CloseUpdateSession();
}
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::Transistor::MaskInfo& masqueinfo)
// **********************************************************
{
return masqueinfo._GetString();
}

View File

@ -0,0 +1,344 @@
// ****************************************************************************************************
// File: Transistor.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_TRANSISTOR
#define HURRICANE_TRANSISTOR
#include "Cell.h"
#include "AnalogicalCommons.h"
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class Library;
class Name;
class Symbol;
class Record;
class GenTrans;
class Transistor : public Cell {
// ********************************
//# if !defined(__DOXYGEN_PROCESSOR__)
// Types
// *****
public : typedef Cell Inherit;
public : class MaskVersion {
// ******************
public : enum Code { VERSION1=0 };
private: Code _code;
public : explicit MaskVersion(const Code& code=VERSION1);
public : MaskVersion(const MaskVersion&);
public : MaskVersion& operator=(const MaskVersion&);
public : bool operator==(const MaskVersion&) const;
public : operator const Code& () const { return _code; };
public : const Code& GetCode() const { return _code; };
public : string _GetTypeName() const { return _TName("Transistor::MaskVersion"); };
public : string _GetString() const;
public : Record* _GetRecord() const;
};
public : class Type {
// *********
public : enum Code { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3};
private: Code _code;
public : explicit Type(const Code& code=INTERNAL);
public : Type(const Type& type);
public : Type& operator=(const Type& type);
public : operator const Code&() const { return _code; };
public : void SetCode(const Code& code) { _code = code; };
public : const Code& GetCode() const { return _code; };
public : string _GetTypeName() const { return _TName("Transistor::Type"); };
public : string _GetString() const;
public : Record* _GetRecord() const;
};
public : class MaskInfo {
// ***************
// Attributs
// *********
private : double _l;
private : double _w ;
private : Type _type;
private : unsigned _nbDrainColumn;
private : unsigned _nbSourceColumn;
// Constructors
// ************
public : MaskInfo(const double& l, const double& w, const Type::Code& type=Type::INTERNAL
, const unsigned& nbDrainColumn=1
, const unsigned& nbSourceColumn=1);
public : virtual MaskInfo& operator=(const MaskInfo&);
private : MaskInfo(const MaskInfo& );
protected : virtual void _PostCreate();
// Destructors
// ***********
protected: virtual ~MaskInfo() {};
protected: virtual void _PreDelete();
public : virtual void Delete();
// Accessors
// *********
public : const double& GetL() const { return _l; };
public : const double& GetW() const { return _w; };
public : const unsigned & GetNbDrainColumn() const { return _nbDrainColumn; };
public : const unsigned & GetNbSourceColumn() const { return _nbSourceColumn; };
public : const Type& GetType() const { return _type; };
// Update
// ******
public : void SetL(const double& l) { _l=l;};
public : void SetW(const double& w) { _w=w;};
public : void SetNbDrainColumn(const unsigned& column) { _nbDrainColumn=column; };
public : void SetNbSourceColumn(const unsigned& column) { _nbSourceColumn=column; };
public : void SetType(const Type::Code& code) { _type.SetCode(code); };
public : void SetType(const Type& type) { _type = type; };
// Predicats
// *********
// Operators
// *********
public : virtual bool operator==(const MaskInfo&);
// Others
// ******
public : virtual string _GetTypeName() const =0;
public : virtual string _GetString() const;
public : virtual Record* _GetRecord() const;
};
public : class MaskV1Info : public MaskInfo {
// *************************************
// type
// *****
public : typedef MaskInfo Inherit ;
// Attributs
// *********
// Constructors
// ************
public: MaskV1Info(const double& l, const double& w, const Type::Code& type=Type::INTERNAL
, const unsigned& nbDrainColumn = 1
, const unsigned& nbSourceColumn = 1);
public: static MaskV1Info* Create(const double& l, const double& w, const Type::Code& type=Type::INTERNAL
, const unsigned& nbDrainColumn = 1
, const unsigned& nbSourceColumn = 1);
public : MaskInfo& operator=(const MaskInfo&);
protected : void _PostCreate();
// Destructor
// ***********
public : virtual ~MaskV1Info() {};
protected: void _PreDelete();
// Operators
// *********
public : bool operator==(const MaskInfo&);
// Others
// *********
public : virtual string _GetTypeName() const { return _TName("Transistor::MaskV1Info"); };
public : virtual string _GetString() const;
public : virtual Record* _GetRecord() const;
};
# if !defined(__DOXYGEN_PROCESSOR__)
// Attributes
// *******************
private : char _type;
private : MaskInfo* _masqueInfo;
private : GenTrans * _genTrans;
//public : RealInfo * _realInfo;
private : map<Net*, Box> _mapNet2Box; // This Map Is For localize The Position Of Routing.
# endif
// Constructors
// ************
# if !defined(__DOXYGEN_PROCESSOR__)
protected : Transistor(Library* library, const Name& name, char type);
# endif
public : static Transistor* Create(Library* library, const Name& name, char type);
# if !defined(__DOXYGEN_PROCESSOR__)
protected : virtual void _PostCreate();
// Destructors
// ***********
protected : ~Transistor() {};
protected : virtual void _PreDelete();
# endif
// Accessors
// *********
public : char GetType() const { return _type; };
public : MaskVersion GetMaskVersion() const { return _GetMaskInfoVersion(_masqueInfo); };
public : const MaskInfo* GetMaskInfo() const { return _masqueInfo; };
public : const double& GetL() const { return _masqueInfo->GetL(); };
public : const double& GetW() const { return _masqueInfo->GetW(); };
public : const unsigned& GetNbDrainColumn() const { return _masqueInfo->GetNbDrainColumn(); };
public : const unsigned& GetNbSourceColumn() const { return _masqueInfo->GetNbSourceColumn(); };
public : const char* GetDrainName() const { return "DRAIN"; };
public : const char* GetSourceName() const { return "SOURCE"; };
public : const char* GetGridName() const { return "GRID"; };
public : Net* GetDrain() const { return GetNet(GetDrainName()); };
public : Net* GetSource() const { return GetNet(GetSourceName()); };
public : Net* GetGrid() const { return GetNet(GetGridName()); };
public : const Type& GetAbutmentType() const { return _masqueInfo->GetType(); };
// Predicats
// *********
public : bool IsNmos() const { return _type==TRANSN; };
public : bool IsPmos() const { return _type==TRANSP; };
public : bool IsInternal() const { return GetAbutmentType().GetCode()==Type::INTERNAL; };
public : bool IsLeft() const { return GetAbutmentType().GetCode()==Type::LEFT; };
public : bool IsRight() const { return GetAbutmentType().GetCode()==Type::RIGHT; };
public : bool IsSingle() const { return GetAbutmentType().GetCode()==Type::SINGLE; };
// Updators
// ********
public : void SetL(const double& l) { _masqueInfo->SetL(l); };
public : void SetW(const double& w) { _masqueInfo->SetW(w); };
//# endif
# if !defined(__DOXYGEN_PROCESSOR__)
// Others
// ******
public : virtual string _GetTypeName() const {return _TName("Transistor");};
public : virtual string _GetString() const;
public : virtual Record* _GetRecord() const;
public : const GenTrans* _GetGenTrans() const {return _genTrans; };
public : static MaskVersion _GetMaskInfoVersion(MaskInfo*) ;
public : static MaskInfo* _CreateMaskInfo(const MaskVersion&) ;
public : map<Net*, Box>* _GetMapNet2Box() { return &_mapNet2Box; };
# endif
// Operators
// *********
public : void SetMaskInfo(MaskInfo*);
public : void CreateLayout();
public : void DuplicateLayout(Transistor* transistor) ;
};
# if !defined(__DOXYGEN_PROCESSOR__)
// -------------------------------------------------------------------
// Class : "Proxy...<const Transistor::MaskVersion::Code*>".
template<>
inline string ProxyTypeName<Transistor::MaskVersion::Code>
( const Transistor::MaskVersion::Code* object )
{ return "<PointerSlotAdapter<Transistor::MaskVersion::Code>>"; }
template<>
inline string ProxyString <Transistor::MaskVersion::Code>
( const Transistor::MaskVersion::Code* object )
{
switch ( *object ) {
case Transistor::MaskVersion::VERSION1: return "VERSION1";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Transistor::MaskVersion::Code>
( const Transistor::MaskVersion::Code* object )
{
Record* record = new Record(GetString(object));
record->Add(GetSlot("Code", (unsigned int*)object));
return record;
}
// -------------------------------------------------------------------
// Class : "Proxy...<const Transistor::Type::Code*>".
template<>
inline string ProxyTypeName<Transistor::Type::Code>
( const Transistor::Type::Code* object )
{ return "<PointerSlotAdapter<Transistor::Type::Code>>"; }
template<>
inline string ProxyString <Transistor::Type::Code>
( const Transistor::Type::Code* object )
{
switch ( *object ) {
case Transistor::Type::LEFT : return "LEFT";
case Transistor::Type::SINGLE: return "SINGLE";
case Transistor::Type::RIGHT: return "RIGHT";
case Transistor::Type::INTERNAL: return "INTERNAL";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Transistor::Type::Code>
( const Transistor::Type::Code* object )
{
Record* record = new Record(GetString(object));
record->Add(GetSlot("Code", (unsigned int*)object));
return record;
}
# endif
}
//END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::Transistor::MaskInfo&);
#endif // HURRICANE_TRANSISTOR

View File

@ -0,0 +1,59 @@
// ****************************************************************************************************
// File: Transistors.h
// Authors: YIFEI WU
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_TRANSISTORS
#define HURRICANE_TRANSISTORS
#include "Collection.h"
BEGIN_NAMESPACE_HURRICANE
class Transistor;
// ****************************************************************************************************
// Transistors declaration
// ****************************************************************************************************
typedef GenericCollection<Transistor*> Transistors;
// ****************************************************************************************************
// TransistorLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Transistor*> TransistorLocator;
// ****************************************************************************************************
// TransistorFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Transistor*> TransistorFilter;
// ****************************************************************************************************
// for_each_transistor declaration
// ****************************************************************************************************
#define for_each_transistor(transistor, transistors)\
/******************************/\
{\
TransistorLocator _locator = transistors.GetLocator();\
while (_locator.IsValid()) {\
Transistor* transistor = _locator.GetElement();\
_locator.Progress();
END_NAMESPACE_HURRICANE
#endif // HURRICANE_TRANSISTORS

View File

@ -0,0 +1,123 @@
// **************************************************************
// TwoSpaces.cpp
// Author : Wu YiFei
// Date : 12/04/2007
// ***************************************************************
#include "TwoSpaces.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Two Spaces definition.
// ****************************************************************************************************
TwoSpaces::TwoSpaces(const string& s)
// *********************************
: _s(s)
,_n(1)
{
}
TwoSpaces::TwoSpaces(const TwoSpaces& ts)
// **************************************
: _s(ts._s)
,_n(ts._n)
{
}
TwoSpaces& TwoSpaces::operator=(const TwoSpaces& ts)
// ************************************************
{
_s = ts._s;
_n = ts._n;
return *this;
}
TwoSpaces& TwoSpaces::operator++()
// *******************************
{
if(_n<100) _n++;
return *this;
}
TwoSpaces TwoSpaces::operator++(int)
// *********************************
{
TwoSpaces ts = *this;
if(_n<100) _n++;
return ts;
}
TwoSpaces& TwoSpaces::operator--()
// *******************************
{
if(_n>1) _n--;
return *this;
}
TwoSpaces TwoSpaces::operator--(int)
// *********************************
{
TwoSpaces ts = *this;
if(_n>1) _n--;
return ts;
}
TwoSpaces TwoSpaces::operator+(int count)
// **************************************
{
TwoSpaces ts = *this;
if( (_n+count) <= 100 ) ts._n = _n + count;
return ts;
}
TwoSpaces TwoSpaces::operator-(int count)
// **************************************
{
TwoSpaces ts = *this;
if ( (_n - count) >= 1 ) ts._n = _n - count;
return ts;
}
string TwoSpaces::_GetString() const
// *********************************
{
string s;
unsigned n = _n;
while(n--) {
s += _s;
}
return s;
}
// ****************************************************************************************************
// Variables definition.
// ****************************************************************************************************
TwoSpaces ts(" ");
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::TwoSpaces& ts)
// ***********************************
{
return ts._GetString();
}

View File

@ -0,0 +1,72 @@
// **************************************************************
// TwoSpaces.h
// Author : Wu YiFei
// Date : 12/04/2007
// ***************************************************************
# ifndef HURRICANE_TWOSPACES
# define HURRICANE_TWOSPACES
# include "Commons.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// TwoSpaces declaration.
// ****************************************************************************************************
class TwoSpaces {
// ***************
// Attributes
// **********
private : string _s;
private : unsigned _n;
// Constructors
// *************
public : TwoSpaces(const string& s = " ");
public : TwoSpaces(const TwoSpaces&);
// Destructors
// ***********
public : ~TwoSpaces(){};
// Operators
// *********
public : TwoSpaces& operator=(const TwoSpaces&);
public : TwoSpaces& operator++();
public : TwoSpaces operator++(int);
public : TwoSpaces& operator--();
public : TwoSpaces operator--(int);
public : TwoSpaces operator+(int);
public : TwoSpaces operator-(int);
// Others
// ******
public : string _GetString() const ;
};
// ****************************************************************************************************
// Variables declaration.
// ****************************************************************************************************
extern TwoSpaces ts;
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::TwoSpaces&);
inline ostream& operator<<(ostream& stream, const H::TwoSpaces& ts)
// ****************************************************************
{
return stream<< GetString(ts);
}
# endif // END HURRICANE_TWOSPACES

View File

@ -0,0 +1,162 @@
# - Find bison executable and provides macros to generate custom build rules
# The module defined the following variables:
# BISON_EXECUTABLE - path to the bison program
# BISON_VERSION - version of bison
# BISON_FOUND - true if the program was found
# If bison is found, the module defines the macros:
# BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>]
# [COMPILE_FLAGS <string>])
# which will create a custom rule to generate a parser. <YaccInput> is
# the path to a yacc file. <CodeOutput> is the name of the source file
# generated by bison. A header file is also be generated, and contains
# the token list. If COMPILE_FLAGS option is specified, the next
# parameter is added in the bison command line. if VERBOSE option is
# specified, <file> is created and contains verbose descriptions of the
# grammar and parser. The macro defines a set of variables:
# BISON_${Name}_DEFINED - true is the macro ran successfully
# BISON_${Name}_INPUT - The input source file, an alias for <YaccInput>
# BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison
# BISON_${Name}_OUTPUT_HEADER - The header file generated by bison
# BISON_${Name}_OUTPUTS - The sources files generated by bison
# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line
#
# Example:
# FIND_PACKAGE(BISON)
# BISON_TARGET(MyParser parser.y ${PROJECT_BINARY_DIR}/parser.cpp)
# ADD_EXECUTABLE(Foo main.cpp ${BISON_MyParser_OUTPUTS})
#
# Copyright (c) 2006, Tristan Carel
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the University of California, Berkeley nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# $Id: FindBISON.cmake 1218 2007-03-22 22:10:45Z jmh $
SET(BISON_FOUND FALSE)
FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
MARK_AS_ADVANCED(BISON_EXECUTABLE)
IF(BISON_EXECUTABLE)
SET(BISON_FOUND TRUE)
EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
OUTPUT_VARIABLE BISON_version_output
ERROR_VARIABLE BISON_version_error
RESULT_VARIABLE BISON_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${BISON_version_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
ELSE(NOT ${BISON_version_result} EQUAL 0)
STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
BISON_VERSION "${BISON_version_output}")
ENDIF(NOT ${BISON_version_result} EQUAL 0)
# internal macro
MACRO(BISON_TARGET_option_verbose Name BisonOutput filename)
LIST(APPEND BISON_TARGET_cmdopt "--verbose")
GET_FILENAME_COMPONENT(BISON_TARGET_output_path "${BisonOutput}" PATH)
GET_FILENAME_COMPONENT(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
ADD_CUSTOM_COMMAND(OUTPUT ${filename}
COMMAND ${CMAKE_COMMAND} -E copy
"${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
"${filename}"
DEPENDS
"${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
SET(BISON_${Name}_VERBOSE_FILE ${filename})
LIST(APPEND BISON_TARGET_extraoutputs
"${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
ENDMACRO(BISON_TARGET_option_verbose)
# internal macro
MACRO(BISON_TARGET_option_extraopts Options)
SET(BISON_TARGET_extraopts "${Options}")
SEPARATE_ARGUMENTS(BISON_TARGET_extraopts)
LIST(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
ENDMACRO(BISON_TARGET_option_extraopts)
MACRO(BISON_TARGET Name BisonInput BisonOutput)
SET(BISON_TARGET_output_header "")
SET(BISON_TARGET_command_opt "")
SET(BISON_TARGET_outputs "${BisonOutput}")
IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
MESSAGE(SEND_ERROR "Usage")
ELSE(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
# Parsing parameters
IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
IF("${ARGV3}" STREQUAL "VERBOSE")
BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}")
ENDIF("${ARGV3}" STREQUAL "VERBOSE")
IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
BISON_TARGET_option_extraopts("${ARGV4}")
ENDIF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
ENDIF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
IF(${ARGC} EQUAL 7)
IF("${ARGV5}" STREQUAL "VERBOSE")
BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
ENDIF("${ARGV5}" STREQUAL "VERBOSE")
IF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
BISON_TARGET_option_extraopts("${ARGV6}")
ENDIF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
ENDIF(${ARGC} EQUAL 7)
# Header's name generated by bison (see option -d)
LIST(APPEND BISON_TARGET_cmdopt "-d")
STRING(REGEX REPLACE "^(.*)\\.c([^.]*)$" "\\1.h\\2"
BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
DEPENDS ${ARGV1}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# define target variables
SET(BISON_${Name}_DEFINED TRUE)
SET(BISON_${Name}_INPUT ${ARGV1})
SET(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
SET(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
SET(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
ENDMACRO(BISON_TARGET)
ENDIF(BISON_EXECUTABLE)
IF(NOT BISON_FOUND)
IF(NOT BISON_FIND_QUIETLY)
MESSAGE(STATUS "BISON was not found.")
ELSE(NOT BISON_FIND_QUIETLY)
IF(BISON_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "BISON was not found.")
ENDIF(BISON_FIND_REQUIRED)
ENDIF(NOT BISON_FIND_QUIETLY)
ENDIF(NOT BISON_FOUND)
# FindBISON.cmake ends here

View File

@ -0,0 +1,134 @@
# - Find flex executable and provides a macro to generate custom build rules
# The module defines the following variables:
# FLEX_FOUND - true is flex executable is found
# FLEX_VERSION - the version of flex
# If flex is found on the system, the module provides the macro:
# FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>])
# which creates a custom command to generate the <FlexOutput> file from
# the <FlexInput> file. If COMPILE_FLAGS option is specified, the next
# parameter is added to the flex command line. Name is an alias used to
# get details of this custom command. Indeed the macro defines the
# following variables:
# FLEX_${Name}_DEFINED - true is the macro ran successfully
# FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
# alias for FlexOutput
# FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
#
# Flex scanners oftenly use tokens defined by Bison: the code generated
# by Flex depends of the header generated by Bison. This module also
# defines a macro:
# ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
# which adds the required dependency between a scanner and a parser
# where <FlexTarget> and <BisonTarget> are the first parameters of
# respectively FLEX_TARGET and BISON_TARGET macros.
#
# Example:
# FIND_PACKAGE(BISON)
# FIND_PACKAGE(FLEX)
# BISON_TARGET(MyParser parser.y ${PROJECT_BINARY_DIR}/parser.cpp
# FLEX_TARGET(MyScanner lexer.l ${PROJECT_BINARY_DIR}/lexer.cpp)
# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
#
# Copyright (c) 2006, Tristan Carel
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the University of California, Berkeley nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# $Id: FindFLEX.cmake 1218 2007-03-22 22:10:45Z jmh $
SET(FLEX_FOUND FALSE)
FIND_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable")
MARK_AS_ADVANCED(FLEX_EXECUTABLE)
FIND_LIBRARY(FL_LIBRARY NAMES fl
PATHS /usr/lib DOC "path to the fl library")
SET(FLEX_LIBRARIES ${FL_LIBRARY})
IF(FLEX_EXECUTABLE)
SET(FLEX_FOUND TRUE)
EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
OUTPUT_VARIABLE FLEX_version_output
ERROR_VARIABLE FLEX_version_error
RESULT_VARIABLE FLEX_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${FLEX_version_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_error}")
ELSE(NOT ${FLEX_version_result} EQUAL 0)
STRING(REGEX REPLACE "^flex (.*)$" "\\1"
FLEX_VERSION "${FLEX_version_output}")
ENDIF(NOT ${FLEX_version_result} EQUAL 0)
MACRO(FLEX_TARGET Name Input Output)
SET(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
IF(${ARGC} GREATER 3)
IF(${ARGC} EQUAL 5)
IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
SET(FLEX_EXECUTABLE_opts "${ARGV4}")
SEPARATE_ARGUMENTS(FLEX_EXECUTABLE_opts)
ELSE("${ARGV3}" STREQUAL "COMPILE_FLAGS")
MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
ENDIF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
ELSE(${ARGC} EQUAL 5)
MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
ENDIF(${ARGC} EQUAL 5)
ENDIF(${ARGC} GREATER 3)
ADD_CUSTOM_COMMAND(OUTPUT ${Output}
COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
DEPENDS ${Input}
COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
SET(FLEX_${Name}_DEFINED TRUE)
SET(FLEX_${Name}_OUTPUTS ${Output})
SET(FLEX_${Name}_INPUT ${Input})
SET(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
ENDMACRO(FLEX_TARGET)
MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
IF(NOT FLEX_${FlexTarget}_TARGET)
MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
ENDIF(NOT FLEX_${FlexTarget}_TARGET)
IF(NOT BISON_${BisonTarget}_TARGET)
MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
ENDIF(NOT BISON_${BisonTarget}_TARGET)
SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUT}
PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER})
ENDMACRO(ADD_FLEX_BISON_DEPENDENCY)
ENDIF(FLEX_EXECUTABLE)
IF(NOT FLEX_FOUND)
IF(NOT FLEX_FIND_QUIETLY)
MESSAGE(STATUS "FLEX was not found.")
ELSE(NOT FLEX_FIND_QUIETLY)
IF(FLEX_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "FLEX was not found.")
ENDIF(FLEX_FIND_REQUIRED)
ENDIF(NOT FLEX_FIND_QUIETLY)
ENDIF(NOT FLEX_FOUND)
# FindFLEX.cmake ends here

View File

@ -0,0 +1,11 @@
include(${QT_USE_FILE})
include_directories(${HURRICANE_SOURCE_DIR}/hurricane)
set(includes CellFigure.h InstanceFigure.h SliceFigure.h GoFigure.h SegmentFigure.h)
set(cpps CellFigure.cpp InstanceFigure.cpp SliceFigure.cpp GoFigure.cpp SegmentFigure.cpp)
add_library(hurricanefigs SHARED ${cpps})
install(FILES ${includes} DESTINATION /include/hurricane)
install(TARGETS hurricanefigs DESTINATION /lib)

View File

@ -0,0 +1,81 @@
#include <math.h>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include "InstanceFigure.h"
#include "SliceFigure.h"
#include "Utils.h"
#include "CellFigure.h"
CellFigure::CellFigure(Cell* c):
QGraphicsItem(),
cell(c) {
QTransform transform;
transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
setTransform(transform);
for_each_instance(instance, cell->GetInstances()) {
new InstanceFigure(this, instance);
end_for;
}
for_each_slice(slice, cell->GetSlices()) {
new SliceFigure(this, slice);
end_for;
}
}
CellFigure::CellFigure(InstanceFigure* master, Cell* c) : QGraphicsItem(master), cell(c) {
for_each_instance(instance, cell->GetInstances()) {
new InstanceFigure(this, instance);
end_for;
}
for_each_slice(slice, cell->GetSlices()) {
new SliceFigure(this, slice);
end_for;
}
}
QRectF CellFigure::boundingRect() const {
Box box = cell->GetBoundingBox();
QRectF rect;
BoxToRectangle(box, rect);
rect = transform().mapRect(rect);
return rect;
}
void CellFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem* option, QWidget *) {
// QPen pen(Qt::blue);
// pen.setWidth(10);
// painter->setPen(pen);
// painter->drawLine(0, 0, 50, 0);
//
// painter->drawLine(0, 0, 0, 50);
// pen.setColor(Qt::red);
// painter->setPen(pen);
painter->setClipRect(option->exposedRect);
if (option->levelOfDetail > 1.0) {
drawBoundary(painter);
} else {
drawPhantom(painter);
}
}
void CellFigure::drawBoundary(QPainter* painter) {
QPen pen(Qt::black);
painter->setPen(pen);
Box box = cell->GetAbutmentBox();
QRectF rect;
BoxToRectangle(box, rect);
painter->drawRect(rect);
}
void CellFigure::drawPhantom(QPainter* painter) {
painter->setBrush(Qt::red);
Box box = cell->GetAbutmentBox();
QRectF rect;
BoxToRectangle(box, rect);
painter->drawRect(rect);
}

View File

@ -0,0 +1,27 @@
#ifndef __CELL_FIGURE_H
#define __CELL_FIGURE_H
#include <QGraphicsItem>
#include <QObject>
#include "Cell.h"
using namespace Hurricane;
class InstanceFigure;
class CellFigure : public QGraphicsItem {
public:
CellFigure(Cell* cell);
CellFigure(InstanceFigure* master, Cell* cell);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
private:
Cell* cell;
void drawBoundary(QPainter* painter);
void drawPhantom(QPainter* painter);
};
#endif /* __CELL_FIGURE_H */

View File

@ -0,0 +1,19 @@
#include <math.h>
#include <QPainter>
#include "SliceFigure.h"
#include "Utils.h"
#include "GoFigure.h"
GoFigure::GoFigure(SliceFigure* master):
QGraphicsItem(master)
{}
QRectF GoFigure::boundingRect() const {
Box box = getGo()->GetBoundingBox();
QRectF rect;
BoxToRectangle(box, rect);
return rect;
}

View File

@ -0,0 +1,20 @@
#ifndef __GO_FIGURE_H
#define __GO_FIGURE_H
#include <QGraphicsItem>
#include <QObject>
#include "Go.h"
using namespace H;
class SliceFigure;
class GoFigure : public QGraphicsItem {
public:
GoFigure(SliceFigure* parent);
QRectF boundingRect() const;
protected:
virtual Go* getGo() const = 0;
};
#endif /* __GO_FIGURE_H */

View File

@ -0,0 +1,30 @@
#include <QPainter>
#include <QTransform>
#include "Utils.h"
#include "InstanceFigure.h"
InstanceFigure::InstanceFigure(CellFigure* parent, Instance* inst):
QGraphicsItem(parent),
instance(inst) {
Cell* masterCell = inst->GetMasterCell();
Transformation transformation = instance->GetTransformation();
QTransform transform;
QPoint pos;
HurricanePositionToQtPosition(transformation, transform, pos);
setTransform(transform);
setPos(pos);
new CellFigure(this, masterCell);
}
QRectF InstanceFigure::boundingRect() const {
Cell* masterCell = instance->GetMasterCell();
Box box = masterCell->GetAbutmentBox();
QRectF rect;
BoxToRectangle(box, rect);
return rect;
}
void InstanceFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{}

View File

@ -0,0 +1,24 @@
#ifndef __INSTANCE_FIGURE_H
#define __INSTANCE_FIGURE_H
#include <QGraphicsItem>
#include <QObject>
#include "CellFigure.h"
#include "Instance.h"
using namespace Hurricane;
class InstanceFigure : public QGraphicsItem {
public:
InstanceFigure(CellFigure* parent, Instance* instance);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
private:
Instance* instance;
};
#endif /* __INSTANCE_FIGURE_H */

View File

@ -0,0 +1,31 @@
#include <math.h>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include "BasicLayer.h"
using namespace H;
#include "Utils.h"
#include "SegmentFigure.h"
SegmentFigure::SegmentFigure(SliceFigure* master, Segment* s):
GoFigure(master),
segment(s)
{}
void SegmentFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
if (option->levelOfDetail < 1.0) {
painter->setClipRect(option->exposedRect);
BasicLayer* layer = dynamic_cast<BasicLayer*>(segment->GetLayer());
if (layer) {
painter->setBrush(QColor(layer->GetRedValue(), layer->GetGreenValue(), layer->GetBlueValue()));
} else {
painter->setBrush(Qt::blue);
}
Box box = segment->GetBoundingBox();
QRectF rect;
BoxToRectangle(box, rect);
painter->drawRect(rect);
}
}

View File

@ -0,0 +1,23 @@
#ifndef __SEGMENT_FIGURE_H
#define __SEGMENT_FIGURE_H
#include <QGraphicsItem>
#include <QObject>
#include "GoFigure.h"
#include "Segment.h"
using namespace Hurricane;
class SegmentFigure : public GoFigure {
public:
SegmentFigure(SliceFigure* parent, Segment* segment);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
Segment* segment;
protected:
Go* getGo() const { return segment; }
};
#endif /* __SEGMENT_FIGURE_H */

View File

@ -0,0 +1,53 @@
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include "BasicLayer.h"
using namespace H;
#include "SegmentFigure.h"
#include "Utils.h"
#include "SliceFigure.h"
SliceFigure::SliceFigure(CellFigure* parent, Slice* sli):
QGraphicsItem(parent),
slice(sli)
{
// constructGoFigures();
}
QRectF SliceFigure::boundingRect() const {
Box box = slice->GetBoundingBox();
return QRectF(box.GetXMin(), box.GetXMax(), box.GetYMin(), box.GetYMax());
}
void SliceFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
if (option->levelOfDetail > 1.0) {
// painter->setClipRect(option->exposedRect);
BasicLayer* layer = dynamic_cast<BasicLayer*>(slice->GetLayer());
if (layer) {
painter->setBrush(QColor(layer->GetRedValue(), layer->GetGreenValue(), layer->GetBlueValue()));
} else {
painter->setBrush(Qt::blue);
}
for_each_go(go, slice->GetGos()) {
Segment* segment = dynamic_cast<Segment*>(go);
if (segment) {
Box box = segment->GetBoundingBox();
QRectF rect;
BoxToRectangle(box, rect);
painter->drawRect(rect);
}
end_for;
}
}
}
void SliceFigure::constructGoFigures() {
for_each_go(go, slice->GetGos()) {
Segment* segment = dynamic_cast<Segment*>(go);
if (segment) {
new SegmentFigure(this, segment);
}
end_for;
}
}

View File

@ -0,0 +1,24 @@
#ifndef __SLICE_FIGURE_H
#define __SLICE_FIGURE_H
#include <QGraphicsItem>
#include <QObject>
#include "CellFigure.h"
#include "Slice.h"
using namespace Hurricane;
class SliceFigure : public QGraphicsItem {
public:
SliceFigure(CellFigure* parent, Slice* slice);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
private:
Slice* slice;
void constructGoFigures();
};
#endif /* __SLICE_FIGURE_H */

View File

@ -0,0 +1,44 @@
#ifndef __UTILS_H
#define __UTILS_H
#include <QRectF>
#include <QTransform>
#include "Box.h"
#include "Transformation.h"
using namespace H;
inline void BoxToRectangle(const Box& box, QRectF& rec) {
double xmin = GetValue(box.GetXMin());
double xmax = GetValue(box.GetXMax());
double ymin = GetValue(box.GetYMin());
double ymax = GetValue(box.GetYMax());
rec.setCoords(xmin, ymin, xmax, ymax);
}
inline void HurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) {
double tx = GetValue(transformation.GetTx());
double ty = GetValue(transformation.GetTy());
position.setX((int)tx);
position.setY((int)ty);
switch (transformation.GetOrientation()) {
case Transformation::Orientation::ID:
transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::MX:
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::MY:
transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
break;
case Transformation::Orientation::R2:
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
break;
default:
break;
}
}
#endif /* __UTILS_H */

View File

@ -1 +0,0 @@
test

View File

@ -0,0 +1,462 @@
// ****************************************************************************************************
// File: BasicLayer.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "BasicLayer.h"
#include "Technology.h"
#include "CompositeLayer.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// BasicLayer_BasicLayers declaration
// ****************************************************************************************************
class BasicLayer_BasicLayers : public Collection<BasicLayer*> {
// **********************************************************
// Types
// *****
public: typedef Collection<BasicLayer*> Inherit;
public: class Locator : public Hurricane::Locator<BasicLayer*> {
// ***********************************************************
public: typedef Hurricane::Locator<BasicLayer*> Inherit;
private: const BasicLayer* _basicLayer;
public: Locator(const BasicLayer* basicLayer = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual BasicLayer* GetElement() const;
public: virtual Hurricane::Locator<BasicLayer*>* GetClone() const;
public: virtual bool IsValid() const;
public: virtual void Progress();
public: virtual string _GetString() const;
};
// Atributes
// *********
private: const BasicLayer* _basicLayer;
// Constructors
// ************
public: BasicLayer_BasicLayers(const BasicLayer* basicLayer = NULL);
public: BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers);
// Operators
// *********
public: BasicLayer_BasicLayers& operator=(const BasicLayer_BasicLayers& basicLayers);
// Accessors
// *********
public: virtual Collection<BasicLayer*>* GetClone() const;
public: virtual Hurricane::Locator<BasicLayer*>* GetLocator() const;
// Others
// ******
public: virtual string _GetString() const;
};
// ****************************************************************************************************
// BasicLayer implementation
// ****************************************************************************************************
BasicLayer::BasicLayer(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize, const Unit& minimalSpacing)
// ****************************************************************************************************
: Inherit(technology, name, minimalSize, minimalSpacing),
_type(type),
_extractNumber(extractNumber),
_redValue(255),
_greenValue(255),
_blueValue(255),
_fillPattern("FFFFFFFFFFFFFFFF"),
_displayThreshold(0.0)
{
}
BasicLayer* BasicLayer::Create(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize, const Unit& minimalSpacing)
// ****************************************************************************************************
{
BasicLayer* basicLayer =
new BasicLayer(technology, name, type, extractNumber, minimalSize, minimalSpacing);
basicLayer->_PostCreate();
return basicLayer;
}
BasicLayers BasicLayer::GetBasicLayers() const
// *******************************************
{
return BasicLayer_BasicLayers(this);
}
void BasicLayer::SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue)
// ****************************************************************************************************
{
if ((redValue != _redValue) || (greenValue != _greenValue) || (blueValue != _blueValue)) {
_redValue = redValue;
_greenValue = greenValue;
_blueValue = blueValue;
//if (_drawGC) {
// gdk_gc_destroy(_drawGC);
// _drawGC = NULL;
//}
//if (_fillGC) {
// gdk_gc_destroy(_fillGC);
// _fillGC = NULL;
//}
}
}
void BasicLayer::SetFillPattern(const string& fillPattern)
// *******************************************************
{
if (fillPattern != _fillPattern) {
if (fillPattern.size() != 16)
throw Error("Can't set fill pattern (bad value)");
string validChars = "0123456789ABCDEFabcdef";
for (unsigned i = 0; i < 16; i++) {
if (validChars.find(fillPattern[i]) == string::npos)
throw Error("Can't set fill pattern (bad value)");
}
_fillPattern = fillPattern;
//if (_drawGC) {
// gdk_gc_destroy(_drawGC);
// _drawGC = NULL;
//}
//if (_fillGC) {
// gdk_gc_destroy(_fillGC);
// _fillGC = NULL;
//}
}
}
void BasicLayer::_PostCreate()
// ***************************
{
Mask basicLayersMask = 0;
for_each_basic_layer(basicLayer, GetTechnology()->GetBasicLayers()) {
basicLayersMask |= basicLayer->GetMask();
end_for;
}
Mask mask = 1;
while (mask && (mask & basicLayersMask)) mask = mask<<1;
if (!mask)
throw Error("Can't create " + _TName("BasicLayer") + " : mask capacity overflow");
_SetMask(mask);
if (_extractNumber) {
Mask extractMask = (1 << _extractNumber);
if (!extractMask)
throw Error("Can't create " + _TName("BasicLayer") + " : extract mask capacity overflow");
_SetExtractMask(extractMask);
}
Inherit::_PostCreate();
}
void BasicLayer::_PreDelete()
// **************************
{
Inherit::_PreDelete();
//if (_drawGC) gdk_gc_destroy(_drawGC);
//if (_fillGC) gdk_gc_destroy(_fillGC);
CompositeLayers compositeLayers = GetTechnology()->GetCompositeLayers();
for_each_composite_layer(compositeLayer, compositeLayers) {
if (compositeLayer->Contains(this)) compositeLayer->Remove(this);
end_for;
}
}
string BasicLayer::_GetString() const
// **********************************
{
string s = Inherit::_GetString();
// s.insert(s.length() - 1, " " + GetString(_type));
return s;
}
Record* BasicLayer::_GetRecord() const
// *****************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Type", &_type));
record->Add(GetSlot("RedValue", &_redValue));
record->Add(GetSlot("GreenValue", &_greenValue));
record->Add(GetSlot("BlueValue", &_blueValue));
record->Add(GetSlot("FillPattern", &_fillPattern));
record->Add(GetSlot("DisplayThreshold", &_displayThreshold));
}
return record;
}
//GdkGC* BasicLayer::_GetDrawGC()
//// ****************************
//{
// if (!_drawGC) _drawGC = gtk_gc_new(_redValue, _greenValue, _blueValue);
//
// return _drawGC;
//}
//
//GdkGC* BasicLayer::_GetFillGC()
//// ****************************
//{
// if (!_fillGC) _fillGC = gtk_gc_new(_redValue, _greenValue, _blueValue, _fillPattern);
//
// return _fillGC;
//}
//
//void BasicLayer::_Fill(View* view, const Box& box) const
//// *****************************************************
//{
// switch (_type) {
// case Type::CONTACT : {
//
// Unit minimalSize = GetMinimalSize();
// Unit minimalSpacing = GetMinimalSpacing();
//
// if ((minimalSize <= 0) || (minimalSpacing <= 0))
// view->FillRectangle(box);
// else {
// view->DrawRectangle(box);
//
// Unit width = box.GetWidth();
// Unit height = box.GetHeight();
// Unit offset = minimalSize + minimalSpacing;
//
// int nx = (int)(GetValue(width) / GetValue(offset));
// int ny = (int)(GetValue(height) / GetValue(offset));
//
// Unit dx = (width - (minimalSize + (offset * nx))) / 2;
// Unit dy = (height - (minimalSize + (offset * ny))) / 2;
//
// if (dx < 0) dx = (width - (minimalSize + (offset * (--nx)))) / 2;
// if (dy < 0) dy = (height - (minimalSize + (offset * (--ny)))) / 2;
//
// Unit xmin = box.GetXMin() + dx;
// Unit ymin = box.GetYMin() + dy;
// Unit xmax = box.GetXMax() - dx;
// Unit ymax = box.GetYMax() - dy;
//
// if ((xmin < xmax) && (ymin < ymax)) {
// Unit y = ymin;
// do {
// Unit x = xmin;
// do {
// view->FillRectangle(x, y, x + minimalSize, y + minimalSize, true);
// x += offset;
// } while (x < xmax);
// y += offset;
// } while (y < ymax);
// }
// }
// break;
// }
// default : {
// view->FillRectangle(box);
// break;
// }
// }
//}
//
// ****************************************************************************************************
// BasicLayer_BasicLayers implementation
// ****************************************************************************************************
BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer* basicLayer)
// *************************************************************************
: Inherit(),
_basicLayer(basicLayer)
{
}
BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers)
// **************************************************************************************
: Inherit(),
_basicLayer(basicLayers._basicLayer)
{
}
BasicLayer_BasicLayers& BasicLayer_BasicLayers::operator=(const BasicLayer_BasicLayers& basicLayers)
// *************************************************************************************************
{
_basicLayer = basicLayers._basicLayer;
return *this;
}
Collection<BasicLayer*>* BasicLayer_BasicLayers::GetClone() const
// **************************************************************
{
return new BasicLayer_BasicLayers(*this);
}
Locator<BasicLayer*>* BasicLayer_BasicLayers::GetLocator() const
// *************************************************************
{
return new Locator(_basicLayer);
}
string BasicLayer_BasicLayers::_GetString() const
// **********************************************
{
string s = "<" + _TName("BasicLayer::BasicLayers");
if (_basicLayer) s += " " + GetString(_basicLayer);
s += ">";
return s;
}
// ****************************************************************************************************
// BasicLayer_BasicLayers::Locator implementation
// ****************************************************************************************************
BasicLayer_BasicLayers::Locator::Locator(const BasicLayer* basicLayer)
// *******************************************************************
: Inherit(),
_basicLayer(basicLayer)
{
}
BasicLayer_BasicLayers::Locator::Locator(const Locator& locator)
// *************************************************************
: Inherit(),
_basicLayer(locator._basicLayer)
{
}
BasicLayer_BasicLayers::Locator& BasicLayer_BasicLayers::Locator::operator=(const Locator& locator)
// ************************************************************************************************
{
_basicLayer = locator._basicLayer;
return *this;
}
BasicLayer* BasicLayer_BasicLayers::Locator::GetElement() const
// ************************************************************
{
return (BasicLayer*)_basicLayer;
}
Locator<BasicLayer*>* BasicLayer_BasicLayers::Locator::GetClone() const
// ********************************************************************
{
return new Locator(*this);
}
bool BasicLayer_BasicLayers::Locator::IsValid() const
// **************************************************
{
return (_basicLayer != NULL);
}
void BasicLayer_BasicLayers::Locator::Progress()
// *********************************************
{
_basicLayer = NULL;
}
string BasicLayer_BasicLayers::Locator::_GetString() const
// *******************************************************
{
string s = "<" + _TName("BasicLayer::BasicLayers::Locator");
if (_basicLayer) s += " " + GetString(_basicLayer);
s += ">";
return s;
}
// ****************************************************************************************************
// BasicLayer::Type implementation
// ****************************************************************************************************
BasicLayer::Type::Type(const Code& code)
// *************************************
: _code(code)
{
}
BasicLayer::Type::Type(const Type& type)
// *************************************
: _code(type._code)
{
}
BasicLayer::Type& BasicLayer::Type::operator=(const Type& type)
// ************************************************************
{
_code = type._code;
return *this;
}
string BasicLayer::Type::_GetString() const
// ****************************************
{
return GetString(_code);
}
Record* BasicLayer::Type::_GetRecord() const
// ***********************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", &_code));
return record;
}
} // End of Hurricane namespace.
bool Scan(const string& s, H::BasicLayer::Type& type)
// **************************************************
{
if (s == "UNDEFINED") {
type = H::BasicLayer::Type::UNDEFINED;
return true;
}
if (s == "CONDUCTING") {
type = H::BasicLayer::Type::CONDUCTING;
return true;
}
if (s == "CONTACT") {
type = H::BasicLayer::Type::CONTACT;
return true;
}
return false;
}
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,154 @@
// ****************************************************************************************************
// File: BasicLayer.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_BASIC_LAYER
#define HURRICANE_BASIC_LAYER
#include "Layer.h"
#include "BasicLayers.h"
#include "Box.h"
namespace Hurricane {
class View;
// ****************************************************************************************************
// BasicLayer declaration
// ****************************************************************************************************
class BasicLayer : public Layer {
// ****************************
// Types
// *****
public: typedef Layer Inherit;
public: class Type {
// ***************
public: enum Code {UNDEFINED=0, CONDUCTING=1, CONTACT=2};
private: Code _code;
public: Type(const Code& code = UNDEFINED);
public: Type(const Type& type);
public: Type& operator=(const Type& type);
public: operator const Code&() const {return _code;};
public: const Code& GetCode() const {return _code;};
public: string _GetTypeName() const { return _TName("BasicLayer::Type"); };
public: string _GetString() const;
public: Record* _GetRecord() const;
};
// Attributes
// **********
private: Type _type;
private: unsigned _extractNumber;
private: unsigned short _redValue;
private: unsigned short _greenValue;
private: unsigned short _blueValue;
private: string _fillPattern;
private: double _displayThreshold;
// private: GdkGC* _drawGC;
// private: GdkGC* _fillGC;
// Constructors
// ************
protected: BasicLayer(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
public: static BasicLayer* Create(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
// Accessors
// *********
public: const Type& GetType() const {return _type;};
public: unsigned GetExtractNumber() const {return _extractNumber;};
public: const unsigned short& GetRedValue() const {return _redValue;};
public: const unsigned short& GetGreenValue() const {return _greenValue;};
public: const unsigned short& GetBlueValue() const {return _blueValue;};
public: const string& GetFillPattern() const {return _fillPattern;};
public: double GetDisplayThreshold() const {return _displayThreshold;};
public: virtual BasicLayers GetBasicLayers() const;
// Updators
// ********
public: void SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue);
public: void SetFillPattern(const string& fillPattern);
public: void SetDisplayThreshold(double threshold) {_displayThreshold = threshold;};
// Others
// ******
protected: virtual void _PostCreate();
protected: virtual void _PreDelete();
public: virtual string _GetTypeName() const {return _TName("BasicLayer");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: virtual BasicLayer* _GetSymbolicBasicLayer() {return this;};
//public: GdkGC* _GetDrawGC();
//public: GdkGC* _GetFillGC();
public: void _Fill(View* view, const Box& box) const;
};
// -------------------------------------------------------------------
// Class : "Proxy...<const BasicLayer::Type::Code*>".
template<>
inline string ProxyTypeName<BasicLayer::Type::Code> ( const BasicLayer::Type::Code* object )
{ return "<PointerSlotAdapter<BasicLayer::Type::Code>>"; }
template<>
inline string ProxyString<BasicLayer::Type::Code> ( const BasicLayer::Type::Code* object )
{
switch ( *object ) {
case BasicLayer::Type::UNDEFINED: return "UNDEFINED";
case BasicLayer::Type::CONDUCTING: return "CONDUCTING";
case BasicLayer::Type::CONTACT: return "CONTACT";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord<BasicLayer::Type::Code> ( const BasicLayer::Type::Code* object )
{
Record* record = new Record(GetString(object));
record->Add(GetSlot("Code", (unsigned int*)object));
return record;
}
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::BasicLayer)
bool Scan(const string& s, H::BasicLayer::Type& type);
#endif // HURRICANE_BASIC_LAYER
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: BasicLayers.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_BASIC_LAYERS
#define HURRICANE_BASIC_LAYERS
#include "Collection.h"
namespace Hurricane {
class BasicLayer;
// ****************************************************************************************************
// BasicLayers declaration
// ****************************************************************************************************
typedef GenericCollection<BasicLayer*> BasicLayers;
// ****************************************************************************************************
// BasicLayerLocator declaration
// ****************************************************************************************************
typedef GenericLocator<BasicLayer*> BasicLayerLocator;
// ****************************************************************************************************
// BasicLayerFilter declaration
// ****************************************************************************************************
typedef GenericFilter<BasicLayer*> BasicLayerFilter;
// ****************************************************************************************************
// for_each_basic_layer declaration
// ****************************************************************************************************
#define for_each_basic_layer(basicLayer, basicLayers)\
/****************************************************/\
{\
BasicLayerLocator _locator = basicLayers.GetLocator();\
while (_locator.IsValid()) {\
BasicLayer* basicLayer = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_BASIC_LAYERS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,349 @@
// ****************************************************************************************************
// File: Box.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
// 21-10-2003 added ManhattanDistance & ShrinkByFactor
#include "Error.h"
#include "Box.h"
namespace Hurricane {
// ****************************************************************************************************
// Box implementation
// ****************************************************************************************************
Box::Box()
// *******
: _xMin(1),
_yMin(1),
_xMax(-1),
_yMax(-1)
{
}
Box::Box(const Unit& x, const Unit& y)
// ***********************************
: _xMin(x),
_yMin(y),
_xMax(x),
_yMax(y)
{
}
Box::Box(const Point& point)
// *************************
: _xMin(point.GetX()),
_yMin(point.GetY()),
_xMax(point.GetX()),
_yMax(point.GetY())
{
}
Box::Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2)
// *********************************************************************
: _xMin(min(x1, x2)),
_yMin(min(y1, y2)),
_xMax(max(x1, x2)),
_yMax(max(y1, y2))
{
}
Box::Box(const Point& point1, const Point& point2)
// ***********************************************
: _xMin(min(point1.GetX(), point2.GetX())),
_yMin(min(point1.GetY(), point2.GetY())),
_xMax(max(point1.GetX(), point2.GetX())),
_yMax(max(point1.GetY(), point2.GetY()))
{
}
Box::Box(const Box& box)
// *********************
: _xMin(box._xMin),
_yMin(box._yMin),
_xMax(box._xMax),
_yMax(box._yMax)
{
}
Box& Box::operator=(const Box& box)
// ********************************
{
_xMin = box._xMin;
_yMin = box._yMin;
_xMax = box._xMax;
_yMax = box._yMax;
return *this;
}
bool Box::operator==(const Box& box) const
// ***************************************
{
return (!IsEmpty() &&
!box.IsEmpty() &&
(_xMin == box._xMin) &&
(_yMin == box._yMin) &&
(_xMax == box._xMax) &&
(_yMax == box._yMax));
}
bool Box::operator!=(const Box& box) const
// ***************************************
{
return (IsEmpty() ||
box.IsEmpty() ||
(_xMin != box._xMin) ||
(_yMin != box._yMin) ||
(_xMax != box._xMax) ||
(_yMax != box._yMax));
}
Box Box::GetUnion(const Box& box) const
// ************************************
{
if (IsEmpty() && box.IsEmpty()) return Box();
return Box(min(_xMin, box._xMin),
min(_yMin, box._yMin),
max(_xMax, box._xMax),
max(_yMax, box._yMax));
}
Box Box::GetIntersection(const Box& box) const
// *******************************************
{
if (!Intersect(box)) return Box();
return Box(max(_xMin, box._xMin),
max(_yMin, box._yMin),
min(_xMax, box._xMax),
min(_yMax, box._yMax));
}
Unit Box::ManhattanDistance(const Point& pt) const
// ***********************************************
{
Unit dist = 0;
if (IsEmpty())
throw Error("Can't compute distance to an empty Box");
if (pt.GetX() < _xMin) dist = _xMin - pt.GetX();
else if (pt.GetX() > _xMax) dist = pt.GetX() - _xMax;
// else dist = 0;
if (pt.GetY() < _yMin) dist += _yMin - pt.GetY();
else if (pt.GetY() > _yMax) dist += pt.GetY() - _yMax;
// else dist += 0;
return dist;
}
Unit Box::ManhattanDistance(const Box& box) const
// **********************************************
{
if (IsEmpty() || box.IsEmpty())
throw Error("Can't compute distance to an empty Box");
Unit dx, dy;
if ((dx=box.GetXMin() - _xMax) < 0)
if ((dx=_xMin-box.GetXMax()) < 0) dx=0;
if ((dy=box.GetYMin() - _yMax) < 0)
if ((dy=_yMin-box.GetYMax()) < 0) dy=0;
return dx+dy;
}
bool Box::IsEmpty() const
// **********************
{
return ((_xMax < _xMin) || (_yMax < _yMin));
}
bool Box::IsFlat() const
// *********************
{
return (!IsEmpty() &&
(((_xMin == _xMax) && (_yMin < _yMax)) ||
((_xMin < _xMax) && (_yMin == _yMax))));
}
bool Box::IsPonctual() const
// *************************
{
return (!IsEmpty() && (_xMax == _xMin) && (_yMax == _yMin));
}
bool Box::Contains(const Unit& x, const Unit& y) const
// ***************************************************
{
return (!IsEmpty() &&
(_xMin <= x) &&
(_yMin <= y) &&
(x <= _xMax) &&
(y <= _yMax));
}
bool Box::Contains(const Point& point) const
// *****************************************
{
return Contains(point.GetX(), point.GetY());
}
bool Box::Contains(const Box& box) const
// *************************************
{
return (!IsEmpty() &&
!box.IsEmpty() &&
(_xMin <= box._xMin) &&
(box._xMax <= _xMax) &&
(_yMin <= box._yMin) &&
(box._yMax <= _yMax));
}
bool Box::Intersect(const Box& box) const
// **************************************
{
return (!IsEmpty() &&
!box.IsEmpty() &&
!((_xMax < box._xMin) ||
(box._xMax < _xMin) ||
(_yMax < box._yMin) ||
(box._yMax < _yMin)));
}
bool Box::IsConstrainedBy(const Box& box) const
// ********************************************
{
return (!IsEmpty() &&
!box.IsEmpty() &&
((_xMin == box.GetXMin()) ||
(_yMin == box.GetYMin()) ||
(_xMax == box.GetXMax()) ||
(_yMax == box.GetYMax())));
}
Box& Box::MakeEmpty()
// ******************
{
_xMin = 1;
_yMin = 1;
_xMax = -1;
_yMax = -1;
return *this;
}
Box& Box::Inflate(const Unit& d)
// *****************************
{
return Inflate(d, d, d, d);
}
Box& Box::Inflate(const Unit& dx, const Unit& dy)
// **********************************************
{
return Inflate(dx, dy, dx, dy);
}
Box& Box::Inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax)
// ******************************************************************************************
{
if (!IsEmpty()) {
_xMin -= dxMin;
_yMin -= dyMin;
_xMax += dxMax;
_yMax += dyMax;
}
return *this;
}
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)));
return Inflate(-dx, -dy);
}
Box& Box::Merge(const Unit& x, const Unit& y)
// ******************************************
{
if (IsEmpty()) {
_xMin = x;
_yMin = y;
_xMax = x;
_yMax = y;
}
else {
_xMin = min(_xMin, x);
_yMin = min(_yMin, y);
_xMax = max(_xMax, x);
_yMax = max(_yMax, y);
}
return *this;
}
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)
// ****************************************************************************
{
Merge(x1, y1);
Merge(x2, y2);
return *this;
}
Box& Box::Merge(const Box& box)
// ****************************
{
if (!box.IsEmpty()) {
Merge(box.GetXMin(), box.GetYMin());
Merge(box.GetXMax(), box.GetYMax());
}
return *this;
}
Box& Box::Translate(const Unit& dx, const Unit& dy)
// ************************************************
{
if (!IsEmpty()) {
_xMin += dx;
_yMin += dy;
_xMax += dx;
_yMax += dy;
}
return *this;
}
string Box::_GetString() const
// ***************************
{
if (IsEmpty())
return "<" + _TName("Box") + " empty>";
else
return "<" + _TName("Box") + " " +
GetValueString(_xMin) + " " + GetValueString(_yMin) + " " +
GetValueString(_xMax) + " " + GetValueString(_yMax) +
">";
}
Record* Box::_GetRecord() const
// **********************
{
if (IsEmpty()) return NULL;
Record* record = new Record(GetString(this));
record->Add(GetSlot("XMin", &_xMin));
record->Add(GetSlot("YMin", &_yMin));
record->Add(GetSlot("XMax", &_xMax));
record->Add(GetSlot("YMax", &_yMax));
return record;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,128 @@
// ****************************************************************************************************
// File: Box.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
// 21-10-2003 added ManhattanDistance & ShrinkByFactor
#ifndef HURRICANE_BOX
#define HURRICANE_BOX
#include "Point.h"
namespace Hurricane {
// ****************************************************************************************************
// Box declaration
// ****************************************************************************************************
class Box {
// ******
// Attributes
// **********
private: Unit _xMin;
private: Unit _yMin;
private: Unit _xMax;
private: Unit _yMax;
// constructors
// ************
public: Box();
public: Box(const Unit& x, const Unit& y);
public: Box(const Point& point);
public: Box(const Unit& x1, const Unit& y1, const Unit& x2, const Unit& y2);
public: Box(const Point& point1, const Point& point2);
public: Box(const Box& box);
// Operators
// *********
public: Box& operator=(const Box& box);
public: bool operator==(const Box& box) const;
public: bool operator!=(const Box& box) const;
// 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: Unit GetXCenter() const {return ((_xMin + _xMax) / 2);};
public: 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: 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;
// Predicates
// **********
public: bool IsEmpty() const;
public: bool IsFlat() const;
public: bool IsPonctual() const;
public: bool Contains(const Unit& x, const Unit& y) const;
public: bool Contains(const Point& point) const;
public: bool Contains(const Box& box) const;
public: bool Intersect(const Box& box) const;
public: bool IsConstrainedBy(const Box& box) const;
// Updators
// ********
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& ShrinkByFactor(double factor); // 0 <= factor <= 1
public: Box& Merge(const Unit& x, const 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 Box& box);
public: Box& Translate(const Unit& dx, const Unit& dy);
// Others
// ******
public: string _GetTypeName() const { return _TName("Box"); };
public: string _GetString() const;
public: Record* _GetRecord() const;
};
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Box)
#endif // HURRICANE_BOX
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,61 @@
// ****************************************************************************************************
// File: Boxes.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_BOXES
#define HURRICANE_BOXES
#include "Collection.h"
#include "Box.h"
namespace Hurricane {
// ****************************************************************************************************
// Boxes declaration
// ****************************************************************************************************
typedef GenericCollection<Box> Boxes;
// ****************************************************************************************************
// BoxLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Box> BoxLocator;
// ****************************************************************************************************
// BoxFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Box> BoxFilter;
// ****************************************************************************************************
// for_each_box declaration
// ****************************************************************************************************
#define for_each_box(box, boxes)\
/*******************************/\
{\
BoxLocator _locator = boxes.GetLocator();\
while (_locator.IsValid()) {\
Box box = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_BOXES
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,36 @@
set(includes BasicLayer.h BasicLayers.h Boxes.h Box.h Cell.h
Cells.h Collection.h Commons.h Component.h Components.h CompositeLayer.h
CompositeLayers.h Contact.h Contacts.h DataBase.h DBo.h DBos.h
DeepNet.h DisplaySlot.h DisplaySlots.h DRCError.h Entities.h
Entity.h Error.h Exception.h Filter.h Go.h Gos.h
Hook.h Hooks.h Horizontal.h Horizontals.h
HyperNet.h Instance.h Instances.h Interruption.h Interval.h
Intervals.h IntrusiveMap.h IntrusiveSet.h Layer.h Layers.h Libraries.h
Library.h ListCollection.h Locator.h MapCollection.h Marker.h Markers.h
MultisetCollection.h Name.h Names.h NetExternalComponents.h Net.h
Nets.h Occurrence.h Occurrences.h Pad.h Pads.h Pathes.h Path.h
Pin.h Pins.h Plug.h Plugs.h Point.h Points.h Primitives.h Properties.h
Property.h QuadTree.h Quark.h Quarks.h Record.h Reference.h References.h Region.h
Relation.h RoutingPad.h RoutingPads.h Rubber.h Rubbers.h Segment.h Segments.h Selectors.h
SetCollection.h SharedName.h SharedPathes.h SharedPath.h Slice.h Slices.h
SlotAdapter.h Slot.h Symbols.h Tabulation.h Tag.h Tags.h Technology.h Timer.h
Transformation.h Unit.h UpdateSession.h UserGo.h UserGos.h VectorCollection.h Vertical.h
Verticals.h Views.h Warning.h)
set(cpps BasicLayer.cpp Box.cpp CellCollections.cpp Cell.cpp
Commons.cpp Component.cpp CompositeLayer.cpp Contact.cpp DataBase.cpp
DBo.cpp DeepNet.cpp DisplaySlot.cpp DRCError.cpp Entity.cpp
Error.cpp Exception.cpp Go.cpp Hook.cpp Horizontal.cpp HyperNet.cpp
Instance.cpp Interruption.cpp Interval.cpp Layer.cpp Library.cpp
Marker.cpp Name.cpp Net.cpp NetExternalComponents.cpp Occurrence.cpp
Pad.cpp Path.cpp Pin.cpp Plug.cpp Point.cpp Property.cpp
QuadTree.cpp Quark.cpp Record.cpp Reference.cpp Region.cpp
Relation.cpp RoutingPad.cpp Rubber.cpp Segment.cpp SharedName.cpp
SharedPath.cpp Slice.cpp SlotAdapter.cpp Slot.cpp Tabulation.cpp
Tag.cpp Technology.cpp Timer.cpp Transformation.cpp Unit.cpp UpdateSession.cpp
UserGo.cpp Vertical.cpp Warning.cpp)
add_library(hurricane SHARED ${cpps})
install(FILES ${includes} DESTINATION /include/hurricane)
install(TARGETS hurricane DESTINATION /lib)

View File

@ -0,0 +1,701 @@
// ****************************************************************************************************
// File: Cell.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Cell.h"
#include "DataBase.h"
#include "Library.h"
#include "Instance.h"
#include "Net.h"
#include "Pin.h"
#include "RoutingPad.h"
#include "Layer.h"
#include "Slice.h"
#include "Rubber.h"
#include "Marker.h"
#include "Component.h"
#include "UpdateSession.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Cell implementation
// ****************************************************************************************************
Cell::Cell(Library* library, const Name& name)
// *******************************************
: Inherit(),
_library(library),
_name(name),
_instanceMap(),
_quadTree(),
_slaveInstanceSet(),
_netMap(),
_sliceMap(),
_markerSet(),
//_viewSet(),
_abutmentBox(),
_boundingBox(),
_isTerminal(true),
_isPad(false),
_nextOfLibraryCellMap(NULL),
_nextOfSymbolCellSet(NULL),
_slaveEntityMap()
{
if (!_library)
throw Error("Can't create " + _TName("Cell") + " : null library");
if (name.IsEmpty())
throw Error("Can't create " + _TName("Cell") + " : empty name");
if (_library->GetCell(_name))
throw Error("Can't create " + _TName("Cell") + " : already exists");
}
Cell* Cell::Create(Library* library, const Name& name)
// ***************************************************
{
Cell* cell = new Cell(library, name);
cell->_PostCreate();
return cell;
}
Box Cell::GetBoundingBox() const
// *****************************
{
if (_boundingBox.IsEmpty()) {
Box& boundingBox = (Box&)_boundingBox;
boundingBox = _abutmentBox;
boundingBox.Merge(_quadTree.GetBoundingBox());
for_each_slice(slice, GetSlices()) {
boundingBox.Merge(slice->GetBoundingBox());
end_for;
}
}
return _boundingBox;
}
bool Cell::IsLeaf() const
// **********************
{
return _instanceMap.IsEmpty();
}
bool Cell::IsCalledBy(Cell* cell) const
// ************************************
{
for_each_instance(instance, cell->GetInstances()) {
Cell* masterCell = instance->GetMasterCell();
if (masterCell == this) return true;
if (IsCalledBy(masterCell)) return true;
end_for;
}
return false;
}
void Cell::SetName(const Name& name)
// *********************************
{
if (name != _name) {
if (name.IsEmpty())
throw Error("Can't change " + _TName("Cell") + " name : empty name");
if (_library->GetCell(name))
throw Error("Can't change " + _TName("Cell") + " name : already exists");
_library->_GetCellMap()._Remove(this);
_name = name;
_library->_GetCellMap()._Insert(this);
}
}
void Cell::SetAbutmentBox(const Box& abutmentBox)
// **********************************************
{
if (abutmentBox != _abutmentBox) {
if (!_abutmentBox.IsEmpty() &&
(abutmentBox.IsEmpty() || !abutmentBox.Contains(_abutmentBox)))
_Unfit(_abutmentBox);
_abutmentBox = abutmentBox;
_Fit(_abutmentBox);
}
}
void Cell::FlattenNets(bool buildRings)
// ************************************
{
OpenUpdateSession ();
for_each_occurrence ( occurrence, GetHyperNetRootNetOccurrences() ) {
HyperNet hyperNet ( occurrence );
if ( !occurrence.GetPath().IsEmpty() ) {
DeepNet* deepNet = DeepNet::Create ( hyperNet );
if (deepNet) deepNet->_CreateRoutingPads ( buildRings );
} else {
RoutingPad* previousRP = NULL;
RoutingPad* currentRP = NULL;
Net* net = static_cast<Net*>(occurrence.GetEntity());
for_each_component ( component, net->GetComponents() ) {
Plug* primaryPlug = dynamic_cast<Plug*>( component );
if ( primaryPlug ) {
if ( !primaryPlug->GetBodyHook()->GetSlaveHooks().IsEmpty() ) {
cerr << "[ERROR] " << primaryPlug << "\n"
<< " has attached components, not managed yet." << endl;
} else {
primaryPlug->GetBodyHook()->Detach ();
}
}
end_for
}
for_each_occurrence ( plugOccurrence, hyperNet.GetLeafPlugOccurrences() ) {
currentRP = CreateRoutingPad ( net, plugOccurrence );
currentRP->Materialize ();
if ( buildRings ) {
if ( previousRP ) {
currentRP->GetBodyHook()->Attach ( previousRP->GetBodyHook() );
}
Plug* plug = static_cast<Plug*>( plugOccurrence.GetEntity() );
if ( plugOccurrence.GetPath().IsEmpty() ) {
plug->GetBodyHook()->Attach ( currentRP->GetBodyHook() );
plug->GetBodyHook()->Detach ();
}
previousRP = currentRP;
}
end_for
}
for_each_component ( component, net->GetComponents() ) {
Pin* pin = dynamic_cast<Pin*>( component );
if ( pin ) {
currentRP = CreateRoutingPad ( pin );
if ( buildRings ) {
if ( previousRP ) {
currentRP->GetBodyHook()->Attach ( previousRP->GetBodyHook() );
}
pin->GetBodyHook()->Attach ( currentRP->GetBodyHook() );
pin->GetBodyHook()->Detach ();
}
previousRP = currentRP;
}
end_for
}
}
end_for
}
CloseUpdateSession ();
}
void Cell::Materialize()
// *********************
{
for_each_instance(instance, GetInstances()) instance->Materialize(); end_for;
for_each_net(net, GetNets()) net->Materialize(); end_for;
for_each_marker(marker, GetMarkers()) marker->Materialize(); end_for;
}
void Cell::Unmaterialize()
// ***********************
{
for_each_instance(instance, GetInstances()) instance->Unmaterialize(); end_for;
for_each_net(net, GetNets()) net->Unmaterialize(); end_for;
for_each_marker(marker, GetMarkers()) marker->Unmaterialize(); end_for;
}
void Cell::_PostCreate()
// *********************
{
_library->_GetCellMap()._Insert(this);
Inherit::_PostCreate();
}
void Cell::_PreDelete()
// ********************
{
Inherit::_PreDelete();
while(_slaveEntityMap.size()) {
_slaveEntityMap.begin()->second->Delete();
}
//for_each_view(view, GetViews()) view->SetCell(NULL); end_for;
for_each_marker(marker, GetMarkers()) marker->Delete(); end_for;
for_each_instance(slaveInstance, GetSlaveInstances()) slaveInstance->Delete(); end_for;
for_each_instance(instance, GetInstances()) instance->Delete(); end_for;
for_each_net(net, GetNets()) net->Delete(); end_for;
for_each_slice(slice, GetSlices()) slice->_Delete(); end_for;
_library->_GetCellMap()._Remove(this);
}
string Cell::_GetString() const
// ****************************
{
string s = Inherit::_GetString();
s.insert(s.length() - 1, " " + GetString(_name));
return s;
}
Record* Cell::_GetRecord() const
// ***********************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Library", _library));
record->Add(GetSlot("Name", &_name));
record->Add(GetSlot("Instances", &_instanceMap));
record->Add(GetSlot("QuadTree", &_quadTree));
record->Add(GetSlot("SlaveInstances", &_slaveInstanceSet));
record->Add(GetSlot("Nets", &_netMap));
record->Add(GetSlot("Pins", &_pinMap));
record->Add(GetSlot("Slices", &_sliceMap));
record->Add(GetSlot("Markers", &_markerSet));
//record->Add(GetSlot("Views", &_viewSet));
record->Add(GetSlot("AbutmentBox", &_abutmentBox));
record->Add(GetSlot("BoundingBox", &_boundingBox));
record->Add(GetSlot("IsTerminal", &_isTerminal));
record->Add(GetSlot("IsFlattenLeaf", &_isFlattenLeaf));
//record->Add(GetSlot("Symbol", _symbol));
}
return record;
}
void Cell::_Fit(const Box& box)
// ****************************
{
if (box.IsEmpty()) return;
if (_boundingBox.IsEmpty()) return;
if (_boundingBox.Contains(box)) return;
_boundingBox.Merge(box);
for_each_instance(instance, GetSlaveInstances()) {
instance->GetCell()->_Fit(instance->GetTransformation().GetBox(box));
end_for;
}
}
void Cell::_Unfit(const Box& box)
// ******************************
{
if (box.IsEmpty()) return;
if (_boundingBox.IsEmpty()) return;
if (!_boundingBox.IsConstrainedBy(box)) return;
_boundingBox.MakeEmpty();
for_each_instance(instance, GetSlaveInstances()) {
instance->GetCell()->_Unfit(instance->GetTransformation().GetBox(box));
end_for;
}
}
void Cell::_AddSlaveEntity(Entity* entity, Entity* slaveEntity)
// ************************************************************************
{
assert(entity->GetCell() == this);
_slaveEntityMap.insert(pair<Entity*,Entity*>(entity,slaveEntity));
}
void Cell::_RemoveSlaveEntity(Entity* entity, Entity* slaveEntity)
// ***************************************************************************
{
assert(entity->GetCell() == this);
pair<SlaveEntityMap::iterator,SlaveEntityMap::iterator>
bounds = _slaveEntityMap.equal_range(entity);
multimap<Entity*,Entity*>::iterator it = bounds.first;
for(; it != bounds.second ; it++ ) {
if (it->second == slaveEntity) {
_slaveEntityMap.erase(it);
break;
}
}
}
void Cell::_GetSlaveEntities(SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end)
// *********************************************************************************************************
{
begin = _slaveEntityMap.begin();
end = _slaveEntityMap.end();
}
void Cell::_GetSlaveEntities(Entity* entity, SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end)
// *********************************************************************************************************
{
begin = _slaveEntityMap.lower_bound(entity);
end = _slaveEntityMap.upper_bound(entity);
}
//bool Cell::_IsDrawable(View* view) const
//// *************************************
//{
// return true;
// //if (view->GetCell() == this) return true;
//
// //if (is_a<MapView*>(view)) return true;
//
// //return (1 < (double)view->GetScreenSize(_boundingBox.GetHeight()));
//// return (100 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) *
//// (double)view->GetScreenSize(_boundingBox.GetHeight())));
//}
//
//bool Cell::_ContentIsDrawable(View* view) const
//// ********************************************
//{
// if (IsTerminal()) return false;
//
// return true;
//
// //if (view->GetCell() == this) return true;
//
// //if (is_a<MapView*>(view)) return false;
//
// //return (40 < (double)view->GetScreenSize(_boundingBox.GetHeight()));
//// return (400 < ((double)view->GetScreenSize(_boundingBox.GetWidth()) *
//// (double)view->GetScreenSize(_boundingBox.GetHeight())));
//}
//
//void Cell::_DrawPhantoms(View* view, const Box& updateArea, const Transformation& transformation)
//// **********************************************************************************************
//{
//// if (_IsDrawable(view)) { // To avoid irregular display of instances phantoms
//// if (!_ContentIsDrawable(view))
//// view->FillRectangle(transformation.GetBox(GetAbutmentBox()));
//// else {
//// for_each_instance(instance, GetInstancesUnder(updateArea)) {
//// instance->_DrawPhantoms(view, updateArea, transformation);
//// end_for;
//// }
//// }
//// }
//}
//
//void Cell::_DrawBoundaries(View* view, const Box& updateArea, const Transformation& transformation)
//// ************************************************************************************************
//{
// // if (_IsDrawable(view)) { // To avoid irregular display of instances phantoms
// // view->DrawRectangle(transformation.GetBox(GetAbutmentBox()));
// // if (_ContentIsDrawable(view)) {
// // for_each_instance(instance, GetInstancesUnder(updateArea)) {
// // instance->_DrawBoundaries(view, updateArea, transformation);
// // end_for;
// // }
// // }
// // }
//}
//
//void Cell::_DrawContent(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation)
//// ****************************************************************************************************
//{
//// if (_IsDrawable(view)) {
//// if (_ContentIsDrawable(view)) {
//// view->CheckForDisplayInterruption();
//// for_each_instance(instance, GetInstancesUnder(updateArea)) {
//// instance->_Draw(view, basicLayer, updateArea, transformation);
//// end_for;
//// }
//// for_each_slice(slice, GetSlices()) {
//// slice->_Draw(view, basicLayer, updateArea, transformation);
//// end_for;
//// }
//// }
//// }
//}
//
//void Cell::_DrawRubbers(View* view, const Box& updateArea, const Transformation& transformation)
//// *********************************************************************************************
//{
//// if (_IsDrawable(view)) {
//// if (_ContentIsDrawable(view)) {
//// for_each_instance(instance, GetInstancesUnder(updateArea)) {
//// instance->_DrawRubbers(view, updateArea, transformation);
//// end_for;
//// }
//// for_each_rubber(rubber, GetRubbersUnder(updateArea)) {
//// rubber->_Draw(view, NULL, updateArea, transformation);
//// end_for;
//// }
//// }
//// }
//}
//
//void Cell::_DrawMarkers(View* view, const Box& updateArea, const Transformation& transformation)
//// *********************************************************************************************
//{
//// if (_IsDrawable(view)) {
//// if (_ContentIsDrawable(view)) {
//// for_each_instance(instance, GetInstancesUnder(updateArea)) {
//// instance->_DrawMarkers(view, updateArea, transformation);
//// end_for;
//// }
//// for_each_marker(marker, GetMarkersUnder(updateArea)) {
//// marker->_Draw(view, NULL, updateArea, transformation);
//// end_for;
//// }
//// }
//// }
//}
//
//void Cell::_DrawDisplaySlots(View* view, const Box& area, const Box& updateArea, const Transformation& transformation)
//// ********************************************************************************************************************
//{
//// if (_IsDrawable(view)) {
//// if (_ContentIsDrawable(view)) {
//// for_each_instance(instance, GetInstancesUnder(updateArea)) {
//// instance->_DrawDisplaySlots(view, area, updateArea, transformation);
//// end_for;
//// }
//// for_each_display_slot(displaySlot, GetDisplaySlots(this)) {
//// view->_DrawDisplaySlot(displaySlot, area, updateArea, transformation);
//// end_for;
//// }
//// }
//// }
//}
//
// ****************************************************************************************************
// Cell::InstanceMap implementation
// ****************************************************************************************************
Cell::InstanceMap::InstanceMap()
// *****************************
: Inherit()
{
}
Name Cell::InstanceMap::_GetKey(Instance* instance) const
// ******************************************************
{
return instance->GetName();
}
unsigned Cell::InstanceMap::_GetHashValue(Name name) const
// *******************************************************
{
return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8;
}
Instance* Cell::InstanceMap::_GetNextElement(Instance* instance) const
// *******************************************************************
{
return instance->_GetNextOfCellInstanceMap();
}
void Cell::InstanceMap::_SetNextElement(Instance* instance, Instance* nextInstance) const
// **************************************************************************************
{
instance->_SetNextOfCellInstanceMap(nextInstance);
}
// ****************************************************************************************************
// Cell::SlaveInstanceSet implementation
// ****************************************************************************************************
Cell::SlaveInstanceSet::SlaveInstanceSet()
// ***************************************
: Inherit()
{
}
unsigned Cell::SlaveInstanceSet::_GetHashValue(Instance* slaveInstance) const
// **************************************************************************
{
return ( (unsigned int)( (unsigned long)slaveInstance ) ) / 8;
}
Instance* Cell::SlaveInstanceSet::_GetNextElement(Instance* slaveInstance) const
// *****************************************************************************
{
return slaveInstance->_GetNextOfCellSlaveInstanceSet();
}
void Cell::SlaveInstanceSet::_SetNextElement(Instance* slaveInstance, Instance* nextSlaveInstance) const
// ****************************************************************************************************
{
slaveInstance->_SetNextOfCellSlaveInstanceSet(nextSlaveInstance);
}
// ****************************************************************************************************
// Cell::NetMap implementation
// ****************************************************************************************************
Cell::NetMap::NetMap()
// *******************
: Inherit()
{
}
Name Cell::NetMap::_GetKey(Net* net) const
// ***************************************
{
return net->GetName();
}
unsigned Cell::NetMap::_GetHashValue(Name name) const
// **************************************************
{
return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8;
}
Net* Cell::NetMap::_GetNextElement(Net* net) const
// ***********************************************
{
return net->_GetNextOfCellNetMap();
}
void Cell::NetMap::_SetNextElement(Net* net, Net* nextNet) const
// *************************************************************
{
net->_SetNextOfCellNetMap(nextNet);
}
// ****************************************************************************************************
// Cell::PinMap implementation
// ****************************************************************************************************
Cell::PinMap::PinMap()
// *******************
: Inherit()
{
}
Name Cell::PinMap::_GetKey(Pin* pin) const
// ***************************************
{
return pin->GetName();
}
unsigned Cell::PinMap::_GetHashValue(Name name) const
// **************************************************
{
return ( (unsigned int)( (unsigned long)name._GetSharedName() ) ) / 8;
}
Pin* Cell::PinMap::_GetNextElement(Pin* pin) const
// ***********************************************
{
return pin->_GetNextOfCellPinMap();
}
void Cell::PinMap::_SetNextElement(Pin* pin, Pin* nextPin) const
// *************************************************************
{
pin->_SetNextOfCellPinMap(nextPin);
}
// ****************************************************************************************************
// Cell::SliceMap implementation
// ****************************************************************************************************
Cell::SliceMap::SliceMap()
// ***********************
: Inherit()
{
}
const Layer* Cell::SliceMap::_GetKey(Slice* slice) const
// *****************************************************
{
return slice->GetLayer();
}
unsigned Cell::SliceMap::_GetHashValue(const Layer* layer) const
// *************************************************************
{
return ( (unsigned int)( (unsigned long)layer ) ) / 8;
}
Slice* Cell::SliceMap::_GetNextElement(Slice* slice) const
// *******************************************************
{
return slice->_GetNextOfCellSliceMap();
}
void Cell::SliceMap::_SetNextElement(Slice* slice, Slice* nextSlice) const
// ***********************************************************************
{
slice->_SetNextOfCellSliceMap(nextSlice);
};
// ****************************************************************************************************
// Cell::MarkerSet implementation
// ****************************************************************************************************
Cell::MarkerSet::MarkerSet()
// *************************
: Inherit()
{
}
unsigned Cell::MarkerSet::_GetHashValue(Marker* marker) const
// **********************************************************
{
return ( (unsigned int)( (unsigned long)marker ) ) / 8;
}
Marker* Cell::MarkerSet::_GetNextElement(Marker* marker) const
// ***********************************************************
{
return marker->_GetNextOfCellMarkerSet();
}
void Cell::MarkerSet::_SetNextElement(Marker* marker, Marker* nextMarker) const
// ****************************************************************************
{
marker->_SetNextOfCellMarkerSet(nextMarker);
}
//// ****************************************************************************************************
//// Cell::ViewSet implementation
//// ****************************************************************************************************
//
//Cell::ViewSet::ViewSet()
//// *********************
//: Inherit()
//{
//}
//
//unsigned Cell::ViewSet::_GetHashValue(View* view) const
//// ****************************************************
//{
// return ( (unsigned int)( (unsigned long)view ) ) / 8;
//}
//
//View* Cell::ViewSet::_GetNextElement(View* view) const
//// ***************************************************
//{
// return view->_GetNextOfCellViewSet();
//}
//
//void Cell::ViewSet::_SetNextElement(View* view, View* nextView) const
//// ******************************************************************
//{
// view->_SetNextOfCellViewSet(nextView);
//}
//
//
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,322 @@
// ****************************************************************************************************
// File: Cell.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_CELL
#define HURRICANE_CELL
#include "Pathes.h"
#include "Entity.h"
#include "Cells.h"
#include "Instance.h"
#include "DeepNet.h"
#include "Pin.h"
#include "Pins.h"
#include "Slices.h"
#include "Rubbers.h"
#include "Markers.h"
#include "Marker.h"
#include "Reference.h"
#include "Components.h"
#include "Occurrences.h"
#include "Transformation.h"
#include "Layer.h"
#include "QuadTree.h"
#include "IntrusiveMap.h"
#include "IntrusiveSet.h"
namespace Hurricane {
class Library;
class BasicLayer;
typedef multimap<Entity*,Entity*> SlaveEntityMap;
// ****************************************************************************************************
// Cell declaration
// ****************************************************************************************************
class Cell : public Entity {
// ***********************
# if !defined(__DOXYGEN_PROCESSOR__)
// Types
// *****
public: typedef Entity Inherit;
class InstanceMap : public IntrusiveMap<Name, Instance> {
// ****************************************************
public: typedef IntrusiveMap<Name, Instance> Inherit;
public: InstanceMap();
public: virtual Name _GetKey(Instance* instance) const;
public: virtual unsigned _GetHashValue(Name name) const;
public: virtual Instance* _GetNextElement(Instance* instance) const;
public: virtual void _SetNextElement(Instance* instance, Instance* nextInstance) const;
};
public: class SlaveInstanceSet : public IntrusiveSet<Instance> {
// ***********************************************************
public: typedef IntrusiveSet<Instance> Inherit;
public: SlaveInstanceSet();
public: virtual unsigned _GetHashValue(Instance* slaveInstance) const;
public: virtual Instance* _GetNextElement(Instance* slaveInstance) const;
public: virtual void _SetNextElement(Instance* slaveInstance, Instance* nextSlaveInstance) const;
};
public: class NetMap : public IntrusiveMap<Name, Net> {
// **************************************************
public: typedef IntrusiveMap<Name, Net> Inherit;
public: NetMap();
public: virtual Name _GetKey(Net* net) const;
public: virtual unsigned _GetHashValue(Name name) const;
public: virtual Net* _GetNextElement(Net* net) const;
public: virtual void _SetNextElement(Net* net, Net* nextNet) const;
};
class PinMap : public IntrusiveMap<Name, Pin> {
// *******************************************
public: typedef IntrusiveMap<Name, Pin> Inherit;
public: PinMap();
public: virtual Name _GetKey(Pin* pin) const;
public: virtual unsigned _GetHashValue(Name name) const;
public: virtual Pin* _GetNextElement(Pin* pin) const;
public: virtual void _SetNextElement(Pin* pin, Pin* nextPin) const;
};
public: class SliceMap : public IntrusiveMap<const Layer*, Slice> {
// **************************************************************
public: typedef IntrusiveMap<const Layer*, Slice> Inherit;
public: SliceMap();
public: virtual const Layer* _GetKey(Slice* slice) const;
public: virtual unsigned _GetHashValue(const Layer* layer) const;
public: virtual Slice* _GetNextElement(Slice* slice) const;
public: virtual void _SetNextElement(Slice* slice, Slice* nextSlice) const;
};
public: class MarkerSet : public IntrusiveSet<Marker> {
// **************************************************
public: typedef IntrusiveSet<Marker> Inherit;
public: MarkerSet();
public: virtual unsigned _GetHashValue(Marker* marker) const;
public: virtual Marker* _GetNextElement(Marker* marker) const;
public: virtual void _SetNextElement(Marker* marker, Marker* nextMarker) const;
};
//public: class ViewSet : public IntrusiveSet<View> {
//// **********************************************
// public: typedef IntrusiveSet<View> Inherit;
//
// public: ViewSet();
// public: virtual unsigned _GetHashValue(View* view) const;
// public: virtual View* _GetNextElement(View* view) const;
// public: virtual void _SetNextElement(View* view, View* nextView) const;
//};
// Attributes
// **********
private: Library* _library;
private: Name _name;
private: InstanceMap _instanceMap;
private: QuadTree _quadTree;
private: SlaveInstanceSet _slaveInstanceSet;
private: NetMap _netMap;
private: PinMap _pinMap;
private: SliceMap _sliceMap;
private: MarkerSet _markerSet;
//private: ViewSet _viewSet;
private: Box _abutmentBox;
private: Box _boundingBox;
private: bool _isTerminal;
private: bool _isFlattenLeaf;
private: bool _isPad;
private: Cell* _nextOfLibraryCellMap;
private: Cell* _nextOfSymbolCellSet;
private: multimap<Entity*,Entity*> _slaveEntityMap;
// Constructors
// ************
protected: Cell(Library* library, const Name& name);
// Others
// ******
protected: virtual void _PostCreate();
protected: virtual void _PreDelete();
public: virtual string _GetTypeName() const {return _TName("Cell");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: InstanceMap& _GetInstanceMap() {return _instanceMap;};
public: QuadTree* _GetQuadTree() {return &_quadTree;};
public: SlaveInstanceSet& _GetSlaveInstanceSet() {return _slaveInstanceSet;};
public: NetMap& _GetNetMap() {return _netMap;};
public: PinMap& _GetPinMap() {return _pinMap;};
public: SliceMap& _GetSliceMap() {return _sliceMap;};
public: MarkerSet& _GetMarkerSet() {return _markerSet;};
//public: ViewSet& _GetViewSet() {return _viewSet;};
public: Cell* _GetNextOfLibraryCellMap() const {return _nextOfLibraryCellMap;};
public: Cell* _GetNextOfSymbolCellSet() const {return _nextOfSymbolCellSet;};
public: void _SetNextOfLibraryCellMap(Cell* cell) {_nextOfLibraryCellMap = cell;};
public: void _SetNextOfSymbolCellSet(Cell* cell) {_nextOfSymbolCellSet = cell;};
public: void _Fit(const Box& box);
public: void _Unfit(const Box& box);
public: void _AddSlaveEntity(Entity* entity, Entity* slaveEntity);
public: void _RemoveSlaveEntity(Entity* entity, Entity* slaveEntity);
public: void _GetSlaveEntities(SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end);
public: void _GetSlaveEntities(Entity* entity, SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end);
//public: bool _IsDrawable(View* view) const;
//public: bool _ContentIsDrawable(View* view) const;
//public: void _DrawPhantoms(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawBoundaries(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawContent(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation);
//public: void _DrawRubbers(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawMarkers(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawDisplaySlots(View* view, const Box& area, const Box& updateArea, const Transformation& transformation);
# endif
// Constructors
// ************
public: static Cell* Create(Library* library, const Name& name);
// Accessors
// *********
public: virtual Cell* GetCell() const {return (Cell*)this;};
public: virtual Box GetBoundingBox() const;
public: Library* GetLibrary() const {return _library;};
public: const Name& GetName() const {return _name;};
public: Instance* GetInstance(const Name& name) const {return _instanceMap.GetElement(name);};
public: Instances GetInstances() const {return _instanceMap.GetElements();};
public: Instances GetPlacedInstances() const;
public: Instances GetFixedInstances() const;
public: Instances GetUnplacedInstances() const;
public: Instances GetNotUnplacedInstances() const;
public: Instances GetInstancesUnder(const Box& area) const;
public: Instances GetPlacedInstancesUnder(const Box& area) const;
public: Instances GetFixedInstancesUnder(const Box& area) const;
public: Instances GetUnplacedInstancesUnder(const Box& area) const;
public: Instances GetNotUnplacedInstancesUnder(const Box& area) const;
public: Instances GetSlaveInstances() const; // {return _slaveInstanceSet.GetElements();}; NOON!!
public: Instances GetTerminalInstances() const;
public: Instances GetTerminalInstancesUnder(const Box& area) const;
public: Instances GetNonTerminalInstances() const;
public: Instances GetNonTerminalInstancesUnder(const Box& area) const;
public: Instances GetLeafInstances() const;
public: Instances GetLeafInstancesUnder(const Box& area) const;
public: Instances GetNonLeafInstances() const;
public: Instances GetNonLeafInstancesUnder(const Box& area) const;
public: Net* GetNet(const Name& name) const {return _netMap.GetElement(name);};
public: Nets GetNets() const {return _netMap.GetElements();};
public: Nets GetGlobalNets() const;
public: Nets GetExternalNets() const;
public: Nets GetInternalNets() const;
public: Nets GetClockNets() const;
public: Nets GetSupplyNets() const;
public: Nets GetPowerNets() const;
public: Nets GetGroundNets() const;
public: Pin* GetPin(const Name& name) const {return _pinMap.GetElement(name);};
public: Pins GetPins() const {return _pinMap.GetElements();};
public: Slice* GetSlice(const Layer* layer) const {return _sliceMap.GetElement(layer);};
public: Slices GetSlices(const Layer::Mask& mask = ~0) const;
// public: Views GetViews() const {return _viewSet.GetElements();};
// public: MainViews GetMainViews() const;
// public: MainViews GetImpactedMainViews() const;
public: Rubbers GetRubbers() const;
public: Rubbers GetRubbersUnder(const Box& area) const;
public: Markers GetMarkers() const {return _markerSet.GetElements();};
public: Markers GetMarkersUnder(const Box& area) const;
public: References GetReferences() const;
public: Components GetComponents(const Layer::Mask& mask = ~0) const;
public: Components GetComponentsUnder(const Box& area, const Layer::Mask& mask = ~0) const;
public: Occurrences GetOccurrences(unsigned searchDepth = (unsigned)-1) const;
public: Occurrences GetOccurrencesUnder(const Box& area, unsigned searchDepth = (unsigned)-1) const;
public: Occurrences GetTerminalInstanceOccurrences() const;
public: Occurrences GetTerminalInstanceOccurrencesUnder(const Box& area) const;
public: Occurrences GetLeafInstanceOccurrences() const;
public: Occurrences GetLeafInstanceOccurrencesUnder(const Box& area) const;
public: Occurrences GetComponentOccurrences(const Layer::Mask& mask = ~0) const;
public: Occurrences GetComponentOccurrencesUnder(const Box& area, const Layer::Mask& mask = ~0) const;
public: Occurrences GetHyperNetRootNetOccurrences() const;
public: Cells GetSubCells() const;
public: Pathes GetRecursiveSlavePathes() const;
public: const Box& GetAbutmentBox() const {return _abutmentBox;};
// Predicates
// **********
public: bool IsCalledBy(Cell* cell) const;
public: bool IsTerminal() const {return _isTerminal;};
public: bool IsFlattenLeaf() const {return _isFlattenLeaf;};
public: bool IsLeaf() const;
public: bool IsPad() const {return _isPad;};
// Updators
// ********
public: void SetName(const Name& name);
public: void SetAbutmentBox(const Box& abutmentBox);
public: void SetTerminal(bool isTerminal) {_isTerminal = isTerminal;};
public: void SetFlattenLeaf(bool isFlattenLeaf) {_isFlattenLeaf = isFlattenLeaf;};
public: void SetPad(bool isPad) {_isPad = isPad;};
public: void FlattenNets(bool buildRings=true);
public: void Materialize();
public: void Unmaterialize();
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Cell)
#endif // HURRICANE_CELL
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Cells.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_CELLS
#define HURRICANE_CELLS
#include "Collection.h"
namespace Hurricane {
class Cell;
// ****************************************************************************************************
// Cells declaration
// ****************************************************************************************************
typedef GenericCollection<Cell*> Cells;
// ****************************************************************************************************
// CellLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Cell*> CellLocator;
// ****************************************************************************************************
// CellFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Cell*> CellFilter;
// ****************************************************************************************************
// for_each_cell declaration
// ****************************************************************************************************
#define for_each_cell(cell, cells)\
/*********************************/\
{\
CellLocator _locator = cells.GetLocator();\
while (_locator.IsValid()) {\
Cell* cell = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_CELLS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,837 @@
// ****************************************************************************************************
// File: Collection.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
// 21-10-2003 Alignment LIP6 & BULL versions
#ifndef HURRICANE_COLLECTION
#define HURRICANE_COLLECTION
#include "Locator.h"
#include "Filter.h"
namespace Hurricane {
template<class Type> class GenericCollection;
template<class Type, class SubType> class SubTypeCollection;
template<class Type> class SubSetCollection;
// ****************************************************************************************************
// Collection declaration
// ****************************************************************************************************
template<class Type> class Collection : public NestedSlotAdapter {
// *************************************************************
// Constructors
// ************
protected: Collection()
// ********************
{
}
private: Collection(const Collection& collection);
// ***********************************************
// not implemented to forbid copy construction
// ***********************************************
// Destructor
// **********
public: virtual ~Collection()
// **************************
{
}
// Operators
// *********
private: Collection& operator=(const Collection& collection);
// **********************************************************
// not implemented to forbid assignment
// **********************************************************
// Accessors
// *********
public: virtual Collection<Type>* GetClone() const = 0;
public: virtual Locator<Type>* GetLocator() const = 0;
public: virtual unsigned GetSize() const
// *************************************
{
unsigned size = 0;
// we use a GenericLocator to delete the locator allocated by GetLocator()
GenericLocator<Type> locator = GetLocator();
while (locator.IsValid()) {
size++;
locator.Progress();
}
return size;
}
public: Type GetFirst() const
// **************************
{
// we use a GenericLocator to delete the locator allocated by GetLocator()
return GenericLocator<Type>(GetLocator()).GetElement();
}
public: GenericCollection<Type> GetSubSet(const Filter<Type>& filter) const
// ************************************************************************
{
return SubSetCollection<Type>(*this, filter);
}
public: template<class SubType> GenericCollection<SubType> GetSubSet() const
// *************************************************************************
{
return SubTypeCollection<Type, SubType>(this);
}
public: template<class SubType>
GenericCollection<SubType> GetSubSet(const Filter<SubType>& filter) const
// ******************************************************************************
{
return GetSubSet<SubType>().GetSubSet(filter);
}
// Predicates
// **********
public: bool IsEmpty() const
// *************************
{
// we use a GenericLocator to delete the locator allocated by GetLocator()
return !GenericLocator<Type>(GetLocator()).IsValid();
}
// Utilitarians
// ************
public: void Fill(list<Type>& list) const
// **************************************
{
GenericLocator<Type> locator = GetLocator();
while (locator.IsValid()) {
list.push_back(locator.GetElement());
locator.Progress();
}
}
public: void Fill(set<Type>& set) const
// ************************************
{
GenericLocator<Type> locator = GetLocator();
while (locator.IsValid()) {
set.insert(locator.GetElement());
locator.Progress();
}
}
public: template<class Compare> void Fill(set<Type, Compare>& set) const
// *********************************************************************
{
GenericLocator<Type> locator = GetLocator();
while (locator.IsValid()) {
set.insert(locator.GetElement());
locator.Progress();
}
}
public: void Fill(vector<Type>& vector) const
// ******************************************
{
GenericLocator<Type> locator = GetLocator();
while (locator.IsValid()) {
vector.push_back(locator.GetElement());
locator.Progress();
}
}
// Others
// ******
public: virtual string _GetTypeName() const
// **************************************
{
return _TName("Collection<Type>");
};
public: virtual string _GetString() const = 0;
public: Record* _GetRecord() const
// *************************
{
Record* record = NULL;
if (!IsEmpty()) {
record = new Record(GetString(this));
unsigned n = 1;
GenericLocator<Type> locator = GetLocator();
while (locator.IsValid()) {
string slotName = GetString(n++);
Type slotRecord = locator.GetElement();
record->Add(GetSlot(slotName, slotRecord));
locator.Progress();
}
}
return record;
}
};
// ****************************************************************************************************
// GenericCollection declaration
// ****************************************************************************************************
template<class Type> class GenericCollection : public Collection<Type> {
// *******************************************************************
// Types
// *****
public: typedef Collection<Type> Inherit;
// Attributes
// **********
private: Collection<Type>* _collection;
// Constructors
// ************
public: GenericCollection()
// ***********************
: Inherit(),
_collection(NULL)
{
}
public: GenericCollection(const Collection<Type>& collection)
// **********************************************************
: Inherit(),
_collection(collection.GetClone())
{
}
public: GenericCollection(const GenericCollection<Type>& genericCollection)
// ************************************************************************
: Inherit(),
_collection(genericCollection.GetClone())
{
}
public: GenericCollection(Collection<Type>* collection)
// *************************************************************
// CAUTION : collection will be deleted by the GenericCollection
// *************************************************************
: Inherit(),
_collection(collection)
{
}
// Destructor
// **********
public: virtual ~GenericCollection()
// *********************************
{
if (_collection) delete _collection;
}
// Operators
// *********
public: GenericCollection& operator=(const Collection<Type>& collection)
// *********************************************************************
{
if (_collection) delete _collection;
_collection = collection.GetClone();
return *this;
}
public: GenericCollection& operator=(const GenericCollection& genericCollection)
// *****************************************************************************
{
if (_collection) delete _collection;
_collection = genericCollection.GetClone();
return *this;
}
public: GenericCollection& operator=(Collection<Type>* collection)
// ***************************************************************
// CAUTION : collection will be deleted by the GenericCollection
// ***************************************************************
{
if (_collection) delete _collection;
_collection = collection;
return *this;
}
// Accessors
// *********
public: virtual Collection<Type>* GetClone() const
// ***********************************************
{
return (_collection) ? _collection->GetClone() : NULL;
}
public: virtual Locator<Type>* GetLocator() const
// **********************************************
{
return (_collection) ? _collection->GetLocator() : NULL;
}
public: virtual unsigned GetSize() const
// *************************************
{
return (_collection) ? _collection->GetSize() : 0;
}
// Others
// ******
public: virtual string _GetTypeName() const
// **************************************
{
return _TName("GenericCollection");
};
public: virtual string _GetString() const
// **************************************
{
if (!_collection)
return "<" + _GetTypeName() + " unbound>";
else
return "<" + _GetTypeName()+ " " + GetString(_collection) + ">";
}
};
// ****************************************************************************************************
// ElementCollection declaration
// ****************************************************************************************************
template<class Type> class ElementCollection : public Collection<Type> {
// *********************************************************************
// -----------------------------------------------------------------
// Sub-Class : "::ElementCollection::Locator".
public: template<class ElType> class Locator : public Hurricane::Locator<ElType> {
// Attributes
// **********
protected: const ElType _element;
protected: bool _done;
// Constructors
// ************
public: Locator ( const ElType _element ) : _element(_element), _done(false) {};
public: Locator ( const Locator &locator ) : _element(locator._element), _done(locator._done) {};
// Accessors
// *********
public: virtual ElType GetElement () const { return const_cast<ElType>(_element); };
public: virtual Locator<ElType>* GetClone () const { return new Locator(*this); };
public: virtual bool IsValid () const { return !_done; };
public: virtual void Progress () { _done = true; };
// Hurricane Management
// ********************
public: virtual string _GetString () const {
if (!_element)
return "<" + _TName("ElementCollection::Locator") + " unbound>";
else
return "<" + _TName("ElementCollection::Locator") + " " + GetString(_element) + ">";
}
};
// Types
// *****
public: typedef Collection<Type> Inherit;
// Attributes
// **********
private: Type _element;
// Constructors
// ************
public: ElementCollection()
// ***********************
: Inherit(),
_element(NULL)
{
}
public: ElementCollection(const Type element)
// **********************************************************
: Inherit(),
_element(element)
{
}
public: ElementCollection(const ElementCollection<Type>& elementCollection)
// ************************************************************************
: Inherit(),
_element(elementCollection._element)
{
}
// Accessors
// *********
public: virtual Collection<Type>* GetClone() const
// ***********************************************
{
return ( new ElementCollection (*this) );
}
public: virtual Locator<Type>* GetLocator() const
// **********************************************
{
return ( new Locator<Type> (_element) );
}
public: virtual unsigned GetSize() const
// *************************************
{
return (_element) ? 1 : 0;
}
// Others
// ******
public: virtual string _GetString() const
// **************************************
{
if (!_element)
return "<" + _TName("ElementCollection") + " unbound>";
else
return "<" + _TName("ElementCollection") + " " + GetString(_element) + ">";
}
};
// ****************************************************************************************************
// SubTypeCollection declaration
// ****************************************************************************************************
template<class Type, class SubType> class SubTypeCollection : public Collection<SubType> {
// *************************************************************************************
// Types
// *****
public: typedef Collection<SubType> Inherit;
public: class Locator : public Hurricane::Locator<SubType> {
// *******************************************************
// Types
// *****
public: typedef Hurricane::Locator<SubType> Inherit;
// Attributes
// **********
private: GenericLocator<Type> _locator;
// Constructors
// ************
public: Locator(const GenericCollection<Type>& collection)
// ********************************************************
: Inherit(),
_locator(collection.GetLocator())
{
while (_locator.IsValid() && !is_a<SubType>(_locator.GetElement()))
_locator.Progress();
}
public: Locator(const GenericLocator<Type>& genericLocator)
// ********************************************************
: Inherit(),
_locator(genericLocator.GetClone())
{
while (_locator.IsValid() && !is_a<SubType>(_locator.GetElement()))
_locator.Progress();
}
// Accessors
// *********
public: virtual SubType GetElement() const
// ***************************************
{
return (_locator.IsValid()) ? (SubType)_locator.GetElement() : SubType();
}
public: virtual Hurricane::Locator<SubType>* GetClone() const
// **********************************************************
{
return new Locator(_locator);
}
public: virtual Hurricane::Locator<SubType>* GetLocator() // 21-10-03
// *************************************************
{
return dynamic_cast<Hurricane::Locator<SubType>*> (
_locator.GetLocator()->GetLocator() );
}
// Predicates
// **********
public: virtual bool IsValid() const
// *********************************
{
return _locator.IsValid();
}
// Updators
// ********
public: virtual void Progress()
// ****************************
{
if (_locator.IsValid()) {
do {
_locator.Progress();
} while (_locator.IsValid() && !is_a<SubType>(_locator.GetElement()));
}
}
};
// Attributes
// **********
private: GenericCollection<Type> _collection;
// Constructors
// ************
public: SubTypeCollection()
// ********************
: Inherit(),
_collection()
{
}
public: SubTypeCollection(const Collection<Type>* collection)
// **********************************************************
: Inherit(),
_collection(collection->GetClone())
{
}
public: SubTypeCollection(const GenericCollection<Type>& collection)
// *****************************************************************
: Inherit(),
_collection(collection)
{
}
public: SubTypeCollection(const SubTypeCollection& subTypeCollection)
// ******************************************************************
: Inherit(),
_collection(subTypeCollection._collection)
{
}
// Operators
// *********
public: SubTypeCollection& operator=(const SubTypeCollection& subTypeCollection)
// *****************************************************************************
{
_collection = subTypeCollection._collection;
return *this;
}
// Accessors
// *********
public: virtual Collection<SubType>* GetClone() const
// **************************************************
{
return new SubTypeCollection(_collection);
}
public: virtual Hurricane::Locator<SubType>* GetLocator() const
// ************************************************************
{
return new Locator(_collection);
}
// Accessors
// *********
public: virtual string _GetString() const
// **************************************
{
return "<" + _TName("SubTypeCollection") + " " + GetString(_collection) + ">";
}
};
// ****************************************************************************************************
// SubSetCollection implementation
// ****************************************************************************************************
template<class Type> class SubSetCollection : public Collection<Type> {
// ******************************************************************
// Types
// *****
public: typedef Collection<Type> Inherit;
public: class Locator : public Hurricane::Locator<Type> {
// ****************************************************
// Types
// *****
public: typedef Hurricane::Locator<Type> Inherit;
// Attributes
// **********
private: GenericLocator<Type> _locator;
private: GenericFilter<Type> _filter;
// Constructors
// ************
public: Locator(const SubSetCollection<Type>& collection, const Filter<Type>& filter)
// **********************************************************************************
: Inherit(),
_locator(collection.GetLocator()),
_filter(filter)
{
while (_locator.IsValid() && !_filter.Accept(_locator.GetElement()))
_locator.Progress();
}
public: Locator(const Collection<Type>& collection, const Filter<Type>& filter)
// ****************************************************************************
: Inherit(),
_locator(collection.GetLocator()),
_filter(filter)
{
while (_locator.IsValid() && !_filter.Accept(_locator.GetElement()))
_locator.Progress();
}
public: Locator(const GenericCollection<Type>& genericCollection, const Filter<Type>& filter)
// ******************************************************************************************
: Inherit(),
_locator(genericCollection.GetLocator()),
_filter(filter)
{
while (_locator.IsValid() && !_filter.Accept(_locator.GetElement()))
_locator.Progress();
}
public: Locator(const GenericLocator<Type>& genericLocator, const Filter<Type>& filter)
// ************************************************************************************
: Inherit(),
_locator(genericLocator),
_filter(filter)
{
while (_locator.IsValid() && !_filter.Accept(_locator.GetElement()))
_locator.Progress();
}
// Accessors
// *********
public: virtual Type GetElement() const
// ************************************
{
return (_locator.IsValid()) ? _locator.GetElement() : Type();
}
public: virtual Hurricane::Locator<Type>* GetClone() const
// *******************************************************
{
return new Locator(_locator, _filter);
}
public: virtual Hurricane::Locator<Type>* GetLocator() // 21-10-03
// ***************************************************
{
return ( _locator.GetLocator()->GetLocator() );
}
// Predicates
// **********
public: virtual bool IsValid() const
// *********************************
{
return _locator.IsValid();
}
// Updators
// ********
public: virtual void Progress()
// ****************************
{
if (_locator.IsValid()) {
do {
_locator.Progress();
} while (_locator.IsValid() && !_filter.Accept(_locator.GetElement()));
}
}
};
// Attributes
// **********
private: GenericCollection<Type> _collection;
private: GenericFilter<Type> _filter;
// Constructors
// ************
public: SubSetCollection()
// ***********************
: Inherit(),
_collection(),
_filter()
{
}
public: SubSetCollection(const Collection<Type>& collection, const Filter<Type>& filter)
// *************************************************************************************
: Inherit(),
_collection(collection),
_filter(filter)
{
}
public: SubSetCollection(const SubSetCollection& subSetCollection)
// ***************************************************************
: Inherit(),
_collection(subSetCollection._collection),
_filter(subSetCollection._filter)
{
}
// Operators
// *********
public: SubSetCollection& operator=(const SubSetCollection& subSetCollection)
// **************************************************************************
{
_collection = subSetCollection._collection;
_filter = subSetCollection._filter;
return *this;
}
// Accessors
// *********
public: virtual Collection<Type>* GetClone() const
// ***********************************************
{
return new SubSetCollection(_collection, _filter);
}
public: virtual Hurricane::Locator<Type>* GetLocator() const
// *********************************************************
{
return new Locator(_collection, _filter);
}
// Accessors
// *********
public: virtual string _GetString() const
// **************************************
{
return "<" + _TName("SubSetCollection") + " " + GetString(_collection) + ">";
}
};
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
// ****************************************************************************************************
// Macros declaration
// ****************************************************************************************************
#define end_for\
/**************/\
}\
}
#define for_each_object(Type, element, collection)\
/*************************************************/\
{\
GenericLocator<Type> _locator = collection.GetLocator();\
while (_locator.IsValid()) {\
Type element = _locator.GetElement();\
_locator.Progress();
#define for_each_element(Type, element, collection)\
/*************************************************/\
{\
ElementCollection<Type>::Locator<Type>* _locator = collection.GetLocator();\
while (_locator->IsValid()) {\
Type element = _locator->GetElement();\
_locator->Progress();
template<typename T>
class IsNestedSlotAdapter<const Hurricane::GenericCollection<T> > {
public:
enum { True=1, False=0 };
};
} // End of Hurricane namespace.
#include "MultisetCollection.h"
#include "SetCollection.h"
#include "MapCollection.h"
#include "ListCollection.h"
#include "VectorCollection.h"
#endif // HURRICANE_COLLECTION
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,221 @@
// ****************************************************************************************************
// File: Commons.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifdef HAVE_LIBIBERTY
# include "demangle.h"
# include "libiberty.h"
#endif
#include "Commons.h"
namespace Hurricane {
// ****************************************************************************************************
// Tracing tools
// ****************************************************************************************************
static long TRACE_LEVEL = 0;
static unsigned int TRACE_SHOW_LEVEL = (unsigned int)-1;
bool in_trace()
// ************
{
return (0 < TRACE_LEVEL);
}
void trace_on()
// ************
{
TRACE_LEVEL++;
}
void trace_off()
// *************
{
if (0 < TRACE_LEVEL) TRACE_LEVEL--;
}
void trace_in()
// ************
{
if (0 < TRACE_LEVEL) tab++;
}
void trace_out()
// *************
{
if (0 < TRACE_LEVEL) tab--;
}
bool inltrace ( unsigned int level )
//***********************************
{
return TRACE_SHOW_LEVEL <= level;
}
unsigned int ltracelevel ( unsigned int level )
//**********************************************
{
unsigned int previousLevel = TRACE_SHOW_LEVEL;
TRACE_SHOW_LEVEL = level;
return previousLevel;
}
void ltracein (unsigned int level, unsigned int count )
//******************************************************
{
if ( inltrace(level) ) while ( count-- ) tab++;
}
void ltraceout (unsigned int level, unsigned int count )
//*******************************************************
{
if ( inltrace(level) ) while ( count-- ) tab--;
}
// -------------------------------------------------------------------
// Function : "Demangle ()".
string Demangle ( const char* symbol )
{
string mangled = "_Z";
mangled += symbol;
# ifdef HAVE_LIBIBERTY
char* result = cplus_demangle ( mangled.c_str(), DMGL_PARAMS|DMGL_ANSI|DMGL_TYPES );
if ( result ) {
mangled = result;
free ( result );
return mangled;
}
# endif
return mangled;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
bool Scan(const string& s, unsigned& u)
// ************************************
{
unsigned v, n;
sscanf(s.c_str(), "%u%n", &v, &n);
if (n != s.size()) return false;
u = v;
return true;
}
bool Scan(const string& s, unsigned short& u)
// ******************************************
{
unsigned short v;
unsigned n;
sscanf(s.c_str(), "%hu%n", &v, &n);
if (n != s.size()) return false;
u = v;
return true;
}
bool Scan(const string& s, double& d)
// **********************************
{
unsigned n;
double v;
sscanf(s.c_str(), "%lf%n", &v, &n);
if (n != s.size()) return false;
d = v;
return true;
}
bool Scan(const string& s, int& i)
// *******************************
{
int v;
unsigned n;
sscanf(s.c_str(), "%d%n", &v, &n);
if (n != s.size()) return false;
i = v;
return true;
}
// -------------------------------------------------------------------
// Function : "Scan()".
/*! \overload bool Scan ( const string &s, string &pattern )
* \param s string to interpret.
* \param pattern a stipple pattern for a layer.
* \return true if the conversion was correct.
*
* Look for a stipple patern. Checks the string length (must be
* equal to 16) and only made of hexadecimal characters.
*/
bool Scan ( const string &s, string &pattern )
{
if ( s.size() != 16 ) return ( false );
string validChars = "0123456789ABCDEFabcdef";
for ( unsigned i=0 ; i<16 ; i++ ) {
if ( validChars.find(s[i]) == string::npos ) return ( false );
}
pattern = s;
return ( true );
}
// -------------------------------------------------------------------
// Function : "Scan()".
/*! \overload bool Scan ( const string &s, unsigned short &redValue, unsigned short &greenValue, unsigned short &blueValue )
* \param s string to interpret.
* \param redValue the red color's component.
* \param greenValue the green color's component.
* \param blueValue the blue color's component.
* \return true if the conversion was correct.
*
* Split a string of the form \c "RRR,GGG,BBB" into its numerical
* components (between 0 and 255).
*/
bool Scan ( const string &s
, unsigned short &redValue
, unsigned short &greenValue
, unsigned short &blueValue )
{
unsigned n;
unsigned short red;
unsigned short green;
unsigned short blue;
sscanf ( s.c_str(), "%hu,%hu,%hu%n", &red, &green, &blue, &n );
if ( n != s.size() ) return ( false );
redValue = red;
greenValue = green;
blueValue = blue;
return ( true );
}
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,174 @@
// -*- C++ -*-
//
// This file is part of the Hurricane Software.
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
//
// ===================================================================
//
// $Id: Commons.h,v 1.19 2007/07/29 15:24:52 jpc Exp $
//
// 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 : "./Commons.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __HURRICANE_COMMONS__
# define __HURRICANE_COMMONS__
# include <stdio.h>
# include <assert.h>
# include <string>
# include <list>
# include <set>
# include <map>
# include <stack>
# include <vector>
# include <iostream>
# include <fstream>
// x-----------------------------------------------------------------x
// | Macros Definition |
// x-----------------------------------------------------------------x
# define Hurricane H
# define BEGIN_NAMESPACE_HURRICANE namespace Hurricane {
# define END_NAMESPACE_HURRICANE }
# define USING_NAMESPACE_HURRICANE using namespace std; using namespace Hurricane;
# define is_a (bool)dynamic_cast
using namespace std;
namespace Hurricane {
using namespace std;
// ---------------------------------------------------------------
// Forward Declarations.
class Slot;
class Record;
// x-------------------------------------------------------------x
// | Tracing/Debugging Utilites |
// x-------------------------------------------------------------x
bool in_trace ();
void trace_on ();
void trace_off ();
void trace_in ();
void trace_out ();
bool inltrace ( unsigned int level );
unsigned int ltracelevel ( unsigned int level );
void ltracein ( unsigned int level, unsigned int count=1 );
void ltraceout ( unsigned int level, unsigned int count=1 );
# define trace if (in_trace() ) cerr << tab
# define ltrace(level) if (inltrace(level)) cerr << tab
// x-------------------------------------------------------------x
// | Miscellaneous Utilites |
// x-------------------------------------------------------------x
inline string _TName ( const string& s ) { return s; }
inline string _PName ( const string& s ) { return "Hurricane::" + s; }
template<class Type>
inline Type abs ( const Type& value ) { return (value<0) ? -value : value; }
string Demangle ( const char* symbol );
inline string Demangle ( const type_info& info ) { return Demangle(info.name()); }
} // End of Hurricane namespace.
// x-----------------------------------------------------------------x
// | Generic Functions Definition |
// x-----------------------------------------------------------------x
using namespace std;
// x-----------------------------------------------------------------x
// | GetString() Overloads for POD/STL types |
// x-----------------------------------------------------------------x
// Note: we are outside the Hurricane namespace.
# include "SlotAdapter.h"
// x-----------------------------------------------------------------x
// | Scan() Overloads for POD/STL types |
// x-----------------------------------------------------------------x
// Note: we are outside the Hurricane namespace.
bool Scan ( const string& s, int& i );
bool Scan ( const string& s, unsigned& u );
bool Scan ( const string& s, unsigned short& u );
bool Scan ( const string& s, double& d );
bool Scan ( const string& s, string& pattern );
bool Scan ( const string& s, unsigned short& redValue
, unsigned short& greenValue
, unsigned short& blueValue );
// x-----------------------------------------------------------------x
// | Record & Tabulation Types Definitions |
// x-----------------------------------------------------------------x
// Note: Record & Tabulation are not templates, so they can be defined
// early.
# include "Tabulation.h"
# endif

View File

@ -0,0 +1,946 @@
// ****************************************************************************************************
// File: Component.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Component.h"
#include "Net.h"
#include "Cell.h"
#include "Rubber.h"
#include "Slice.h"
#include "BasicLayer.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Filters declaration & implementation
// ****************************************************************************************************
class Component_IsUnderFilter : public Filter<Component*> {
// ******************************************************
public: Box _area;
public: Component_IsUnderFilter(const Box& area)
// *********************************************
: _area(area)
{
};
public: Component_IsUnderFilter(const Component_IsUnderFilter& filter)
// *******************************************************************
: _area(filter._area)
{
};
public: Component_IsUnderFilter& operator=(const Component_IsUnderFilter& filter)
// ******************************************************************************
{
_area = filter._area;
return *this;
};
public: virtual Filter<Component*>* GetClone() const
// *************************************************
{
return new Component_IsUnderFilter(*this);
};
public: virtual bool Accept(Component* component) const
// ****************************************************
{
return _area.Intersect(component->GetBoundingBox());
};
public: virtual string _GetString() const
// **************************************
{
return "<" + _TName("Component::IsUnderFilter") + " " + GetString(_area) + ">";
};
};
// ****************************************************************************************************
// Component_Hooks declaration
// ****************************************************************************************************
class Component_Hooks : public Collection<Hook*> {
// *********************************************
// Types
// *****
public: typedef Collection<Hook*> Inherit;
public: class Locator : public Hurricane::Locator<Hook*> {
// *****************************************************
public: typedef Hurricane::Locator<Hook*> Inherit;
private: const Component* _component;
private: Hook* _hook;
public: Locator(const Component* component = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual Hook* GetElement() const;
public: virtual Hurricane::Locator<Hook*>* GetClone() const;
public: virtual bool IsValid() const;
public: virtual void Progress();
public: virtual string _GetString() const;
};
// Attributes
// **********
private: const Component* _component;
// Constructors
// ************
public: Component_Hooks(const Component* component = NULL);
public: Component_Hooks(const Component_Hooks& hooks);
// Operators
// *********
public: Component_Hooks& operator=(const Component_Hooks& hooks);
// Accessors
// *********
public: virtual Collection<Hook*>* GetClone() const;
public: virtual Hurricane::Locator<Hook*>* GetLocator() const;
// Others
// ******
public: virtual string _GetString() const;
};
// ****************************************************************************************************
// Component_ConnexComponents declaration
// ****************************************************************************************************
class Component_ConnexComponents : public Collection<Component*> {
// *************************************************************
// Types
// *****
public: typedef Collection<Component*> Inherit;
public: class Locator : public Hurricane::Locator<Component*> {
// **********************************************************
public: typedef Hurricane::Locator<Component*> Inherit;
private: const Component* _component;
private: set<Component*> _componentSet;
private: stack<Component*> _componentStack;
public: Locator(const Component* component = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual Component* GetElement() const;
public: virtual Hurricane::Locator<Component*>* GetClone() const;
public: virtual bool IsValid() const;
public: virtual void Progress();
public: virtual string _GetString() const;
};
// Attributes
// **********
private: const Component* _component;
// Constructors
// ************
public: Component_ConnexComponents(const Component* component = NULL);
public: Component_ConnexComponents(const Component_ConnexComponents& connexComponents);
// Operators
// *********
public: Component_ConnexComponents& operator=(const Component_ConnexComponents& connexComponents);
// Accessors
// *********
public: virtual Collection<Component*>* GetClone() const;
public: virtual Hurricane::Locator<Component*>* GetLocator() const;
// Others
// ******
public: virtual string _GetString() const;
};
// ****************************************************************************************************
// Component_SlaveComponents declaration
// ****************************************************************************************************
class Component_SlaveComponents : public Collection<Component*> {
// ************************************************************
// Types
// *****
public: typedef Collection<Component*> Inherit;
public: class Locator : public Hurricane::Locator<Component*> {
// **********************************************************
public: typedef Hurricane::Locator<Component*> Inherit;
private: const Component* _component;
private: set<Component*> _componentSet;
private: stack<Component*> _componentStack;
public: Locator(const Component* component = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual Component* GetElement() const;
public: virtual Hurricane::Locator<Component*>* GetClone() const;
public: virtual bool IsValid() const;
public: virtual void Progress();
public: virtual string _GetString() const;
};
// Attributes
// **********
private: const Component* _component;
// Constructors
// ************
public: Component_SlaveComponents(const Component* component = NULL);
public: Component_SlaveComponents(const Component_SlaveComponents& slaveComponents);
// Operators
// *********
public: Component_SlaveComponents& operator=(const Component_SlaveComponents& slaveComponents);
// Accessors
// *********
public: virtual Collection<Component*>* GetClone() const;
public: virtual Hurricane::Locator<Component*>* GetLocator() const;
// Others
// ******
public: virtual string _GetString() const;
};
// ****************************************************************************************************
// Component implementation
// ****************************************************************************************************
Component::Component(Net* net, bool inPlugCreate)
// **********************************************
: Inherit(),
_net(net),
_rubber(NULL),
_bodyHook(this),
_nextOfNetComponentSet(NULL)
{
if (!inPlugCreate && !_net)
throw Error("Can't create " + _TName("Component") + " : null net");
}
Cell* Component::GetCell() const
// *****************************
{
return _net->GetCell();
}
Hooks Component::GetHooks() const
// ******************************
{
return Component_Hooks(this);
}
Components Component::GetConnexComponents() const
// **********************************************
{
return Component_ConnexComponents(this);
}
Components Component::GetSlaveComponents() const
// *********************************************
{
return Component_SlaveComponents(this);
}
ComponentFilter Component::GetIsUnderFilter(const Box& area)
// *********************************************************
{
return Component_IsUnderFilter(area);
}
void Component::Materialize()
// **************************
{
// trace << "Materialize() - " << this << endl;
if (!IsMaterialized()) {
Cell* cell = GetCell();
Layer* layer = GetLayer();
if (cell && layer) {
Slice* slice = cell->GetSlice(layer);
if (!slice) slice = Slice::_Create(cell, layer);
QuadTree* quadTree = slice->_GetQuadTree();
quadTree->Insert(this);
cell->_Fit(quadTree->GetBoundingBox());
} else {
//cerr << "[WARNING] " << this << " not inserted into QuadTree." << endl;
}
}
}
void Component::Unmaterialize()
// ****************************
{
// trace << "Unmaterializing " << this << endl;
if (IsMaterialized()) {
Cell* cell = GetCell();
Slice* slice = cell->GetSlice(GetLayer());
if (slice) {
cell->_Unfit(GetBoundingBox());
slice->_GetQuadTree()->Remove(this);
if (slice->IsEmpty()) slice->_Delete();
}
}
}
void Component::Invalidate(bool propagateFlag)
// *******************************************
{
Inherit::Invalidate(false);
if (propagateFlag) {
Rubber* rubber = GetRubber();
if (rubber) rubber->Invalidate();
for_each_component(component, GetSlaveComponents()) {
component->Invalidate(false);
end_for;
}
}
}
void Component::_PostCreate()
// **************************
{
if (_net) _net->_GetComponentSet()._Insert(this);
Inherit::_PostCreate();
}
void Component::_PreDelete()
// *************************
{
// trace << "entering Component::_PreDelete: " << this << endl;
// trace_in();
ClearProperties();
set<Component*> componentSet;
GetSlaveComponents().Fill(componentSet);
set<Hook*> masterHookSet;
componentSet.insert(this);
for_each_component(component, GetCollection(componentSet)) {
component->Unmaterialize();
for_each_hook(hook, component->GetHooks()) {
for_each_hook(hook, hook->GetHooks()) {
if (hook->IsMaster() && (componentSet.find(hook->GetComponent()) == componentSet.end()))
masterHookSet.insert(hook);
end_for;
}
if (!hook->IsMaster()) hook->Detach();
end_for;
}
end_for;
}
componentSet.erase(this);
for_each_component(component, GetCollection(componentSet)) {
component->Delete();
end_for;
}
set<Rubber*> rubberSet;
set<Hook*> mainMasterHookSet;
for_each_hook(hook, GetCollection(masterHookSet)) {
Rubber* rubber = hook->GetComponent()->GetRubber();
if (!rubber)
mainMasterHookSet.insert(hook);
else {
if (rubberSet.find(rubber) == rubberSet.end()) {
rubberSet.insert(rubber);
mainMasterHookSet.insert(hook);
}
}
end_for;
}
Hook* masterHook = NULL;
for_each_hook(hook, GetCollection(mainMasterHookSet)) {
if (!masterHook)
masterHook = hook;
else
hook->Merge(masterHook);
end_for;
}
/**/
_bodyHook.Detach();
Inherit::_PreDelete();
if (_net) _net->_GetComponentSet()._Remove(this);
// trace << "exiting Component::_PreDelete:" << endl;
// trace_out();
}
string Component::_GetString() const
// *********************************
{
string s = Inherit::_GetString();
if (!_net)
s.insert(s.length() - 1, " UNCONNECTED");
else
s.insert(s.length() - 1, " " + GetString(_net->GetName()));
return s;
}
Record* Component::_GetRecord() const
// ****************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Net", _net));
record->Add(GetSlot("Rubber", _rubber));
record->Add(GetSlot("BodyHook", &_bodyHook));
}
return record;
}
void Component::_SetNet(Net* net)
// ******************************
{
if (net != _net) {
if (_net) _net->_GetComponentSet()._Remove(this);
_net = net;
if (_net) _net->_GetComponentSet()._Insert(this);
}
}
void Component::_SetRubber(Rubber* rubber)
// ***************************************
{
if (rubber != _rubber) {
if (_rubber) _rubber->_Release();
_rubber = rubber;
if (_rubber) _rubber->_Capture();
}
}
//bool Component::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const
//// *****************************************************************************************
//{
// Box area(point);
// area.Inflate(aperture);
// for_each_basic_layer(basicLayer, GetLayer()->GetBasicLayers()) {
// if (view->IsVisible(basicLayer) && GetBoundingBox(basicLayer).Intersect(area))
// return true;
// end_for;
// }
//
// return false;
//}
//
//void Component::_Highlight(View* view, const Box& updateArea, const Transformation& transformation)
//// ************************************************************************************************
//{
// for_each_basic_layer(basicLayer, GetLayer()->GetBasicLayers()) {
// _Draw(view, basicLayer, updateArea, transformation);
// end_for;
// }
//}
//
// ****************************************************************************************************
// Component::BodyHook implementation
// ****************************************************************************************************
static int BODY_HOOK_OFFSET = -1;
Component::BodyHook::BodyHook(Component* component)
// ************************************************
: Inherit()
{
if (!component)
throw Error("Can't create " + _TName("Component::BodyHook") + " : null component");
if (BODY_HOOK_OFFSET == -1)
BODY_HOOK_OFFSET = (unsigned long)this - (unsigned long)component;
}
Component* Component::BodyHook::GetComponent() const
// *************************************************
{
return (Component*)((unsigned long)this - BODY_HOOK_OFFSET);
}
string Component::BodyHook::_GetString() const
// *******************************************
{
return "<" + _TName("Component::BodyHook") + " " + GetString(GetComponent()) + ">";
}
// ****************************************************************************************************
// Component_Hooks implementation
// ****************************************************************************************************
Component_Hooks::Component_Hooks(const Component* component)
// *********************************************************
: Inherit(),
_component(component)
{
}
Component_Hooks::Component_Hooks(const Component_Hooks& hooks)
// ***********************************************************
: Inherit(),
_component(hooks._component)
{
}
Component_Hooks& Component_Hooks::operator=(const Component_Hooks& hooks)
// **********************************************************************
{
_component = hooks._component;
return *this;
}
Collection<Hook*>* Component_Hooks::GetClone() const
// *************************************************
{
return new Component_Hooks(*this);
}
Locator<Hook*>* Component_Hooks::GetLocator() const
// ************************************************
{
return new Locator(_component);
}
string Component_Hooks::_GetString() const
// ***************************************
{
string s = "<" + _TName("Component::Hooks");
if (_component) s += " " + GetString(_component);
s += ">";
return s;
}
// ****************************************************************************************************
// Component_Hooks::Locator implementation
// ****************************************************************************************************
Component_Hooks::Locator::Locator(const Component* component)
// **********************************************************
: Inherit(),
_component(component),
_hook(NULL)
{
if (_component) _hook = ((Component*)_component)->GetBodyHook();
}
Component_Hooks::Locator::Locator(const Locator& locator)
// ******************************************************
: Inherit(),
_component(locator._component),
_hook(locator._hook)
{
}
Component_Hooks::Locator& Component_Hooks::Locator::operator=(const Locator& locator)
// **********************************************************************************
{
_component = locator._component;
_hook = locator._hook;
return *this;
}
Hook* Component_Hooks::Locator::GetElement() const
// ***********************************************
{
return _hook;
}
Locator<Hook*>* Component_Hooks::Locator::GetClone() const
// *******************************************************
{
return new Locator(*this);
}
bool Component_Hooks::Locator::IsValid() const
// *******************************************
{
return (_hook != NULL);
}
void Component_Hooks::Locator::Progress()
// **************************************
{
_hook = NULL;
}
string Component_Hooks::Locator::_GetString() const
// ************************************************
{
string s = "<" + _TName("Component::Hooks::Locator");
if (_component) s += " " + GetString(_component);
s += ">";
return s;
}
// ****************************************************************************************************
// Component_ConnexComponents implementation
// ****************************************************************************************************
Component_ConnexComponents::Component_ConnexComponents(const Component* component)
// *******************************************************************************
: Inherit(),
_component(component)
{
}
Component_ConnexComponents::Component_ConnexComponents(const Component_ConnexComponents& connexComponents)
// ****************************************************************************************************
: Inherit(),
_component(connexComponents._component)
{
}
Component_ConnexComponents&
Component_ConnexComponents::operator=(const Component_ConnexComponents& connexComponents)
// *****************************************************************************************
{
_component = connexComponents._component;
return *this;
}
Collection<Component*>* Component_ConnexComponents::GetClone() const
// *****************************************************************
{
return new Component_ConnexComponents(*this);
}
Locator<Component*>* Component_ConnexComponents::GetLocator() const
// ****************************************************************
{
return new Locator(_component);
}
string Component_ConnexComponents::_GetString() const
// **************************************************
{
string s = "<" + _TName("Component::ConnexComponents");
if (_component) s += " " + GetString(_component);
s += ">";
return s;
}
// ****************************************************************************************************
// Component_ConnexComponents::Locator implementation
// ****************************************************************************************************
Component_ConnexComponents::Locator::Locator(const Component* component)
// *********************************************************************
: Inherit(),
_component(component),
_componentSet(),
_componentStack()
{
if (_component) {
_componentSet.insert((Component*)_component);
_componentStack.push((Component*)_component);
}
}
Component_ConnexComponents::Locator::Locator(const Locator& locator)
// *****************************************************************
: Inherit(),
_component(locator._component),
_componentSet(locator._componentSet),
_componentStack(locator._componentStack)
{
}
Component_ConnexComponents::Locator& Component_ConnexComponents::Locator::operator=(const Locator& locator)
// ****************************************************************************************************
{
_component = locator._component;
_componentSet = locator._componentSet;
_componentStack = locator._componentStack;
return *this;
}
Component* Component_ConnexComponents::Locator::GetElement() const
// ***************************************************************
{
return _componentStack.top();
}
Locator<Component*>* Component_ConnexComponents::Locator::GetClone() const
// ***********************************************************************
{
return new Locator(*this);
}
bool Component_ConnexComponents::Locator::IsValid() const
// ******************************************************
{
return !_componentStack.empty();
}
void Component_ConnexComponents::Locator::Progress()
// *************************************************
{
if (!_componentStack.empty()) {
Component* component = _componentStack.top();
_componentStack.pop();
for_each_hook(componentHook, component->GetHooks()) {
Hook* masterHook = componentHook->GetMasterHook();
if (masterHook) {
for_each_hook(slaveHook, masterHook->GetSlaveHooks()) {
Component* component = slaveHook->GetComponent();
if (_componentSet.find(component) == _componentSet.end()) {
_componentSet.insert(component);
_componentStack.push(component);
}
end_for;
}
Component* component = masterHook->GetComponent();
if (_componentSet.find(component) == _componentSet.end()) {
_componentSet.insert(component);
_componentStack.push(component);
}
}
end_for;
}
}
}
string Component_ConnexComponents::Locator::_GetString() const
// ***********************************************************
{
string s = "<" + _TName("Component::ConnexComponents::Locator");
if (_component) s += " " + GetString(_component);
s += ">";
return s;
}
// ****************************************************************************************************
// Component_SlaveComponents implementation
// ****************************************************************************************************
Component_SlaveComponents::Component_SlaveComponents(const Component* component)
// *****************************************************************************
: Inherit(),
_component(component)
{
}
Component_SlaveComponents::Component_SlaveComponents(const Component_SlaveComponents& slaveComponents)
// ***************************************************************************************************
: Inherit(),
_component(slaveComponents._component)
{
}
Component_SlaveComponents&
Component_SlaveComponents::operator=(const Component_SlaveComponents& slaveComponents)
// **************************************************************************************
{
_component = slaveComponents._component;
return *this;
}
Collection<Component*>* Component_SlaveComponents::GetClone() const
// ****************************************************************
{
return new Component_SlaveComponents(*this);
}
Locator<Component*>* Component_SlaveComponents::GetLocator() const
// ***************************************************************
{
return new Locator(_component);
}
string Component_SlaveComponents::_GetString() const
// *************************************************
{
string s = "<" + _TName("Component::SlaveComponents");
if (_component) s += " " + GetString(_component);
s += ">";
return s;
}
// ****************************************************************************************************
// Component_SlaveComponents::Locator implementation
// ****************************************************************************************************
Component_SlaveComponents::Locator::Locator(const Component* component)
// ********************************************************************
: Inherit(),
_component(component),
_componentSet(),
_componentStack()
{
if (_component) {
_componentSet.insert((Component*)_component);
Hook* masterHook = ((Component*)_component)->GetBodyHook();
for_each_hook(slaveHook, masterHook->GetSlaveHooks()) {
Component* component = slaveHook->GetComponent();
if (_componentSet.find(component) == _componentSet.end()) {
_componentSet.insert(component);
_componentStack.push(component);
}
end_for;
}
}
}
Component_SlaveComponents::Locator::Locator(const Locator& locator)
// ****************************************************************
: Inherit(),
_component(locator._component),
_componentSet(locator._componentSet),
_componentStack(locator._componentStack)
{
}
Component_SlaveComponents::Locator&
Component_SlaveComponents::Locator::operator=(const Locator& locator)
// *********************************************************************
{
_component = locator._component;
_componentSet = locator._componentSet;
_componentStack = locator._componentStack;
return *this;
}
Component* Component_SlaveComponents::Locator::GetElement() const
// **************************************************************
{
return _componentStack.top();
}
Locator<Component*>* Component_SlaveComponents::Locator::GetClone() const
// **********************************************************************
{
return new Locator(*this);
}
bool Component_SlaveComponents::Locator::IsValid() const
// *****************************************************
{
return !_componentStack.empty();
}
void Component_SlaveComponents::Locator::Progress()
// ************************************************
{
if (!_componentStack.empty()) {
Component* component = _componentStack.top();
_componentStack.pop();
Hook* masterHook = component->GetBodyHook();
for_each_hook(slaveHook, masterHook->GetSlaveHooks()) {
Component* component = slaveHook->GetComponent();
if (_componentSet.find(component) == _componentSet.end()) {
_componentSet.insert(component);
_componentStack.push(component);
}
end_for;
}
}
}
string Component_SlaveComponents::Locator::_GetString() const
// **********************************************************
{
string s = "<" + _TName("Component::SlaveComponents::Locator");
if (_component) s += " " + GetString(_component);
s += ">";
return s;
}
double GetArea ( Component* component )
//**************************************
{
Box bb = component->GetBoundingBox ();
return GetValue(bb.GetWidth()) * GetValue(bb.GetHeight());
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,132 @@
// ****************************************************************************************************
// File: Component.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_COMPONENT
#define HURRICANE_COMPONENT
#include "Go.h"
#include "Components.h"
#include "Hook.h"
#include "Hooks.h"
#include "Interval.h"
namespace Hurricane {
class Net;
class Rubber;
class Layer;
// ****************************************************************************************************
// Component declaration
// ****************************************************************************************************
class Component : public Go {
// ************************
// Types
// *****
public: typedef Go Inherit;
public: class BodyHook : public Hook {
// *********************************
friend class Component;
public: typedef Hook Inherit;
private: BodyHook(Component* component);
public: virtual Component* GetComponent() const;
public: virtual bool IsMaster() const {return true;};
public: virtual string _GetTypeName() const { return _TName("Component::BodyHook"); };
public: virtual string _GetString() const;
};
// Attributes
// **********
private: Net* _net;
private: Rubber* _rubber;
private: BodyHook _bodyHook;
private: Component* _nextOfNetComponentSet;
// Constructors
// ************
protected: Component(Net* net, bool inPlugCreate = false);
// Accessors
// *********
public: virtual Cell* GetCell() const;
public: Net* GetNet() const {return _net;};
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 Point GetPosition() const {return Point(GetX(), GetY());};
public: virtual Point GetCenter() const {return GetPosition();};
public: virtual Layer* GetLayer() const = 0;
public: virtual Box GetBoundingBox() const = 0;
public: virtual Box GetBoundingBox(BasicLayer* basicLayer) const = 0;
public: Components GetConnexComponents() const;
public: Components GetSlaveComponents() const;
// Updators
// ********
public: virtual void Materialize();
public: virtual void Unmaterialize();
public: virtual void Invalidate(bool propagateFlag = true);
// Filters
// *******
public: static ComponentFilter GetIsUnderFilter(const Box& area);
// Others
// ******
protected: virtual void _PostCreate();
protected: virtual void _PreDelete();
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: Component* _GetNextOfNetComponentSet() const {return _nextOfNetComponentSet;};
public: void _SetNet(Net* net);
public: void _SetRubber(Rubber* rubber);
public: void _SetNextOfNetComponentSet(Component* component) {_nextOfNetComponentSet = component;};
//public: virtual bool _IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const;
//public: virtual void _Highlight(View* view, const Box& updateArea, const Transformation& transformation);
};
double GetArea ( Component* component );
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Component)
SetNestedSlotAdapter(Hurricane::Component::BodyHook)
#endif // HURRICANE_COMPONENT
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Components.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_COMPONENTS
#define HURRICANE_COMPONENTS
#include "Collection.h"
namespace Hurricane {
class Component;
// ****************************************************************************************************
// Components declaration
// ****************************************************************************************************
typedef GenericCollection<Component*> Components;
// ****************************************************************************************************
// ComponentLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Component*> ComponentLocator;
// ****************************************************************************************************
// ComponentFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Component*> ComponentFilter;
// ****************************************************************************************************
// for_each_component declaration
// ****************************************************************************************************
#define for_each_component(component, components)\
/************************************************/\
{\
ComponentLocator _locator = components.GetLocator();\
while (_locator.IsValid()) {\
Component* component = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_COMPONENTS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,270 @@
// ****************************************************************************************************
// File: CompositeLayer.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "CompositeLayer.h"
#include "Technology.h"
#include "BasicLayer.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// CompositeLayer implementation
// ****************************************************************************************************
CompositeLayer::CompositeLayer(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize, const Unit& minimalSpacing)
// ****************************************************************************************************
: Inherit(technology, name, minimalSize, minimalSpacing),
_type(type),
_basicLayerList(),
_contactSizeMap(),
_segmentSizeMap(),
_segmentExtentionMap(),
_padSizeMap(),
_maximalContactSize(0),
_maximalSegmentSize(0),
_maximalSegmentExtention(0),
_maximalPadSize(0),
_symbolicBasicLayer(NULL)
{
}
CompositeLayer* CompositeLayer::Create(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize, const Unit& minimalSpacing)
// ****************************************************************************************************
{
CompositeLayer* compositeLayer =
new CompositeLayer(technology, name, type, minimalSize, minimalSpacing);
compositeLayer->_PostCreate();
return compositeLayer;
}
BasicLayers CompositeLayer::GetBasicLayers() const
// ***********************************************
{
return GetCollection(_basicLayerList);
}
Unit CompositeLayer::GetContactSize(BasicLayer* basicLayer) const
// **************************************************************
{
SizeMap::const_iterator it = _contactSizeMap.find(basicLayer);
return ((it == _contactSizeMap.end()) ? 0 : (*it).second);
}
Unit CompositeLayer::GetSegmentSize(BasicLayer* basicLayer) const
// **************************************************************
{
SizeMap::const_iterator it = _segmentSizeMap.find(basicLayer);
return ((it == _segmentSizeMap.end()) ? 0 : (*it).second);
}
Unit CompositeLayer::GetSegmentExtention(BasicLayer* basicLayer) const
// *******************************************************************
{
SizeMap::const_iterator it = _segmentExtentionMap.find(basicLayer);
return ((it == _segmentExtentionMap.end()) ? 0 : (*it).second);
}
Unit CompositeLayer::GetPadSize(BasicLayer* basicLayer) const
// **********************************************************
{
SizeMap::const_iterator it = _padSizeMap.find(basicLayer);
return ((it == _padSizeMap.end()) ? 0 : (*it).second);
}
void CompositeLayer::Add(BasicLayer* basicLayer, const Unit& contactSize, const Unit& segmentSize, const Unit& segmentExtention, const Unit& padSize)
// ****************************************************************************************************
{
if (!basicLayer)
throw Error("Can't add basic layer : null basic layer");
if (Contains(basicLayer))
throw Error("Can't add basic layer : already done");
_basicLayerList.push_back(basicLayer);
_SetMask(GetMask() | basicLayer->GetMask());
_SetExtractMask(GetExtractMask() | basicLayer->GetExtractMask());
if (contactSize != 0) _contactSizeMap[basicLayer] = contactSize;
if (segmentSize != 0) _segmentSizeMap[basicLayer] = segmentSize;
if (segmentExtention != 0) _segmentExtentionMap[basicLayer] = segmentExtention;
if (padSize != 0) _padSizeMap[basicLayer] = padSize;
_maximalContactSize = max(contactSize, _maximalContactSize);
_maximalSegmentSize = max(segmentSize, _maximalSegmentSize);
_maximalSegmentExtention = max(segmentExtention, _maximalSegmentExtention);
_maximalPadSize = max(padSize, _maximalPadSize);
}
void CompositeLayer::Remove(BasicLayer* basicLayer)
// ************************************************
{
if (!basicLayer)
throw Error("Can't remove basic layer : null basic layer");
if (!Contains(basicLayer))
throw Error("Can't remove basic layer : not contained");
_basicLayerList.remove(basicLayer);
_contactSizeMap.erase(basicLayer);
_segmentSizeMap.erase(basicLayer);
_segmentExtentionMap.erase(basicLayer);
_padSizeMap.erase(basicLayer);
_maximalContactSize = 0;
_maximalSegmentSize = 0;
_maximalSegmentExtention = 0;
_maximalPadSize = 0;
Mask mask = 0;
Mask extractMask = 0;
for_each_basic_layer(basicLayer, GetBasicLayers()) {
mask |= basicLayer->GetMask();
extractMask |= basicLayer->GetExtractMask();
_maximalContactSize = max(GetContactSize(basicLayer), _maximalContactSize);
_maximalSegmentSize = max(GetSegmentSize(basicLayer), _maximalSegmentSize);
_maximalSegmentExtention = max(GetSegmentExtention(basicLayer), _maximalSegmentExtention);
_maximalPadSize = max(GetPadSize(basicLayer), _maximalPadSize);
end_for;
}
_SetMask(mask);
_SetExtractMask(extractMask);
}
string CompositeLayer::_GetString() const
// **************************************
{
string s = Inherit::_GetString();
/*
s.insert(s.length() - 1, " " + GetString(_type));
s.insert(s.length() - 1, " {");
string separator = "";
for_each_basic_layer(basicLayer, GetBasicLayers()) {
s.insert(s.length() - 1, separator + GetString(basicLayer->GetName()));
separator = "|";
end_for;
}
s.insert(s.length() - 1, "}");
*/
return s;
}
Record* CompositeLayer::_GetRecord() const
// ***************************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Type", &_type));
record->Add(GetSlot("BasicLayers", &_basicLayerList));
record->Add(GetSlot("ContactSizes", &_contactSizeMap));
record->Add(GetSlot("SegmentSizes", &_segmentSizeMap));
record->Add(GetSlot("SegmentExtentions", &_segmentExtentionMap));
record->Add(GetSlot("PadSizes", &_padSizeMap));
record->Add(GetSlot("MaximalContactSize", &_maximalContactSize));
record->Add(GetSlot("MaximalSegmentSize", &_maximalSegmentSize));
record->Add(GetSlot("MaximalSegmentExtention", &_maximalSegmentExtention));
record->Add(GetSlot("MaximalPadSize", &_maximalPadSize));
}
return record;
}
void CompositeLayer::_UpdateSymbolicBasicLayer(const Layer::Mask& visibleBasicLayersMask)
// **************************************************************************************
{
_symbolicBasicLayer = NULL;
BasicLayer* symbolicBasicLayer = NULL;
for_each_basic_layer(basicLayer, GetBasicLayers()) {
if (basicLayer->GetMask() & visibleBasicLayersMask) {
symbolicBasicLayer = basicLayer;
if (basicLayer->GetType() == BasicLayer::Type::CONTACT)
_symbolicBasicLayer = basicLayer;
}
end_for;
}
if (!_symbolicBasicLayer) _symbolicBasicLayer = symbolicBasicLayer;
}
// ****************************************************************************************************
// CompositeLayer::Type implementation
// ****************************************************************************************************
CompositeLayer::Type::Type(const Code& code)
// *****************************************
: _code(code)
{
}
CompositeLayer::Type::Type(const Type& type)
// *****************************************
: _code(type._code)
{
}
CompositeLayer::Type& CompositeLayer::Type::operator=(const Type& type)
// ********************************************************************
{
_code = type._code;
return *this;
}
string CompositeLayer::Type::_GetString() const
// ********************************************
{
switch (_code) {
case UNDEFINED : return "UNDEFINED";
case METAL : return "METAL";
case VIA : return "VIA";
}
return "ABNORMAL";
}
Record* CompositeLayer::Type::_GetRecord() const
// *********************************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", (int)_code));
return record;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
bool Scan(const string& s, H::CompositeLayer::Type& type)
// ***************************************************
{
if (s == "UNDEFINED") {
type = H::CompositeLayer::Type::UNDEFINED;
return true;
}
if (s == "METAL") {
type = H::CompositeLayer::Type::METAL;
return true;
}
if (s == "VIA") {
type = H::CompositeLayer::Type::VIA;
return true;
}
return false;
}
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,129 @@
// ****************************************************************************************************
// File: CompositeLayer.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_COMPOSITE_LAYER
#define HURRICANE_COMPOSITE_LAYER
#include "Layer.h"
#include "CompositeLayers.h"
namespace Hurricane {
// ****************************************************************************************************
// CompositeLayer declaration
// ****************************************************************************************************
class CompositeLayer : public Layer {
// ********************************
// Types
// *****
public: typedef Layer Inherit;
public: class Type {
// ***************
public: enum Code {UNDEFINED=0, METAL=1, VIA=2};
private: Code _code;
public: Type(const Code& code = UNDEFINED);
public: Type(const Type& type);
public: Type& operator=(const Type& type);
public: operator const Code&() const {return _code;};
public: const Code& GetCode() const {return _code;};
public: string _GetTypeName() const { return _TName("CompositeLayer::Type"); };
public: string _GetString() const;
public: Record* _GetRecord() const;
};
public: typedef list<BasicLayer*> BasicLayerList;
public: typedef map<BasicLayer*, Unit> SizeMap;
// Attributes
// **********
private: Type _type;
private: BasicLayerList _basicLayerList;
private: SizeMap _contactSizeMap;
private: SizeMap _segmentSizeMap;
private: SizeMap _segmentExtentionMap;
private: SizeMap _padSizeMap;
private: Unit _maximalContactSize;
private: Unit _maximalSegmentSize;
private: Unit _maximalSegmentExtention;
private: Unit _maximalPadSize;
private: BasicLayer* _symbolicBasicLayer;
// Constructors
// ************
protected: CompositeLayer(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
public: static CompositeLayer* Create(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
// Accessors
// *********
public: const Type& GetType() const {return _type;};
public: virtual BasicLayers GetBasicLayers() const;
public: Unit GetContactSize(BasicLayer* basicLayer) const;
public: Unit GetSegmentSize(BasicLayer* basicLayer) const;
public: Unit GetSegmentExtention(BasicLayer* basicLayer) const;
public: Unit GetPadSize(BasicLayer* basicLayer) const;
public: const Unit& GetMaximalContactSize() const {return _maximalContactSize;};
public: const Unit& GetMaximalSegmentSize() const {return _maximalSegmentSize;};
public: const Unit& GetMaximalSegmentExtention() const {return _maximalSegmentExtention;};
public: const Unit& GetMaximalPadSize() const {return _maximalPadSize;};
// Updators
// ********
public: void Add(BasicLayer* basicLayer, const Unit& contactSize, const Unit& segmentSize, const Unit& segmentExtention, const Unit& padSize);
public: void Remove(BasicLayer* basicLayer);
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("CompositeLayer");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: virtual BasicLayer* _GetSymbolicBasicLayer() {return _symbolicBasicLayer;};
public: BasicLayerList& _GetBasicLayerList() {return _basicLayerList;};
public: void _UpdateSymbolicBasicLayer(const Layer::Mask& visibleBasicLayersMask);
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::CompositeLayer)
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
bool Scan(const string& s, H::CompositeLayer::Type& type);
#endif // HURRICANE_COMPOSITE_LAYER
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: CompositeLayers.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_COMPOSITE_LAYERS
#define HURRICANE_COMPOSITE_LAYERS
#include "Collection.h"
namespace Hurricane {
class CompositeLayer;
// ****************************************************************************************************
// CompositeLayers declaration
// ****************************************************************************************************
typedef GenericCollection<CompositeLayer*> CompositeLayers;
// ****************************************************************************************************
// CompositeLayerLocator declaration
// ****************************************************************************************************
typedef GenericLocator<CompositeLayer*> CompositeLayerLocator;
// ****************************************************************************************************
// CompositeLayerFilter declaration
// ****************************************************************************************************
typedef GenericFilter<CompositeLayer*> CompositeLayerFilter;
// ****************************************************************************************************
// for_each_composite_layer declaration
// ****************************************************************************************************
#define for_each_composite_layer(compositeLayer, compositeLayers)\
/****************************************************************/\
{\
CompositeLayerLocator _locator = compositeLayers.GetLocator();\
while (_locator.IsValid()) {\
CompositeLayer* compositeLayer = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_COMPOSITE_LAYERS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,575 @@
// ****************************************************************************************************
// File: Contact.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Contact.h"
#include "Net.h"
#include "BasicLayer.h"
#include "CompositeLayer.h"
#include "Plug.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Contact_Hooks declaration
// ****************************************************************************************************
class Contact_Hooks : public Collection<Hook*> {
// *******************************************
// Types
// *****
public: typedef Collection<Hook*> Inherit;
public: class Locator : public Hurricane::Locator<Hook*> {
// *****************************************************
public: typedef Hurricane::Locator<Hook*> Inherit;
private: const Contact* _contact;
private: Hook* _hook;
public: Locator(const Contact* contact = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual Hook* GetElement() const;
public: virtual Hurricane::Locator<Hook*>* GetClone() const;
public: virtual bool IsValid() const;
public: virtual void Progress();
public: virtual string _GetString() const;
};
// Attributes
// **********
private: const Contact* _contact;
// Constructors
// ************
public: Contact_Hooks(const Contact* contact = NULL);
public: Contact_Hooks(const Contact_Hooks& hooks);
// Operators
// *********
public: Contact_Hooks& operator=(const Contact_Hooks& hooks);
// Accessors
// ********^
public: virtual Collection<Hook*>* GetClone() const;
public: virtual Hurricane::Locator<Hook*>* GetLocator() const;
// Others
// ******
public: virtual string _GetString() const;
};
// ****************************************************************************************************
// Contact implementation
// ****************************************************************************************************
Contact::Contact(Net* net, Layer* layer, const Unit& x, const Unit& y, const Unit& width, const Unit& height)
// ****************************************************************************************************
: Inherit(net),
_anchorHook(this),
_layer(layer),
_dx(x),
_dy(y),
_width(width),
_height(height)
{
if (!_layer)
throw Error("Can't create " + _TName("Contact") + " : null layer");
}
Contact::Contact(Net* net, Component* anchor, Layer* layer, const Unit& dx, const Unit& dy, const Unit& width, const Unit& height)
// ****************************************************************************************************
: Inherit(net),
_anchorHook(this),
_layer(layer),
_dx(dx),
_dy(dy),
_width(width),
_height(height)
{
if (!anchor)
throw Error("Can't create " + _TName("Contact") + " : null anchor");
if (!anchor->GetNet())
throw Error("Can't create " + _TName("Contact") + " : unconnected anchor");
if (anchor->GetNet() != GetNet())
throw Error("Can't create " + _TName("Contact") + " : incompatible anchor");
if (!_layer)
throw Error("Can't create " + _TName("Contact") + " : null layer");
_anchorHook.Attach(anchor->GetBodyHook());
}
Contact* Contact::Create(Net* net, Layer* layer, const Unit& x, const Unit& y, const Unit& width, const Unit& height)
// ****************************************************************************************************
{
Contact* contact = new Contact(net, layer, x, y, width, height);
contact->_PostCreate();
return contact;
}
Contact* Contact::Create(Component* anchor, Layer* layer, const Unit& dx, const Unit& dy, const Unit& width, const Unit& height)
// ****************************************************************************************************
{
if (!anchor)
throw Error("Can't create " + _TName("Contact") + " : null anchor");
Contact* contact = new Contact(anchor->GetNet(), anchor, layer, dx, dy, width, height);
contact->_PostCreate();
return contact;
}
Hooks Contact::GetHooks() const
// ****************************
{
return Contact_Hooks(this);
}
Unit Contact::GetX() const
// ***********************
{
Component* anchor = GetAnchor();
return (!anchor) ? _dx : anchor->GetX() + _dx;
}
Unit Contact::GetY() const
// ***********************
{
Component* anchor = GetAnchor();
return (!anchor) ? _dy : anchor->GetY() + _dy;
}
Point Contact::GetPosition() const
// *******************************
{
Component* anchor = GetAnchor();
return (!anchor) ? Point(_dx, _dy) : anchor->GetPosition().Translate(_dx, _dy);
}
Box Contact::GetBoundingBox() const
// ********************************
{
Unit size = _GetSize();
return Box(GetPosition()).Inflate(GetHalfWidth() + size, GetHalfHeight() + size);
}
Box Contact::GetBoundingBox(BasicLayer* basicLayer) const
// ******************************************************
{
if (!_layer->Contains(basicLayer)) return Box();
Unit size = _GetSize(basicLayer);
return Box(GetPosition()).Inflate(GetHalfWidth() + size, GetHalfHeight() + size);
}
Component* Contact::GetAnchor() const
// **********************************
{
Hook* masterHook = _anchorHook.GetMasterHook();
return (masterHook) ? masterHook->GetComponent() : NULL;
}
void Contact::Translate(const Unit& dx, const Unit& dy)
// ****************************************************
{
if ((dx != 0) || (dy != 0)) {
Invalidate(true);
_dx += dx;
_dy += dy;
}
}
void Contact::SetLayer(Layer* layer)
// *********************************
{
if (!layer)
throw Error("Can't set layer : null layer");
if (layer != _layer) {
Invalidate(false);
_layer = layer;
}
}
void Contact::SetWidth(const Unit& width)
// **************************************
{
if (width != _width) {
Invalidate(false);
_width = width;
}
}
void Contact::SetHeight(const Unit& height)
// ****************************************
{
if (height != _height) {
Invalidate(false);
_height = height;
}
}
void Contact::SetSizes(const Unit& width, const Unit& height)
// **********************************************************
{
if ((width != _width) || (height != _height)) {
Invalidate(false);
_width = width;
_height = height;
}
}
void Contact::SetX(const Unit& x)
// ******************************
{
SetPosition(x, GetY());
}
void Contact::SetY(const Unit& y)
// ******************************
{
SetPosition(GetX(), y);
}
void Contact::SetPosition(const Unit& x, const Unit& y)
// ****************************************************
{
Component* anchor = GetAnchor();
if (!anchor)
SetOffset(x, y);
else
SetOffset(x - anchor->GetX(), y - anchor->GetY());
}
void Contact::SetPosition(const Point& position)
// *********************************************
{
SetPosition(position.GetX(), position.GetY());
}
void Contact::SetDx(const Unit& dx)
// ********************************
{
SetOffset(dx, _dy);
}
void Contact::SetDy(const Unit& dy)
// ********************************
{
SetOffset(_dx, dy);
}
void Contact::SetOffset(const Unit& dx, const Unit& dy)
// ****************************************************
{
if ((dx != _dx) || (dy != _dy)) {
Invalidate(true);
_dx = dx;
_dy = dy;
}
}
void Contact::_PreDelete()
// ***********************
{
// trace << "entering Contact::PreDelete: " << this << endl;
// trace_in();
Inherit::_PreDelete();
_anchorHook.Detach();
// trace << "exiting Contact::PreDelete:" << endl;
// trace_out();
}
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));
return s;
}
Record* Contact::_GetRecord() const
// **************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("AnchorHook", &_anchorHook));
record->Add(GetSlot("Anchor", GetAnchor()));
record->Add(GetSlot("Layer", _layer));
record->Add(GetSlot("Dx", &_dx));
record->Add(GetSlot("Dy", &_dy));
record->Add(GetSlot("Width", &_width));
record->Add(GetSlot("Height", &_height));
}
return record;
}
Unit Contact::_GetSize() const
// ***************************
{
Unit size = 0;
Layer* layer = GetLayer();
if (is_a<CompositeLayer*>(layer))
size = ((CompositeLayer*)layer)->GetMaximalContactSize();
return size;
}
Unit Contact::_GetSize(BasicLayer* basicLayer) const
// *************************************************
{
Layer* layer = GetLayer();
if (!layer->Contains(basicLayer)) return 0;
Unit size = 0;
if (is_a<CompositeLayer*>(layer))
size = ((CompositeLayer*)layer)->GetContactSize(basicLayer);
return size;
}
//void Contact::_Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation)
//// ****************************************************************************************************
//{
// if (_width && _height) {
// if (1 < view->GetScreenSize(max(_width, _height)))
// basicLayer->_Fill(view, transformation.GetBox(GetBoundingBox(basicLayer)));
// }
// if (basicLayer == _layer->_GetSymbolicBasicLayer()) {
// if (view->CutPointsAreVisible() && (3 < view->GetScale())) {
// Point position = GetPosition();
// view->DrawPoint(transformation.GetPoint(position), 3);
// if (_width) {
// Box box = transformation.GetBox(Box(position).Inflate(GetHalfWidth(), 0));
// view->DrawLine(box.GetXMin(), box.GetYMin(), box.GetXMax(), box.GetYMax());
// }
// if (_height) {
// Box box = transformation.GetBox(Box(position).Inflate(0, GetHalfHeight()));
// view->DrawLine(box.GetXMin(), box.GetYMin(), box.GetXMax(), box.GetYMax());
// }
// }
// }
//}
//
//void Contact::_Highlight(View* view, const Box& updateArea, const Transformation& transformation)
//// **********************************************************************************************
//{
// if (_width && _height) {
// if (1 < view->GetScreenSize(max(_width, _height))) {
// for_each_basic_layer(basicLayer, GetLayer()->GetBasicLayers()) {
// basicLayer->_Fill(view, transformation.GetBox(GetBoundingBox(basicLayer)));
// end_for;
// }
// }
// }
// if (view->GetScale() <= 1)
// view->DrawPoint(transformation.GetPoint(GetPosition()), 1);
// else if (view->GetScale() <= 3)
// view->DrawPoint(transformation.GetPoint(GetPosition()), 2);
// else {
// Point position = GetPosition();
// view->DrawPoint(transformation.GetPoint(position), 3);
// if (_width) {
// Box box = transformation.GetBox(Box(position).Inflate(GetHalfWidth(), 0));
// view->DrawLine(box.GetXMin(), box.GetYMin(), box.GetXMax(), box.GetYMax());
// }
// if (_height) {
// Box box = transformation.GetBox(Box(position).Inflate(0, GetHalfHeight()));
// view->DrawLine(box.GetXMin(), box.GetYMin(), box.GetXMax(), box.GetYMax());
// }
// }
//}
//
// ****************************************************************************************************
// Contact::AnchorHook implementation
// ****************************************************************************************************
static int ANCHOR_HOOK_OFFSET = -1;
Contact::AnchorHook::AnchorHook(Contact* contact)
// **********************************************
: Inherit()
{
if (!contact)
throw Error("Can't create " + _TName("Contact::AnchorHook") + " : null contact");
if (ANCHOR_HOOK_OFFSET == -1)
ANCHOR_HOOK_OFFSET = (unsigned long)this - (unsigned long)contact;
}
Component* Contact::AnchorHook::GetComponent() const
// *************************************************
{
return (Component*)((unsigned long)this - ANCHOR_HOOK_OFFSET);
}
string Contact::AnchorHook::_GetString() const
// *******************************************
{
return "<" + _TName("Contact::AnchorHook") + " " + GetString(GetComponent()) + ">";
}
// ****************************************************************************************************
// Contact_Hooks implementation
// ****************************************************************************************************
Contact_Hooks::Contact_Hooks(const Contact* contact)
// *************************************************
: Inherit(),
_contact(contact)
{
}
Contact_Hooks::Contact_Hooks(const Contact_Hooks& hooks)
// *****************************************************
: Inherit(),
_contact(hooks._contact)
{
}
Contact_Hooks& Contact_Hooks::operator=(const Contact_Hooks& hooks)
// ****************************************************************
{
_contact = hooks._contact;
return *this;
}
Collection<Hook*>* Contact_Hooks::GetClone() const
// ***********************************************
{
return new Contact_Hooks(*this);
}
Locator<Hook*>* Contact_Hooks::GetLocator() const
// **********************************************
{
return new Locator(_contact);
}
string Contact_Hooks::_GetString() const
// *************************************
{
string s = "<" + _TName("Contact::Hooks");
if (_contact) s += " " + GetString(_contact);
s += ">";
return s;
}
// ****************************************************************************************************
// Contact_Hooks::Locator implementation
// ****************************************************************************************************
Contact_Hooks::Locator::Locator(const Contact* contact)
// ****************************************************
: Inherit(),
_contact(contact),
_hook(NULL)
{
if (_contact) _hook = ((Contact*)_contact)->GetBodyHook();
}
Contact_Hooks::Locator::Locator(const Locator& locator)
// ****************************************************
: Inherit(),
_contact(locator._contact),
_hook(locator._hook)
{
}
Contact_Hooks::Locator& Contact_Hooks::Locator::operator=(const Locator& locator)
// ******************************************************************************
{
_contact = locator._contact;
_hook = locator._hook;
return *this;
}
Hook* Contact_Hooks::Locator::GetElement() const
// *********************************************
{
return _hook;
}
Locator<Hook*>* Contact_Hooks::Locator::GetClone() const
// *****************************************************
{
return new Locator(*this);
}
bool Contact_Hooks::Locator::IsValid() const
// *****************************************
{
return (_hook != NULL);
}
void Contact_Hooks::Locator::Progress()
// ************************************
{
if (_hook) {
if (_hook == ((Contact*)_contact)->GetBodyHook())
_hook = ((Contact*)_contact)->GetAnchorHook();
else
_hook = NULL;
}
}
string Contact_Hooks::Locator::_GetString() const
// **********************************************
{
string s = "<" + _TName("Contact::Hooks::Locator");
if (_contact) s += " " + GetString(_contact);
s += ">";
return s;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,128 @@
// ****************************************************************************************************
// File: Contact.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_CONTACT
#define HURRICANE_CONTACT
#include "Component.h"
#include "Contacts.h"
namespace Hurricane {
// ****************************************************************************************************
// Contact declaration
// ****************************************************************************************************
class Contact : public Component {
// *****************************
// Types
// *****
public: typedef Component Inherit;
public: class AnchorHook : public Hook {
// ***********************************
friend class Contact;
public: typedef Hook Inherit;
private: AnchorHook(Contact* contact);
public: virtual Component* GetComponent() const;
public: virtual bool IsMaster() const {return false;};
public: virtual string _GetTypeName() const { return _TName("Contact::AnchorHook"); };
public: virtual string _GetString() const;
};
// Attributes
// **********
private: AnchorHook _anchorHook;
private: Layer* _layer;
private: Unit _dx;
private: Unit _dy;
protected: Unit _width;
protected: Unit _height;
// Constructors
// ************
protected: Contact(Net* net, Layer* layer, const Unit& x, const Unit& y, const Unit& width = 0, const Unit& height = 0);
protected: Contact(Net* net, Component* anchor, Layer* layer, const Unit& dx, const Unit& dy, const Unit& width = 0, const Unit& height = 0);
public: static Contact* Create(Net* net, Layer* layer, const Unit& x, const Unit& y, const Unit& width = 0, const Unit& height = 0);
public: static Contact* Create(Component* anchor, Layer* layer, const Unit& dx, const Unit& dy, const Unit& width = 0, const Unit& height = 0);
// Accessors
// *********
public: virtual Hooks GetHooks() const;
public: virtual Unit GetX() const;
public: virtual Unit GetY() const;
public: virtual Point GetPosition() const;
public: virtual Box GetBoundingBox() const;
public: virtual Layer* GetLayer() const {return _layer;};
public: virtual Box GetBoundingBox(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);};
// Updators
// ********
public: virtual void Translate(const Unit& dx, const Unit& dy);
public: void SetLayer(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 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);
// Others
// ******
protected: virtual void _PreDelete();
public: virtual string _GetTypeName() const {return _TName("Contact");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: Unit _GetSize() const;
public: Unit _GetSize(BasicLayer* basicLayer) const;
//public: virtual void _Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation);
//public: virtual void _Highlight(View* view, const Box& updateArea, const Transformation& transformation);
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Contact)
#endif // HURRICANE_CONTACT
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Contacts.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_CONTACTS
#define HURRICANE_CONTACTS
#include "Collection.h"
namespace Hurricane {
class Contact;
// ****************************************************************************************************
// Contacts declaration
// ****************************************************************************************************
typedef GenericCollection<Contact*> Contacts;
// ****************************************************************************************************
// ContactLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Contact*> ContactLocator;
// ****************************************************************************************************
// ContactFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Contact*> ContactFilter;
// ****************************************************************************************************
// for_each_contact declaration
// ****************************************************************************************************
#define for_each_contact(contact, contacts)\
/******************************************/\
{\
ContactLocator _locator = contacts.GetLocator();\
while (_locator.IsValid()) {\
Contact* contact = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_CONTACTS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,162 @@
// ****************************************************************************************************
// File: DBo.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "DBo.h"
#include "Property.h"
#include "Quark.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// DBo implementation
// ****************************************************************************************************
DBo::DBo()
// *******
: _propertySet()
{
}
DBo::~DBo()
// ********
{
}
void DBo::Delete()
// ***************
{
// trace << "entering DBo::Delete: " << this << endl;
// trace_in();
_PreDelete();
delete this;
// trace << "exiting DBo::Delete:" << endl;
// trace_out();
}
Property* DBo::GetProperty(const Name& name) const
// ***********************************************
{
PropertySet::const_iterator iterator = _propertySet.begin();
while (iterator != _propertySet.end()) {
Property* property = *iterator;
if (property->GetName() == name) return property;
++iterator;
}
return NULL;
}
void DBo::Put(Property* property)
// ******************************
{
if (!property)
throw Error("Can't put property : null property");
Property* oldProperty = GetProperty(property->GetName());
if (property != oldProperty) {
if (oldProperty) {
_propertySet.erase(oldProperty);
oldProperty->OnReleasedBy(this);
}
_propertySet.insert(property);
property->OnCapturedBy(this);
}
}
void DBo::Remove(Property* property)
// *********************************
{
if (!property)
throw Error("Can't remove property : null property");
if (_propertySet.find(property) != _propertySet.end()) {
_propertySet.erase(property);
property->OnReleasedBy(this);
if (is_a<Quark*>(this) && _propertySet.empty()) Delete();
}
}
void DBo::RemoveProperty(const Name& name)
// ***************************************
{
Property* property = GetProperty(name);
if (property) {
_propertySet.erase(property);
property->OnReleasedBy(this);
if (is_a<Quark*>(this) && _propertySet.empty()) Delete();
}
}
void DBo::ClearProperties()
// ************************
{
// trace << "entering DBo::ClearProperties: " << this << endl;
// trace_in();
while (!_propertySet.empty()) {
Property* property = *_propertySet.begin();
// trace << property << endl;
_propertySet.erase(property);
property->OnReleasedBy(this);
}
// trace << "exiting DBo::ClearProperties:" << endl;
// trace_out();
}
void DBo::_PostCreate()
// ********************
{
}
void DBo::_PreDelete()
// *******************
{
// trace << "entering DBo::_PreDelete: " << this << endl;
// trace_in();
ClearProperties();
// trace << "exiting DBo::_PreDelete:" << endl;
// trace_out();
}
string DBo::_GetString() const
// ***************************
{
return "<" + _GetTypeName() + ">";
}
Record* DBo::_GetRecord() const
// **********************
{
Record* record = new Record(GetString(this));
if (record) {
record->Add(GetSlot("Properties", &_propertySet));
}
return record;
}
void DBo::_OnDeleted(Property* property)
// *************************************
{
if (property && (_propertySet.find(property) != _propertySet.end())) {
_propertySet.erase(property);
if (is_a<Quark*>(this) && _propertySet.empty()) Delete();
}
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,107 @@
// ****************************************************************************************************
// File: DBo.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_DBO
#define HURRICANE_DBO
#include "DBos.h"
#include "Name.h"
#include "Property.h"
namespace Hurricane {
// ****************************************************************************************************
// DBo declaration
// ****************************************************************************************************
class DBo : public NestedSlotAdapter {
// *********************************
# if !defined(__DOXYGEN_PROCESSOR__)
// Types
// *****
public: typedef set<Property*> PropertySet;
// Attributs
// *********
private: PropertySet _propertySet;
// Constructors
// ************
protected: DBo();
private: DBo(const DBo& dbo); // not implemented to forbid copy construction
// Destructors
// ***********
protected: virtual ~DBo();
// Operators
// *********
private: DBo& operator=(const DBo& dbo); // not implemented to forbid assignment
// Others
// ******
protected: virtual void _PostCreate();
protected: virtual void _PreDelete();
public: virtual string _GetTypeName() const = 0;
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: PropertySet& _GetPropertySet() {return _propertySet;};
public: void _OnDeleted(Property* property);
# endif
// Destructors
// ***********
public: virtual void Delete();
// Accessors
// *********
public: Property* GetProperty(const Name& name) const;
public: Properties GetProperties() const {return GetCollection(_propertySet);};
// Predicates
// **********
public: bool HasProperty() const {return !_propertySet.empty();};
// Updators
// ********
public: void Put(Property* property);
public: void Remove(Property* property);
public: void RemoveProperty(const Name& name);
public: void ClearProperties();
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::DBo)
PointerIOStreamSupport(Hurricane::DBo)
#endif // HURRICANE_DBO
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: DBos.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_DBOS
#define HURRICANE_DBOS
#include "Collection.h"
namespace Hurricane {
class DBo;
// ****************************************************************************************************
// DBos declaration
// ****************************************************************************************************
typedef GenericCollection<DBo*> DBos;
// ****************************************************************************************************
// DBoLocator declaration
// ****************************************************************************************************
typedef GenericLocator<DBo*> DBoLocator;
// ****************************************************************************************************
// DBoFilter declaration
// ****************************************************************************************************
typedef GenericFilter<DBo*> DBoFilter;
// ****************************************************************************************************
// for_each_dbo declaration
// ****************************************************************************************************
#define for_each_dbo(dbo, dbos)\
/******************************/\
{\
DBoLocator _locator = dbos.GetLocator();\
while (_locator.IsValid()) {\
DBo* dbo = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_DBOS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,94 @@
// ****************************************************************************************************
// File: DRCError.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "DRCError.h"
#include "Cell.h"
#include "Slice.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// DRCError implementation
// ****************************************************************************************************
DRCError::DRCError(Cell* cell, const Name& name, const Box& boundingBox)
// *********************************************************************
: Inherit(cell),
_name(name),
_boundingBox(boundingBox)
{
if (_name.IsEmpty())
throw Error("Can't create " + _TName("DRCError") + " : empty name");
if (_boundingBox.IsEmpty())
throw Error("Can't create " + _TName("DRCError") + " : empty bounding box");
}
DRCError* DRCError::Create(Cell* cell, const Name& name, const Box& boundingBox)
// *****************************************************************************
{
DRCError* drcError = new DRCError(cell, name, boundingBox);
drcError->_PostCreate();
return drcError;
}
void DRCError::Translate(const Unit& dx, const Unit& dy)
// *****************************************************
{
if ((dx != 0) || (dy != 0)) {
Invalidate(false);
_boundingBox.Translate(dx, dy);
}
}
string DRCError::_GetString() const
// ********************************
{
string s = Inherit::_GetString();
s.insert(s.length() - 1, " " + GetString(_name));
s.insert(s.length() - 1, " " + GetString(_boundingBox));
return s;
}
Record* DRCError::_GetRecord() const
// ***************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Name", &_name));
record->Add(GetSlot("BoundingBox", &_boundingBox));
}
return record;
}
//bool DRCError::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const
//// ****************************************************************************************
//{
// return GetBoundingBox().Intersect(Box(point).Inflate(aperture));
//}
//
//void DRCError::_Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation)
//// ****************************************************************************************************
//{
// assert(!basicLayer);
//
// view->DrawRectangle(transformation.GetBox(GetBoundingBox()));
//}
//
//void DRCError::_Highlight(View* view, const Box& updateArea, const Transformation& transformation)
//// **********************************************************************************************
//{
// view->FillRectangle(transformation.GetBox(GetBoundingBox()));
//}
//
} // End of Hurricane namespace.

View File

@ -0,0 +1,72 @@
// ****************************************************************************************************
// File: DRCError.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_DRCERROR
#define HURRICANE_DRCERROR
#include "Marker.h"
namespace Hurricane {
// ****************************************************************************************************
// DRCError declaration
// ****************************************************************************************************
class DRCError : public Marker {
// *****************************
// Types
// *****
public: typedef Marker Inherit;
// Attributes
// **********
public: Name _name;
public: Box _boundingBox;
// Constructors
// ************
protected: DRCError(Cell* cell, const Name& name, const Box& boundingBox);
public: static DRCError* Create(Cell* cell, const Name& name, const Box& boundingBox);
// Accessors
// *********
public: virtual Box GetBoundingBox() const {return _boundingBox;};
public: const Name& GetName() const {return _name;};
// Updators
// ********
public: virtual void Translate(const Unit& dx, const Unit& dy);
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("DRCError");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
// public: virtual bool _IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const;
// public: virtual void _Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation);
// public: virtual void _Highlight(View* view, const Box& updateArea, const Transformation& transformation);
//
};
} // End of Hurricane namespace.
#endif // HURRICANE_DRCERROR
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,102 @@
// ****************************************************************************************************
// File: DataBase.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "DataBase.h"
#include "Technology.h"
#include "Library.h"
#include "Cell.h"
#include "Timer.h"
#include "Error.h"
#include "UpdateSession.h"
namespace Hurricane {
// ****************************************************************************************************
// DataBase implementation
// ****************************************************************************************************
static DataBase* DATA_BASE = NULL;
DataBase::DataBase()
// *****************
: Inherit(),
_technology(NULL),
_rootLibrary(NULL)
{
if (DATA_BASE)
throw Error("Can't create " + _TName("DataBase") + " : already exists");
}
DataBase* DataBase::Create()
// *************************
{
DataBase* dataBase = new DataBase();
dataBase->_PostCreate();
return dataBase;
}
void DataBase::_PostCreate()
// *************************
{
Inherit::_PostCreate();
DATA_BASE = this;
}
void DataBase::_PreDelete()
// ************************
{
OpenUpdateSession();
Inherit::_PreDelete();
if (_rootLibrary) _rootLibrary->Delete();
if (_technology) _technology->Delete();
CloseUpdateSession ();
DATA_BASE = NULL;
}
string DataBase::_GetString() const
// ********************************
{
return Inherit::_GetString();
}
Record* DataBase::_GetRecord() const
// ***************************
{
Record* record = Inherit::_GetRecord();
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())));
}
return record;
}
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
DataBase* GetDataBase()
// ********************
{
return DATA_BASE;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,89 @@
// ****************************************************************************************************
// File: DataBase.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_DATA_BASE
#define HURRICANE_DATA_BASE
#include "DBo.h"
#include "Unit.h"
namespace Hurricane {
class Library;
class Technology;
// ****************************************************************************************************
// DataBase declaration
// ****************************************************************************************************
class DataBase : public DBo {
// ************************
# if !defined(__DOXYGEN_PROCESSOR__)
// Types
// *****
public: typedef DBo Inherit;
// Attributes
// **********
private: Technology* _technology;
private: Library* _rootLibrary;
// Constructors
// ************
protected: DataBase();
// Others
// ******
protected: virtual void _PostCreate();
protected: virtual void _PreDelete();
public: virtual string _GetTypeName() const {return _TName("DataBase");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: void _SetTechnology(Technology* technology) {_technology = technology;};
public: void _SetRootLibrary(Library* rootLibrary) {_rootLibrary = rootLibrary;};
# endif
public: static DataBase* Create();
// Accessors
// *********
public: Technology* GetTechnology() const {return _technology;};
public: Library* GetRootLibrary() const {return _rootLibrary;};
};
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
DataBase* GetDataBase();
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::DataBase)
#endif // HURRICANE_DATA_BASE
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,175 @@
// -*- 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>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Christian Masson <Christian.Masson@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: DeepNet.cpp,v 1.3 2007/06/27 21:13:25 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./DeepNet.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "DeepNet.h"
# include "Cell.h"
# include "Instance.h"
# include "Plug.h"
# include "RoutingPad.h"
# include "Pin.h"
# include "Contact.h"
# include "Vertical.h"
# include "Horizontal.h"
# include "Pad.h"
# include "UpdateSession.h"
# include "Error.h"
namespace Hurricane {
namespace {
using namespace std;
using namespace Hurricane;
# if !defined(__DOXYGEN_PROCESSOR__)
# endif
} // End of local namespace.
// x-----------------------------------------------------------------x
// | "::DeepNet" Class Definitions |
// x-----------------------------------------------------------------x
# if !defined(__DOXYGEN_PROCESSOR__)
// -------------------------------------------------------------------
// Constructor : "DeepNet::DeepNet ()".
DeepNet::DeepNet ( Occurrence& netOccurrence )
: Net(netOccurrence.GetOwnerCell()
,netOccurrence.GetName()
)
, _netOccurrence(netOccurrence)
{
}
// -------------------------------------------------------------------
// Inspector Management : "DeepNet::_GetRecord ()".
Record* DeepNet::_GetRecord () const
{
Record* record = Net::_GetRecord();
if (record) {
record->Add(GetSlot("_netOccurrence", &_netOccurrence));
}
return record;
}
# endif
// -------------------------------------------------------------------
// Constructor : "DeepNet::Create ()".
DeepNet* DeepNet::Create ( HyperNet& hyperNet )
{
if ( !hyperNet.IsValid() )
throw Error ( "Can't create " + _TName("DeepNet") + ": occurence is invalid." );
Occurrence rootNetOccurrence = GetHyperNetRootNetOccurrence ( hyperNet.GetNetOccurrence() );
if ( rootNetOccurrence.GetMasterCell()->IsFlattenLeaf() ) return NULL;
if ( rootNetOccurrence.GetPath().IsEmpty() ) return NULL;
DeepNet* deepNet = new DeepNet ( rootNetOccurrence );
deepNet->_PostCreate ();
return deepNet;
}
// -------------------------------------------------------------------
// Internal Modifier : "DeepNet::_CreateRoutingPads ()".
size_t DeepNet::_CreateRoutingPads ( bool buildRings )
{
size_t nbRoutingPads = 0;
HyperNet hyperNet ( _netOccurrence );
RoutingPad* previousRP = NULL;
RoutingPad* currentRP = NULL;
for_each_occurrence ( plugOccurrence, hyperNet.GetLeafPlugOccurrences() ) {
nbRoutingPads++;
currentRP = CreateRoutingPad ( this, plugOccurrence );
if ( buildRings ) {
if ( previousRP ) {
currentRP->GetBodyHook()->Attach ( previousRP->GetBodyHook() );
}
previousRP = currentRP;
}
end_for
}
return nbRoutingPads;
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,108 @@
// -*- 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>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Christian Masson <Christian.Masson@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: DeepNet.h,v 1.3 2007/06/27 21:13:25 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./DeepNet.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __HURRICANE_DEEPNET__
# define __HURRICANE_DEEPNET__
# include "Net.h"
# include "HyperNet.h"
# include "Occurrence.h"
namespace Hurricane {
class DeepNet : public Net {
# if !defined(__DOXYGEN_PROCESSOR__)
// Attributes.
protected:
Occurrence _netOccurrence;
// Constructors.
protected:
DeepNet ( Occurrence& netOccurrence );
// Inspector Management.
public:
virtual Record* _GetRecord () const;
virtual string _GetTypeName() const { return "DeepNet"; };
# endif
// Constructors.
public:
static DeepNet* Create ( HyperNet& hyperNet );
// Accessors.
public:
// Predicates.
public:
virtual bool IsDeepNet () const { return true; };
// Internal Modifiers.
public:
size_t _CreateRoutingPads ( bool buildRings=false );
};
} // End of Hurricane namespace.
# endif

View File

@ -0,0 +1,199 @@
// ****************************************************************************************************
//
// This file is part of the Tsunami Project.
// Copyright (c) 2001-2004 Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie.
//
// File: DisplaySlot.cpp
// Author: C. Alexandre
// ****************************************************************************************************
#include "Error.h"
#include "UserGo.h"
#include "Relation.h"
#include "Cell.h"
#include "UpdateSession.h"
#include "DisplaySlot.h"
namespace Hurricane {
static Name DisplaySlotsCellRelationName("DisplaySlotsCellRelation");
static StandardRelation* GetDisplaySlotRelation(const Cell* cell)
{
Property* property = cell->GetProperty(DisplaySlotsCellRelationName);
if (!property)
return NULL;
else
{
StandardRelation* relation = dynamic_cast<StandardRelation*>(property);
if (!relation)
throw Error("Bad Property type: Must be a Standard Relation");
return relation;
}
}
// ****************************************************************************************************
// DisplaySlot implementation
// ****************************************************************************************************
DisplaySlot::DisplaySlot(Cell* cell,const Name& name, unsigned short red1, unsigned short green1, unsigned short blue1, const string& pattern1, unsigned linewidth1, unsigned short red2, unsigned short green2, unsigned short blue2, const string& pattern2, unsigned linewidth2)
// ***********************
: Inherit()
, _cell(cell)
, _name(name)
, _quadTree()
//, _drawGC(NULL)
//, _fillGC(NULL)
, _isVisible(true)
{
//_drawGC = gtk_gc_new(red1, green1, blue1, pattern1, linewidth1);
//_fillGC = gtk_gc_new(red2, green2, blue2, pattern2, linewidth2);
}
DisplaySlot* DisplaySlot::Create(Cell* cell, const Name& name, unsigned short red1, unsigned short green1, unsigned short blue1, const string& pattern1, unsigned linewidth1, unsigned short red2, unsigned short green2, unsigned short blue2, const string& pattern2, unsigned linewidth2)
// ******************************************
{
DisplaySlot* displaySlot = new DisplaySlot(cell, name, red1, green1, blue1, pattern1, linewidth1, red2, green2, blue2, pattern2, linewidth2);
displaySlot->_PostCreate();
return displaySlot;
}
void DisplaySlot::_PostCreate()
// ***********************
{
Inherit::_PostCreate();
StandardRelation* relation = GetDisplaySlotRelation(_cell);
if (!relation)
relation = StandardRelation::Create(_cell, DisplaySlotsCellRelationName);
Put(relation);
}
void DisplaySlot::Show()
// *********************
{
if (!_isVisible) {
_isVisible = true;
//for_each_view(view, _cell->GetViews())
//{
// view->Invalidate();
// end_for;
//}
}
}
void DisplaySlot::Hide()
// *********************
{
if (_isVisible) {
_isVisible = false;
//for_each_view(view, _cell->GetViews())
//{
// view->Invalidate();
// end_for;
//}
}
}
void DisplaySlot::Flush()
// **********************
{
OpenUpdateSession();
vector<Go*> govect;
_quadTree.GetGos().Fill(govect);
for (unsigned i = 0 ; i < govect.size() ; i++)
{
govect[i]->Delete();
}
CloseUpdateSession();
}
//void DisplaySlot::_Draw(View* view, const Box& updateArea, const Transformation& transformation)
//// *********************************************************************************************
//{
// if (GetBoundingBox().Intersect(updateArea)) {
// for_each_go(go, _quadTree.GetGos())
// {
// go->_Draw(view, NULL, updateArea, transformation);
// end_for;
// }
// }
//}
//
void DisplaySlot::_PreDelete()
// ***************************
{
Inherit::_PreDelete();
//gdk_gc_destroy(_drawGC);
//gdk_gc_destroy(_fillGC);
}
UserGos DisplaySlot::GetUserGos() const
// ************************************
{
return _quadTree.GetGos().GetSubSet<UserGo*>();
}
UserGos DisplaySlot::GetUserGosUnder(const Box& area) const
// ********************************************************
{
return _quadTree.GetGosUnder(area).GetSubSet<UserGo*>();
}
string DisplaySlot::_GetString() const
// ***********************************
{
string s = Inherit::_GetString();
s.insert(s.length() - 1, " " + GetString(GetName()));
return s;
}
Record* DisplaySlot::_GetRecord() const
// ******************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Cell", _cell));
record->Add(GetSlot("Name", _name));
record->Add(GetSlot("QuadTree", &_quadTree));
record->Add(GetSlot("Is Visible", _isVisible));
}
return record;
}
DisplaySlots GetDisplaySlots(const Cell* cell)
{
if (!cell)
throw Error("Null pointer on cell while getting display slots");
StandardRelation* relation = GetDisplaySlotRelation(cell);
if (!relation)
return DisplaySlots();
return relation->GetSlaveOwners().GetSubSet<DisplaySlot*>();
}
DisplaySlot* GetDisplaySlot(const Cell* cell,const Name& name)
{
if (!cell)
throw Error("Null pointer on cell while getting display slots");
StandardRelation* relation = GetDisplaySlotRelation(cell);
if (!relation)
return NULL;
else
{
for_each_display_slot(displaySlot,relation->GetSlaveOwners().GetSubSet<DisplaySlot*>())
{
if (displaySlot->GetName() == name)
return displaySlot;
end_for;
}
return NULL;
}
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,94 @@
// ****************************************************************************************************
//
// This file is part of the Tsunami Project.
// Copyright (c) 2001-2004 Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie.
//
// File: DisplaySlot.h
// Author: C. Alexandre
// ****************************************************************************************************
#ifndef HURRICANE_DISPLAY_SLOT
#define HURRICANE_DISPLAY_SLOT
#include "QuadTree.h"
#include "UserGos.h"
#include "DisplaySlots.h"
namespace Hurricane {
// ****************************************************************************************************
// DisplaySlot declaration
// ****************************************************************************************************
class DisplaySlot : public DBo {
// ***************************
// Types
// *****
public: typedef DBo Inherit;
// Attributes
// **********
private: Cell* _cell;
private: Name _name;
private: QuadTree _quadTree;
//private: GdkGC* _drawGC;
//private: GdkGC* _fillGC;
private: bool _isVisible;
// Constructors
// ************
protected: DisplaySlot(Cell* cell,const Name& name, unsigned short red1, unsigned short green1, unsigned short blue1, const string& pattern1, unsigned linewidth1, unsigned short red2, unsigned short green2, unsigned short blue2, const string& pattern2, unsigned linewidth2);
public: static DisplaySlot* Create(Cell* cell, const Name& name, unsigned short red1, unsigned short green1, unsigned short blue1, const string& pattern1 = "FFFFFFFFFFFFFFFF", unsigned linewidth1=0, unsigned short red2 = 0, unsigned short green2 = 0, unsigned short blue2 = 0, const string& pattern2 = "FFFFFFFFFFFFFFFF", unsigned linewidth2=0);
protected: virtual void _PostCreate();
// Destructor
// **********
protected: virtual void _PreDelete();
// Accessors
// *********
public: const Name& GetName() const {return _name;};
public: const Box& GetBoundingBox() const {return _quadTree.GetBoundingBox();};
public: UserGos GetUserGos() const;
public: UserGos GetUserGosUnder(const Box& area) const;
// Predicates
// **********
public: bool IsVisible() const {return _isVisible;};
public: void Show();
public: void Hide();
// Updators
// ********
public: void Flush();
// Others
// ******
//public: GdkGC* _GetDrawGC() const { return _drawGC; }
//public: GdkGC* _GetFillGC() const { return _fillGC; }
public: QuadTree& _GetQuadTree() { return _quadTree; }
//public: virtual void _Draw(View* view, const Box& updateArea, const Transformation& transformation);
public: virtual string _GetTypeName() const {return _TName("DisplaySlot");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
};
DisplaySlots GetDisplaySlots(const Cell* cell);
DisplaySlot* GetDisplaySlot(const Cell* cell, const Name& name);
} // End of Hurricane namespace.
#endif // HURRICANE_DISPLAY_SLOT

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
//
// This file is part of the Tsunami Project.
// Copyright (c) 2001-2004 Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie.
//
// File: DisplaySlots.h
// Author: C. Alexandre
// ****************************************************************************************************
#ifndef HURRICANE_DISPLAY_SLOTS
#define HURRICANE_DISPLAY_SLOTS
#include "Collection.h"
namespace Hurricane {
class DisplaySlot;
// ****************************************************************************************************
// DisplaySlots declaration
// ****************************************************************************************************
typedef GenericCollection<DisplaySlot*> DisplaySlots;
// ****************************************************************************************************
// DisplaySlotLocator declaration
// ****************************************************************************************************
typedef GenericLocator<DisplaySlot*> DisplaySlotLocator;
// ****************************************************************************************************
// DisplaySlotFilter declaration
// ****************************************************************************************************
typedef GenericFilter<DisplaySlot*> DisplaySlotFilter;
// ****************************************************************************************************
// for_each_view declaration
// ****************************************************************************************************
#define for_each_display_slot(displaySlot, displaySlots)\
/******************************************************/\
{\
DisplaySlotLocator _locator = displaySlots.GetLocator();\
while (_locator.IsValid()) {\
DisplaySlot* displaySlot = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_DISPLAY_SLOTS

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Entities.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_ENTITIES
#define HURRICANE_ENTITIES
#include "Collection.h"
namespace Hurricane {
class Entity;
// ****************************************************************************************************
// Entities declaration
// ****************************************************************************************************
typedef GenericCollection<Entity*> Entities;
// ****************************************************************************************************
// EntityLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Entity*> EntityLocator;
// ****************************************************************************************************
// EntityFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Entity*> EntityFilter;
// ****************************************************************************************************
// for_each_entity declaration
// ****************************************************************************************************
#define for_each_entity(entity, entities)\
/****************************************/\
{\
EntityLocator _locator = entities.GetLocator();\
while (_locator.IsValid()) {\
Entity* entity = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_ENTITIES
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,96 @@
// ****************************************************************************************************
// File: Entity.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Entity.h"
#include "Quark.h"
#include "Cell.h"
#include "Instance.h"
#include "SharedPath.h"
namespace Hurricane {
// ****************************************************************************************************
// Entity implementation
// ****************************************************************************************************
Entity::Entity()
// *************
: Inherit()
{
}
void Entity::_PreDelete()
// **********************
{
// trace << "entering Entity::_PreDelete: " << this << endl;
// trace_in();
vector<Entity*> slaveEntities;
SlaveEntityMap::iterator it;
SlaveEntityMap::iterator end;
GetCell()->_GetSlaveEntities(this,it,end);
for(; it != end ; it++)
slaveEntities.push_back(it->second);
for(; slaveEntities.size() ; slaveEntities.pop_back()) {
cerr << "Erasing " << slaveEntities.back() << endl;
slaveEntities.back()->Delete();
}
Quark* quark = _GetQuark();
if (quark) quark->Delete();
stack<SharedPath*> sharedPathStack;
for_each_instance(instance, GetCell()->GetSlaveInstances()) {
SharedPath* sharedPath = instance->_GetSharedPath(NULL);
if (sharedPath) sharedPathStack.push(sharedPath);
end_for;
}
while (!sharedPathStack.empty()) {
SharedPath* sharedPath = sharedPathStack.top();
sharedPathStack.pop();
Quark* quark = _GetQuark(sharedPath);
if (quark) quark->Delete();
Cell* cell = sharedPath->GetOwnerCell();
for_each_instance(instance, cell->GetSlaveInstances()) {
SharedPath* sharedPath2 = instance->_GetSharedPath(sharedPath);
if (sharedPath2) sharedPathStack.push(sharedPath2);
end_for;
}
}
Inherit::_PreDelete();
// trace << "exiting Entity::_PreDelete:" << endl;
// trace_out();
}
string Entity::_GetString() const
// ******************************
{
return Inherit::_GetString();
}
Record* Entity::_GetRecord() const
// *************************
{
Record* record = Inherit::_GetRecord();
if (record) {
Occurrence occurrence = Occurrence(this);
if (occurrence.HasProperty())
record->Add(GetSlot("Occurrence", occurrence));
}
return record;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,70 @@
// ****************************************************************************************************
// File: Entity.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_ENTITY
#define HURRICANE_ENTITY
#include "DBo.h"
#include "Entities.h"
#include "Box.h"
namespace Hurricane {
class Cell;
class Quark;
class SharedPath;
// ****************************************************************************************************
// Entity declaration
// ****************************************************************************************************
class Entity : public DBo {
// **********************
# if !defined(__DOXYGEN_PROCESSOR__)
// Types
// *****
public: typedef DBo Inherit;
// Constructors
// ************
protected: Entity();
// Others
// ******
protected: virtual void _PreDelete();
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: Quark* _GetQuark(SharedPath* sharedPath = NULL) const;
# endif
// Accessors
// *********
public: virtual Cell* GetCell() const = 0;
public: virtual Box GetBoundingBox() const = 0;
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Entity)
#endif // HURRICANE_ENTITY
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,56 @@
// ****************************************************************************************************
// File: Error.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Error implementation
// ****************************************************************************************************
Error::Error(const string& reason, int code)
// *****************************************
: Inherit(),
_reason(reason),
_code(code)
{
}
Error::Error(const Error& error)
// *****************************
: Inherit(),
_reason(error._reason),
_code(error._code)
{
}
Error& Error::operator=(const Error& error)
// ****************************************
{
_reason = error._reason;
_code = error._code;
return *this;
}
string Error::_GetString() const
// *****************************
{
if (!_code) return "[ERROR] " + _reason;
return "[ERROR:" + GetString(_code) + "] " + _reason;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,75 @@
// ****************************************************************************************************
// File: Error.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_ERROR
#define HURRICANE_ERROR
#include "Exception.h"
namespace Hurricane {
// ****************************************************************************************************
// Error declaration
// ****************************************************************************************************
class Error : public Exception {
// ***************************
// Types
// *****
public: typedef Exception Inherit;
// Attributes
// **********
private: string _reason;
private: int _code;
// Constructors
// ************
public: Error(const string& reason, int code = 0);
public: Error(const Error& error);
// Operators
// *********
public: Error& operator=(const Error& error);
// Accessors
// *********
public: string GetReason() const {return _reason;};
public: int GetCode() const {return _code;};
// Modifiers
// *********
public: void SetReason ( const string& reason ) { _reason = reason; };
// Others
// ******
public: virtual string _GetTypeName() const { return _TName("Error"); };
public: virtual string _GetString() const;
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Error)
#endif // HURRICANE_ERROR
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,39 @@
// ****************************************************************************************************
// File: Exception.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Exception.h"
namespace Hurricane {
// ****************************************************************************************************
// Exception implementation
// ****************************************************************************************************
Exception::Exception()
// *******************
{
}
Exception::~Exception()
// ********************
{
}
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,63 @@
// ****************************************************************************************************
// File: Exception.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_EXCEPTION
#define HURRICANE_EXCEPTION
#include "Commons.h"
namespace Hurricane {
// ****************************************************************************************************
// Exception declaration
// ****************************************************************************************************
class Exception : public NestedSlotAdapter {
// ***************************************
// Constructors
// ************
protected: Exception();
private: Exception(const Exception& exception); // not implemented to forbid copy construction
// Destructor
// **********
public: virtual ~Exception();
// Operators
// *********
private: Exception& operator=(const Exception& exception); // not implemented to forbid assignment
// Accessors
// *********
public: string What() const { return _GetString(); };
// Others
// ******
public: virtual string _GetString() const = 0;
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Exception)
#endif // HURRICANE_EXCEPTION
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,304 @@
// ****************************************************************************************************
// File: Filter.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_FILTER
#define HURRICANE_FILTER
#include "Commons.h"
namespace Hurricane {
template<class Type> class GenericFilter;
template<class Type> class NotFilter;
// ****************************************************************************************************
// Filter declaration
// ****************************************************************************************************
template<class Type> class Filter : public NestedSlotAdapter {
// *********************************************************
// Constructors
// ************
public: Filter() {};
private: Filter(const Filter& filter); // not implemented to forbid copie
// Destructor
// **********
public: virtual ~Filter() {};
// Operators
// *********
private: Filter& operator=(const Filter& filter); // not implemented to forbid assigment
public: GenericFilter<Type> operator!() const
// ******************************************
{
return NotFilter<Type>(*this);
};
// Accessors
// *********
public: virtual Filter<Type>* GetClone() const = 0;
// Predicates
// **********
public: virtual bool Accept(Type type) const = 0;
// Others
// ******
public: virtual string _GetTypeName() const { return _TName("Filter"); };
public: virtual string _GetString() const = 0;
};
// ****************************************************************************************************
// GenericFilter declaration
// ****************************************************************************************************
template<class Type> class GenericFilter : public Filter<Type> {
// ***********************************************************
// Types
// *****
public: typedef Filter<Type> Inherit;
// Attributes
// **********
private: Filter<Type>* _filter;
// Constructors
// ************
public: GenericFilter()
// ********************
: Inherit(),
_filter(NULL)
{
};
public: GenericFilter(const Filter<Type>& filter)
// **********************************************
: Inherit(),
_filter(filter.GetClone())
{
};
public: GenericFilter(const GenericFilter<Type>& genericFilter)
// ************************************************************
: Inherit(),
_filter(genericFilter.GetClone())
{
};
public: GenericFilter(Filter<Type>* filter)
// *****************************************************
// CAUTION : filter will be deleted by the GenericFilter
// *****************************************************
: Inherit(),
_filter(filter)
{
};
// Destructor
// **********
public: virtual ~GenericFilter()
// *****************************
{
if (_filter) delete _filter;
};
// Operators
// *********
public: GenericFilter& operator=(const Filter<Type>& filter)
// *********************************************************
{
if (_filter) delete _filter;
_filter = filter.GetClone();
return *this;
};
public: GenericFilter& operator=(const GenericFilter& genericFilter)
// *****************************************************************
{
if (_filter) delete _filter;
_filter = genericFilter.GetClone();
return *this;
};
public: GenericFilter& operator=(Filter<Type>* filter)
// *****************************************************
// CAUTION : filter will be deleted by the GenericFilter
// *****************************************************
{
if (_filter) delete _filter;
_filter = filter;
return *this;
};
// Accessors
// *********
public: virtual Filter<Type>* GetClone() const
// *******************************************
{
return (_filter) ? _filter->GetClone() : NULL;
};
// Predicates
// **********
public: virtual bool Accept(Type type) const
// *****************************************
{
return (_filter) ? _filter->Accept(type) : false;
};
// Others
// ******
public: virtual string _GetTypeName() const
// **************************************
{
return _TName("GenericFilter");
}
public: virtual string _GetString() const
// **************************************
{
if (!_filter)
return "<" + _GetTypeName() + " unbound>";
else
return "<" + _GetTypeName() + " " + GetString(_filter) + ">";
};
};
// ****************************************************************************************************
// NotFilter declaration
// ****************************************************************************************************
template<class Type> class NotFilter : public Filter<Type> {
// *******************************************************
// Types
// *****
public: typedef Filter<Type> Inherit;
// Attributes
// **********
private: GenericFilter<Type> _genericFilter;
// Constructors
// ************
public: NotFilter()
// ****************
: Inherit(),
_genericFilter()
{
};
public: NotFilter(const Filter<Type>& filter)
// ******************************************
: Inherit(),
_genericFilter(filter)
{
};
public: NotFilter(const NotFilter<Type>& notFilter)
// ************************************************
: Inherit(),
_genericFilter(notFilter._genericFilter)
{
};
// Operators
// *********
public: NotFilter& operator=(const NotFilter<Type>& notFilter)
// ***********************************************************
{
_genericFilter = notFilter._genericFilter;
return *this;
};
// Accessors
// *********
public: virtual Filter<Type>* GetClone() const
// *******************************************
{
return new NotFilter(*this);
};
// Predicates
// **********
public: virtual bool Accept(Type type) const
// *****************************************
{
return !_genericFilter.Accept(type);
};
// Others
// ******
public: virtual string _GetTypeName() const
// **************************************
{
return _TName("GenericNotFilter");
}
public: virtual string _GetString() const
// **************************************
{
return "<" + _GetTypeName() + " " + GetString(_genericFilter) + ">";
};
};
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
template<typename T>
class IsNestedSlotAdapter<const Hurricane::GenericFilter<T> > {
public:
enum { True=1, False=0 };
};
} // End of Hurricane namespace.
#endif // HURRICANE_FILTER
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,90 @@
// ****************************************************************************************************
// File: Go.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Go.h"
#include "QuadTree.h"
namespace Hurricane {
// ****************************************************************************************************
// Go implementation
// ****************************************************************************************************
static bool AUTO_MATERIALIZATION_IS_ENABLED = true;
Go::Go()
// *****
: Inherit(),
_quadTree(NULL),
_nextOfQuadTreeGoSet(NULL)
{
}
bool Go::AutoMaterializationIsDisabled()
// *************************************
{
return !AUTO_MATERIALIZATION_IS_ENABLED;
}
void Go::EnableAutoMaterialization()
// *********************************
{
AUTO_MATERIALIZATION_IS_ENABLED = true;
}
void Go::DisableAutoMaterialization()
// **********************************
{
AUTO_MATERIALIZATION_IS_ENABLED = false;
}
void Go::_PostCreate()
// *******************
{
Inherit::_PostCreate();
if (!AutoMaterializationIsDisabled()) Materialize(); // materialized after entire post creation
}
void Go::_PreDelete()
// ******************
{
// trace << "entering Go::_PreDelete: " << this << endl;
// trace_in();
Unmaterialize(); // unmaterialized before starting pre destruction
Inherit::_PreDelete();
// trace << "exiting Go::_PreDelete:" << endl;
// trace_out();
}
string Go::_GetString() const
// **************************
{
return Inherit::_GetString();
}
Record* Go::_GetRecord() const
// *********************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("QuadTree", _quadTree));
}
return record;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,100 @@
// ****************************************************************************************************
// File: Go.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_GO
#define HURRICANE_GO
#include "Entity.h"
#include "Gos.h"
#include "Transformation.h"
namespace Hurricane {
//class View;
class BasicLayer;
class QuadTree;
// ****************************************************************************************************
// Go declaration
// ****************************************************************************************************
class Go : public Entity {
// *********************
// Friends
// *******
friend class QuadTree;
// Types
// *****
public: typedef Entity Inherit;
// Attributes
// **********
private: QuadTree* _quadTree;
private: Go* _nextOfQuadTreeGoSet;
// Constructors
// ************
protected: Go();
// Predicates
// **********
public: static bool AutoMaterializationIsDisabled();
public: bool IsMaterialized() const {return (_quadTree != NULL);};
// Updators
// ********
public: static void EnableAutoMaterialization();
public: static void DisableAutoMaterialization();
public: virtual void Materialize() = 0;
public: virtual void Unmaterialize() = 0;
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;
// Others
// ******
protected: virtual void _PostCreate();
protected: virtual void _PreDelete();
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: Go* _GetNextOfQuadTreeGoSet() const {return _nextOfQuadTreeGoSet;};
public: void _SetNextOfQuadTreeGoSet(Go* go) {_nextOfQuadTreeGoSet = go;};
//public: virtual bool _IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const = 0;
//public: virtual void _Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation) = 0;
//public: virtual void _Highlight(View* view, const Box& updateArea, const Transformation& transformation) = 0;
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Go)
#endif // HURRICANE_GO
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Gos.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_GOS
#define HURRICANE_GOS
#include "Collection.h"
namespace Hurricane {
class Go;
// ****************************************************************************************************
// Gos declaration
// ****************************************************************************************************
typedef GenericCollection<Go*> Gos;
// ****************************************************************************************************
// GoLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Go*> GoLocator;
// ****************************************************************************************************
// GoFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Go*> GoFilter;
// ****************************************************************************************************
// for_each_go declaration
// ****************************************************************************************************
#define for_each_go(go, gos)\
/***************************/\
{\
GoLocator _locator = gos.GetLocator();\
while (_locator.IsValid()) {\
Go* go = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_GOS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,618 @@
// ****************************************************************************************************
// File: Hook.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Hook.h"
#include "Component.h"
#include "Rubber.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Filters declaration & implementation
// ****************************************************************************************************
class Hook_IsMasterFilter : public Filter<Hook*> {
// *********************************************
public: Hook_IsMasterFilter() {};
public: Hook_IsMasterFilter(const Hook_IsMasterFilter& filter) {};
public: Hook_IsMasterFilter& operator=(const Hook_IsMasterFilter& filter) {return *this;};
public: virtual Filter<Hook*>* GetClone() const {return new Hook_IsMasterFilter(*this);};
public: virtual bool Accept(Hook* hook) const {return hook->IsMaster();};
public: virtual string _GetString() const {return "<" + _TName("Hook::IsMasterFilter>");};
};
// ****************************************************************************************************
// Hook_Hooks implementation
// ****************************************************************************************************
class Hook_Hooks : public Collection<Hook*> {
// ****************************************
// Types
// *****
public: typedef Collection<Hook*> Inherit;
public: class Locator : public Hurricane::Locator<Hook*> {
// *****************************************************
public: typedef Hurricane::Locator<Hook*> Inherit;
private: const Hook* _hook;
private: Hook* _currentHook;
public: Locator(const Hook* hook = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual Hook* GetElement() const;
public: virtual Hurricane::Locator<Hook*>* GetClone() const;
public: virtual bool IsValid() const;
public: virtual void Progress();
public: virtual string _GetString() const;
};
// Attributes
// **********
private: const Hook* _hook;
// Constructors
// ************
public: Hook_Hooks(const Hook* hook = NULL);
public: Hook_Hooks(const Hook_Hooks& hooks);
// Operators
// *********
public: Hook_Hooks& operator=(const Hook_Hooks& hooks);
// Accessors
// *********
public: virtual Collection<Hook*>* GetClone() const;
public: virtual Hurricane::Locator<Hook*>* GetLocator() const;
// Others
// ******
public: virtual string _GetString() const;
};
// ****************************************************************************************************
// Hook_SlaveHooks implementation
// ****************************************************************************************************
class Hook_SlaveHooks : public Collection<Hook*> {
// *********************************************
// Types
// *****
public: typedef Collection<Hook*> Inherit;
public: class Locator : public Hurricane::Locator<Hook*> {
// *****************************************************
public: typedef Hurricane::Locator<Hook*> Inherit;
private: const Hook* _hook;
private: Hook* _currentHook;
public: Locator(const Hook* hook = NULL);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
public: virtual Hook* GetElement() const;
public: virtual Hurricane::Locator<Hook*>* GetClone() const;
public: virtual bool IsValid() const;
public: virtual void Progress();
public: virtual string _GetString() const;
};
// Attributes
// **********
private: const Hook* _hook;
// Constructors
// ************
public: Hook_SlaveHooks(const Hook* hook = NULL);
public: Hook_SlaveHooks(const Hook_SlaveHooks& hooks);
// Operators
// *********
public: Hook_SlaveHooks& operator=(const Hook_SlaveHooks& hooks);
// Accessors
// *********
public: virtual Collection<Hook*>* GetClone() const;
public: virtual Hurricane::Locator<Hook*>* GetLocator() const;
// Others
// ******
public: virtual string _GetString() const;
};
// ****************************************************************************************************
// Hook implementation
// ****************************************************************************************************
Hook::Hook()
// *********
: _nextHook(this)
{
}
Hook::~Hook()
// **********
{
if (_nextHook != this)
throw Error("Abnormal deletion of hook : always attached");
}
Hook* Hook::GetNextHook() const
// ****************************
{
return _nextHook;
}
Hook* Hook::GetPreviousHook() const
// ********************************
{
Hook* hook = (Hook*)this;
while (hook->_nextHook != this) hook = hook->_nextHook;
return hook;
}
Hook* Hook::GetMasterHook() const
// ******************************
{
Hook* hook = (Hook*)this;
do {
if (hook->IsMaster()) return hook;
hook = hook->_nextHook;
} while (hook != this);
return NULL;
}
Hook* Hook::GetNextMasterHook() const
// **********************************
{
return _nextHook->GetMasterHook();
}
Hook* Hook::GetPreviousMasterHook() const
// **************************************
{
Hook* previousMasterHook = NULL;
Hook* hook = (Hook*)this;
do {
if (hook->IsMaster()) previousMasterHook = hook;
hook = hook->_nextHook;
} while (hook != this);
return previousMasterHook;
}
Hooks Hook::GetHooks() const
// *************************
{
return Hook_Hooks(this);
}
Hooks Hook::GetSlaveHooks() const
// ******************************
{
return Hook_SlaveHooks(this);
}
HookFilter Hook::GetIsMasterFilter()
// *********************************
{
return Hook_IsMasterFilter();
}
bool Hook::IsAttached() const
// **************************
{
if (!IsMaster())
return (GetMasterHook() != NULL);
else
return (GetNextMasterHook() != this);
}
Hook* Hook::Detach()
// *****************
{
Hook* previousHook = NULL;
Hook* hook = _nextHook;
while (hook != this) {
if (!IsMaster() || hook->IsMaster()) previousHook = hook;
hook = hook->_nextHook;
}
if (previousHook) {
Hook* nextHook = _nextHook;
_nextHook = previousHook->_nextHook;
previousHook->_nextHook = nextHook;
// /*
if (IsMaster()) {
assert(previousHook->IsMaster());
Component* component = GetComponent();
Rubber* rubber = component->GetRubber();
if (rubber) {
rubber->_SetHook(previousHook);
component->_SetRubber(NULL);
}
}
// */
}
return previousHook;
}
Hook* Hook::Attach(Hook* hook)
// ***************************
{
if (IsAttached())
throw Error("Can't attach : already attached");
if (!hook)
throw Error("Can't attach : null hook");
if (!hook->IsMaster())
throw Error("Can't attach : not a master hook");
if (hook == this)
throw Error("Can't attach : itself");
Hook* masterHook = hook->GetPreviousMasterHook();
Hook* nextHook = masterHook->_nextHook;
masterHook->_nextHook = _nextHook;
_nextHook = nextHook;
// /*
if (IsMaster()) {
Rubber* rubber = hook->GetComponent()->GetRubber();
if (rubber)
GetComponent()->_SetRubber(rubber);
else
Rubber::_Create(this);
}
// */
return this;
}
void Hook::_SetNextHook(Hook* hook)
{
if (IsMaster())
{
Rubber* rubber = hook->GetComponent()->GetRubber();
if (rubber)
rubber->_Delete();
}
_nextHook = hook;
}
Hook* Hook::Merge(Hook* hook)
// **************************
{
if (!IsMaster())
throw Error("Can't merge : not a master");
if (!hook)
throw Error("Can't merge : null hook");
if (!hook->IsMaster())
throw Error("Can't merge : not a master hook");
if (hook == this)
throw Error("Can't merge : itself");
Hook* masterHook = hook->GetPreviousMasterHook();
Hook* nextHook = masterHook->_nextHook;
masterHook->_nextHook = _nextHook;
_nextHook = nextHook;
Rubber* rubber = GetComponent()->GetRubber();
if (rubber) rubber->_Delete();
rubber = hook->GetComponent()->GetRubber();
if (rubber) rubber->_Delete();
Rubber::_Create(this);
return this;
}
Record* Hook::_GetRecord() const
// ***********************
{
Record* record = NULL;
if (_nextHook != this) {
record = new Record(GetString(this));
record->Add(GetSlot("Component", GetComponent()));
record->Add(GetSlot("NextHook", _nextHook));
}
return record;
}
// ****************************************************************************************************
// Hook_Hooks implementation
// ****************************************************************************************************
Hook_Hooks::Hook_Hooks(const Hook* hook)
// *************************************
: Inherit(),
_hook(hook)
{
}
Hook_Hooks::Hook_Hooks(const Hook_Hooks& hooks)
// ********************************************
: Inherit(),
_hook(hooks._hook)
{
}
Hook_Hooks& Hook_Hooks::operator=(const Hook_Hooks& hooks)
// *******************************************************
{
_hook = hooks._hook;
return *this;
}
Collection<Hook*>* Hook_Hooks::GetClone() const
// ********************************************
{
return new Hook_Hooks(*this);
}
Locator<Hook*>* Hook_Hooks::GetLocator() const
// *******************************************
{
return new Locator(_hook);
}
string Hook_Hooks::_GetString() const
// **********************************
{
string s = "<" + _TName("Hook::Hooks");
if (_hook) s += " " + GetString(_hook);
s += ">";
return s;
}
// ****************************************************************************************************
// Hook_Hooks::Locator implementation
// ****************************************************************************************************
Hook_Hooks::Locator::Locator(const Hook* hook)
// *******************************************
: Inherit(),
_hook(hook),
_currentHook((Hook*)hook)
{
}
Hook_Hooks::Locator::Locator(const Locator& locator)
// *************************************************
: Inherit(),
_hook(locator._hook),
_currentHook(locator._currentHook)
{
}
Hook_Hooks::Locator& Hook_Hooks::Locator::operator=(const Locator& locator)
// ************************************************************************
{
_hook = locator._hook;
_currentHook = locator._currentHook;
return *this;
}
Hook* Hook_Hooks::Locator::GetElement() const
// ******************************************
{
return _currentHook;
}
Locator<Hook*>* Hook_Hooks::Locator::GetClone() const
// **************************************************
{
return new Locator(*this);
}
bool Hook_Hooks::Locator::IsValid() const
// **************************************
{
return (_currentHook != NULL);
}
void Hook_Hooks::Locator::Progress()
// *********************************
{
if (_currentHook) {
_currentHook = _currentHook->GetNextHook();
if (_currentHook == _hook) _currentHook = NULL;
}
}
string Hook_Hooks::Locator::_GetString() const
// *******************************************
{
string s = "<" + _TName("Hook::Hooks::Locator");
if (_hook) s += " " + GetString(_hook);
s += ">";
return s;
}
// ****************************************************************************************************
// Hook_SlaveHooks implementation
// ****************************************************************************************************
Hook_SlaveHooks::Hook_SlaveHooks(const Hook* hook)
// ***********************************************
: Inherit(),
_hook(hook)
{
}
Hook_SlaveHooks::Hook_SlaveHooks(const Hook_SlaveHooks& slaveHooks)
// ****************************************************************
: Inherit(),
_hook(slaveHooks._hook)
{
}
Hook_SlaveHooks& Hook_SlaveHooks::operator=(const Hook_SlaveHooks& slaveHooks)
// ***************************************************************************
{
_hook = slaveHooks._hook;
return *this;
}
Collection<Hook*>* Hook_SlaveHooks::GetClone() const
// *************************************************
{
return new Hook_SlaveHooks(*this);
}
Locator<Hook*>* Hook_SlaveHooks::GetLocator() const
// ************************************************
{
return new Locator(_hook);
}
string Hook_SlaveHooks::_GetString() const
// ***************************************
{
string s = "<" + _TName("Hook::SlaveHooks");
if (_hook) s += " " + GetString(_hook);
s += ">";
return s;
}
// ****************************************************************************************************
// Hook_SlaveHooks::Locator implementation
// ****************************************************************************************************
Hook_SlaveHooks::Locator::Locator(const Hook* hook)
// ************************************************
: Inherit(),
_hook(hook),
_currentHook(NULL)
{
if (_hook && _hook->IsMaster()) {
_currentHook = _hook->GetPreviousMasterHook();
if (_currentHook) {
_currentHook = _currentHook->GetNextHook();
if (_currentHook == _hook) _currentHook = NULL;
}
assert(!_currentHook || !_currentHook->IsMaster());
}
}
Hook_SlaveHooks::Locator::Locator(const Locator& locator)
// ******************************************************
: Inherit(),
_hook(locator._hook),
_currentHook(locator._currentHook)
{
}
Hook_SlaveHooks::Locator& Hook_SlaveHooks::Locator::operator=(const Locator& locator)
// **********************************************************************************
{
_hook = locator._hook;
_currentHook = locator._currentHook;
return *this;
}
Hook* Hook_SlaveHooks::Locator::GetElement() const
// ***********************************************
{
return _currentHook;
}
Locator<Hook*>* Hook_SlaveHooks::Locator::GetClone() const
// *******************************************************
{
return new Locator(*this);
}
bool Hook_SlaveHooks::Locator::IsValid() const
// *******************************************
{
return (_currentHook != NULL);
}
void Hook_SlaveHooks::Locator::Progress()
// **************************************
{
if (_currentHook) {
_currentHook = _currentHook->GetNextHook();
if (_currentHook == _hook) _currentHook = NULL;
assert(!_currentHook || !_currentHook->IsMaster());
}
}
string Hook_SlaveHooks::Locator::_GetString() const
// ************************************************
{
string s = "<" + _TName("Hook::SlaveHooks::Locator");
if (_hook) s += " " + GetString(_hook);
s += ">";
return s;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,101 @@
// ****************************************************************************************************
// File: Hook.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_HOOK
#define HURRICANE_HOOK
#include "Hooks.h"
namespace Hurricane {
class Component;
// ****************************************************************************************************
// Hook declaration
// ****************************************************************************************************
class Hook : public NestedSlotAdapter {
// **********************************
// Attributes
// **********
private: Hook* _nextHook;
// Constructors
// ************
protected: Hook();
private: Hook(const Hook& hook); // not implemented to forbid copy construction
// Destructor
// **********
protected: virtual ~Hook();
// Operators
// *********
private: Hook& operator=(const Hook& hook); // not implemented to forbid assignment
// Accessors
// *********
public: virtual Component* GetComponent() const = 0;
public: Hook* GetNextHook() const;
public: Hook* GetPreviousHook() const;
public: Hook* GetMasterHook() const;
public: Hook* GetNextMasterHook() const;
public: Hook* GetPreviousMasterHook() const;
public: Hooks GetHooks() const;
public: Hooks GetSlaveHooks() const;
// Filters
// *******
public: static HookFilter GetIsMasterFilter();
// Predicates
// **********
public: virtual bool IsMaster() const = 0;
public: bool IsAttached() const;
// Updators
// ********
public: Hook* Detach();
public: Hook* Attach(Hook* hook);
public: Hook* Merge(Hook* hook);
public: void _SetNextHook(Hook* hook);
// Others
// ******
public: virtual string _GetString() const = 0;
public: virtual Record* _GetRecord() const;
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Hook)
#endif // HURRICANE_HOOK
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Hooks.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_HOOKS
#define HURRICANE_HOOKS
#include "Collection.h"
namespace Hurricane {
class Hook;
// ****************************************************************************************************
// Hooks declaration
// ****************************************************************************************************
typedef GenericCollection<Hook*> Hooks;
// ****************************************************************************************************
// HookLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Hook*> HookLocator;
// ****************************************************************************************************
// HookFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Hook*> HookFilter;
// ****************************************************************************************************
// for_each_hook declaration
// ****************************************************************************************************
#define for_each_hook(hook, hooks)\
/*********************************/\
{\
HookLocator _locator = hooks.GetLocator();\
while (_locator.IsValid()) {\
Hook* hook = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_HOOKS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,174 @@
// ****************************************************************************************************
// File: Horizontal.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Horizontal.h"
#include "Net.h"
#include "BasicLayer.h"
#include "CompositeLayer.h"
#include "Plug.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Horizontal implementation
// ****************************************************************************************************
Horizontal::Horizontal(Net* net, Component* source, Component* target, Layer* layer, const Unit& y, const Unit& width, const Unit& dxSource, const Unit& dxTarget)
// ****************************************************************************************************
: Inherit(net, source, target, layer, width),
_y(y),
_dxSource(dxSource),
_dxTarget(dxTarget)
{
}
Horizontal* Horizontal::Create(Net* net, Layer* layer, const Unit& y, const Unit& width, const Unit& dxSource, const Unit& dxTarget)
// ****************************************************************************************************
{
if (!net)
throw Error("Can't create " + _TName("Horizontal") + " : null net");
Horizontal* horizontal = new Horizontal(net, NULL, NULL, layer, y, width, dxSource, dxTarget);
horizontal->_PostCreate();
return horizontal;
}
Horizontal* Horizontal::Create(Component* source, Component* target, Layer* layer, const Unit& y, const Unit& width, const Unit& dxSource, const Unit& dxTarget)
// ****************************************************************************************************
{
if (!source)
throw Error("Can't create " + _TName("Horizontal") + " : null source");
if (!target)
throw Error("Can't create " + _TName("Horizontal") + " : null target");
Horizontal* horizontal =
new Horizontal(source->GetNet(), source, target, layer, y, width, dxSource, dxTarget);
horizontal->_PostCreate();
return horizontal;
}
Box Horizontal::GetBoundingBox() const
// ***********************************
{
Unit size = GetHalfWidth() + _GetSize();
Unit extention = _GetExtention();
return Box(GetSourceX(), _y, GetTargetX(), _y).Inflate(extention, size);
}
Box Horizontal::GetBoundingBox(BasicLayer* basicLayer) const
// *********************************************************
{
if (!GetLayer()->Contains(basicLayer)) return Box();
Unit size = GetHalfWidth() + _GetSize(basicLayer);
Unit extention = _GetExtention(basicLayer);
return Box(GetSourceX(), _y, GetTargetX(), _y).Inflate(extention, size);
}
Unit Horizontal::GetSourceX() const
// ********************************
{
Component* source = GetSource();
return (source) ? source->GetX() + _dxSource : _dxSource;
}
Unit Horizontal::GetTargetX() const
// ********************************
{
Component* target = GetTarget();
return (target) ? target->GetX() + _dxTarget : _dxTarget;
}
Unit Horizontal::GetLength() const
// *******************************
{
return abs(GetSourceX() - GetTargetX());
}
Point Horizontal::GetCenter() const
// *******************************
{
return Point ( (GetSourceX()+GetTargetX())/2, GetY() );
}
void Horizontal::Translate(const Unit& dx, const Unit& dy)
// *******************************************************
{
if (dy != 0) {
Invalidate(true);
_y += dy;
}
}
void Horizontal::SetY(const Unit& y)
// *********************************
{
if (y != _y) {
Invalidate(true);
_y = y;
}
}
void Horizontal::SetDxSource(const Unit& dxSource)
// ***********************************************
{
if (dxSource != _dxSource) {
Invalidate(false);
_dxSource = dxSource;
}
}
void Horizontal::SetDxTarget(const Unit& dxTarget)
// ***********************************************
{
if (dxTarget != _dxTarget) {
Invalidate(false);
_dxTarget = dxTarget;
}
}
void Horizontal::Translate(const Unit& dy)
// ***************************************
{
if (dy != 0) {
Invalidate(true);
_y += dy;
}
}
string Horizontal::_GetString() const
// **********************************
{
return Inherit::_GetString();
}
Record* Horizontal::_GetRecord() const
// *****************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Y", &_y));
record->Add(GetSlot("DxSource", &_dxSource));
record->Add(GetSlot("DxTarget", &_dxTarget));
}
return record;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,88 @@
// ****************************************************************************************************
// File: Horizontal.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_HORIZONTAL
#define HURRICANE_HORIZONTAL
#include "Segment.h"
#include "Horizontals.h"
namespace Hurricane {
// ****************************************************************************************************
// Horizontal declaration
// ****************************************************************************************************
class Horizontal : public Segment {
// ******************************
// Types
// *****
public: typedef Segment Inherit;
// Attributes
// **********
private: Unit _y;
private: Unit _dxSource;
private: Unit _dxTarget;
// Constructors
// ************
protected: Horizontal(Net* net, Component* source, Component* target, Layer* layer, const Unit& y, const Unit& width = 0, const Unit& dxSource = 0, const Unit& dxTarget = 0);
public: static Horizontal* Create(Net* net, 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, Layer* layer, const Unit& y, const Unit& width = 0, const Unit& dxSource = 0, const Unit& dxTarget = 0);
// Accessors
// *********
public: virtual Unit GetY() const {return _y;};
public: virtual Point GetCenter() const;
public: virtual Box GetBoundingBox() const;
public: virtual Box GetBoundingBox(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;};
// Updators
// ********
public: virtual void Translate(const Unit& dx, const 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);
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("Horizontal");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Horizontal)
#endif // HURRICANE_HORIZONTAL
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Horizontals.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_HORIZONTALS
#define HURRICANE_HORIZONTALS
#include "Collection.h"
namespace Hurricane {
class Horizontal;
// ****************************************************************************************************
// Horizontals declaration
// ****************************************************************************************************
typedef GenericCollection<Horizontal*> Horizontals;
// ****************************************************************************************************
// HorizontalLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Horizontal*> HorizontalLocator;
// ****************************************************************************************************
// HorizontalFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Horizontal*> HorizontalFilter;
// ****************************************************************************************************
// for_each_horizontal declaration
// ****************************************************************************************************
#define for_each_horizontal(horizontal, horizontals)\
/***************************************************/\
{\
HorizontalLocator _locator = horizontals.GetLocator();\
while (_locator.IsValid()) {\
Horizontal* horizontal = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_HORIZONTALS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,65 @@
// ****************************************************************************************************
// File: Hurricane.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
// 21-10-2003 Alignment BULL-LIP6
#ifndef HURRICANE_ALL
#define HURRICANE_ALL
#include "Error.h"
#include "Warning.h"
#include "Interruption.h"
#include "Tag.h"
#include "Timer.h"
#include "Region.h"
#include "Property.h"
#include "Relation.h"
#include "Selector.h"
#include "UpdateSession.h"
#include "DataBase.h"
#include "Technology.h"
#include "Layer.h"
#include "BasicLayer.h"
#include "CompositeLayer.h"
#include "Library.h"
#include "Cell.h"
#include "Instance.h"
#include "Marker.h"
#include "DRCError.h"
#include "Reference.h"
#include "Net.h"
#include "Rubber.h"
#include "Component.h"
#include "Plug.h"
#include "Pin.h"
#include "Contact.h"
#include "Vertical.h"
#include "Horizontal.h"
#include "Pad.h"
#include "MainView.h"
#include "MapView.h"
#include "Symbol.h"
#include "Primitive.h"
#include "Path.h"
#include "SharedPath.h"
#include "Occurrence.h"
#include "Quark.h"
#include "HyperNet.h"
#include "DisplaySlot.h"
#include "UserGo.h"
#endif // HURRICANE_ALL
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
// ****************************************************************************************************
// File: HyperNet.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
// 21-10-2003 Alignment BULL-LIP6
#ifndef HURRICANE_HYPER_NET
#define HURRICANE_HYPER_NET
#include "Occurrences.h"
namespace Hurricane {
// ****************************************************************************************************
// HyperNet declaration
// ****************************************************************************************************
class HyperNet {
// ***********
// Attributes
// **********
private: Occurrence _netOccurrence;
// Constructors
// ************
public: HyperNet(const Occurrence& occurrence);
private: HyperNet(const HyperNet& hyperNet); // not implemented to forbid copy construction
// Operators
// *********
private: HyperNet& operator=(const HyperNet& hyperNet); // not implemented to forbid assignment
// Accessors
// *********
public: const Occurrence& GetNetOccurrence() const {return _netOccurrence;};
public: Cell* GetCell() const {return _netOccurrence.GetOwnerCell();};
public: Occurrences GetNetOccurrences(bool doExtraction = false, bool allowInterruption = false) const;
public: Occurrences GetNetOccurrencesUnder(Box area, bool doExtraction = false,
bool allowInterruption = false) const;
public: Occurrences GetLeafPlugOccurrences(bool doExtraction = false , bool allowInterruption = false) const;
// Predicates
// **********
public: bool IsValid() const {return _netOccurrence.IsValid();};
// Others
// ******
public: string _GetTypeName() const { return _TName("HyperNet"); };
public: string _GetString() const;
public: Record* _GetRecord() const;
};
Occurrence GetHyperNetRootNetOccurrence(const Occurrence& netoccurrence);
bool IsHyperNetRootNetOccurrence(Occurrence netoccurrence);
} // End of Hurricane namespace.
PointerIOStreamSupport(Hurricane::HyperNet)
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
#endif // HURRICANE_HYPER_NET
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,708 @@
// ****************************************************************************************************
// File: Instance.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
// 21-10-2003 Alignment BULL-LIP6
#include "Instance.h"
#include "Cell.h"
#include "Net.h"
#include "Plug.h"
#include "SharedPath.h"
#include "Error.h"
namespace Hurricane {
// ****************************************************************************************************
// Filters declaration & implementation
// ****************************************************************************************************
class Instance_IsUnderFilter : public Filter<Instance*> {
// ****************************************************
public: Box _area;
public: Instance_IsUnderFilter(const Box& area)
// ********************************************
: _area(area)
{
};
public: Instance_IsUnderFilter(const Instance_IsUnderFilter& filter)
// *****************************************************************
: _area(filter._area)
{
};
public: Instance_IsUnderFilter& operator=(const Instance_IsUnderFilter& filter)
// ****************************************************************************
{
_area = filter._area;
return *this;
};
public: virtual Filter<Instance*>* GetClone() const
// ************************************************
{
return new Instance_IsUnderFilter(*this);
};
public: virtual bool Accept(Instance* instance) const
// **************************************************
{
return _area.Intersect(instance->GetBoundingBox());
};
public: virtual string _GetString() const
// **************************************
{
return "<" + _TName("Instance::IsUnderFilter") + " " + GetString(_area) + ">";
};
};
class Instance_IsTerminalFilter : public Filter<Instance*> {
// *******************************************************
public: Instance_IsTerminalFilter() {};
public: Instance_IsTerminalFilter(const Instance_IsTerminalFilter& filter) {};
public: Instance_IsTerminalFilter& operator=(const Instance_IsTerminalFilter& filter) {return *this;};
public: virtual Filter<Instance*>* GetClone() const {return new Instance_IsTerminalFilter(*this);};
public: virtual bool Accept(Instance* instance) const {return instance->IsTerminal();};
public: virtual string _GetString() const {return "<" + _TName("Instance::IsTerminalFilter") + ">";};
};
class Instance_IsLeafFilter : public Filter<Instance*> {
// *******************************************************
public: Instance_IsLeafFilter() {};
public: Instance_IsLeafFilter(const Instance_IsLeafFilter& filter) {};
public: Instance_IsLeafFilter& operator=(const Instance_IsLeafFilter& filter) {return *this;};
public: virtual Filter<Instance*>* GetClone() const {return new Instance_IsLeafFilter(*this);};
public: virtual bool Accept(Instance* instance) const {return instance->IsLeaf();};
public: virtual string _GetString() const {return "<" + _TName("Instance::IsLeafFilter") + ">";};
};
class Instance_IsUnplacedFilter : public Filter<Instance*> {
// *******************************************************
public: Instance_IsUnplacedFilter() {};
public: Instance_IsUnplacedFilter(const Instance_IsUnplacedFilter& filter) {};
public: Instance_IsUnplacedFilter& operator=(const Instance_IsUnplacedFilter& filter) {return *this;};
public: virtual Filter<Instance*>* GetClone() const {return new Instance_IsUnplacedFilter(*this);};
public: virtual bool Accept(Instance* instance) const {return instance->IsUnplaced();};
public: virtual string _GetString() const {return "<" + _TName("Net::IsUnplacedFilter>");};
};
class Instance_IsPlacedFilter : public Filter<Instance*> {
// *****************************************************
public: Instance_IsPlacedFilter() {};
public: Instance_IsPlacedFilter(const Instance_IsPlacedFilter& filter) {};
public: Instance_IsPlacedFilter& operator=(const Instance_IsPlacedFilter& filter) {return *this;};
public: virtual Filter<Instance*>* GetClone() const {return new Instance_IsPlacedFilter(*this);};
public: virtual bool Accept(Instance* instance) const {return instance->IsPlaced();};
public: virtual string _GetString() const {return "<" + _TName("Net::IsPlacedFilter>");};
};
class Instance_IsFixedFilter : public Filter<Instance*> {
// *****************************************************
public: Instance_IsFixedFilter() {};
public: Instance_IsFixedFilter(const Instance_IsFixedFilter& filter) {};
public: Instance_IsFixedFilter& operator=(const Instance_IsFixedFilter& filter) {return *this;};
public: virtual Filter<Instance*>* GetClone() const {return new Instance_IsFixedFilter(*this);};
public: virtual bool Accept(Instance* instance) const {return instance->IsFixed();};
public: virtual string _GetString() const {return "<" + _TName("Net::IsFixedFilter>");};
};
// ****************************************************************************************************
// Instance implementation
// ****************************************************************************************************
Instance::Instance(Cell* cell, const Name& name, Cell* masterCell, const Transformation& transformation, const PlacementStatus& placementstatus, bool secureFlag)
// ****************************************************************************************************
: Inherit(),
_cell(cell),
_name(name),
_masterCell(masterCell),
_transformation(transformation),
_placementStatus(placementstatus),
_plugMap(),
_sharedPathMap(),
_nextOfCellInstanceMap(NULL),
_nextOfCellSlaveInstanceSet(NULL)
{
if (!_cell)
throw Error("Can't create " + _TName("Instance") + " : null cell");
if (name.IsEmpty())
throw Error("Can't create " + _TName("Instance") + " : empty name");
if (_cell->GetInstance(_name))
throw Error("Can't create " + _TName("Instance") + " : already exists");
if (!_masterCell)
throw Error("Can't create " + _TName("Instance") + " : null master cell");
if (secureFlag && _cell->IsCalledBy(_masterCell))
throw Error("Can't create " + _TName("Instance") + " : cyclic construction");
}
Instance* Instance::Create(Cell* cell, const Name& name, Cell* masterCell, bool secureFlag)
// ****************************************************************************************
{
Instance* instance =
new Instance(cell, name, masterCell, Transformation(), PlacementStatus(), secureFlag);
instance->_PostCreate();
return instance;
}
Instance* Instance::Create(Cell* cell, const Name& name, Cell* masterCell, const Transformation& transformation, const PlacementStatus& placementstatus, bool secureFlag)
// ****************************************************************************************************
{
Instance* instance =
new Instance(cell, name, masterCell, transformation, placementstatus, secureFlag);
instance->_PostCreate();
return instance;
}
Box Instance::GetBoundingBox() const
// *********************************
{
return _transformation.GetBox(_masterCell->GetBoundingBox());
}
Plugs Instance::GetConnectedPlugs() const
// **************************************
{
return GetPlugs().GetSubSet(Plug::GetIsConnectedFilter());
}
Plugs Instance::GetUnconnectedPlugs() const
// ****************************************
{
return GetPlugs().GetSubSet(Plug::GetIsUnconnectedFilter());
}
Path Instance::GetPath(const Path& tailPath) const
// ***********************************************
{
return Path((Instance*)this, tailPath);
}
Box Instance::GetAbutmentBox() const
// *********************************
{
return _transformation.GetBox(_masterCell->GetAbutmentBox());
}
bool Instance::IsTerminal() const
// ******************************
{
return GetMasterCell()->IsTerminal();
}
bool Instance::IsLeaf() const
// **************************
{
return GetMasterCell()->IsLeaf();
}
InstanceFilter Instance::GetIsUnderFilter(const Box& area)
// *******************************************************
{
return Instance_IsUnderFilter(area);
}
InstanceFilter Instance::GetIsTerminalFilter()
// *******************************************
{
return Instance_IsTerminalFilter();
}
InstanceFilter Instance::GetIsLeafFilter()
// *******************************************
{
return Instance_IsLeafFilter();
}
InstanceFilter Instance::GetIsUnplacedFilter()
// *******************************************
{
return Instance_IsUnplacedFilter();
}
InstanceFilter Instance::GetIsPlacedFilter()
// *****************************************
{
return Instance_IsPlacedFilter();
}
InstanceFilter Instance::GetIsFixedFilter()
// ****************************************
{
return Instance_IsFixedFilter();
}
InstanceFilter Instance::GetIsNotUnplacedFilter()
// **********************************************
{
return !Instance_IsUnplacedFilter();
}
void Instance::Materialize()
// *************************
{
if (!IsMaterialized()) {
Box boundingBox = GetBoundingBox();
if (!boundingBox.IsEmpty()) {
QuadTree* quadTree = _cell->_GetQuadTree();
quadTree->Insert(this);
_cell->_Fit(quadTree->GetBoundingBox());
}
}
}
void Instance::Unmaterialize()
// ***************************
{
if (IsMaterialized()) {
_cell->_Unfit(GetBoundingBox());
_cell->_GetQuadTree()->Remove(this);
}
}
void Instance::Invalidate(bool propagateFlag)
// ******************************************
{
Inherit::Invalidate(false);
if (propagateFlag) {
for_each_plug(plug, GetConnectedPlugs()) {
plug->Invalidate(true);
end_for;
}
}
}
void Instance::Translate(const Unit& dx, const Unit& dy)
// *****************************************************
{
if ((dx != 0) || (dy !=0)) {
Point translation = _transformation.GetTranslation();
Unit x = translation.GetX() + dx;
Unit y = translation.GetY() + dy;
Transformation::Orientation orientation = _transformation.GetOrientation();
SetTransformation(Transformation(x, y, orientation));
}
}
void Instance::SetName(const Name& name)
// *************************************
{
if (name != _name) {
if (name.IsEmpty())
throw Error("Can't change instance name : empty name");
if (_cell->GetInstance(name))
throw Error("Can't change instance name : already exists");
_cell->_GetInstanceMap()._Remove(this);
_name = name;
_cell->_GetInstanceMap()._Insert(this);
}
}
void Instance::SetTransformation(const Transformation& transformation)
// *******************************************************************
{
if (transformation != _transformation) {
Invalidate(true);
_transformation = transformation;
}
}
void Instance::SetPlacementStatus(const PlacementStatus& placementstatus)
// **********************************************************************
{
// if (placementstatus != _placementStatus) {
// Invalidate(true);
_placementStatus = placementstatus;
// }
}
void Instance::SetMasterCell(Cell* masterCell, bool secureFlag)
// ************************************************************
{
if (masterCell != _masterCell) {
if (!masterCell)
throw Error("Can't set master : null master cell");
if (secureFlag && _cell->IsCalledBy(masterCell))
throw Error("Can't set master : cyclic construction");
list<Plug*> connectedPlugList;
list<Net*> masterNetList;
for_each_plug(plug, GetConnectedPlugs()) {
Net* masterNet = masterCell->GetNet(plug->GetMasterNet()->GetName());
if (!masterNet || !masterNet->IsExternal())
throw Error("Can't set master (bad master net matching)");
connectedPlugList.push_back(plug);
masterNetList.push_back(masterNet);
end_for;
}
for_each_shared_path(sharedPath, _GetSharedPathes()) {
if (!sharedPath->GetTailSharedPath())
// if the tail is empty the SharedPath isn't impacted by the change
delete sharedPath;
end_for;
}
Invalidate(true);
for_each_plug(plug, GetUnconnectedPlugs()) {
plug->_Delete();
end_for;
}
while (!connectedPlugList.empty() && !masterNetList.empty()) {
Plug* plug = connectedPlugList.front();
Net* masterNet = masterNetList.front();
_plugMap._Remove(plug);
plug->_SetMasterNet(masterNet);
_plugMap._Insert(plug);
connectedPlugList.pop_front();
masterNetList.pop_front();
}
_masterCell->_GetSlaveInstanceSet()._Remove(this);
_masterCell = masterCell;
_masterCell->_GetSlaveInstanceSet()._Insert(this);
for_each_net(externalNet, _masterCell->GetExternalNets()) {
if (!GetPlug(externalNet)) Plug::_Create(this, externalNet);
end_for;
}
}
}
void Instance::_PostCreate()
// *************************
{
_cell->_GetInstanceMap()._Insert(this);
_masterCell->_GetSlaveInstanceSet()._Insert(this);
for_each_net(externalNet, _masterCell->GetExternalNets()) {
Plug::_Create(this, externalNet);
end_for;
}
Inherit::_PostCreate();
}
void Instance::_PreDelete()
// ************************
{
for_each_shared_path(sharedPath, _GetSharedPathes()) delete sharedPath; end_for;
Inherit::_PreDelete();
for_each_plug(plug, GetPlugs()) plug->_Delete(); end_for;
_masterCell->_GetSlaveInstanceSet()._Remove(this);
_cell->_GetInstanceMap()._Remove(this);
}
string Instance::_GetString() const
// ********************************
{
string s = Inherit::_GetString();
s.insert(s.length() - 1, " " + GetString(_name));
s.insert(s.length() - 1, " " + GetString(_masterCell->GetName()));
return s;
}
Record* Instance::_GetRecord() const
// ***************************
{
Record* record = Inherit::_GetRecord();
if (record) {
record->Add(GetSlot("Cell", _cell));
record->Add(GetSlot("Name", &_name));
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("Plugs", &_plugMap));
record->Add(GetSlot("SharedPathes", &_sharedPathMap));
}
return record;
}
//void Instance::_DrawPhantoms(View* view, const Box& updateArea, const Transformation& transformation)
//// **************************************************************************************************
//{
// Symbol* symbol = _masterCell->GetSymbol();
// if (!symbol) {
// Box masterArea = updateArea;
// Transformation masterTransformation = _transformation;
// _transformation.GetInvert().ApplyOn(masterArea);
// transformation.ApplyOn(masterTransformation);
// _masterCell->_DrawPhantoms(view, masterArea, masterTransformation);
// }
//}
//
//void Instance::_DrawBoundaries(View* view, const Box& updateArea, const Transformation& transformation)
//// ****************************************************************************************************
//{
// Box masterArea = updateArea;
// Transformation masterTransformation = _transformation;
// _transformation.GetInvert().ApplyOn(masterArea);
// transformation.ApplyOn(masterTransformation);
// Symbol* symbol = _masterCell->GetSymbol();
// if (!symbol)
// _masterCell->_DrawBoundaries(view, masterArea, masterTransformation);
// else
// _masterCell->GetSymbol()->_Draw(view, masterArea, masterTransformation);
//}
//
//void Instance::_DrawRubbers(View* view, const Box& updateArea, const Transformation& transformation)
//// *************************************************************************************************
//{
// Box masterArea = updateArea;
// Transformation masterTransformation = _transformation;
// _transformation.GetInvert().ApplyOn(masterArea);
// transformation.ApplyOn(masterTransformation);
// _masterCell->_DrawRubbers(view, masterArea, masterTransformation);
//}
//
//void Instance::_DrawMarkers(View* view, const Box& updateArea, const Transformation& transformation)
//// *************************************************************************************************
//{
// Box masterArea = updateArea;
// Transformation masterTransformation = _transformation;
// _transformation.GetInvert().ApplyOn(masterArea);
// transformation.ApplyOn(masterTransformation);
// _masterCell->_DrawMarkers(view, masterArea, masterTransformation);
//}
//
//void Instance::_DrawDisplaySlots(View* view, const Box& area, const Box& updateArea, const Transformation& transformation)
//// ***********************************************************************************************************************
//{
// Box masterArea = updateArea;
// Transformation masterTransformation = _transformation;
// _transformation.GetInvert().ApplyOn(masterArea);
// transformation.ApplyOn(masterTransformation);
// _masterCell->_DrawDisplaySlots(view, area, masterArea, masterTransformation);
//}
//
//bool Instance::_IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const
//// ****************************************************************************************
//{
// Symbol* symbol = _masterCell->GetSymbol();
// if (!symbol)
// return (view->PhantomsAreVisible() || view->BoundariesAreVisible()) &&
// GetAbutmentBox().Intersect(Box(point).Inflate(aperture));
// else {
// Point masterPoint = point;
// _transformation.GetInvert().ApplyOn(masterPoint);
// return (view->BoundariesAreVisible() && symbol->_IsInterceptedBy(view, masterPoint, aperture));
// }
//}
//
//void Instance::_Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation)
//// ****************************************************************************************************
//{
// Symbol* symbol = _masterCell->GetSymbol();
// if (!symbol) {
// Box masterArea = updateArea;
// Transformation masterTransformation = _transformation;
// _transformation.GetInvert().ApplyOn(masterArea);
// transformation.ApplyOn(masterTransformation);
// _masterCell->_DrawContent(view, basicLayer, masterArea, masterTransformation);
// }
//}
//
//void Instance::_Highlight(View* view, const Box& updateArea, const Transformation& transformation)
//// ***********************************************************************************************
//{
// Symbol* symbol = _masterCell->GetSymbol();
// if (!symbol) {
// Box abutmentBox = transformation.GetBox(GetAbutmentBox());
// view->FillRectangle(abutmentBox);
// view->DrawRectangle(abutmentBox);
//
// if ( view->GetScale() > 1 )
// {
// if ( view->IsTextVisible() )
// {
// string text = GetString ( _name ) + " ("
// + GetString ( GetValue ( abutmentBox.GetXCenter () ) ) + ","
// + GetString ( GetValue ( abutmentBox.GetYCenter () ) ) + ")";
// view->DrawString ( text, abutmentBox.GetXMin(), abutmentBox.GetYMax() );
// }
// }
// }
// else {
// Box masterArea = updateArea;
// Transformation masterTransformation = _transformation;
// _transformation.GetInvert().ApplyOn(masterArea);
// transformation.ApplyOn(masterTransformation);
// symbol->_Highlight(view, masterArea, masterTransformation);
// }
//}
//
// ****************************************************************************************************
// Instance::PlugMap implementation
// ****************************************************************************************************
Instance::PlugMap::PlugMap()
// *************************
: Inherit()
{
}
const Net* Instance::PlugMap::_GetKey(Plug* plug) const
// ****************************************************
{
return plug->GetMasterNet();
}
unsigned Instance::PlugMap::_GetHashValue(const Net* masterNet) const
// ******************************************************************
{
return ( (unsigned int)( (unsigned long)masterNet ) ) / 8;
}
Plug* Instance::PlugMap::_GetNextElement(Plug* plug) const
// *******************************************************
{
return plug->_GetNextOfInstancePlugMap();
}
void Instance::PlugMap::_SetNextElement(Plug* plug, Plug* nextPlug) const
// **********************************************************************
{
plug->_SetNextOfInstancePlugMap(nextPlug);
}
// ****************************************************************************************************
// Instance::SharedPathMap implementation
// ****************************************************************************************************
Instance::SharedPathMap::SharedPathMap()
// *************************************
: Inherit()
{
}
const SharedPath* Instance::SharedPathMap::_GetKey(SharedPath* sharedPath) const
// *****************************************************************************
{
return sharedPath->GetTailSharedPath();
}
unsigned Instance::SharedPathMap::_GetHashValue(const SharedPath* tailSharedPath) const
// ************************************************************************************
{
return ( (unsigned int)( (unsigned long)tailSharedPath ) ) / 8;
}
SharedPath* Instance::SharedPathMap::_GetNextElement(SharedPath* sharedPath) const
// *******************************************************************************
{
return sharedPath->_GetNextOfInstanceSharedPathMap();
}
void Instance::SharedPathMap::_SetNextElement(SharedPath* sharedPath, SharedPath* nextSharedPath) const
// ****************************************************************************************************
{
sharedPath->_SetNextOfInstanceSharedPathMap(nextSharedPath);
};
// ****************************************************************************************************
// Instance::PlacementStatus implementation
// ****************************************************************************************************
Instance::PlacementStatus::PlacementStatus(const Code& code)
// *********************************************************
: _code(code)
{
}
Instance::PlacementStatus::PlacementStatus(const PlacementStatus& placementstatus)
// *******************************************************************************
: _code(placementstatus._code)
{
}
Instance::PlacementStatus& Instance::PlacementStatus::operator=(const PlacementStatus& placementstatus)
// ****************************************************************************************************
{
_code = placementstatus._code;
return *this;
}
string Instance::PlacementStatus::_GetString() const
// *************************************************
{
return GetString(&_code);
}
Record* Instance::PlacementStatus::_GetRecord() const
// ********************************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", &_code));
return record;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,231 @@
// ****************************************************************************************************
// File: Instance.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
// 21-10-2003 Alignment BULL-LIP6
#ifndef HURRICANE_INSTANCE
#define HURRICANE_INSTANCE
#include "Go.h"
#include "Instances.h"
#include "Transformation.h"
#include "Plug.h"
#include "Path.h"
#include "SharedPath.h"
#include "IntrusiveMap.h"
namespace Hurricane {
class Net;
//class View;
class BasicLayer;
// ****************************************************************************************************
// Instance declaration
// ****************************************************************************************************
class Instance : public Go {
// ***********************
// Types
// *****
public: typedef Go Inherit;
public: class PlacementStatus {
// **************************
public: enum Code {UNPLACED=0, PLACED=1, FIXED=2};
private: Code _code;
public: PlacementStatus(const Code& code = UNPLACED);
public: PlacementStatus(const PlacementStatus& placementstatus);
public: PlacementStatus& operator=(const PlacementStatus& placementstatus);
public: operator const Code&() const {return _code;};
public: const Code& GetCode() const {return _code;};
public: string _GetTypeName() const { return _TName("Instance::PlacementStatus"); };
public: string _GetString() const;
public: Record* _GetRecord() const;
};
public: class PlugMap : public IntrusiveMap<const Net*, Plug> {
// **********************************************************
public: typedef IntrusiveMap<const Net*, Plug> Inherit;
public: PlugMap();
public: virtual const Net* _GetKey(Plug* plug) const;
public: virtual unsigned _GetHashValue(const Net* masterNet) const;
public: virtual Plug* _GetNextElement(Plug* plug) const;
public: virtual void _SetNextElement(Plug* plug, Plug* nextPlug) const;
};
public: class SharedPathMap : public IntrusiveMap<const SharedPath*, SharedPath> {
// *****************************************************************************
public: typedef IntrusiveMap<const SharedPath*, SharedPath> Inherit;
public: SharedPathMap();
public: virtual const SharedPath* _GetKey(SharedPath* sharedPath) const;
public: virtual unsigned _GetHashValue(const SharedPath* tailSharedPath) const;
public: virtual SharedPath* _GetNextElement(SharedPath* sharedPath) const;
public: virtual void _SetNextElement(SharedPath* sharedPath, SharedPath* nextSharedPath) const;
};
// Attributes
// **********
private: Cell* _cell;
private: Name _name;
private: Cell* _masterCell;
private: Transformation _transformation;
private: PlacementStatus _placementStatus;
private: PlugMap _plugMap;
private: SharedPathMap _sharedPathMap;
private: Instance* _nextOfCellInstanceMap;
private: Instance* _nextOfCellSlaveInstanceSet;
// Constructors
// ************
protected: Instance(Cell* cell, const Name& name, Cell* masterCell, const Transformation& transformation, const PlacementStatus& placementstatus, bool secureFlag);
public: static Instance* Create(Cell* cell, const Name& name, Cell* masterCell, bool secureFlag = true);
public: static Instance* Create(Cell* cell, const Name& name, Cell* masterCell, const Transformation& transformation, const PlacementStatus& placementstatus, bool secureFlag = true);
// Accessors
// *********
public: virtual Cell* GetCell() const {return _cell;};
public: virtual Box GetBoundingBox() const;
public: const Name& GetName() const {return _name;};
public: Cell* GetMasterCell() const {return _masterCell;};
public: const Transformation& GetTransformation() const {return _transformation;};
public: const PlacementStatus& GetPlacementStatus() const {return _placementStatus;};
public: Plug* GetPlug(const Net* masterNet) const {return _plugMap.GetElement(masterNet);};
public: Plugs GetPlugs() const {return _plugMap.GetElements();};
public: Plugs GetConnectedPlugs() const;
public: Plugs GetUnconnectedPlugs() const;
public: Path GetPath(const Path& tailPath = Path()) const;
public: Box GetAbutmentBox() const;
// Predicates
// **********
public: bool IsUnplaced() const {return _placementStatus == PlacementStatus::UNPLACED;};
public: bool IsPlaced() const {return _placementStatus == PlacementStatus::PLACED;};
public: bool IsFixed() const {return _placementStatus == PlacementStatus::FIXED;};
public: bool IsTerminal() const;
public: bool IsLeaf() const;
// Filters
// *******
public: static InstanceFilter GetIsUnderFilter(const Box& area);
public: static InstanceFilter GetIsTerminalFilter();
public: static InstanceFilter GetIsLeafFilter();
public: static InstanceFilter GetIsUnplacedFilter();
public: static InstanceFilter GetIsPlacedFilter();
public: static InstanceFilter GetIsFixedFilter();
public: static InstanceFilter GetIsNotUnplacedFilter();
// Updators
// ********
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: void SetName(const Name& name);
public: void SetTransformation(const Transformation& transformation);
public: void SetPlacementStatus(const PlacementStatus& placementstatus);
public: void SetMasterCell(Cell* masterCell, bool secureFlag = true);
// Others
// ******
protected: virtual void _PostCreate();
protected: virtual void _PreDelete();
public: virtual string _GetTypeName() const {return _TName("Instance");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: PlugMap& _GetPlugMap() {return _plugMap;};
public: SharedPath* _GetSharedPath(const SharedPath* tailSharedPath) const {return _sharedPathMap.GetElement(tailSharedPath);}
public: SharedPathes _GetSharedPathes() const {return _sharedPathMap.GetElements();};
public: SharedPathMap& _GetSharedPathMap() {return _sharedPathMap;};
public: Instance* _GetNextOfCellInstanceMap() const {return _nextOfCellInstanceMap;};
public: Instance* _GetNextOfCellSlaveInstanceSet() const {return _nextOfCellSlaveInstanceSet;};
public: void _SetNextOfCellInstanceMap(Instance* instance) {_nextOfCellInstanceMap = instance;};
public: void _SetNextOfCellSlaveInstanceSet(Instance* instance) {_nextOfCellSlaveInstanceSet = instance;};
//public: void _DrawPhantoms(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawBoundaries(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawRubbers(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawMarkers(View* view, const Box& updateArea, const Transformation& transformation);
//public: void _DrawDisplaySlots(View* view, const Box& area, const Box& updateArea, const Transformation& transformation);
//public: virtual bool _IsInterceptedBy(View* view, const Point& point, const Unit& aperture) const;
//public: virtual void _Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation);
//public: virtual void _Highlight(View* view, const Box& updateArea, const Transformation& transformation);
};
// -------------------------------------------------------------------
// Class : "Proxy...<const Instance::PlacementStatus::Code*>".
template<>
inline string ProxyTypeName<Instance::PlacementStatus::Code>
( const Instance::PlacementStatus::Code* object )
{ return "<PointerSlotAdapter<Instance::PlacementStatus::Code>>"; }
template<>
inline string ProxyString <Instance::PlacementStatus::Code>
( const Instance::PlacementStatus::Code* object )
{
switch ( *object ) {
case Instance::PlacementStatus::UNPLACED: return "PLACED";
case Instance::PlacementStatus::PLACED: return "PLACED";
case Instance::PlacementStatus::FIXED: return "FIXED";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Instance::PlacementStatus::Code>
( const Instance::PlacementStatus::Code* object )
{
Record* record = new Record(GetString(object));
record->Add(GetSlot("Code", (unsigned int*)object));
return record;
}
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Instance)
#endif // HURRICANE_INSTANCE
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,62 @@
// ****************************************************************************************************
// File: Instances.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_INSTANCES
#define HURRICANE_INSTANCES
#include "Collection.h"
namespace Hurricane {
class Instance;
// ****************************************************************************************************
// Instances declaration
// ****************************************************************************************************
typedef GenericCollection<Instance*> Instances;
// ****************************************************************************************************
// InstanceLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Instance*> InstanceLocator;
// ****************************************************************************************************
// InstanceFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Instance*> InstanceFilter;
// ****************************************************************************************************
// for_each_instance declaration
// ****************************************************************************************************
#define for_each_instance(instance, instances)\
/*********************************************/\
{\
InstanceLocator _locator = instances.GetLocator();\
while (_locator.IsValid()) {\
Instance* instance = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_INSTANCES
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,55 @@
// ****************************************************************************************************
// File: Interruption.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Interruption.h"
namespace Hurricane {
// ****************************************************************************************************
// Interruption implementation
// ****************************************************************************************************
Interruption::Interruption(const string& reason, int code)
// *******************************************************
: Inherit(),
_reason(reason),
_code(code)
{
}
Interruption::Interruption(const Interruption& interruption)
// *********************************************************
: Inherit(),
_reason(interruption._reason),
_code(interruption._code)
{
}
Interruption& Interruption::operator=(const Interruption& interruption)
// ********************************************************************
{
_reason = interruption._reason;
_code = interruption._code;
return *this;
}
string Interruption::_GetString() const
// ************************************
{
if (!_code) return "[INTERRUPTION] " + _reason;
return "[INTERRUPTION:" + GetString(_code) + "] " + _reason;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,71 @@
// ****************************************************************************************************
// File: Interruption.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_INTERRUPTION
#define HURRICANE_INTERRUPTION
#include "Exception.h"
namespace Hurricane {
// ****************************************************************************************************
// Interruption declaration
// ****************************************************************************************************
class Interruption : public Exception {
// **********************************
// Types
// *****
public: typedef Exception Inherit;
// Attributes
// **********
private: string _reason;
private: int _code;
// Constructors
// ************
public: Interruption(const string& reason, int code = 0);
public: Interruption(const Interruption& interruption);
// Operators
// *********
public: Interruption& operator=(const Interruption& interruption);
// Accessors
// *********
public: string GetReason() const {return _reason;};
public: int GetCode() const {return _code;};
// Others
// ******
public: virtual string _GetTypeName() const { return _TName("Interruption"); };
public: virtual string _GetString() const;
};
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Interruption)
#endif // HURRICANE_INTERRUPTION
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,232 @@
// ****************************************************************************************************
// File: Interval.cpp
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#include "Interval.h"
namespace Hurricane {
// ****************************************************************************************************
// Interval implementation
// ****************************************************************************************************
Interval::Interval(bool makeEmpty)
// *******************************
: _vMin(1),
_vMax(-1)
{
if (!makeEmpty) {
_vMin = UNIT_MIN;
_vMax = UNIT_MAX;
}
}
Interval::Interval(const Unit& value)
// **********************************
: _vMin(value),
_vMax(value)
{
}
Interval::Interval(const Unit& v1, const Unit& v2)
// ***********************************************
: _vMin(min(v1, v2)),
_vMax(max(v1, v2))
{
}
Interval::Interval(const Interval& interval)
// *****************************************
: _vMin(interval._vMin),
_vMax(interval._vMax)
{
}
Interval& Interval::operator=(const Interval& interval)
// ****************************************************
{
_vMin = interval._vMin;
_vMax = interval._vMax;
return *this;
}
bool Interval::operator==(const Interval& interval) const
// ******************************************************
{
return !IsEmpty() && !interval.IsEmpty() && (_vMin == interval._vMin) && (_vMax == interval._vMax);
}
bool Interval::operator!=(const Interval& interval) const
// ******************************************************
{
return IsEmpty() || interval.IsEmpty() || (_vMin != interval._vMin) || (_vMax != interval._vMax);
}
Interval Interval::GetUnion(const Interval& interval) const
// ********************************************************
{
if (IsEmpty() && interval.IsEmpty()) return Interval();
return Interval(min(_vMin, interval._vMin), max(_vMax, interval._vMax));
}
Interval Interval::GetIntersection(const Interval& interval) const
// ***************************************************************
{
if (!Intersect(interval)) return Interval();
return Interval(max(_vMin, interval._vMin), min(_vMax, interval._vMax));
}
bool Interval::IsEmpty() const
// ***************************
{
return (_vMax < _vMin);
}
bool Interval::IsPonctual() const
// ******************************
{
return (_vMax == _vMin);
}
bool Interval::Contains(const Unit& v) const
// *****************************************
{
return !IsEmpty() && (_vMin <= v) && (v <= _vMax);
}
bool Interval::Contains(const Interval& interval) const
// ****************************************************
{
return !IsEmpty() && !interval.IsEmpty() && (_vMin <= interval._vMin) && (interval._vMax <= _vMax);
}
bool Interval::Intersect(const Interval& interval) const
// *****************************************************
{
return !IsEmpty() && !interval.IsEmpty() && !((_vMax < interval._vMin) || (interval._vMax < _vMin));
}
bool Interval::Inferior(const Interval& interval, bool strict) const
// *****************************************************************
{
if (_vMax < interval._vMin) return true;
return !strict && (_vMax == interval._vMin);
}
bool Interval::Superior(const Interval& interval, bool strict) const
// *****************************************************************
{
if (_vMin > interval._vMax) return true;
return !strict && (_vMin == interval._vMax);
}
bool Interval::IsConstrainedBy(const Interval& interval) const
// ***********************************************************
{
return (!IsEmpty() &&
!interval.IsEmpty() &&
((_vMin == interval.GetVMin()) || (_vMax == interval.GetVMax())));
}
Interval& Interval::MakeEmpty()
// ****************************
{
_vMin = 1;
_vMax = -1;
return *this;
}
Interval& Interval::Inflate(const Unit& dv)
// ****************************************
{
return Inflate(dv, dv);
}
Interval& Interval::Inflate(const Unit& dvMin, const Unit& dvMax)
// **************************************************************
{
if (!IsEmpty()) {
_vMin -= dvMin;
_vMax += dvMax;
}
return *this;
}
Interval& Interval::Merge(const Unit& v)
// *************************************
{
if (IsEmpty()) {
_vMin = v;
_vMax = v;
}
else {
_vMin = min(_vMin, v);
_vMax = max(_vMax, v);
}
return *this;
}
Interval& Interval::Merge(const Interval& interval)
// ************************************************
{
if (!interval.IsEmpty()) {
_vMin = min(_vMin, interval._vMin);
_vMax = max(_vMax, interval._vMax);
}
return *this;
}
Interval& Interval::Intersection(const Unit& vMin, const Unit& vMax)
// *****************************************************************
{
return Intersection(Interval(vMin,vMax));
}
Interval& Interval::Intersection(const Interval& interval)
// *******************************************************
{
if (!Intersect(interval)) MakeEmpty();
else {
_vMin = max(_vMin, interval._vMin);
_vMax = min(_vMax, interval._vMax);
}
return *this;
}
Interval& Interval::Translate(const Unit& dv)
// ******************************************
{
if (!IsEmpty()) {
_vMin += dv;
_vMax += dv;
}
return *this;
}
string Interval::_GetString() const
// ********************************
{
return "<" + _TName("Interval") + " " + GetValueString(_vMin) + " " + GetValueString(_vMax) + ">";
}
Record* Interval::_GetRecord() const
// ***************************
{
Record* record = new Record(GetString(this));
record->Add(GetSlot("VMin", &_vMin));
record->Add(GetSlot("VMin", &_vMax));
return record;
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,103 @@
// ****************************************************************************************************
// File: Interval.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_INTERVAL
#define HURRICANE_INTERVAL
#include "Unit.h"
namespace Hurricane {
// ****************************************************************************************************
// Interval declaration
// ****************************************************************************************************
class Interval {
// ***********
// Attributes
// **********
private: Unit _vMin;
private: Unit _vMax;
// Constructors
// ************
public: Interval(bool makeEmpty=true);
public: Interval(const Unit& v);
public: Interval(const Unit& v1, const Unit& v2);
public: Interval(const Interval& interval);
// Operators
// *********
public: Interval& operator=(const Interval& interval);
public: bool operator==(const Interval& interval) const;
public: bool operator!=(const Interval& interval) const;
// 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: Interval GetUnion(const Interval& interval) const;
public: Interval GetIntersection(const Interval& interval) const;
// Predicates
// **********
public: bool IsEmpty() const;
public: bool IsPonctual() const;
public: bool Contains(const 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;
public: bool Superior(const Interval& interval, bool strict=true) const;
public: bool IsConstrainedBy(const Interval& interval) const;
// Updators
// ********
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& Merge(const Interval& interval);
public: Interval& Intersection(const Unit& vMin, const Unit& vMax);
public: Interval& Intersection(const Interval& interval);
public: Interval& Translate(const Unit& dv);
// Others
// ******
public: string _GetTypeName() const { return _TName("Interval"); };
public: string _GetString() const;
public: Record* _GetRecord() const;
};
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Interval)
#endif // HURRICANE_INTERVAL
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -0,0 +1,61 @@
// ****************************************************************************************************
// File: Intervals.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_INTERVALS
#define HURRICANE_INTERVALS
#include "Collection.h"
#include "Interval.h"
namespace Hurricane {
// ****************************************************************************************************
// Intervals declaration
// ****************************************************************************************************
typedef GenericCollection<Interval> Intervals;
// ****************************************************************************************************
// IntervalLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Interval> IntervalLocator;
// ****************************************************************************************************
// IntervalFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Interval> IntervalFilter;
// ****************************************************************************************************
// for_each_interval declaration
// ****************************************************************************************************
#define for_each_interval(interval, intervals)\
/*********************************************/\
{\
IntervalLocator _locator = intervals.GetLocator();\
while (_locator.IsValid()) {\
Interval interval = _locator.GetElement();\
_locator.Progress();
} // End of Hurricane namespace.
#endif // HURRICANE_INTERVALS
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

Some files were not shown because too many files have changed in this diff Show More