Derrick Release !!

* ./hurricane/src
   - Simplification of the Inspector internal mechanism. Simple, but with
       more templates, means a slower compilation.
   - The DbU::Unit problem : DbU::Unit are only typedef over long type,
       so we cannot create a specific overload for them. Uses "getValueRecord()"
       instead of "getRecord()"
   - For HInspectorWidget add a "getClone()" method. Also add a global
       object counter (for Record too) to track down memory leaks.
   - Big rewrite of the HInspectorWidget : now do not leak memory like hell,
       and only kept allocated the current Record and not the full stack
       of them (instead, we stack Slots which are ligthweigh objects).
   - Rename of "real" unit to "grid" unit.
   - New conversion function "getPhysicalsPerGrid()" and associated
       mechanism.

 * ./coriolis/src/crlcore :
   - Synchronise with the Hurricane modifications.
This commit is contained in:
Jean-Paul Chaput 2008-06-17 15:30:00 +00:00
parent 77d56ae638
commit a8b40f3b5c
97 changed files with 1994 additions and 1726 deletions

View File

@ -2,6 +2,7 @@
include ( ${QT_USE_FILE} )
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane
${HURRICANE_SOURCE_DIR}/src/hviewer
${HURRICANE_SOURCE_DIR}/src/hinspector
)

View File

@ -1,135 +1,204 @@
#include <QFontMetrics>
#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
#include <QTableView>
#include <QHeaderView>
#include <QSortFilterProxyModel>
#include <QKeyEvent>
#include <QGroupBox>
#include <QVBoxLayout>
#include "hurricane/viewer/Graphics.h"
#include "hurricane/inspector/RecordModel.h"
#include "hurricane/inspector/HInspectorWidget.h"
#include "hurricane/Slot.h"
HInspectorWidget::HInspectorWidget(QWidget* parent):
QWidget(parent),
filterProxyModels(),
filterProxyModelsHistory(),
recordsHistoryComboBox(NULL),
slotsView(NULL)
HInspectorWidget::HInspectorWidget ( Record* rootRecord, QWidget* parent )
: QWidget(parent)
, _slotsHistory()
, _recordModel(NULL)
, _sortModel(NULL)
, _recordsHistoryComboBox(NULL)
, _slotsView(NULL)
, _rowHeight(20)
, _rootRecord(rootRecord)
{
setAttribute ( Qt::WA_DeleteOnClose );
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
//recordsHistoryComboBox = new QComboBox(this);
slotsView = new QTableView(this);
slotsView->setAlternatingRowColors(true);
slotsView->setSelectionBehavior(QAbstractItemView::SelectRows);
slotsView->setSortingEnabled(true);
_slotsView = new QTableView(this);
_slotsView->setShowGrid(false);
_slotsView->setAlternatingRowColors(true);
_slotsView->setSelectionBehavior(QAbstractItemView::SelectRows);
_slotsView->setSortingEnabled(true);
QHeaderView* horizontalHeader = _slotsView->horizontalHeader ();
horizontalHeader->setStretchLastSection ( true );
horizontalHeader->setMinimumSectionSize ( 200 );
QHeaderView* verticalHeader = _slotsView->verticalHeader ();
verticalHeader->setVisible ( false );
Slot* rootSlot = getSlot ( "TopLevelSlot", _rootRecord );
_slotsHistory.push_back ( rootSlot );
_recordModel = new RecordModel ( rootSlot->getClone(), this );
_sortModel = new QSortFilterProxyModel ( this );
_sortModel->setSourceModel ( _recordModel );
_sortModel->setDynamicSortFilter ( true );
_sortModel->setFilterKeyColumn ( 1 );
_slotsView->setModel ( _sortModel );
_slotsView->horizontalHeader()->setStretchLastSection ( true );
_slotsView->resizeColumnToContents ( 0 );
int rows = _sortModel->rowCount ();
for ( rows-- ; rows >= 0 ; rows-- )
_slotsView->setRowHeight ( rows, _rowHeight );
QGridLayout* inspectorLayout = new QGridLayout();
//inspectorLayout->addWidget(recordsHistoryComboBox, 0, 0, 1, 2);
inspectorLayout->addWidget(slotsView, 1, 0, 1, 2);
inspectorLayout->addWidget(_slotsView, 1, 0, 1, 2);
filterPatternLineEdit = new QLineEdit(this);
_filterPatternLineEdit = new QLineEdit(this);
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
filterPatternLabel->setBuddy(filterPatternLineEdit);
filterPatternLabel->setBuddy(_filterPatternLineEdit);
inspectorLayout->addWidget(filterPatternLabel, 2, 0);
inspectorLayout->addWidget(filterPatternLineEdit, 2, 1);
inspectorLayout->addWidget(_filterPatternLineEdit, 2, 1);
QGroupBox* inspectorGroupBox = new QGroupBox(tr("Hurricane inspector"), this);
inspectorGroupBox->setLayout(inspectorLayout);
//QGroupBox* inspectorGroupBox = new QGroupBox(tr("Hurricane inspector"), this);
//inspectorGroupBox->setLayout(inspectorLayout);
QVBoxLayout* mainLayout = new QVBoxLayout;
mainLayout->addWidget(inspectorGroupBox);
setLayout(mainLayout);
//QVBoxLayout* mainLayout = new QVBoxLayout;
//mainLayout->addWidget(inspectorGroupBox);
//setLayout(mainLayout);
setLayout(inspectorLayout);
//connect(recordsHistoryComboBox, SIGNAL(currentIndexChanged(int)),
// this, SLOT(recordChanged(int)));
connect(filterPatternLineEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(textFilterChanged()));
connect ( _filterPatternLineEdit
, SIGNAL(textChanged(const QString &))
, this
, SLOT(textFilterChanged())
);
setWindowTitle(tr("Inspector"));
resize(1000, 500);
resize(500, 300);
}
void HInspectorWidget::setRecord(Record* record) {
filterProxyModelsHistory.clear();
HInspectorWidget::~HInspectorWidget ()
{
//cerr << "HInspector::~HInspector() - " << hex << (void*)this << dec << endl;
clearHistory ();
//cerr << "Records: " << Record::getAllocateds() << endl;
//cerr << "Slots: " << Slot::getAllocateds() << endl;
}
void HInspectorWidget::setRootRecord ( Record* record )
{
//recordsHistoryComboBox->clear();
internalSetRecord(record);
clearHistory ();
_rootRecord = record;
Slot* rootSlot = getSlot("TopLevelRecord",record);
_slotsHistory.push_back ( rootSlot );
_recordModel->setSlot ( rootSlot->getClone(), _slotsHistory.size() );
}
void HInspectorWidget::internalSetRecord(Record* record) {
QSortFilterProxyModel* sortModel = NULL;
FilterProxyModels::iterator fpmit = filterProxyModels.find(record);
if (fpmit != filterProxyModels.end()) {
sortModel = fpmit->second;
} else {
RecordModel* recordModel = new RecordModel(record, this);
sortModel = new QSortFilterProxyModel(this);
sortModel->setDynamicSortFilter(true);
sortModel->setSourceModel(recordModel);
sortModel->setFilterKeyColumn(1);
filterProxyModels[record] = sortModel;
void HInspectorWidget::clearHistory ()
{
if ( !_slotsHistory.empty() ) {
if ( _slotsHistory.size() > 1 )
delete _slotsHistory[0]->getDataRecord();
for ( size_t i=0 ; i < _slotsHistory.size() ; i++ )
delete _slotsHistory[i];
_slotsHistory.clear ();
}
slotsView->setModel(sortModel);
slotsView->resizeColumnsToContents();
filterProxyModelsHistory.push_back(sortModel);
//recordsHistoryComboBox->addItem(QString(record->getName().c_str()));
//recordsHistoryComboBox->setCurrentIndex(recordsHistoryComboBox->count()-1);
}
void HInspectorWidget::keyPressEvent(QKeyEvent *event) {
bool HInspectorWidget::setSlot ( Slot* slot )
{
if ( !slot ) return false;
bool change = true;
//cerr << "HInspector::setSlot() - " << hex << (void*)slot << dec << endl;
change = _recordModel->setSlot ( slot, _slotsHistory.size() );
int rows = _sortModel->rowCount ();
for ( rows-- ; rows >= 0 ; rows-- )
_slotsView->setRowHeight ( rows, _rowHeight );
//cerr << "Records: " << Record::getAllocateds() << endl;
//cerr << "Slots: " << Slot::getAllocateds() << endl;
return change;
}
void HInspectorWidget::pushSlot ( Slot* slot )
{
//cerr << "pushSlot() - [clone of] " << hex << (void*)slot << dec << endl;
_slotsHistory.push_back ( slot->getClone() );
if ( !setSlot(slot->getClone()) ) {
//cerr << "pushSlot() cancelled" << endl;
delete _slotsHistory.back ();
_slotsHistory.pop_back ();
}
}
void HInspectorWidget::popSlot ()
{
if ( _slotsHistory.size() > 1 ) {
//cerr << "popSlot() - " << hex << (void*)_slotsHistory.back() << dec << endl;
//cerr << "popSlot() - " << _slotsHistory.back()->getDataString() << endl;
delete _slotsHistory.back ();
_slotsHistory.pop_back ();
setSlot ( _slotsHistory.back()->getClone() );
}
}
void HInspectorWidget::keyPressEvent(QKeyEvent *event)
{
if ( event->matches(QKeySequence::MoveToNextChar) ) {
QModelIndex index = slotsView->currentIndex();
QModelIndex index = _slotsView->currentIndex();
if ( index.isValid() ) {
QSortFilterProxyModel* sortModel =
static_cast<QSortFilterProxyModel*>(slotsView->model());
QModelIndex modelIndex = sortModel->mapToSource(index);
RecordModel* recordModel =
static_cast<RecordModel*>(sortModel->sourceModel());
Record* record = recordModel->getRecord();
unsigned row = modelIndex.row();
Slot* slot = record->getSlot(row);
if (slot) {
Record* newRecord = slot->getDataRecord();
if (newRecord) {
internalSetRecord(newRecord);
}
}
Slot* slot = _recordModel->getRecord()->getSlot(_sortModel->mapToSource(index).row());
if ( slot )
pushSlot ( slot );
}
} else if ( event->matches(QKeySequence::MoveToPreviousChar) ) {
if (!filterProxyModelsHistory.empty()) {
filterProxyModelsHistory.pop_back();
if (!filterProxyModelsHistory.empty()) {
QSortFilterProxyModel* proxyModel = filterProxyModelsHistory.back();
slotsView->setModel(proxyModel);
}
//unsigned count = recordsHistoryComboBox->count();
//if (count > 0) {
// recordsHistoryComboBox->removeItem(count-1);
//}
}
popSlot ();
} else {
event->ignore();
}
}
void HInspectorWidget::recordChanged(size_t index) {
if (index >= 0 && index < filterProxyModelsHistory.size()) {
QSortFilterProxyModel* proxyModel = filterProxyModelsHistory[index];
slotsView->setModel(proxyModel);
//if (recordsHistoryComboBox->count() > index) {
// for (int i = recordsHistoryComboBox->count() - 1; i <= index; i--) {
// recordsHistoryComboBox->removeItem(i);
// }
//}
}
}
void HInspectorWidget::textFilterChanged() {
QRegExp regExp(filterPatternLineEdit->text());
QSortFilterProxyModel* sortModel =
static_cast<QSortFilterProxyModel*>(slotsView->model());
sortModel->setFilterRegExp(regExp);
void HInspectorWidget::textFilterChanged ()
{
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
}

View File

@ -1,34 +1,112 @@
#include <QFont>
#include <QApplication>
#include "hurricane/Name.h"
#include "hurricane/viewer/Graphics.h"
#include "hurricane/inspector/RecordModel.h"
RecordModel::RecordModel(Record* r, QObject* parent):
QAbstractTableModel(parent),
record(r)
RecordModel::RecordModel ( Slot* slot, QObject* parent )
: QAbstractTableModel(parent)
, _slot(slot)
, _record(slot->getDataRecord())
, _depth(1)
{ }
QVariant RecordModel::data(const QModelIndex &index, int role) const {
if (!index.isValid())
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
RecordModel::~RecordModel ()
{
//cerr << "RecordModel::~RecordModel()" << endl;
unsigned row = index.row();
Slot* slot = record->getSlot(row);
delete _record;
delete _slot;
}
bool RecordModel::setSlot ( Slot* slot, size_t depth )
{
//cerr << "RecordModel::setSlot() " << _depth << " -> " << depth << endl;
//cerr << slot->getDataString() << endl;
Record* record = slot->getDataRecord ();
if ( !record ) {
//cerr << "RecordModel::setSlot() - Cancelling, NULL record" << endl;
delete slot;
return false;
}
emit layoutAboutToBeChanged ();
if ( _depth > 1 ) delete _record;
delete _slot;
_slot = slot;
_record = record;
_depth = depth;
emit layoutChanged ();
return true;
}
QVariant RecordModel::data ( const QModelIndex& index, int role ) const
{
static QFont nameFont = Graphics::getFixedFont ( QFont::Bold );
static QFont valueFont = Graphics::getFixedFont ( QFont::Normal, true );
if ( !index.isValid() ) return QVariant ();
if ( role == Qt::SizeHintRole ) {
switch (index.column()) {
case 0: return 200;
case 1: return -1;
}
}
if ( role == Qt::FontRole ) {
switch (index.column()) {
case 0: return nameFont;
case 1: return valueFont;
}
}
if ( role == Qt::DisplayRole ) {
int row = index.row ();
Slot* slot = _record->getSlot ( row );
if ( slot ) {
switch ( index.column() ) {
case 0:
return QVariant(getString(slot->getName()).c_str());
case 1:
return QVariant(slot->getDataString().c_str());
case 0: return QVariant(slot->getName ().c_str());
case 1: return QVariant(slot->getDataString().c_str());
}
}
}
return QVariant();
}
int RecordModel::rowCount(const QModelIndex &parent) const {
return record->_getSlotList().size();
QVariant RecordModel::headerData ( int section
, Qt::Orientation orientation
, int role ) const
{
if ( ( orientation == Qt::Vertical ) || ( section > 1 ) || (role != Qt::DisplayRole) )
return QVariant();
if ( section == 0 )
return QVariant ( tr("Object Attribute") );
return QVariant ( tr("Value") );
}
int RecordModel::columnCount(const QModelIndex &parent) const {
int RecordModel::rowCount ( const QModelIndex& parent ) const
{
return _record->_getSlotList().size();
}
int RecordModel::columnCount ( const QModelIndex& parent ) const
{
return 2;
}

View File

@ -1,39 +1,53 @@
#ifndef HINSPECTORWIDGET_H
#define HINSPECTORWIDGET_H
#ifndef __HINSPECTOR_WIDGET_H__
#define __HINSPECTOR_WIDGET_H__
#include "hurricane/Commons.h"
using namespace Hurricane;
#include <QWidget>
class QSortFilterProxyModel;
class QTableView;
class QLineEdit;
class QComboBox;
class QHeaderView;
class RecordModel;
class HInspectorWidget : public QWidget {
Q_OBJECT
Q_OBJECT;
public:
typedef map<Record*, QSortFilterProxyModel*> FilterProxyModels;
typedef vector<QSortFilterProxyModel*> FilterProxyModelsHistory;
HInspectorWidget(QWidget* parent=0);
void setRecord(Record* record);
typedef vector<Slot*> SlotsVector;
public:
HInspectorWidget ( Record* rootRecord, QWidget* parent=NULL );
~HInspectorWidget ();
void setRootRecord ( Record* record );
private slots:
void recordChanged(size_t index);
void textFilterChanged ();
protected:
void keyPressEvent ( QKeyEvent * event );
private:
void clearHistory ();
void pushSlot ( Slot* slot );
void popSlot ();
bool setSlot ( Slot* slot );
private:
void internalSetRecord(Record* record);
FilterProxyModels filterProxyModels;
FilterProxyModelsHistory filterProxyModelsHistory;
QComboBox* recordsHistoryComboBox;
QTableView* slotsView;
QLineEdit* filterPatternLineEdit;
SlotsVector _slotsHistory;
RecordModel* _recordModel;
QSortFilterProxyModel* _sortModel;
QComboBox* _recordsHistoryComboBox;
QTableView* _slotsView;
QLineEdit* _filterPatternLineEdit;
int _rowHeight;
Record* _rootRecord;
};
#endif // HINSPECTORWIDGET_H
#endif // __HINSPECTOR_WIDGET_H__

View File

@ -1,22 +1,39 @@
#ifndef RECORDMODEL_H
#define RECORDMODEL_H
#ifndef __RECORD_MODEL_H__
#define __RECORD_MODEL_H__
#include <QAbstractTableModel>
#include "hurricane/Commons.h"
using namespace Hurricane;
class RecordModel : public QAbstractTableModel {
Q_OBJECT
Q_OBJECT;
public:
RecordModel(Record* record, QObject* parent=0);
RecordModel ( Slot* slot, QObject* parent=NULL );
~RecordModel ();
bool setSlot ( Slot* slot, size_t depth );
int rowCount ( const QModelIndex& parent=QModelIndex() ) const;
int columnCount ( const QModelIndex& parent=QModelIndex() ) const;
QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const;
Record* getRecord() { return record; }
QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const;
inline Record* getRecord ();
inline Slot* getSlot ();
private:
Record* record;
Slot* _slot;
Record* _record;
size_t _depth;
};
#endif // RECORDMODEL_H
// Inline Functions.
inline Record* RecordModel::getRecord () { return _record; }
inline Slot* RecordModel::getSlot () { return _slot; }
#endif // __RECORD_MODEL_H__

View File

@ -255,8 +255,8 @@ Box& Box::shrinkByFactor(double factor)
// **************************************
{
assert((0.0 <= factor) && (factor <= 1.0));
DbU::Unit dx = DbU::real ( 0.5 * (1-factor) * (DbU::getReal(_xMax) - DbU::getReal(_xMin)) );
DbU::Unit dy = DbU::real ( 0.5 * (1-factor) * (DbU::getReal(_yMax) - DbU::getReal(_yMin)) );
DbU::Unit dx = DbU::grid ( 0.5 * (1-factor) * (DbU::getGrid(_xMax) - DbU::getGrid(_xMin)) );
DbU::Unit dy = DbU::grid ( 0.5 * (1-factor) * (DbU::getGrid(_yMax) - DbU::getGrid(_yMin)) );
//DbU::Unit dx=getUnit(0.5*(1- factor) * (getValue(_xMax) - getValue(_xMin)));
//DbU::Unit dy=getUnit(0.5*(1- factor) * (getValue(_yMax) - getValue(_yMin)));

View File

@ -78,69 +78,68 @@
hurricane/Views.h
hurricane/Warning.h
)
set ( cpps BasicLayer.cpp
set ( cpps Record.cpp
Slot.cpp
Commons.cpp
Exception.cpp
Error.cpp
DRCError.cpp
Warning.cpp
Interruption.cpp
Tabulation.cpp
DbU.cpp
Point.cpp
Box.cpp
Interval.cpp
Transformation.cpp
Name.cpp
DBo.cpp
DataBase.cpp
Technology.cpp
Layer.cpp
BasicLayer.cpp
RegularLayer.cpp
ViaLayer.cpp
ContactLayer.cpp
DiffusionLayer.cpp
TransistorLayer.cpp
Box.cpp
CellCollections.cpp
Cell.cpp
Commons.cpp
Component.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
Entity.cpp
Cell.cpp
CellCollections.cpp
Net.cpp
NetExternalComponents.cpp
Occurrence.cpp
Pad.cpp
Path.cpp
Pin.cpp
DeepNet.cpp
HyperNet.cpp
Go.cpp
UserGo.cpp
Hook.cpp
Instance.cpp
Component.cpp
Plug.cpp
Point.cpp
Property.cpp
QuadTree.cpp
Quark.cpp
Record.cpp
Reference.cpp
Region.cpp
Relation.cpp
RoutingPad.cpp
Rubber.cpp
Contact.cpp
Pin.cpp
Segment.cpp
Vertical.cpp
Horizontal.cpp
Pad.cpp
RoutingPad.cpp
NetExternalComponents.cpp
Reference.cpp
Rubber.cpp
Quark.cpp
Property.cpp
Relation.cpp
SharedName.cpp
SharedPath.cpp
Path.cpp
Occurrence.cpp
QuadTree.cpp
Slice.cpp
SlotAdapter.cpp
Slot.cpp
Tabulation.cpp
Technology.cpp
Timer.cpp
Transformation.cpp
DbU.cpp
UpdateSession.cpp
UserGo.cpp
Vertical.cpp
Warning.cpp
Region.cpp
DisplaySlot.cpp
Marker.cpp
Timer.cpp
)
add_library ( hurricane SHARED ${cpps} )

View File

@ -261,6 +261,7 @@ Record* Cell::_getRecord() const
record->add(getSlot("Pins", &_pinMap));
record->add(getSlot("Slices", &_sliceMap));
record->add(getSlot("Markers", &_markerSet));
record->add(getSlot("SlaveEntityMap", &_slaveEntityMap));
record->add(getSlot("AbutmentBox", &_abutmentBox));
record->add(getSlot("BoundingBox", &_boundingBox));
record->add(getSlot("isTerminal", &_isTerminal));

View File

@ -112,6 +112,7 @@ string demangle ( const char* symbol )
// Generic functions
// ****************************************************************************************************
# if 0
bool Scan(const string& s, unsigned& u)
// ************************************
{
@ -215,6 +216,7 @@ bool Scan ( const string &s
return ( true );
}
# endif
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved

View File

@ -924,7 +924,7 @@ double getArea ( Component* component )
{
Box bb = component->getBoundingBox ();
return DbU::getReal(bb.getWidth()) * DbU::getReal(bb.getHeight());
return DbU::getGrid(bb.getWidth()) * DbU::getGrid(bb.getHeight());
}

View File

@ -10,6 +10,7 @@
#include "hurricane/BasicLayer.h"
#include "hurricane/Plug.h"
#include "hurricane/Error.h"
# include "hurricane/Slot.h"
namespace Hurricane {

View File

@ -146,9 +146,7 @@ Record* DBo::_getRecord() const
// **********************
{
Record* record = new Record(getString(this));
if (record) {
record->add(getSlot("Properties", &_propertySet));
}
return record;
}

View File

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

View File

@ -36,12 +36,47 @@ namespace Hurricane {
const unsigned int DbU::_maximalPrecision = 3;
unsigned int DbU::_precision = 1;
double DbU::_resolution = 0.1;
double DbU::_realsPerLambda = 10.0;
double DbU::_gridsPerLambda = 10.0;
double DbU::_physicalsPerGrid = 1.0;
unsigned int DbU::_stringMode = DbU::Symbolic;
const DbU::Unit DbU::Min = LONG_MIN;
const DbU::Unit DbU::Max = LONG_MAX;
// -------------------------------------------------------------------
// Class : "Hurricane::DbUSlot".
class DbUSlot : public Slot {
public:
// Constructor.
DbUSlot ( const string& name, const DbU::Unit* data );
DbUSlot ( string& name, const DbU::Unit* data );
// Accessors.
virtual string getDataString () const;
virtual Record* getDataRecord () const;
virtual DbUSlot* getClone () const;
protected:
// Internal: Attributes.
const DbU::Unit* _unit;
private:
// Internal: Constructors.
DbUSlot ( const DbUSlot& );
DbUSlot& operator= ( const DbUSlot& );
};
// Inline Member Functions.
DbUSlot::DbUSlot ( const string& name, const DbU::Unit* unit ) : Slot(name), _unit(unit) {}
DbUSlot::DbUSlot ( string& name, const DbU::Unit* unit ) : Slot(name), _unit(unit) {}
string DbUSlot::getDataString () const { return DbU::getValueString(*_unit); }
Record* DbUSlot::getDataRecord () const { return DbU::getValueRecord( _unit); }
DbUSlot* DbUSlot::getClone () const { return new DbUSlot(_name,_unit); }
// -------------------------------------------------------------------
// Class : "Hurricane::DbU".
@ -75,20 +110,44 @@ namespace Hurricane {
}
void DbU::setRealsPerLambda ( double realsPerLambda )
double DbU::getUnitPower ( UnitPower p )
{
if ( ( rint(realsPerLambda) != realsPerLambda )
|| ( remainder(realsPerLambda,2.0) != 0.0 ) )
throw Error ( "DbU::Unit::setRealPerLambdas(): \"realsPerLambda\" (%f) must be an even integer."
, realsPerLambda
);
_realsPerLambda = realsPerLambda;
switch ( p ) {
case Pico: return 1.0e-12;
case Nano: return 1.0e-9;
case Micro: return 1.0e-6;
case Milli: return 1.0e-3;
case Unity: return 1.0;
case Kilo: return 1.0e+3;
}
return 1.0;
}
double DbU::getRealsPerLambda ()
{ return _realsPerLambda; }
void DbU::setPhysicalsPerGrid ( double physicalsPerGrid, UnitPower p )
{
_physicalsPerGrid = physicalsPerGrid * getUnitPower(p);
}
double DbU::getPhysicalsPerGrid ()
{ return _physicalsPerGrid; }
void DbU::setGridsPerLambda ( double gridsPerLambda )
{
if ( ( rint(gridsPerLambda) != gridsPerLambda )
|| ( remainder(gridsPerLambda,2.0) != 0.0 ) )
throw Error ( "DbU::Unit::setGridPerLambdas(): \"gridsPerLambda\" (%f) must be an even integer."
, gridsPerLambda
);
_gridsPerLambda = gridsPerLambda;
}
double DbU::getGridsPerLambda ()
{ return _gridsPerLambda; }
@ -154,11 +213,11 @@ namespace Hurricane {
char buffer[1024];
char unitSymbol = 'u';
if ( _stringMode == Real ) {
if ( _stringMode == Grid ) {
if ( u == 0 ) return "0g";
unitSymbol = 'g';
snprintf ( buffer, 1024, "%.1f", getReal(u) );
snprintf ( buffer, 1024, "%.1f", getGrid(u) );
} else if ( _stringMode == Symbolic ) {
if ( u == 0 ) return "0l";
@ -185,4 +244,18 @@ namespace Hurricane {
}
Record* DbU::getValueRecord ( const DbU::Unit* u )
{
Record* record = new Record(getValueString(*u));
record->add(getSlot("DbU::Unit", u));
return record;
}
Slot* DbU::getValueSlot ( const string& name, const DbU::Unit* u )
{
return new DbUSlot ( name, u );
}
} // End of Hurricane namespace.

View File

@ -471,7 +471,7 @@ Record* Instance::_getRecord() const
record->add(getSlot("Name", &_name));
record->add(getSlot("MasterCell", _masterCell));
record->add(getSlot("Transformation", &_transformation));
record->add(getSlot("PlacementStatus", _placementStatus));
record->add(getSlot("PlacementStatus", &_placementStatus));
record->add(getSlot("XCenter", DbU::getValueString(getAbutmentBox().getXCenter())));
record->add(getSlot("YCenter", DbU::getValueString(getAbutmentBox().getYCenter())));
record->add(getSlot("Plugs", &_plugMap));

View File

@ -178,13 +178,6 @@ Record* Name::_getRecord() const
// Generic functions
// ****************************************************************************************************
bool Scan ( const string& s, Hurricane::Name& name )
// *****************************************
{
name = s;
return ( true );
}
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved

View File

@ -649,8 +649,8 @@ Record* Net::_getRecord() const
record->add(getSlot("Arity", &_arity));
record->add(getSlot("Global", &_isGlobal));
record->add(getSlot("External", &_isExternal));
record->add(getSlot("Type", _type));
record->add(getSlot("Direction", _direction));
record->add(getSlot("Type", &_type));
record->add(getSlot("Direction", &_direction));
record->add(getSlot("Position", &_position));
record->add(getSlot("Components", &_componentSet));
record->add(getSlot("Rubbers", &_rubberSet));

View File

@ -1,46 +1,77 @@
// ****************************************************************************************************
// File: Record.cpp
// Authors: R. Escassut
// -*- C++ -*-
//
// This file is part of the Hurricane Software.
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
//
// ===================================================================
//
// $Id: Record.h,v 1.7 2007/07/29 15:24:58 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++ Module : "./Record.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "hurricane/Commons.h"
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::Record".
size_t Record::_allocateds = 0;
// ****************************************************************************************************
// Record implementation
// ****************************************************************************************************
Record::Record ( const string& name )
// *******************************
: _name(name),
_slotList()
: _name(name)
, _slotList()
{
_allocateds++;
}
Record::~Record ()
// **************
{
//cerr << "Record::~Record() - " << _name << ": " << hex << (void*)this << dec << endl;
while (!_slotList.empty()) {
Slot* slot = *_slotList.begin();
_slotList.remove(slot);
delete slot;
}
_allocateds--;
}
size_t Record::getAllocateds ()
{
return _allocateds;
}
Slot* Record::getSlot ( unsigned no ) const
// *************************************
{
SlotList::const_iterator iterator = _slotList.begin();
while (no-- && (iterator != _slotList.end())) ++iterator;
return (iterator == _slotList.end()) ? NULL : *iterator;
}
void Record::add ( Slot* slot )
// *************************
{
if (!slot) {
cerr << "[ERROR] Record::add(): Attempt to add NULL Slot." << endl;
@ -49,16 +80,5 @@ void Record::add(Slot* slot)
_slotList.push_back(slot);
}
string Record::_getString() const
// ******************************
{
return "<" + _TName("Record") + " " + getName() + ">";
}
} // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -30,7 +30,7 @@ Reference::Reference(Cell* cell, const Name& name, DbU::Unit x, DbU::Unit y)
_name(name),
_point(x,y)
{
if ( !_extend ) _extend = DbU::real(0.5);
if ( !_extend ) _extend = DbU::grid(0.5);
if (_name.isEmpty())
throw Error("Can't create " + _TName("Reference") + " : empty name");

View File

@ -2742,7 +2742,7 @@ Region& Region::Inflate(const DbU::Unit& quantity)
}
}
else if (quantity < 0) {
_growthToFit(getBoundingBox().inflate(DbU::real(1.0)));
_growthToFit(getBoundingBox().inflate(DbU::grid(1.0)));
list<Box> boxList;
for_each_object(Tile*, tile, Region_Tiles(this).getSubSet(Tile::getIsVoidFilter())) {
boxList.push_back(tile->getBoundingBox());
@ -3007,7 +3007,7 @@ Region::verticalEnhancement()
{
bool modif = false;
Region result;
double minSide = DbU::getReal(DbU::real(5.0));
double minSide = DbU::getGrid(DbU::grid(5.0));
double minArea = minSide*minSide;
do {
// Rechercher la box de plus grande surface
@ -3015,7 +3015,7 @@ Region::verticalEnhancement()
double area = minArea;
for_each_box (box, getBoxes()) {
if (! box.isEmpty()) {
double a = DbU::getReal(box.getWidth()) * DbU::getReal(box.getHeight());
double a = DbU::getGrid(box.getWidth()) * DbU::getGrid(box.getHeight());
if (area < a) {
area = a;
maxBox = box;
@ -3025,7 +3025,7 @@ Region::verticalEnhancement()
}
if (maxBox.isEmpty()) break;
Tile* tile = _getTileAt (maxBox.getCenter());
if (maxBox.getWidth() >= DbU::real(2.0)) {
if (maxBox.getWidth() >= DbU::grid(2.0)) {
modif = tile->VerticalEnhancement (this);
}
result.fill (tile->getBoundingBox());
@ -3054,7 +3054,7 @@ Region::horizontalEnhancement()
{
bool modif = false;
Region result;
const double minSide = DbU::getReal(DbU::real(5.0));
const double minSide = DbU::getGrid(DbU::grid(5.0));
double minArea = minSide*minSide;
do {
// Rechercher la box de plus grande surface
@ -3062,7 +3062,7 @@ Region::horizontalEnhancement()
double area = minArea;
for_each_box (box, getBoxes()) {
if (! box.isEmpty()) {
double a = DbU::getReal(box.getWidth()) * DbU::getReal(box.getHeight());
double a = DbU::getGrid(box.getWidth()) * DbU::getGrid(box.getHeight());
if (area < a) {
area = a;
maxBox = box;
@ -3072,7 +3072,7 @@ Region::horizontalEnhancement()
}
if (maxBox.isEmpty()) break;
Tile* tile = _getTileAt (maxBox.getCenter());
if (maxBox.getWidth() >= DbU::real(2.0)) {
if (maxBox.getWidth() >= DbU::grid(2.0)) {
modif = tile->HorizontalEnhancement (this);
}
result.fill (tile->getBoundingBox());

View File

@ -33,5 +33,24 @@
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::Slot".
size_t Slot::_allocateds = 0;
size_t Slot::getAllocateds ()
{
return _allocateds;
}
Slot::~Slot ()
{
//cerr << "Slot::~Slot() - " << _name << ": " << hex << (void*)this << dec << endl;
_allocateds--;
}
} // End of Hurricane namespace.

View File

@ -50,7 +50,6 @@
# include <typeinfo>
# include "hurricane/Commons.h"

View File

@ -209,6 +209,7 @@ Record* Technology::_getRecord() const
if (record) {
record->add(getSlot("DataBase", _dataBase));
record->add(getSlot("Name", &_name));
cerr << "Adding Layers Slot - " << hex << (void*)&_layerList << endl;
record->add(getSlot("Layers", &_layerList));
}
return record;

View File

@ -236,9 +236,9 @@ Record* Transformation::_getRecord() const
// *********************************
{
Record* record = new Record(getString(this));
record->add(getSlot("X", &_tx));
record->add(getSlot("Y", &_ty));
record->add(getSlot("Orientation", _orientation));
record->add(DbU::getValueSlot("_tx",&_tx));
record->add(DbU::getValueSlot("_ty",&_ty));
record->add(getSlot("_orientation", &_orientation));
return record;
}

View File

@ -133,46 +133,46 @@ namespace Hurricane {
void BasicLayer::setRealName ( const char* realName) { _realName = realName; }
} // End of Hurricane namespace.
// -------------------------------------------------------------------
// Class : "Proxy...<const BasicLayer::Material::Code*>".
template<>
inline string ProxyTypeName<BasicLayer::Material::Code> ( const BasicLayer::Material::Code* object )
{ return "<PointerSlotAdapter<BasicLayer::Material::Code>>"; }
// Inspector Support for : BasicLayer::Material::Code.
template<>
inline string ProxyString<BasicLayer::Material::Code> ( const BasicLayer::Material::Code* object )
inline std::string getString<const Hurricane::BasicLayer::Material::Code*>
( const Hurricane::BasicLayer::Material::Code* object )
{
switch ( *object ) {
case BasicLayer::Material::nWell: return "nWell";
case BasicLayer::Material::pWell: return "pWell";
case BasicLayer::Material::nImplant: return "nImplant";
case BasicLayer::Material::pImplant: return "pImplant";
case BasicLayer::Material::active: return "active";
case BasicLayer::Material::poly: return "poly";
case BasicLayer::Material::cut: return "cut";
case BasicLayer::Material::metal: return "metal";
case BasicLayer::Material::blockage: return "blockage";
case BasicLayer::Material::other: return "other";
case Hurricane::BasicLayer::Material::nWell: return "nWell";
case Hurricane::BasicLayer::Material::pWell: return "pWell";
case Hurricane::BasicLayer::Material::nImplant: return "nImplant";
case Hurricane::BasicLayer::Material::pImplant: return "pImplant";
case Hurricane::BasicLayer::Material::active: return "active";
case Hurricane::BasicLayer::Material::poly: return "poly";
case Hurricane::BasicLayer::Material::cut: return "cut";
case Hurricane::BasicLayer::Material::metal: return "metal";
case Hurricane::BasicLayer::Material::blockage: return "blockage";
case Hurricane::BasicLayer::Material::other: return "other";
}
return "abnormal";
}
template<>
inline Record* ProxyRecord<BasicLayer::Material::Code> ( const BasicLayer::Material::Code* object )
inline Hurricane::Record* getRecord<const Hurricane::BasicLayer::Material::Code*>
( const Hurricane::BasicLayer::Material::Code* object )
{
Record* record = new Record(getString(object));
Hurricane::Record* record = new Hurricane::Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::BasicLayer)
INSPECTOR_P_SUPPORT(Hurricane::BasicLayer);
INSPECTOR_P_SUPPORT(Hurricane::BasicLayer::Material);
IOSTREAM_POINTER_SUPPORT(Hurricane::BasicLayer::Material::Code);
# endif

View File

@ -120,7 +120,7 @@ class Box {
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Box)
INSPECTOR_PV_SUPPORT(Hurricane::Box);
#endif // HURRICANE_BOX

View File

@ -286,7 +286,14 @@ class Cell : public Entity {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Cell)
INSPECTOR_P_SUPPORT(Hurricane::Cell);
INSPECTOR_P_SUPPORT(Hurricane::Cell::InstanceMap);
INSPECTOR_P_SUPPORT(Hurricane::Cell::SlaveInstanceSet);
INSPECTOR_P_SUPPORT(Hurricane::Cell::NetMap);
INSPECTOR_P_SUPPORT(Hurricane::Cell::PinMap);
INSPECTOR_P_SUPPORT(Hurricane::Cell::SliceMap);
INSPECTOR_P_SUPPORT(Hurricane::Cell::MarkerSet);
#endif // HURRICANE_CELL

View File

@ -23,8 +23,8 @@ template<class Type> class SubSetCollection;
// Collection declaration
// ****************************************************************************************************
template<class Type> class Collection : public NestedSlotAdapter {
// *************************************************************
template<class Type> class Collection {
// ************************************
// Constructors
// ************
@ -813,17 +813,29 @@ template<class Type> class SubSetCollection : public Collection<Type> {
_locator->progress();
template<typename T>
class IsNestedSlotAdapter<const Hurricane::GenericCollection<T> > {
public:
enum { True=1, False=0 };
};
} // End of Hurricane namespace.
template<typename Type> inline std::string getString ( Hurricane::Collection<Type>& collection )
{ return collection._getString(); }
template<typename Type> inline std::string getString ( Hurricane::Collection<Type>* collection )
{ return collection->_getString(); }
template<typename Type> inline std::string getString ( const Hurricane::Collection<Type>* collection )
{ return collection->_getString(); }
template<typename Type> inline Hurricane::Record* getRecord ( Hurricane::Collection<Type>& collection )
{ return collection._getRecord(); }
template<typename Type> inline Hurricane::Record* getRecord ( Hurricane::Collection<Type>* collection )
{ return collection->_getRecord(); }
template<typename Type> inline Hurricane::Record* getRecord ( const Hurricane::Collection<Type>* collection )
{ return collection->_getRecord(); }
#include "hurricane/MultisetCollection.h"
#include "hurricane/SetCollection.h"
#include "hurricane/MapCollection.h"

View File

@ -30,8 +30,8 @@
#define __HURRICANE_COMMONS__
#include <stdio.h>
#include <assert.h>
#include <cstdio>
#include <cassert>
#include <string>
#include <list>
@ -41,6 +41,7 @@
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
@ -49,19 +50,17 @@
// | Macros Definition |
// x-----------------------------------------------------------------x
using namespace std;
//using namespace std;
namespace Hurricane {
using namespace std;
// ---------------------------------------------------------------
// Forward Declarations.
class Slot;
class Record;
@ -102,60 +101,498 @@ namespace Hurricane {
inline string demangle ( const type_info& info ) { return demangle(info.name()); }
} // End of Hurricane namespace.
#include "hurricane/Record.h"
// x-----------------------------------------------------------------x
// | Generic Functions Definition |
// | Functions for Inspector Support |
// x-----------------------------------------------------------------x
// Note 1: Theses are specialized templates for "getString<>()" & "getRecord<>()".
// Note 2: we are outside the Hurricane namespace.
// Note 3: thoses templates manage all POD & STL types.
using namespace std;
// Forward declaration of "getSlot<>()" template.
template<typename Data> inline Hurricane::Slot* getSlot ( std::string& name, Data d );
template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& name, Data d );
template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& name, Data* d );
// -------------------------------------------------------------------
// Inspector Support for : "POD types".
// Default match.
template<typename Data> inline std::string getString ( Data data )
{ return "<Data Unsupported by Inspector>"; }
// "const *" flavors.
template<> inline std::string getString<const bool*> ( const bool* b )
{ return (*b)?"True":"False" ; }
template<> inline std::string getString<const char*> ( const char* c )
{ return c; }
template<> inline std::string getString<const int*> ( const int* i )
{ std::ostringstream os (""); os << *i; return os.str(); }
template<> inline std::string getString<const long*> ( const long* l )
{ std::ostringstream os (""); os << *l; return os.str(); }
template<> inline std::string getString<const unsigned int*> ( const unsigned int* u )
{ std::ostringstream os (""); os << *u; return os.str(); }
template<> inline std::string getString<const unsigned long*> ( const unsigned long* ul )
{ std::ostringstream os (""); os << *ul; return os.str(); }
template<> inline std::string getString<const unsigned long long*> ( const unsigned long long* ull )
{ std::ostringstream os (""); os << *ull; return os.str(); }
template<> inline std::string getString<const unsigned short int*> ( const unsigned short int* us )
{ std::ostringstream os (""); os << *us; return os.str(); }
template<> inline std::string getString<const float*> ( const float* f )
{ std::ostringstream os (""); os << *f; return os.str(); }
template<> inline std::string getString<const double*> ( const double* d )
{ std::ostringstream os; os << *d; return os.str(); }
template<> inline std::string getString<const void*> ( const void* p )
{ std::ostringstream os ("0x"); os << std::hex << p; return os.str(); }
template<> inline std::string getString<const std::string*> ( const std::string* s )
{ return *s; }
// "*" flavors.
template<> inline std::string getString<bool*> ( bool* b )
{ return (*b)?"True":"False" ; }
template<> inline std::string getString<char*> ( char* c )
{ return c; }
template<> inline std::string getString<int*> ( int* i )
{ std::ostringstream os (""); os << *i; return os.str(); }
template<> inline std::string getString<long*> ( long* l )
{ std::ostringstream os (""); os << *l; return os.str(); }
template<> inline std::string getString<unsigned int*> ( unsigned int* u )
{ std::ostringstream os (""); os << *u; return os.str(); }
template<> inline std::string getString<unsigned long*> ( unsigned long* ul )
{ std::ostringstream os (""); os << *ul; return os.str(); }
template<> inline std::string getString<unsigned long long*> ( unsigned long long* ull )
{ std::ostringstream os (""); os << *ull; return os.str(); }
template<> inline std::string getString<unsigned short int*> ( unsigned short int* us )
{ std::ostringstream os (""); os << *us; return os.str(); }
template<> inline std::string getString<float*> ( float* f )
{ std::ostringstream os (""); os << *f; return os.str(); }
template<> inline std::string getString<double*> ( double* d )
{ std::ostringstream os; os << *d; return os.str(); }
template<> inline std::string getString<void*> ( void* p )
{ std::ostringstream os ("0x"); os << std::hex << p; return os.str(); }
template<> inline std::string getString<std::string*> ( std::string* s )
{ return *s; }
// "by value" flavors.
template<> inline std::string getString<bool> ( bool b )
{ return (b)?"True":"False" ; }
template<> inline std::string getString<char> ( const char c )
{ return std::string(1,c); }
template<> inline std::string getString<int> ( int i )
{ std::ostringstream os (""); os << i; return os.str(); }
template<> inline std::string getString<long> ( long l )
{ std::ostringstream os (""); os << l; return os.str(); }
template<> inline std::string getString<unsigned int> ( unsigned int u )
{ std::ostringstream os (""); os << u; return os.str(); }
template<> inline std::string getString<unsigned long> ( unsigned long ul )
{ std::ostringstream os (""); os << ul; return os.str(); }
template<> inline std::string getString<unsigned long long> ( unsigned long long ull )
{ std::ostringstream os (""); os << ull; return os.str(); }
template<> inline std::string getString<unsigned short int> ( unsigned short int us )
{ std::ostringstream os (""); os << us; return os.str(); }
template<> inline std::string getString<float> ( float f )
{ std::ostringstream os (""); os << f; return os.str(); }
template<> inline std::string getString<double> ( double d )
{ std::ostringstream os; os << d; return os.str(); }
template<> inline std::string getString<std::string> ( std::string s )
{ return s; }
template<typename Data> inline Hurricane::Record* getRecord ( Data data )
{ return NULL; }
// -------------------------------------------------------------------
// Inspector Support for : "const std::vector<Element>*".
template<typename Element>
inline std::string getString ( const std::vector<Element>* v )
{
std::string name = "const std::vector<Element>:";
return name + getString<size_t>(v->size());
}
template<typename Element>
inline Hurricane::Record* getRecord ( const std::vector<Element>* v )
{
Hurricane::Record* record = NULL;
if ( !v->empty() ) {
record = new Hurricane::Record ( "const std::vector<Element>" );
unsigned n = 1;
typename std::vector<Element>::const_iterator iterator = v->begin();
while ( iterator != v->end() ) {
record->add ( getSlot<Element>(getString(n++), *iterator) );
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Inspector Support for : "const std::list<Element>*".
template<typename Element>
inline std::string getString ( const std::list<Element>* l )
{
std::string name = "const std::list<Element>:";
return name + getString<size_t>(l->size());
}
template<typename Element>
inline Hurricane::Record* getRecord ( const std::list<Element>* l )
{
Hurricane::Record* record = NULL;
if ( !l->empty() ) {
record = new Hurricane::Record ( "const std::list<Element>" );
unsigned n = 1;
typename std::list<Element>::const_iterator iterator = l->begin();
while ( iterator != l->end() ) {
record->add ( getSlot<Element>(getString(n++), *iterator) );
++iterator;
}
}
return record;
}
template<typename Element>
inline std::string getString ( std::list<Element>* l )
{
std::string name = "std::list<Element>:";
return name + getString<size_t>(l->size());
}
template<typename Element>
inline Hurricane::Record* getRecord ( std::list<Element>* l )
{
Hurricane::Record* record = NULL;
if ( !l->empty() ) {
record = new Hurricane::Record ( "std::list<Element>" );
unsigned n = 1;
typename std::list<Element>::iterator iterator = l->begin();
while ( iterator != l->end() ) {
record->add ( getSlot<Element>(getString(n++), *iterator) );
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Inspector Support for : "[const] std::map<Key,Element,Compare>*.
template<typename Key, typename Element, typename Compare>
inline std::string getString ( const std::map<Key,Element,Compare>* m )
{
std::string name = "std::map<Element>:";
return name + getString<size_t>(m->size());
}
template<typename Key, typename Element, typename Compare>
inline Hurricane::Record* getRecord ( const std::map<Key,Element,Compare>* m )
{
Hurricane::Record* record = NULL;
if ( !m->empty() ) {
record = new Hurricane::Record ( "std::map<Element>" );
typename std::map<Key,Element,Compare>::const_iterator iterator = m->begin();
while ( iterator != m->end() ) {
record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Inspector Support for : "[const] std::multimap<Key,Element,Compare>*.
template<typename Key, typename Element, typename Compare>
inline std::string getString ( const std::multimap<Key,Element,Compare>* m )
{
std::string name = "std::multimap<Element>:";
return name + getString<size_t>(m->size());
}
template<typename Key, typename Element, typename Compare>
inline Hurricane::Record* getRecord ( const std::multimap<Key,Element,Compare>* m )
{
Hurricane::Record* record = NULL;
if ( !m->empty() ) {
record = new Hurricane::Record ( "std::multimap<Element>" );
typename std::multimap<Key,Element,Compare>::const_iterator iterator = m->begin();
while ( iterator != m->end() ) {
record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
++iterator;
}
}
return record;
}
template<typename Key, typename Element, typename Compare>
inline std::string getString ( std::multimap<Key,Element,Compare>* m )
{
std::string name = "std::multimap<Element>:";
return name + getString<size_t>(m->size());
}
template<typename Key, typename Element, typename Compare>
inline Hurricane::Record* getRecord ( std::multimap<Key,Element,Compare>* m )
{
Hurricane::Record* record = NULL;
if ( !m->empty() ) {
record = new Hurricane::Record ( "std::multimap<Element>" );
typename std::multimap<Key,Element,Compare>::iterator iterator = m->begin();
while ( iterator != m->end() ) {
record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Inspector Support for : "[const] std::set<Element,Compare>*".
template<typename Element, typename Compare>
inline std::string getString ( const std::set<Element,Compare>* s )
{
std::string name = "const std::set<Element>:";
return name + getString<size_t>(s->size());
}
template<typename Element, typename Compare>
inline Hurricane::Record* getRecord ( const std::set<Element,Compare>* s )
{
Hurricane::Record* record = NULL;
if ( !s->empty() ) {
record = new Hurricane::Record ( "const std::set<Element>" );
unsigned n = 1;
typename std::set<Element,Compare>::const_iterator iterator = s->begin();
while ( iterator != s->end() ) {
record->add ( getSlot<Element>(getString(n++), *iterator) );
++iterator;
}
}
return record;
}
template<typename Element, typename Compare>
inline std::string getString ( std::set<Element,Compare>* s )
{
std::string name = "std::set<Element>:";
return name + getString<size_t>(s->size());
}
template<typename Element, typename Compare>
inline Hurricane::Record* getRecord ( std::set<Element,Compare>* s )
{
Hurricane::Record* record = NULL;
if ( !s->empty() ) {
record = new Hurricane::Record ( "std::set<Element>" );
unsigned n = 1;
typename std::set<Element,Compare>::iterator iterator = s->begin();
while ( iterator != s->end() ) {
record->add ( getSlot<Element>(getString(n++), *iterator) );
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Inspector Support for : "const std::multiset<Element,Compare>*".
template<typename Element, typename Compare>
inline std::string getString ( const std::multiset<Element,Compare>* s )
{
std::string name = "std::multiset<Element>:";
return name + getString<size_t>(s->size());
}
template<typename Element, typename Compare>
inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
{
Hurricane::Record* record = NULL;
if ( !s->empty() ) {
record = new Hurricane::Record ( "std::multiset<Element>" );
unsigned n = 1;
typename std::multiset<Element,Compare>::const_iterator iterator = s->begin();
while ( iterator != s->end() ) {
record->add ( getSlot<Element>(getString(n++), *iterator) );
++iterator;
}
}
return record;
}
# define IOSTREAM_POINTER_SUPPORT(Data) \
inline std::ostream& operator<< ( std::ostream& o, Data* d ) \
{ \
if (!d) return o << "NULL"; \
return o << "&" << getString<Data*>(d); \
} \
inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \
{ \
if (!d) return o << "NULL"; \
return o << "&" << getString<const Data*>(d); \
}
# define INSPECTOR_POINTER_SUPPORT(Data) \
template<> inline std::string getString<Data*>( Data* data ) \
{ if (!data) return "NULL " #Data; return data->_getString(); } \
\
template<> inline std::string getString<const Data*>( const Data* data ) \
{ if (!data) return "NULL const " #Data; return data->_getString(); } \
\
template<> inline Hurricane::Record* getRecord<Data*>( Data* data ) \
{ if (!data) return NULL; return data->_getRecord(); } \
\
template<> inline Hurricane::Record* getRecord<const Data*>( const Data* data ) \
{ if (!data) return NULL; return data->_getRecord(); } \
# define IOSTREAM_REFERENCE_SUPPORT(Data) \
inline std::ostream& operator<< ( std::ostream& o, Data& d ) \
{ return o << getString<Data&>(d); } \
\
inline std::ostream& operator<< ( std::ostream& o, const Data& d ) \
{ return o << getString<Data&>(d); }
# define INSPECTOR_REFERENCE_SUPPORT(Data) \
template<> inline std::string getString<Data&>( Data& data ) \
{ return data._getString(); } \
\
template<> inline std::string getString<const Data&>( const Data& data ) \
{ return data._getString(); } \
\
template<> inline Hurricane::Record* getRecord<Data&>( Data& data ) \
{ return data._getRecord(); } \
\
template<> inline Hurricane::Record* getRecord<const Data&>( const Data& data ) \
{ return data._getRecord(); }
# define IOSTREAM_VALUE_SUPPORT(Data) \
inline std::ostream& operator<< ( std::ostream& o, Data d ) \
{ return o << getString<Data>(d); }
# define INSPECTOR_VALUE_SUPPORT(Data) \
template<> inline std::string getString<Data>( Data data ) \
{ return data._getString(); } \
\
template<> inline Hurricane::Record* getRecord<Data>( Data data ) \
{ return data._getRecord(); }
# define INSPECTOR_P_SUPPORT(Data) \
INSPECTOR_POINTER_SUPPORT(Data) \
IOSTREAM_POINTER_SUPPORT(Data)
# define INSPECTOR_R_SUPPORT(Data) \
INSPECTOR_REFERENCE_SUPPORT(Data) \
IOSTREAM_REFERENCE_SUPPORT(Data)
# define INSPECTOR_V_SUPPORT(Data) \
INSPECTOR_VALUE_SUPPORT(Data) \
IOSTREAM_VALUE_SUPPORT(Data)
# define INSPECTOR_PR_SUPPORT(Data) \
INSPECTOR_POINTER_SUPPORT(Data) \
INSPECTOR_REFERENCE_SUPPORT(Data) \
IOSTREAM_POINTER_SUPPORT(Data) \
IOSTREAM_REFERENCE_SUPPORT(Data)
# define INSPECTOR_PV_SUPPORT(Data) \
INSPECTOR_POINTER_SUPPORT(Data) \
INSPECTOR_VALUE_SUPPORT(Data) \
IOSTREAM_POINTER_SUPPORT(Data) \
IOSTREAM_VALUE_SUPPORT(Data)
// x-----------------------------------------------------------------x
// | getString() Overloads for POD/STL types |
// | Classes Neededs in All Hurricane Modules |
// x-----------------------------------------------------------------x
// Note: we are outside the Hurricane namespace.
#include "hurricane/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 "hurricane/Slot.h"
#include "hurricane/Tabulation.h"

View File

@ -119,8 +119,9 @@ double getArea ( Component* component );
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Component)
SetNestedSlotAdapter(Hurricane::Component::BodyHook)
INSPECTOR_P_SUPPORT(Hurricane::Component);
INSPECTOR_P_SUPPORT(Hurricane::Component::BodyHook);
#endif // HURRICANE_COMPONENT

View File

@ -114,9 +114,6 @@ class CompositeLayer : public Layer {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::CompositeLayer)
// ****************************************************************************************************
// Generic functions

View File

@ -138,7 +138,9 @@ class Contact : public Component {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Contact)
INSPECTOR_P_SUPPORT(Hurricane::Contact);
INSPECTOR_P_SUPPORT(Hurricane::Contact::AnchorHook);
#endif // HURRICANE_CONTACT

View File

@ -108,7 +108,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::ContactLayer)
# endif

View File

@ -19,8 +19,8 @@ namespace Hurricane {
// DBo declaration
// ****************************************************************************************************
class DBo : public NestedSlotAdapter {
// *********************************
class DBo {
// ********
#if !defined(__DOXYGEN_PROCESSOR__)
@ -97,8 +97,22 @@ class DBo : public NestedSlotAdapter {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::DBo)
PointerIOStreamSupport(Hurricane::DBo)
INSPECTOR_P_SUPPORT(Hurricane::DBo);
template<>
inline Hurricane::Slot* getSlot ( const std::string& name, const std::set<Hurricane::Property*>* s )
{
return new Hurricane::SlotTemplate<const std::set<Hurricane::Property*>*>(name,s);
}
template<>
inline Hurricane::Slot* getSlot ( const std::string& name, std::set<Hurricane::Property*>* s )
{
return new Hurricane::SlotTemplate<std::set<Hurricane::Property*>*>(name,s);
}
#endif // HURRICANE_DBO

View File

@ -73,7 +73,8 @@ class DataBase : public DBo {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::DataBase)
INSPECTOR_P_SUPPORT(Hurricane::DataBase);
#endif // HURRICANE_DATA_BASE

View File

@ -37,27 +37,39 @@ namespace Hurricane {
class DbU {
public:
enum UnitPower { Pico = 1
, Nano
, Micro
, Milli
, Unity
, Kilo
};
public:
typedef long Unit;
public:
enum StringMode { Db = 1
, Real = 2
, Grid = 2
, Symbolic = 4
};
public:
// User to DB Converters.
static inline Unit db ( long value );
static inline Unit real ( double value );
static inline Unit grid ( double value );
static inline Unit lambda ( double value );
// Precision & Resolution Managment.
static unsigned int getPrecision ();
static unsigned int getMaximalPrecision ();
static double getResolution ();
static void setPrecision ( unsigned int precision );
// Founder Grid Managment.
static double getUnitPower ( UnitPower p );
static void setPhysicalsPerGrid ( double gridsPerLambda, UnitPower p );
static double getPhysicalsPerGrid ();
// Lamba Managment.
static void setRealsPerLambda ( double realsPerLambda );
static double getRealsPerLambda ();
static void setGridsPerLambda ( double gridsPerLambda );
static double getGridsPerLambda ();
// Grid Managment.
//static void setGridStep ( const Unit& gridStep );
//static const Unit getGridStep ();
@ -65,9 +77,11 @@ namespace Hurricane {
//static bool isOnGrid ( const Unit& unit, int n=1 );
// Conversions.
static inline long getDb ( Unit u );
static inline double getReal ( Unit u );
static inline double getGrid ( Unit u );
static inline double getLambda ( Unit u );
static string getValueString ( Unit u );
static Record* getValueRecord ( const Unit* u );
static Slot* getValueSlot ( const string& name, const Unit* u );
static inline void setStringMode ( unsigned int mode );
public:
@ -79,18 +93,19 @@ namespace Hurricane {
static const unsigned int _maximalPrecision;
static unsigned int _precision;
static double _resolution;
static double _realsPerLambda;
static double _gridsPerLambda;
static double _physicalsPerGrid;
static unsigned int _stringMode;
};
// Inline Functions.
inline DbU::Unit DbU::db ( long value ) { return value; }
inline DbU::Unit DbU::real ( double value ) { return (long)rint( value/_resolution ); }
inline DbU::Unit DbU::lambda ( double value ) { return real(value*_realsPerLambda); }
inline DbU::Unit DbU::grid ( double value ) { return (long)rint( value/_resolution ); }
inline DbU::Unit DbU::lambda ( double value ) { return grid(value*_gridsPerLambda); }
inline long DbU::getDb ( DbU::Unit u ) { return u; }
inline double DbU::getReal ( DbU::Unit u ) { return _resolution*(double)u; }
inline double DbU::getLambda ( DbU::Unit u ) { return getReal(u)/_realsPerLambda; }
inline double DbU::getGrid ( DbU::Unit u ) { return _resolution*(double)u; }
inline double DbU::getLambda ( DbU::Unit u ) { return getGrid(u)/_gridsPerLambda; }
inline void DbU::setStringMode ( unsigned int mode ) { _stringMode = mode; }

View File

@ -109,7 +109,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::DiffusionLayer)
# endif

View File

@ -61,7 +61,8 @@ class Entity : public DBo {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Entity)
INSPECTOR_P_SUPPORT(Hurricane::Entity);
#endif // HURRICANE_ENTITY

View File

@ -63,7 +63,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Error)
# endif // __HURRICANE_ERROR__

View File

@ -17,8 +17,8 @@ namespace Hurricane {
// Exception declaration
// ****************************************************************************************************
class Exception : public NestedSlotAdapter {
// ***************************************
class Exception {
// **************
// Constructors
// ************
@ -53,9 +53,6 @@ class Exception : public NestedSlotAdapter {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Exception)
#endif // HURRICANE_EXCEPTION
// ****************************************************************************************************

View File

@ -20,7 +20,7 @@ template<class Type> class NotFilter;
// Filter declaration
// ****************************************************************************************************
template<class Type> class Filter : public NestedSlotAdapter {
template<class Type> class Filter {
// *********************************************************
// Constructors
@ -286,13 +286,6 @@ template<class Type> class NotFilter : public Filter<Type> {
// ****************************************************************************************************
template<typename T>
class IsNestedSlotAdapter<const Hurricane::GenericFilter<T> > {
public:
enum { True=1, False=0 };
};
} // End of Hurricane namespace.

View File

@ -84,7 +84,8 @@ class Go : public Entity {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Go)
INSPECTOR_P_SUPPORT(Hurricane::Go);
#endif // HURRICANE_GO

View File

@ -19,8 +19,8 @@ class Component;
// Hook declaration
// ****************************************************************************************************
class Hook : public NestedSlotAdapter {
// **********************************
class Hook {
// *********
// Attributes
// **********
@ -92,7 +92,8 @@ class Hook : public NestedSlotAdapter {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Hook)
INSPECTOR_P_SUPPORT(Hurricane::Hook);
#endif // HURRICANE_HOOK

View File

@ -101,7 +101,8 @@ class Horizontal : public Segment {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Horizontal)
INSPECTOR_P_SUPPORT(Hurricane::Horizontal);
#endif // HURRICANE_HORIZONTAL

View File

@ -71,7 +71,7 @@ bool IsHyperNetRootNetOccurrence(Occurrence netoccurrence);
} // End of Hurricane namespace.
PointerIOStreamSupport(Hurricane::HyperNet)
INSPECTOR_P_SUPPORT(Hurricane::HyperNet);

View File

@ -172,43 +172,42 @@ class Instance : public Go {
};
} // End of Hurricane namespace.
// -------------------------------------------------------------------
// Class : "Proxy...<const Instance::PlacementStatus::Code*>".
// Inspector Support for : 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 )
inline std::string getString<const Hurricane::Instance::PlacementStatus::Code*>
( const Hurricane::Instance::PlacementStatus::Code* object )
{
switch ( *object ) {
case Instance::PlacementStatus::UNPLACED: return "PLACED";
case Instance::PlacementStatus::PLACED: return "PLACED";
case Instance::PlacementStatus::FIXED: return "FIXED";
case Hurricane::Instance::PlacementStatus::UNPLACED: return "PLACED";
case Hurricane::Instance::PlacementStatus::PLACED: return "PLACED";
case Hurricane::Instance::PlacementStatus::FIXED: return "FIXED";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Instance::PlacementStatus::Code>
( const Instance::PlacementStatus::Code* object )
inline Hurricane::Record* getRecord<const Hurricane::Instance::PlacementStatus::Code*>
( const Hurricane::Instance::PlacementStatus::Code* object )
{
Record* record = new Record(getString(object));
Hurricane::Record* record = new Hurricane::Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Instance);
INSPECTOR_P_SUPPORT(Hurricane::Instance::PlacementStatus);
INSPECTOR_P_SUPPORT(Hurricane::Instance::PlugMap);
INSPECTOR_P_SUPPORT(Hurricane::Instance::SharedPathMap);
IOSTREAM_POINTER_SUPPORT(Hurricane::Instance::PlacementStatus::Code);
IOSTREAM_VALUE_SUPPORT(Hurricane::Instance::PlacementStatus::Code);
SetNestedSlotAdapter(Hurricane::Instance)
#endif // HURRICANE_INSTANCE
// ****************************************************************************************************

View File

@ -61,9 +61,6 @@ class Interruption : public Exception {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Interruption)
#endif // HURRICANE_INTERRUPTION
// ****************************************************************************************************

View File

@ -93,7 +93,7 @@ class Interval {
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Interval)
INSPECTOR_PV_SUPPORT(Hurricane::Interval);
#endif // HURRICANE_INTERVAL

View File

@ -325,14 +325,10 @@ template<class Key, class Element> class IntrusiveMap {
record = new Record(getString(this));
unsigned n = 1;
for (unsigned index = 0; index < _length; index++) {
/**/
n = 1;
/**/
Element* element = _array[index];
while (element) {
// record->add(getSlot(getString(n++), element));
record->add(getSlot(getString(index) + ":" + getString(n++), element));
/**/
element = _getNextElement(element);
}
}
@ -442,6 +438,24 @@ template<class Key, class Element> class IntrusiveMap {
} // End of Hurricane namespace.
template<typename Key, typename Element>
inline std::string getString ( Hurricane::IntrusiveMap<Key,Element>* intrusiveMap )
{ return intrusiveMap->_getString(); }
template<typename Key, typename Element>
inline std::string getString ( const Hurricane::IntrusiveMap<Key,Element>* intrusiveMap )
{ return intrusiveMap->_getString(); }
template<typename Key, typename Element>
inline Hurricane::Record* getRecord ( Hurricane::IntrusiveMap<Key,Element>* intrusiveMap )
{ return intrusiveMap->_getRecord(); }
template<typename Key, typename Element>
inline Hurricane::Record* getRecord ( const Hurricane::IntrusiveMap<Key,Element>* intrusiveMap )
{ return intrusiveMap->_getRecord(); }
#endif // HURRICANE_INTRUSIVE_MAP
// ****************************************************************************************************

View File

@ -20,8 +20,8 @@ namespace Hurricane {
// IntrusiveSet declaration
// ****************************************************************************************************
template<class Element> class IntrusiveSet : public NestedSlotAdapter {
// ******************************************************************
template<class Element> class IntrusiveSet {
// *****************************************
// Types
// *****
@ -326,14 +326,10 @@ template<class Element> class IntrusiveSet : public NestedSlotAdapter {
record = new Record(getString(this));
unsigned n = 1;
for (unsigned index = 0; index < _length; index++) {
/**/
n = 1;
/**/
Element* element = _array[index];
while (element) {
// record->add(getSlot(getString(n++), element));
record->add(getSlot(getString(index) + ":" + getString(n++), element));
/**/
element = _getNextElement(element);
}
}
@ -463,6 +459,16 @@ template<class Element> class IntrusiveSet : public NestedSlotAdapter {
} // End of Hurricane namespace.
template<typename Type>
inline std::string getString ( Hurricane::IntrusiveSet<Type>& intrusiveSet )
{ return intrusiveSet._getString(); }
template<typename Type>
inline Hurricane::Record* getRecord ( Hurricane::IntrusiveSet<Type>& intrusiveSet )
{ return intrusiveSet._getRecord(); }
#endif // HURRICANE_INTRUSIVE_SET
// ****************************************************************************************************

View File

@ -123,7 +123,7 @@ namespace Hurricane {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Layer)
INSPECTOR_P_SUPPORT(Hurricane::Layer);
# endif

View File

@ -114,7 +114,9 @@ class Library : public DBo {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Library)
INSPECTOR_P_SUPPORT(Hurricane::Library);
INSPECTOR_P_SUPPORT(Hurricane::Library::LibraryMap);
INSPECTOR_P_SUPPORT(Hurricane::Library::CellMap);
#endif // HURRICANE_LIBRARY

View File

@ -18,8 +18,8 @@ namespace Hurricane {
// Locator declaration
// ****************************************************************************************************
template<class Type> class Locator : public NestedSlotAdapter {
// **********************************************************
template<class Type> class Locator {
// *********************************
// Constructors
// ************
@ -249,14 +249,6 @@ template<class Type> class GenericLocator : public Locator<Type> {
// ****************************************************************************************************
template<typename T>
class IsNestedSlotAdapter<const Hurricane::GenericLocator<T> > {
public:
enum { True=1, False=0 };
};
} // End of Hurricane namespace.

View File

@ -163,7 +163,7 @@ template<class Key, class Element, class Compare = less<Key> >
record = new Record(_GetString());
typename map<Key, Element, Compare>::const_iterator iterator = _elementMap->begin(); // AD
while (iterator != _elementMap->end()) {
record->add(GetSlot(GetString((*iterator).first), (*iterator).second));
record->add(getSlot<Element>(GetString((*iterator).first), (*iterator).second));
++iterator;
}
}

View File

@ -9,10 +9,6 @@
#include "hurricane/Commons.h"
#include "hurricane/Tabulation.h"
#include "hurricane/Record.h"
#include "hurricane/Slot.h"
namespace Hurricane {

View File

@ -76,11 +76,9 @@ class Name {
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Name)
INSPECTOR_PV_SUPPORT(Hurricane::Name);
bool Scan ( const string& s, Hurricane::Name& name );
#endif // HURRICANE_NAME
// ****************************************************************************************************

View File

@ -219,76 +219,70 @@ class Net : public Entity {
// -------------------------------------------------------------------
// Class : "Proxy...<const Net::Type::Code*>".
template<>
inline string ProxyTypeName<Net::Type::Code>
( const Net::Type::Code* object )
{ return "<PointerSlotAdapter<Net::Type::Code>>"; }
template<>
inline string ProxyString <Net::Type::Code>
( const Net::Type::Code* object )
{
switch ( *object ) {
case Net::Type::UNDEFINED: return "UNDEFINED";
case Net::Type::LOGICAL: return "LOGICAL";
case Net::Type::CLOCK: return "CLOCK";
case Net::Type::POWER: return "POWER";
case Net::Type::GROUND: return "GROUND";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Net::Type::Code>
( const Net::Type::Code* object )
{
Record* record = new Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
// -------------------------------------------------------------------
// Class : "Proxy...<const Net::Direction::Code*>".
template<>
inline string ProxyTypeName<Net::Direction::Code>
( const Net::Direction::Code* object )
{ return "<PointerSlotAdapter<Net::Direction::Code>>"; }
template<>
inline string ProxyString <Net::Direction::Code>
( const Net::Direction::Code* object )
{
switch ( *object ) {
case Net::Direction::UNDEFINED: return "UNDEFINED";
case Net::Direction::IN: return "IN";
case Net::Direction::OUT: return "OUT";
case Net::Direction::INOUT: return "INOUT";
case Net::Direction::TRISTATE: return "TRISTATE";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Net::Direction::Code>
( const Net::Direction::Code* object )
{
Record* record = new Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Net)
// -------------------------------------------------------------------
// Inspector Support for : Net::Type::Code*".
template<>
inline std::string getString<const Hurricane::Net::Type::Code*>
( const Hurricane::Net::Type::Code* object )
{
switch ( *object ) {
case Hurricane::Net::Type::UNDEFINED: return "UNDEFINED";
case Hurricane::Net::Type::LOGICAL: return "LOGICAL";
case Hurricane::Net::Type::CLOCK: return "CLOCK";
case Hurricane::Net::Type::POWER: return "POWER";
case Hurricane::Net::Type::GROUND: return "GROUND";
}
return "ABNORMAL";
}
template<>
inline Hurricane::Record* getRecord<const Hurricane::Net::Type::Code*>
( const Hurricane::Net::Type::Code* object )
{
Hurricane::Record* record = new Hurricane::Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
// -------------------------------------------------------------------
// Inspector Support for : "const Net::Direction::Code*".
template<>
inline std::string getString<const Hurricane::Net::Direction::Code*>
( const Hurricane::Net::Direction::Code* object )
{
switch ( *object ) {
case Hurricane::Net::Direction::UNDEFINED: return "UNDEFINED";
case Hurricane::Net::Direction::IN: return "IN";
case Hurricane::Net::Direction::OUT: return "OUT";
case Hurricane::Net::Direction::INOUT: return "INOUT";
case Hurricane::Net::Direction::TRISTATE: return "TRISTATE";
}
return "ABNORMAL";
}
template<>
inline Hurricane::Record* getRecord<const Hurricane::Net::Direction::Code*>
( const Hurricane::Net::Direction::Code* object )
{
Hurricane::Record* record = new Hurricane::Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
INSPECTOR_P_SUPPORT(Hurricane::Net);
INSPECTOR_P_SUPPORT(Hurricane::Net::ComponentSet);
INSPECTOR_P_SUPPORT(Hurricane::Net::RubberSet);
INSPECTOR_P_SUPPORT(Hurricane::Net::Type);
INSPECTOR_P_SUPPORT(Hurricane::Net::Direction);
#endif // HURRICANE_NET

View File

@ -92,7 +92,7 @@ class Occurrence {
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Occurrence)
INSPECTOR_PV_SUPPORT(Hurricane::Occurrence);
#endif // HURRICANE_OCCURENCE

View File

@ -69,7 +69,8 @@ class Pad : public Component {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Pad)
INSPECTOR_P_SUPPORT(Hurricane::Pad);
#endif // HURRICANE_PAD

View File

@ -97,7 +97,7 @@ class Path {
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Path)
INSPECTOR_PV_SUPPORT(Hurricane::Path);
#endif // HURRICANE_PATH

View File

@ -146,6 +146,4 @@ class Pin : public Contact {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Pin)
#endif // HURRICANE_PIN

View File

@ -104,7 +104,8 @@ class Plug : public Component {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Plug)
INSPECTOR_P_SUPPORT(Hurricane::Plug);
#endif // HURRICANE_PLUG

View File

@ -78,7 +78,7 @@ class Point {
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Point)
INSPECTOR_PV_SUPPORT(Hurricane::Point);
#endif // HURRICANE_POINT

View File

@ -20,8 +20,8 @@ namespace Hurricane {
// Property declaration
// ****************************************************************************************************
class Property : public NestedSlotAdapter {
// **************************************
class Property {
// *************
// Constructors
// ************
@ -352,22 +352,12 @@ template<class Value> class StandardSharedProperty : public SharedProperty {
};
template<typename T>
class IsNestedSlotAdapter<StandardPrivateProperty<T> > {
public:
enum { True=1, False=0 };
};
template<typename T>
class IsNestedSlotAdapter<StandardSharedProperty<T> > {
public:
enum { True=1, False=0 };
};
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Property);
#endif // HURRICANE_PROPERTY
// ****************************************************************************************************

View File

@ -111,6 +111,11 @@ class QuadTree {
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::QuadTree);
INSPECTOR_P_SUPPORT(Hurricane::QuadTree::GoSet);
#endif // HURRICANE_QUAD_TREE
// ****************************************************************************************************

View File

@ -64,7 +64,8 @@ class Quark : public DBo {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Quark)
INSPECTOR_P_SUPPORT(Hurricane::Quark);
#endif // HURRICANE_QUARK

View File

@ -26,8 +26,8 @@
#ifndef __RECORD__
#define __RECORD__
#ifndef __HURRICANE_RECORD__
#define __HURRICANE_RECORD__
#ifndef __HURRICANE_COMMONS__
@ -38,57 +38,45 @@
namespace Hurricane {
// -------------------------------------------------------------------
// Forward Declarations.
class Slot;
// -------------------------------------------------------------------
// Class : "Record".
class Record {
// Types.
public:
// Types.
typedef list<Slot*> SlotList;
// Attributes
public:
// Constructor & Destructor.
Record ( const string& name );
virtual ~Record ();
// Methods.
static size_t getAllocateds ();
inline const string& getName () const;
Slot* getSlot ( unsigned no ) const;
void add ( Slot* slot );
inline SlotList& _getSlotList ();
private:
// Internal: Static Attributes.
static size_t _allocateds;
// Internal: Attributes
string _name;
SlotList _slotList;
// Constructors
public:
Record ( const string& name );
private:
// Forbidden: Constructors
Record ( const Record& record );
Record& operator= ( const Record& record );
// Destructor
public:
virtual ~Record();
// Accessors
public:
const string& getName () const { return _name; };
Slot* getSlot ( unsigned no ) const;
// Updators
public:
void add ( Slot* slot );
// Others
public:
string _getTypeName () const { return _TName("Record"); };
string _getString () const;
SlotList& _getSlotList () { return _slotList; };
};
// Inline Functions.
inline const string& Record::getName () const { return _name; }
inline Record::SlotList& Record::_getSlotList () { return _slotList; }
} // End of Hurricane namespace.

View File

@ -110,7 +110,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::RegularLayer)
# endif

View File

@ -101,9 +101,6 @@ class StandardRelation : public Relation {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Relation)
SetNestedSlotAdapter(Hurricane::StandardRelation)
#endif // HURRICANE_RELATION
// ****************************************************************************************************

View File

@ -96,7 +96,8 @@ class Rubber : public Go {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Rubber)
INSPECTOR_P_SUPPORT(Hurricane::Rubber);
#endif // HURRICANE_RUBBER

View File

@ -123,9 +123,10 @@ class Segment : public Component {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Segment)
SetNestedSlotAdapter(Hurricane::Segment::SourceHook)
SetNestedSlotAdapter(Hurricane::Segment::TargetHook)
INSPECTOR_P_SUPPORT(Hurricane::Segment);
INSPECTOR_P_SUPPORT(Hurricane::Segment::SourceHook);
INSPECTOR_P_SUPPORT(Hurricane::Segment::TargetHook);
#endif // HURRICANE_SEGMENT

View File

@ -10,8 +10,6 @@
#include "hurricane/Commons.h"
#include "hurricane/Tabulation.h"
#include "hurricane/Record.h"
#include "hurricane/Slot.h"
namespace Hurricane {

View File

@ -84,6 +84,9 @@ class SharedName {
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::SharedName);
#endif // HURRICANE_SHARED_NAME
// ****************************************************************************************************

View File

@ -112,6 +112,9 @@ class SharedPath {
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::SharedPath);
#endif // HURRICANE_SHARED_PATH

View File

@ -90,6 +90,10 @@ class Slice {
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Slice);
#endif // HURRICANE_SLICE
// ****************************************************************************************************

View File

@ -6,7 +6,7 @@
//
// ===================================================================
//
// $Id: Slot.h,v 1.9 2007/07/29 15:25:00 jpc Exp $
// $Id$
//
// x-----------------------------------------------------------------x
// | |
@ -42,109 +42,200 @@ namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Slot".
class Slot : public NestedSlotAdapter {
// Attributes
class Slot {
public:
// Destructor.
virtual ~Slot ();
// Accessors.
static size_t getAllocateds ();
const string& getName () const;
virtual string getDataString () const = 0;
virtual Record* getDataRecord () const = 0;
virtual Slot* getClone () const = 0;
protected:
// Internal: Static Attributes.
static size_t _allocateds;
// Internal: Attributes.
const string _name;
const SlotAdapter* _data;
// Constructors
protected:
Slot ( const string& name, const SlotAdapter* data ) : _name(name), _data(data) {};
private:
Slot ( const Slot& slot ); // Not implemented to forbid copy.
// Internal: Constructors & Destructors.
Slot ( const string& name );
};
// Destructor
public:
virtual ~Slot () {};
// Operators
private:
Slot& operator= ( const Slot& slot ); // Not implemented to forbid assignment.
// Accessors
public:
const string& getName () const { return _name; };
virtual string getDataString () const { return _data->_getString(); };
virtual Record* getDataRecord () const { return _data->_getRecord(); };
// Inspector Managment.
public:
virtual string _getString () const
// Inline Member Functions.
inline Slot::Slot ( const string& name ) : _name(name)
{
return "<" + _getTypeName()
+ " " + getName() + " "
+ _data->_getString() + ">";
};
};
_allocateds++;
//cerr << "Slot::Slot() - " << _name << " " << hex << (void*)this << endl;
}
inline const string& Slot::getName () const { return _name; }
// -------------------------------------------------------------------
// Class : "PointerSlot".
//
// The SlotAdapter is not duplicated, it is for objects in which
// it's directly integrated (inheritance). This is used for Hurricane
// objects with virtual functions.
//
// This is default behavior of Slot, so PointerSlot doesn't change
// it, but it's more clear for developpers.
// Class : "SlotTemplate".
class PointerSlot : public Slot {
template<typename Data>
class SlotTemplate : public Slot {
// Constructors
public:
PointerSlot ( const string& name, const SlotAdapter* data ) : Slot(name,data) {};
// Constructor.
SlotTemplate ( const string& name, const Data data );
SlotTemplate ( string& name, const Data data );
// Accessors.
virtual string getDataString () const;
virtual Record* getDataRecord () const;
virtual SlotTemplate<Data>*
getClone () const;
// Destructor.
public:
virtual ~PointerSlot () {};
// Accessors
public:
virtual string _getTypeName () const { return _TName("PointerSlot"); };
protected:
// Internal: Attributes.
const Data _data;
private:
// Internal: Constructors.
SlotTemplate ( const SlotTemplate& );
SlotTemplate& operator= ( const SlotTemplate& );
};
// Inline Member Functions.
template<typename Data>
SlotTemplate<Data>::SlotTemplate ( const string& name, const Data data )
: Slot(name), _data(data) { }
template<typename Data>
SlotTemplate<Data>::SlotTemplate ( string& name, const Data data )
: Slot(name), _data(data) { }
template<typename Data>
string SlotTemplate<Data>::getDataString () const { return getString(_data); }
template<typename Data>
Record* SlotTemplate<Data>::getDataRecord () const { return getRecord(_data); }
template<typename Data>
SlotTemplate<Data>* SlotTemplate<Data>::getClone () const
{ return new SlotTemplate(_name,_data); }
// -------------------------------------------------------------------
// Class : "ValueSlot".
//
// The SlotAdapter is duplicated. It's for objects coming from
// external libraries or that do not have virtual functions (like
// Points or Boxes).
// Class : "SlotTemplate".
class ValueSlot : public Slot {
// Constructors
template<typename Data>
class SlotTemplate<Data*> : public Slot {
public:
ValueSlot (const string& name, const SlotAdapter* data ) : Slot(name,data) {};
// Constructor.
SlotTemplate ( const string& name, Data* data );
SlotTemplate ( string& name, Data* data );
// Accessors.
virtual string getDataString () const;
virtual Record* getDataRecord () const;
virtual SlotTemplate<Data*>*
getClone () const;
// Destructor.
public:
virtual ~ValueSlot () { delete _data; };
// Accessors
public:
virtual string _getTypeName () const { return _TName("ValueSlot"); };
protected:
// Internal: Attributes.
Data* _data;
private:
// Internal: Constructors.
SlotTemplate ( const SlotTemplate& );
SlotTemplate& operator= ( const SlotTemplate& );
};
// Inline Member Functions.
template<typename Data>
SlotTemplate<Data*>::SlotTemplate ( const string& name, Data* data )
: Slot(name), _data(data) {}
template<typename Data>
SlotTemplate<Data*>::SlotTemplate ( string& name, Data* data )
: Slot(name), _data(data) {}
template<typename Data>
string SlotTemplate<Data*>::getDataString () const { return getString(_data); }
template<typename Data>
Record* SlotTemplate<Data*>::getDataRecord () const { return getRecord(_data); }
template<typename Data>
SlotTemplate<Data*>* SlotTemplate<Data*>::getClone () const
{ return new SlotTemplate(_name,_data); }
// -------------------------------------------------------------------
// Class : "SlotTemplate".
template<>
class SlotTemplate<Record*> : public Slot {
public:
// Constructor.
inline SlotTemplate ( const string& name, Record* data );
inline SlotTemplate ( string& name, Record* data );
// Accessors.
inline virtual string getDataString () const;
inline virtual Record* getDataRecord () const;
inline virtual SlotTemplate<Record*>*
getClone () const;
protected:
// Internal: Attributes.
Record* _data;
private:
// Internal: Constructors.
SlotTemplate ( const SlotTemplate& );
SlotTemplate& operator= ( const SlotTemplate& );
};
// Inline Member Functions.
inline SlotTemplate<Record*>::SlotTemplate ( const string& name, Record* data )
: Slot(name), _data(data) {}
inline SlotTemplate<Record*>::SlotTemplate ( string& name, Record* data )
: Slot(name), _data(data) {}
inline string SlotTemplate<Record*>::getDataString () const { return _name; }
inline Record* SlotTemplate<Record*>::getDataRecord () const { return _data; }
inline SlotTemplate<Record*>* SlotTemplate<Record*>::getClone () const
{ return new SlotTemplate<Record*>(_name,_data); }
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Slot)
SetNestedSlotAdapter(Hurricane::PointerSlot)
SetNestedSlotAdapter(Hurricane::ValueSlot)
template<typename Data>
inline Hurricane::Slot* getSlot( std::string& name, Data d )
{
return new Hurricane::SlotTemplate<Data> ( name, d );
}
template<typename Data>
inline Hurricane::Slot* getSlot( const std::string& name, Data d )
{
return new Hurricane::SlotTemplate<Data> ( name, d );
}
template<typename Data>
inline Hurricane::Slot* getSlot( const std::string& name, Data* d )
{
return new Hurricane::SlotTemplate<Data*> ( name, d );
}
#endif

View File

@ -70,443 +70,7 @@ namespace Hurricane {
using namespace std;
// -------------------------------------------------------------------
// Template Functions : "Proxy...()".
template<typename Type>
inline string ProxyTypeName ( const Type* object ) { return object->_getTypeName(); }
template<typename Type>
inline string ProxyString ( const Type* object ) { return object->_getString(); }
template<typename Type>
inline Record* ProxyRecord ( const Type* object ) { return object->_getRecord(); }
// -------------------------------------------------------------------
// SlotAdapter Type Identification by Template.
template<typename T>
class IsNestedSlotAdapter {
public:
enum { True=0, False=1 };
};
template<typename T>
class IsNestedSlotAdapter<const T> {
public:
enum { True=0, False=1 };
};
// -------------------------------------------------------------------
// Class : "SlotAdapter".
class SlotAdapter {
// Destructor.
public:
virtual ~SlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const = 0;
virtual string _getString () const { return "SlotAdapter::_getString()"; };
virtual Record* _getRecord () const { return NULL; };
inline virtual Slot* _getSlot ( const string& name ) const;
};
// -------------------------------------------------------------------
// Class : "NestedSlotAdapter".
class NestedSlotAdapter : public SlotAdapter {
// Destructor.
public:
virtual ~NestedSlotAdapter () {};
// Slot Management.
public:
inline virtual Slot* _getSlot ( const string& name ) const;
};
# define SetNestedSlotAdapter(T) \
namespace Hurricane { \
template<> \
class IsNestedSlotAdapter<const T> { \
protected: \
const T* t; \
public: \
const NestedSlotAdapter* _checkInheritance () const \
{ return static_cast<const NestedSlotAdapter*>(t); } \
public: \
enum { True=1, False=0 }; \
}; \
}
// -------------------------------------------------------------------
// Templates Class : "PointerSlotAdapter<Type>".
template<typename Type>
class PointerSlotAdapter : public SlotAdapter {
// Attributes.
protected:
Type* _object;
// Constructors.
public:
PointerSlotAdapter ( Type* o ) : SlotAdapter(), _object(o) {};
// Destructor.
public:
virtual ~PointerSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return ProxyTypeName(_object); };
virtual string _getString () const { return ProxyString (_object); };
virtual Record* _getRecord () const { return ProxyRecord (_object); };
};
// -------------------------------------------------------------------
// Templates Class : "ValueSlotAdapter<Type>".
template<typename Type>
class ValueSlotAdapter : public SlotAdapter {
// Attributes.
protected:
Type _object;
// Constructors.
public:
ValueSlotAdapter ( Type o ) : SlotAdapter(), _object(o) {};
// Destructor.
public:
virtual ~ValueSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return ProxyTypeName(&_object); };
virtual string _getString () const { return ProxyString (&_object); };
virtual Record* _getRecord () const { return ProxyRecord (&_object); };
};
// -------------------------------------------------------------------
// Class : "Proxy...<const string*>".
template<>
inline string ProxyTypeName<string> ( const string* object ) { return "<PointerSlotAdapter<string>>"; }
template<>
inline string ProxyString<string> ( const string* object ) { return *object; }
template<>
inline Record* ProxyRecord<string> ( const string* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "PointerSlotAdapter<const char*>".
template<>
inline string ProxyTypeName<char> ( const char* object ) { return "<PointerSlotAdapter<char*>>"; }
template<>
inline string ProxyString<char> ( const char* object ) { return object; }
template<>
inline Record* ProxyRecord<char> ( const char* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "ValueSlotAdapter<const char>".
template<>
class ValueSlotAdapter<const char> : public SlotAdapter {
// Attributes.
protected:
const char _c;
// Constructor.
public:
ValueSlotAdapter ( const char c ) : _c(c) {};
// Destructor.
public:
virtual ~ValueSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<ValueSlotAdapter<const char>>"; };
virtual string _getString () const { return string(1,_c); };
};
// -------------------------------------------------------------------
// Class : "ValueSlotAdapter<char>".
template<>
class ValueSlotAdapter<char> : public SlotAdapter {
// Attributes.
protected:
const char _c;
// Constructor.
public:
ValueSlotAdapter ( const char c ) : _c(c) {};
// Destructor.
public:
virtual ~ValueSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<ValueSlotAdapter<const char>>"; };
virtual string _getString () const { return string(1,_c); };
};
// -------------------------------------------------------------------
// Class : "Proxy...<const bool*>".
template<>
inline string ProxyTypeName<bool> ( const bool* object ) { return "<PointerSlotAdapter<bool>>"; }
template<>
inline string ProxyString<bool> ( const bool* object ) { return (*object)?"True":"False" ; }
template<>
inline Record* ProxyRecord<bool> ( const bool* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const void*>".
template<>
inline string ProxyTypeName<void> ( const void* object ) { return "<PointerSlotAdapter<void>>"; }
template<>
inline string ProxyString<void> ( const void* object )
{
static ostringstream os;
os.str ( "0x" );
os << hex << object;
return os.str();
}
template<>
inline Record* ProxyRecord<void> ( const void* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const int*>".
template<>
inline string ProxyTypeName<int> ( const int* object ) { return "<PointerSlotAdapter<int>>"; }
template<>
inline string ProxyString<int> ( const int* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<int> ( const int* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const long*>".
template<>
inline string ProxyTypeName<long> ( const long* object ) { return "<PointerSlotAdapter<long>>"; }
template<>
inline string ProxyString<long> ( const long* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<long> ( const long* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const unsigned int*>".
template<>
inline string ProxyTypeName<unsigned int> ( const unsigned int* object ) { return "<PointerSlotAdapter<unsigned int>>"; }
template<>
inline string ProxyString<unsigned int> ( const unsigned int* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<unsigned int> ( const unsigned int* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const unsigned long*>".
template<>
inline string ProxyTypeName<unsigned long> ( const unsigned long* object ) { return "<PointerSlotAdapter<unsigned long>>"; }
template<>
inline string ProxyString<unsigned long> ( const unsigned long* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<unsigned long> ( const unsigned long* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const unsigned long long*>".
template<>
inline string ProxyTypeName<unsigned long long> ( const unsigned long long* object ) { return "<PointerSlotAdapter<unsigned long long>>"; }
template<>
inline string ProxyString<unsigned long long> ( const unsigned long long* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<unsigned long long> ( const unsigned long long* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const unsigned short int*>".
template<>
inline string ProxyTypeName<unsigned short int> ( const unsigned short int* object ) { return "<PointerSlotAdapter<unsigned long long>>"; }
template<>
inline string ProxyString<unsigned short int> ( const unsigned short int* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<unsigned short int> ( const unsigned short int* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const float*>".
template<>
inline string ProxyTypeName<float> ( const float* object ) { return "<PointerSlotAdapter<float>>"; }
template<>
inline string ProxyString<float> ( const float* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<float> ( const float* object ) { return NULL; }
// -------------------------------------------------------------------
// Class : "Proxy...<const double*>".
template<>
inline string ProxyTypeName<double> ( const double* object ) { return "<PointerSlotAdapter<double>>"; }
template<>
inline string ProxyString<double> ( const double* object )
{
static ostringstream os;
os.str ( "" );
os << *object;
return os.str();
}
template<>
inline Record* ProxyRecord<double> ( const double* object ) { return NULL; }
class Record;
} // End of Hurricane namespace.
@ -522,150 +86,101 @@ template<>
// Note 2: thoses templates manage all types.
template<typename T>
inline Hurricane::Record* getRecord ( T* t ) {
if ( !t ) return NULL;
if ( Hurricane::IsNestedSlotAdapter<T>::True )
return ((const Hurricane::SlotAdapter*)((const void*)t))->_getRecord();
template<typename Data> inline std::string getString ( Data* data ) { return "getString() - Unsupported data"; }
template<typename Data> inline std::string getString ( Data& data ) { return "getString() - Unsupported data"; }
template<typename Data> inline Hurricane::Record* getRecord ( Data* data ) { return NULL; }
template<typename Data> inline Hurricane::Record* getRecord ( Data& data ) { return NULL; }
return Hurricane::PointerSlotAdapter<T>(t)._getRecord();
}
template<> inline std::string getString<const std::string*> ( const std::string* s ) { return *s; }
template<> inline std::string getString<const char*> ( const char* c ) { return c; }
template<> inline std::string getString<const char> ( const char c) { return std::string(1,c); }
template<> inline std::string getString<char> ( const char c) { return std::string(1,c); }
template<> inline std::string getString<const bool*> ( const bool* b ) { return (*b)?"True":"False" ; }
template<> inline std::string getString<const void*> ( const void* p )
{ ostringstream os ("0x"); return (os << hex << p).str(); }
template<> inline std::string getString<const int*> ( const int* i )
{ ostringstream os (""); return (os << *i).str(); }
template<> inline std::string getString<const long*> ( const long* l )
{ ostringstream os (""); return (os << *l).str(); }
template<> inline std::string getString<const unsigned int*> ( const unsigned int* u )
{ ostringstream os (""); return (os << *u).str(); }
template<> inline std::string getString<const unsigned long*> ( const unsigned long* ul )
{ ostringstream os (""); return (os << *ul).str() }
template<> inline std::string ProxyString<const unsigned long long*> ( const unsigned long long* ull )
{ ostringstream os (""); return (os << *ull).str(); }
template<> inline std::string getString<unsigned short int*> ( const unsigned short int* us )
{ ostringstream os (""); return (os << *us).str(); }
template<> inline std::string getString<const float*> ( const float* f )
{ ostringstream os (""); return (os << *f).str(); }
template<> inline std::string getString<const double* d> ( const double* d )
{ ostringstream os; return (os << *d).str(); }
template<typename T>
inline Hurricane::Record* getRecord ( T t ) {
if ( Hurricane::IsNestedSlotAdapter<T>::True )
return ((const Hurricane::SlotAdapter*)((const void*)&t))->_getRecord();
return Hurricane::ValueSlotAdapter<T>(t)._getRecord();
}
template<typename T>
inline string getString ( T* t ) {
if ( !t ) return "NULL";
if ( Hurricane::IsNestedSlotAdapter<T>::True )
return ((const Hurricane::SlotAdapter*)((const void*)t))->_getString();
return Hurricane::PointerSlotAdapter<T>(t)._getString();
}
template<typename T>
inline string getString ( T t )
template<typename Data>
inline Hurricane::Slot* getSlot ( const std::string& name, const Data* d )
{
if ( Hurricane::IsNestedSlotAdapter<T>::True )
return ((const Hurricane::SlotAdapter*)((void*)&t))->_getString();
if ( !d ) return getSlot ( name, "NULL pointer" );
return Hurricane::ValueSlotAdapter<T>(t)._getString();
return new PointerSlot<Data> ( name, d );
}
template<typename Data>
inline Hurricane::Slot* getSlot( const std::string& name, const Data d )
{
return new Hurricane::ValueSlot<Data> ( name, d );
}
template<typename T>
inline Hurricane::Slot* getSlot(const string& name, T* t ) {
if ( !t ) return getSlot ( name, "NULL pointer" );
if ( Hurricane::IsNestedSlotAdapter<T>::True )
return ((const Hurricane::SlotAdapter*)((const void*)t))->_getSlot(name);
template<typename Data>
inline ostream& operator<< ( ostream& o, const Data* d )
{
if (!d) return o << "NULL";
return (new Hurricane::PointerSlotAdapter<T>(t))->_getSlot(name);
return o << "&" << getString(d);
}
template<typename T>
inline Hurricane::Slot* getSlot( const string& name, T t ) {
if ( Hurricane::IsNestedSlotAdapter<T>::True )
return ((const Hurricane::SlotAdapter*)((const void*)&t))->_getSlot(name);
return (new Hurricane::ValueSlotAdapter<T>(t))->_getSlot(name);
template<typename Data>
inline ostream& operator<< ( ostream& o, const Data d )
{
return o << "&" << getString(d);
}
# define PointerIOStreamSupport(Type) \
inline ostream& operator<< ( ostream& stream, const Type* t ) \
{ \
if ( !t ) return stream << "NULL"; \
if ( Hurricane::IsNestedSlotAdapter<Type>::True ) \
return stream << "&" << ((const Hurricane::SlotAdapter*)((const void*)t))->_getString(); \
\
return stream << "&" << Hurricane::PointerSlotAdapter<const Type>(t)._getString(); \
}
# define ValueIOStreamSupport(Type) \
inline ostream& operator<< ( ostream& stream, const Type& t ) \
{ \
if ( Hurricane::IsNestedSlotAdapter<Type>::True ) \
return stream << ((const Hurricane::SlotAdapter*)((const void*)&t))->_getString(); \
\
return stream << Hurricane::ValueSlotAdapter<const Type>(t)._getString(); \
}
# include "hurricane/Record.h"
# include "hurricane/Slot.h"
namespace Hurricane {
inline Slot* SlotAdapter::_getSlot ( const string& name ) const {
return new ValueSlot(name,this);
};
inline Slot* NestedSlotAdapter::_getSlot ( const string& name ) const {
return new PointerSlot(name,this);
};
// Re-Entering Hurricane namespace, but now we can make use of
// getString(), getRecord() & getSlot() for containers templates.
// -------------------------------------------------------------------
// Class : "PointerSlotAdapter<const vector<Element>>".
template<typename Element>
class PointerSlotAdapter<const vector<Element> > : public SlotAdapter {
// Attributes.
protected:
const vector<Element>* _v;
// Constructor.
public:
PointerSlotAdapter ( const vector<Element>* v ) : SlotAdapter(), _v(v) {};
// Destructor.
public:
virtual ~PointerSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<PointerSlotAdapter<const vector<Element>>"; };
virtual string _getString () const;
virtual Record* _getRecord () const;
};
// Inspector Support for : "const vector<Element>*".
template<typename Element>
inline string PointerSlotAdapter<const vector<Element> >::_getString () const {
string name = "vector<Element>:";
return name + getString(_v->size());
inline std::string getString<const vector<Element>*>( const vector<Element>* v )
{
std::string name = "vector<Element>:";
return name + getString(v->size());
}
template<typename Element>
inline Record* PointerSlotAdapter<const vector<Element> >::_getRecord () const {
Record* record = NULL;
if ( !_v->empty() ) {
record = new Record ( "vector<Element>" );
inline Hurricane::Record* getRecord<const vector<Element>*>( const vector<Element>* v )
{
Hurricane::Record* record = NULL;
if ( !v->empty() ) {
record = new Hurricane::Record ( "vector<Element>" );
unsigned n = 1;
typename vector<Element>::const_iterator iterator = _v->begin();
while ( iterator != _v->end() ) {
typename vector<Element>::const_iterator iterator = v->begin();
while ( iterator != v->end() ) {
record->add ( getSlot(getString(n++), *iterator) );
++iterator;
}
@ -674,51 +189,27 @@ template<typename Element>
}
// -------------------------------------------------------------------
// Class : "PointerSlotAdapter<const list<Element>>".
template<typename Element>
class PointerSlotAdapter<const list<Element> > : public SlotAdapter {
// Attributes.
protected:
const list<Element>* _l;
// Constructor.
public:
PointerSlotAdapter ( const list<Element>* l ) : SlotAdapter(), _l(l) {};
// Destructor.
public:
virtual ~PointerSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<PointerSlotAdapter<const list<Element>>"; };
virtual string _getString () const;
virtual Record* _getRecord () const;
};
// Inspector Support for : "const list<Element>*".
template<typename Element>
inline string PointerSlotAdapter<const list<Element> >::_getString () const
inline std::string getString<const list<Element>*>( const list<Element>* l )
{
string name = "list<Element>:";
return name + getString(_l->size());
std::string name = "list<Element>:";
return name + getString(l->size());
}
template<typename Element>
inline Record* PointerSlotAdapter<const list<Element> >::_getRecord () const
inline Hurricane::Record* getRecord<const list<Element>*>( const list<Element>* l )
{
Record* record = NULL;
if ( !_l->empty() ) {
record = new Record ( "list<Element>" );
Hurricane::Record* record = NULL;
if ( !l->empty() ) {
record = new Hurricane::Record ( "list<Element>" );
unsigned n = 1;
typename list<Element>::const_iterator iterator = _l->begin();
while ( iterator != _l->end() ) {
typename list<Element>::const_iterator iterator = l->begin();
while ( iterator != l->end() ) {
record->add ( getSlot(getString(n++), *iterator) );
++iterator;
}
@ -727,48 +218,26 @@ template<typename Element>
}
// -------------------------------------------------------------------
// Class : "PointerSlotAdapter<const map<Element>>.
template<typename Key, typename Element, typename Compare>
class PointerSlotAdapter<const map<Key,Element,Compare> > : public SlotAdapter {
// Attributes.
protected:
const map<Key,Element,Compare>* _m;
// Constructor.
public:
PointerSlotAdapter ( const map<Key,Element,Compare>* m ) : _m(m) {};
// Destructor.
public:
virtual ~PointerSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<PointerSlotAdapter<const map<Element>>"; };
virtual string _getString () const;
virtual Record* _getRecord () const;
};
// Inspector Support for : "const map<Key,Element,Compare>*.
template<typename Key, typename Element, typename Compare>
inline string PointerSlotAdapter<const map<Key,Element,Compare> >::_getString () const {
string name = "map<Element>:";
return name + getString(_m->size());
inline std::string getString<const map<Key,Element,Compare>*>( const map<Key,Element,Compare>* m )
{
std::string name = "map<Element>:";
return name + getString(m->size());
}
template<typename Key, typename Element, typename Compare>
inline Record* PointerSlotAdapter<const map <Key,Element,Compare> >::_getRecord () const {
Record* record = NULL;
if ( !_m->empty() ) {
record = new Record ( "map<Element>" );
typename map<Key,Element,Compare>::const_iterator iterator = _m->begin();
while ( iterator != _m->end() ) {
inline Hurricane::Record* getRecord<const map <Key,Element,Compare>*>( const map<Key,Element,Compare>* m )
{
Hurricane::Record* record = NULL;
if ( !m->empty() ) {
record = new Hurricane::Record ( "map<Element>" );
typename map<Key,Element,Compare>::const_iterator iterator = m->begin();
while ( iterator != m->end() ) {
record->add ( getSlot(getString(iterator->first), iterator->second) );
++iterator;
}
@ -777,49 +246,27 @@ template<typename Key, typename Element, typename Compare>
}
// -------------------------------------------------------------------
// Class : "SlotAdapterSet".
template<typename Element, typename Compare>
class PointerSlotAdapter<const set<Element,Compare> > : public SlotAdapter {
// Attributes.
protected:
const set<Element,Compare>* _s;
// Constructor.
public:
PointerSlotAdapter ( const set<Element,Compare>* m ) : _s(m) {};
// Destructor.
public:
virtual ~PointerSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<PointerSlotAdapter<const set<Element>>"; };
virtual string _getString () const;
virtual Record* _getRecord () const;
};
// Inspector Support for : "const set<Element,Compare>*".
template<typename Element, typename Compare>
inline string PointerSlotAdapter<const set<Element,Compare> >::_getString () const {
string name = "set<Element>:";
return name + getString(_s->size());
inline std::string getString<const set<Element,Compare>*>( const set<Element,Compare>* s )
{
std::string name = "set<Element>:";
return name + getString(s->size());
}
template<typename Element, typename Compare>
inline Record* PointerSlotAdapter<const set<Element,Compare> >::_getRecord () const {
Record* record = NULL;
if ( !_s->empty() ) {
record = new Record ( "set<Element>" );
inline Hurricane::Record* getRecord<const set<Element,Compare>*>( const set<Element,Compare>* s )
{
Hurricane::Record* record = NULL;
if ( !s->empty() ) {
record = new Hurricane::Record ( "set<Element>" );
unsigned n = 1;
typename set<Element,Compare>::const_iterator iterator = _s->begin();
while ( iterator != _s->end() ) {
typename set<Element,Compare>::const_iterator iterator = s->begin();
while ( iterator != s->end() ) {
record->add ( getSlot(getString(n++), *iterator) );
++iterator;
}
@ -828,49 +275,27 @@ template<typename Element, typename Compare>
}
// -------------------------------------------------------------------
// Class : "SlotAdapterSet".
template<typename Element, typename Compare>
class PointerSlotAdapter<set<Element,Compare> > : public SlotAdapter {
// Attributes.
protected:
set<Element,Compare>* _s;
// Constructor.
public:
PointerSlotAdapter ( set<Element,Compare>* m ) : _s(m) {};
// Destructor.
public:
virtual ~PointerSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<PointerSlotAdapter<const set<Element>>"; };
virtual string _getString () const;
virtual Record* _getRecord () const;
};
// Inspector Support for : "const multiset<Element,Compare>*".
template<typename Element, typename Compare>
inline string PointerSlotAdapter<set<Element,Compare> >::_getString () const {
string name = "set<Element>:";
return name + getString(_s->size());
inline std::string getString<const multiset<Element,Compare>*>( const multiset<Element,Compare>* s )
{
std::string name = "multiset<Element>:";
return name + getString(s->size());
}
template<typename Element, typename Compare>
inline Record* PointerSlotAdapter<set<Element,Compare> >::_getRecord () const {
Record* record = NULL;
if ( !_s->empty() ) {
record = new Record ( "set<Element>" );
inline Hurricane::Record* getRecord<const multiset<Element,Compare>*>( const multiset<Element,Compare>* s )
{
Hurricane::Record* record = NULL;
if ( !s->empty() ) {
record = new Hurricane::Record ( "multiset<Element>" );
unsigned n = 1;
typename set<Element,Compare>::const_iterator iterator = _s->begin();
while ( iterator != _s->end() ) {
typename multiset<Element,Compare>::const_iterator iterator = s->begin();
while ( iterator != s->end() ) {
record->add ( getSlot(getString(n++), *iterator) );
++iterator;
}
@ -879,62 +304,4 @@ template<typename Element, typename Compare>
}
// -------------------------------------------------------------------
// Class : "SlotAdapterMultiSet".
template<typename Element, typename Compare>
class PointerSlotAdapter<const multiset<Element,Compare> > : public SlotAdapter {
// Attributes.
protected:
const multiset<Element,Compare>* _s;
// Constructor.
public:
PointerSlotAdapter ( const multiset<Element,Compare>* m ) : _s(m) {};
// Destructor.
public:
virtual ~PointerSlotAdapter () {};
// Slot Management.
public:
virtual string _getTypeName () const { return "<PointerSlotAdapter<const multiset<Element>>"; };
virtual string _getString () const;
virtual Record* _getRecord () const;
};
template<typename Element, typename Compare>
inline string PointerSlotAdapter<const multiset<Element,Compare> >::_getString () const {
string name = "multiset<Element>:";
return name + getString(_s->size());
}
template<typename Element, typename Compare>
inline Record* PointerSlotAdapter<const multiset<Element,Compare> >::_getRecord () const {
Record* record = NULL;
if ( !_s->empty() ) {
record = new Record ( "multiset<Element>" );
unsigned n = 1;
typename multiset<Element,Compare>::const_iterator iterator = _s->begin();
while ( iterator != _s->end() ) {
record->add ( getSlot(getString(n++), *iterator) );
++iterator;
}
}
return record;
}
} // End of Hurricane namespace.
#endif

View File

@ -9,6 +9,10 @@
#include "hurricane/Commons.h"
#ifndef __HURRICANE_SLOT__
#error "Tabulation.h must be included after Commons.h"
#endif
namespace Hurricane {
@ -71,7 +75,8 @@ extern Tabulation tab;
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Tabulation)
INSPECTOR_PV_SUPPORT(Hurricane::Tabulation);
// ****************************************************************************************************

View File

@ -105,7 +105,8 @@ class Technology : public DBo {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Technology)
INSPECTOR_P_SUPPORT(Hurricane::Technology);
#endif // HURRICANE_TECHNOLOGY

View File

@ -51,7 +51,7 @@ class Timer {
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Timer)
INSPECTOR_PV_SUPPORT(Hurricane::Timer);
#endif // HURRICANE_TIMER

View File

@ -127,47 +127,70 @@ class Transformation {
} // End of Hurricane namespace.
// -------------------------------------------------------------------
// Class : "Proxy...<const Transformation::Orientation::Code*>".
// Inspector Support for : "Transformation::Orientation::Code*".
template<>
inline string ProxyTypeName<Transformation::Orientation::Code>
( const Transformation::Orientation::Code* object )
{ return "<PointerSlotAdapter<Transformation::Orientation::Code>>"; }
template<>
inline string ProxyString <Transformation::Orientation::Code>
( const Transformation::Orientation::Code* object )
inline std::string getString<const Hurricane::Transformation::Orientation::Code*>
( const Hurricane::Transformation::Orientation::Code* object )
{
switch ( *object ) {
case Transformation::Orientation::ID: return "ID";
case Transformation::Orientation::R1: return "R1";
case Transformation::Orientation::R2: return "R2";
case Transformation::Orientation::R3: return "R3";
case Transformation::Orientation::MX: return "MX";
case Transformation::Orientation::XR: return "XR";
case Transformation::Orientation::MY: return "MY";
case Transformation::Orientation::YR: return "YR";
case Hurricane::Transformation::Orientation::ID: return "ID";
case Hurricane::Transformation::Orientation::R1: return "R1";
case Hurricane::Transformation::Orientation::R2: return "R2";
case Hurricane::Transformation::Orientation::R3: return "R3";
case Hurricane::Transformation::Orientation::MX: return "MX";
case Hurricane::Transformation::Orientation::XR: return "XR";
case Hurricane::Transformation::Orientation::MY: return "MY";
case Hurricane::Transformation::Orientation::YR: return "YR";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Transformation::Orientation::Code>
( const Transformation::Orientation::Code* object )
inline Hurricane::Record* getRecord<const Hurricane::Transformation::Orientation::Code*>
( const Hurricane::Transformation::Orientation::Code* object )
{
Record* record = new Record(getString(object));
Hurricane::Record* record = new Hurricane::Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
template<>
inline std::string getString<Hurricane::Transformation::Orientation::Code*>
( Hurricane::Transformation::Orientation::Code* object )
{
std::cerr << "Orientation::_getString(): " << std::hex << (void*)&object << " " << (unsigned int)object << std::endl;
switch ( *object ) {
case Hurricane::Transformation::Orientation::ID: return "ID";
case Hurricane::Transformation::Orientation::R1: return "R1";
case Hurricane::Transformation::Orientation::R2: return "R2";
case Hurricane::Transformation::Orientation::R3: return "R3";
case Hurricane::Transformation::Orientation::MX: return "MX";
case Hurricane::Transformation::Orientation::XR: return "XR";
case Hurricane::Transformation::Orientation::MY: return "MY";
case Hurricane::Transformation::Orientation::YR: return "YR";
}
return "ABNORMAL";
}
template<>
inline Hurricane::Record* getRecord<Hurricane::Transformation::Orientation::Code*>
( Hurricane::Transformation::Orientation::Code* object )
{
std::cerr << "Orientation::_getRecord(): " << std::hex << (void*)&object << " " << (unsigned int)object << std::endl;
Hurricane::Record* record = new Hurricane::Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
} // End of Hurricane namespace.
ValueIOStreamSupport(Hurricane::Transformation)
INSPECTOR_PV_SUPPORT(Hurricane::Transformation);
INSPECTOR_PV_SUPPORT(Hurricane::Transformation::Orientation);
IOSTREAM_POINTER_SUPPORT(Hurricane::Transformation::Orientation::Code);
#endif // HURRICANE_TRANSFORMATION

View File

@ -112,7 +112,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::TransistorLayer)
# endif

View File

@ -79,8 +79,6 @@ class UpdateSession : public SharedProperty {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::UpdateSession)
#endif // HURRICANE_UPDATE_SESSION
// ****************************************************************************************************

View File

@ -102,7 +102,8 @@ class Vertical : public Segment {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Vertical)
INSPECTOR_P_SUPPORT(Hurricane::Vertical);
#endif // HURRICANE_VERTICAL

View File

@ -105,7 +105,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::ViaLayer)
# endif

View File

@ -61,8 +61,6 @@ class Warning : public Exception {
} // End of Hurricane namespace.
SetNestedSlotAdapter(Hurricane::Warning)
#endif // HURRICANE_WARNING
// ****************************************************************************************************

View File

@ -2,6 +2,7 @@
include ( ${QT_USE_FILE} )
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane
${HURRICANE_SOURCE_DIR}/src/hinspector
${HURRICANE_SOURCE_DIR}/src/hviewer
)

View File

@ -8,12 +8,14 @@
#include <QMenuBar>
#include <QDockWidget>
#include "hurricane/DataBase.h"
#include "hurricane/Cell.h"
//#include "MapView.h"
#include "hurricane/viewer/Palette.h"
#include "hurricane/viewer/CellWidget.h"
#include "hurricane/viewer/CellViewer.h"
#include "hurricane/inspector/HInspectorWidget.h"
namespace Hurricane {
@ -29,8 +31,11 @@ CellViewer::CellViewer ( Cell* cell ) : QMainWindow()
, _refreshAction(NULL)
, _fitToContentsAction(NULL)
, _showBoundariesAction(NULL)
, _runInspectorOnDataBase(NULL)
, _runInspectorOnCell(NULL)
, _fileMenu(NULL)
, _viewMenu(NULL)
, _toolsMenu(NULL)
//, _mapView(NULL)
, _palette(NULL)
, _cellWidget(NULL)
@ -79,6 +84,12 @@ void CellViewer::createActions ()
_showBoundariesAction = new QAction ( tr("&Boundaries"), this );
_showBoundariesAction->setCheckable ( true );
_showBoundariesAction->setStatusTip ( tr("Show/hide cell & instances abutment boxes") );
_runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this );
_runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") );
_runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this );
_runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") );
}
@ -99,7 +110,11 @@ void CellViewer::createMenus ()
_viewMenu = menuBar()->addMenu ( tr("View") );
_viewMenu->addAction ( _refreshAction );
_viewMenu->addAction ( _fitToContentsAction );
_viewMenu->addAction ( _showBoundariesAction );
//_viewMenu->addAction ( _showBoundariesAction );
_toolsMenu = menuBar()->addMenu ( tr("Tool") );
_toolsMenu->addAction ( _runInspectorOnDataBase );
_toolsMenu->addAction ( _runInspectorOnCell );
}
@ -133,12 +148,40 @@ void CellViewer::createLayout ( Cell* cell )
connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(redraw ()));
connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents ()));
connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase()));
connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell ()));
_showBoundariesAction->setChecked ( _cellWidget->showBoundaries() );
connect ( _showBoundariesAction, SIGNAL(toggled(bool)), _cellWidget, SLOT(setShowBoundaries(bool)) );
//_showBoundariesAction->setChecked ( _cellWidget->showBoundaries() );
//connect ( _showBoundariesAction, SIGNAL(toggled(bool)), _cellWidget, SLOT(setShowBoundaries(bool)) );
_cellWidget->redraw ();
}
void CellViewer::runInspector ( Record* record )
{
//cerr << "INITIAL Records: " << Record::getAllocateds() << endl;
//cerr << "INITIAL Slots: " << Slot::getAllocateds() << endl;
//cerr << "Inspector created." << endl;
if ( record ) {
HInspectorWidget* inspector = new HInspectorWidget ( record );
inspector->show ();
} else
cerr << "[ERROR] Attempt to run Inspector on NULL record." << endl;
}
void CellViewer::runInspectorOnDataBase ()
{
runInspector ( getRecord(DataBase::getDB()) );
}
void CellViewer::runInspectorOnCell ()
{
runInspector ( getRecord(_cellWidget->getCell()) );
}
} // End of Hurricane namespace.

View File

@ -48,13 +48,14 @@ namespace Hurricane {
}
const QFont Graphics::getFixedFont ( bool bold, bool underline )
const QFont Graphics::getFixedFont ( int weight, bool italic, bool underline )
{
const QFont defaultFont = QApplication::font ();
QFont fixedFont ( "Bitstream Vera Sans Mono", defaultFont.pointSize() );
if ( bold ) fixedFont.setBold ( true );
if ( underline ) fixedFont.setUnderline ( true );
fixedFont.setWeight ( weight );
fixedFont.setUnderline ( italic );
fixedFont.setUnderline ( underline );
return fixedFont;
}

View File

@ -44,7 +44,7 @@ namespace Hurricane {
_button = new QPushButton ( this );
_button->setFlat ( true );
_button->setText ( getString(getName()).c_str() );
_button->setFont ( Graphics::getFixedFont(true,true) );
_button->setFont ( Graphics::getFixedFont(QFont::Bold,false,true) );
layout->addWidget ( _button );
layout->addStretch ();
@ -139,9 +139,9 @@ namespace Hurricane {
}
if ( !_expanded )
_button->setFont ( Graphics::getFixedFont(true,true) );
_button->setFont ( Graphics::getFixedFont(QFont::Bold,false,true) );
else
_button->setFont ( Graphics::getFixedFont(true,false) );
_button->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
label.insert ( 0, spacingLeft, ' ' );
label.append ( spacingRight, ' ' );

View File

@ -36,7 +36,7 @@ namespace {
}
bool getPattern ( uchar bits[], const string& pattern )
bool getPattern ( uchar bits[], const std::string& pattern )
{
bool isValid = true;

View File

@ -31,6 +31,12 @@ namespace Hurricane {
class CellViewer : public QMainWindow {
Q_OBJECT;
public:
CellViewer ( Cell* cell );
public slots:
void runInspectorOnDataBase ();
void runInspectorOnCell ();
protected:
QAction* _openAction;
QAction* _nextCellAction;
@ -41,23 +47,23 @@ namespace Hurricane {
QAction* _refreshAction;
QAction* _fitToContentsAction;
QAction* _showBoundariesAction;
QAction* _runInspectorOnDataBase;
QAction* _runInspectorOnCell;
QMenu* _fileMenu;
QMenu* _viewMenu;
QMenu* _toolsMenu;
//MapView* _mapView;
Palette* _palette;
CellWidget* _cellWidget;
public:
CellViewer ( Cell* cell );
protected:
void createActions ();
void createMenus ();
void createLayout ( Cell* cell );
void runInspector ( Record* record );
};
} // End of Hurricane namespace.

View File

@ -30,7 +30,7 @@ namespace Hurricane {
public:
// Accessors.
static Graphics* getGraphics ();
static const QFont getFixedFont ( bool bold=false, bool underline=false );
static const QFont getFixedFont ( int weight=-1, bool italic=false, bool underline=false );
static const Name& getGroup ( const Name& key );
static const QColor& getColor ( const Name& key );
static const QPen& getPen ( const Name& key );

View File

@ -103,24 +103,24 @@ extern "C" {
// ---------------------------------------------------------------
// Module Method : "PyDbU_real ()"
// Module Method : "PyDbU_grid ()"
extern PyObject* PyDbU_real ( PyObject* module, PyObject* args )
extern PyObject* PyDbU_grid ( PyObject* module, PyObject* args )
{
trace << "PyDbU_real ()" << endl;
trace << "PyDbU_grid ()" << endl;
PyObject* arg0;
DbU::Unit result = 0;
HTRY
__cs.Init ( "DbU.real" );
if ( ! PyArg_ParseTuple(args,"|O&:DbU.real",Converter,&arg0) )
__cs.Init ( "DbU.grid" );
if ( ! PyArg_ParseTuple(args,"|O&:DbU.grid",Converter,&arg0) )
return ( NULL );
if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::real ( PyFloat_AsDouble ( arg0 ) ); }
if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::grid ( PyFloat_AsDouble ( arg0 ) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.real converter." );
PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.grid converter." );
return ( NULL );
}
@ -173,16 +173,16 @@ extern "C" {
// ---------------------------------------------------------------
// Module Method : "PyDbU_getReal ()"
// Module Method : "PyDbU_getGrid ()"
extern PyObject* PyDbU_getReal ( PyObject* module, PyObject* args )
extern PyObject* PyDbU_getGrid ( PyObject* module, PyObject* args )
{
trace << "PyDbU_getReal ()" << endl;
trace << "PyDbU_getGrid ()" << endl;
PyObject* arg0;
if ( ! ParseOneArg ( "Dbu.getReal", args,INT_ARG, &arg0 ) ) return ( NULL );
if ( ! ParseOneArg ( "Dbu.getGrid", args,INT_ARG, &arg0 ) ) return ( NULL );
return ( Py_BuildValue("d",DbU::getReal(PyInt_AsLong(arg0))) );
return ( Py_BuildValue("d",DbU::getGrid(PyInt_AsLong(arg0))) );
}

View File

@ -524,10 +524,10 @@ extern "C" {
static PyMethodDef PyHurricane_Methods[] =
{ { "DbU_db" , PyDbU_db , METH_VARARGS, "Convert an integer to DbU::Unit (no scale factor)." }
, { "DbU_real" , PyDbU_real , METH_VARARGS, "Convert a real (founder grid) to DbU::Unit." }
, { "DbU_grid" , PyDbU_grid , METH_VARARGS, "Convert a founder grid to DbU::Unit." }
, { "DbU_lambda" , PyDbU_lambda , METH_VARARGS, "Convert a symbolic (lambda) to DbU::Unit." }
, { "DbU_getDb" , PyDbU_getDb , METH_VARARGS, "Convert a DbU::Unit to an integer value (no scale factor)." }
, { "DbU_getReal" , PyDbU_getReal , METH_VARARGS, "Convert a DbU::Unit to a real value (to grid founder)." }
, { "DbU_getGrid" , PyDbU_getGrid , METH_VARARGS, "Convert a DbU::Unit to a to grid founder." }
, { "DbU_getLambda" , PyDbU_getLambda , METH_VARARGS, "Convert a DbU::Unit to a symbolic value (to lambda)." }
, { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Get the current DataBase." }
//, { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." }

View File

@ -132,8 +132,5 @@ using namespace Hurricane;
} // End of Isobar namespace.
SetNestedSlotAdapter(Isobar::ProxyProperty)
#endif

View File

@ -78,10 +78,10 @@ extern "C" {
// Functions & Types exported to "PyHurricane.ccp".
extern PyObject* PyDbU_db ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_real ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_grid ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_lambda ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getDb ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getReal ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getGrid ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getLambda ( PyObject* module, PyObject* args );
extern PyObject* PyDbU_getResolution ( PyObject* module );