diff --git a/hurricane/src/hinspector/CMakeLists.txt b/hurricane/src/hinspector/CMakeLists.txt index c2862ade..4d8cfaee 100644 --- a/hurricane/src/hinspector/CMakeLists.txt +++ b/hurricane/src/hinspector/CMakeLists.txt @@ -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 ) diff --git a/hurricane/src/hinspector/HInspectorWidget.cpp b/hurricane/src/hinspector/HInspectorWidget.cpp index 14b94afc..0b76ac73 100644 --- a/hurricane/src/hinspector/HInspectorWidget.cpp +++ b/hurricane/src/hinspector/HInspectorWidget.cpp @@ -1,135 +1,204 @@ + + +#include #include #include #include #include +#include #include #include #include #include +#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) { - //recordsHistoryComboBox = new QComboBox(this); + 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); - QGridLayout* inspectorLayout = new QGridLayout(); - //inspectorLayout->addWidget(recordsHistoryComboBox, 0, 0, 1, 2); - inspectorLayout->addWidget(slotsView, 1, 0, 1, 2); + QHeaderView* horizontalHeader = _slotsView->horizontalHeader (); + horizontalHeader->setStretchLastSection ( true ); + horizontalHeader->setMinimumSectionSize ( 200 ); - filterPatternLineEdit = new QLineEdit(this); - QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); - filterPatternLabel->setBuddy(filterPatternLineEdit); + QHeaderView* verticalHeader = _slotsView->verticalHeader (); + verticalHeader->setVisible ( false ); - inspectorLayout->addWidget(filterPatternLabel, 2, 0); - inspectorLayout->addWidget(filterPatternLineEdit, 2, 1); + Slot* rootSlot = getSlot ( "TopLevelSlot", _rootRecord ); + _slotsHistory.push_back ( rootSlot ); - QGroupBox* inspectorGroupBox = new QGroupBox(tr("Hurricane inspector"), this); - inspectorGroupBox->setLayout(inspectorLayout); + _recordModel = new RecordModel ( rootSlot->getClone(), this ); + _sortModel = new QSortFilterProxyModel ( this ); + _sortModel->setSourceModel ( _recordModel ); + _sortModel->setDynamicSortFilter ( true ); + _sortModel->setFilterKeyColumn ( 1 ); - QVBoxLayout* mainLayout = new QVBoxLayout; - mainLayout->addWidget(inspectorGroupBox); - setLayout(mainLayout); + _slotsView->setModel ( _sortModel ); + _slotsView->horizontalHeader()->setStretchLastSection ( true ); + _slotsView->resizeColumnToContents ( 0 ); - //connect(recordsHistoryComboBox, SIGNAL(currentIndexChanged(int)), - // this, SLOT(recordChanged(int))); + int rows = _sortModel->rowCount (); + for ( rows-- ; rows >= 0 ; rows-- ) + _slotsView->setRowHeight ( rows, _rowHeight ); - connect(filterPatternLineEdit, SIGNAL(textChanged(const QString &)), - this, SLOT(textFilterChanged())); + QGridLayout* inspectorLayout = new QGridLayout(); +//inspectorLayout->addWidget(recordsHistoryComboBox, 0, 0, 1, 2); + inspectorLayout->addWidget(_slotsView, 1, 0, 1, 2); - setWindowTitle(tr("Inspector")); - resize(1000, 500); + _filterPatternLineEdit = new QLineEdit(this); + QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); + filterPatternLabel->setBuddy(_filterPatternLineEdit); + + inspectorLayout->addWidget(filterPatternLabel, 2, 0); + inspectorLayout->addWidget(_filterPatternLineEdit, 2, 1); + +//QGroupBox* inspectorGroupBox = new QGroupBox(tr("Hurricane inspector"), this); +//inspectorGroupBox->setLayout(inspectorLayout); + +//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()) + ); + + setWindowTitle(tr("Inspector")); + resize(500, 300); } -void HInspectorWidget::setRecord(Record* record) { - filterProxyModelsHistory.clear(); - //recordsHistoryComboBox->clear(); - internalSetRecord(record); + +HInspectorWidget::~HInspectorWidget () +{ +//cerr << "HInspector::~HInspector() - " << hex << (void*)this << dec << endl; + clearHistory (); + +//cerr << "Records: " << Record::getAllocateds() << endl; +//cerr << "Slots: " << Slot::getAllocateds() << endl; } -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::setRootRecord ( Record* record ) +{ +//recordsHistoryComboBox->clear(); + clearHistory (); + + _rootRecord = record; + Slot* rootSlot = getSlot("TopLevelRecord",record); + + _slotsHistory.push_back ( rootSlot ); + _recordModel->setSlot ( rootSlot->getClone(), _slotsHistory.size() ); +} + + +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 (); + } +} + + +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(); + if ( index.isValid() ) { + Slot* slot = _recordModel->getRecord()->getSlot(_sortModel->mapToSource(index).row()); + + if ( slot ) + pushSlot ( slot ); } - slotsView->setModel(sortModel); - slotsView->resizeColumnsToContents(); - filterProxyModelsHistory.push_back(sortModel); - //recordsHistoryComboBox->addItem(QString(record->getName().c_str())); - //recordsHistoryComboBox->setCurrentIndex(recordsHistoryComboBox->count()-1); + } else if ( event->matches(QKeySequence::MoveToPreviousChar) ) { + popSlot (); + } else { + event->ignore(); + } } -void HInspectorWidget::keyPressEvent(QKeyEvent *event) { - if (event->matches(QKeySequence::MoveToNextChar)) { - QModelIndex index = slotsView->currentIndex(); - if (index.isValid()) { - QSortFilterProxyModel* sortModel = - static_cast(slotsView->model()); - QModelIndex modelIndex = sortModel->mapToSource(index); - RecordModel* recordModel = - static_cast(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); - } - } - } - } 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); - //} - } - } 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(slotsView->model()); - sortModel->setFilterRegExp(regExp); +void HInspectorWidget::textFilterChanged () +{ + _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); } diff --git a/hurricane/src/hinspector/RecordModel.cpp b/hurricane/src/hinspector/RecordModel.cpp index 052e29a8..45cf1257 100644 --- a/hurricane/src/hinspector/RecordModel.cpp +++ b/hurricane/src/hinspector/RecordModel.cpp @@ -1,34 +1,112 @@ -#include "hurricane/inspector/RecordModel.h" -RecordModel::RecordModel(Record* r, QObject* parent): - QAbstractTableModel(parent), - record(r) -{} +#include +#include -QVariant RecordModel::data(const QModelIndex &index, int role) const { - if (!index.isValid()) - return QVariant(); +#include "hurricane/Name.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/inspector/RecordModel.h" - if (role != Qt::DisplayRole) - return QVariant(); - unsigned 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()); - } +RecordModel::RecordModel ( Slot* slot, QObject* parent ) + : QAbstractTableModel(parent) + , _slot(slot) + , _record(slot->getDataRecord()) + , _depth(1) +{ } + + +RecordModel::~RecordModel () +{ +//cerr << "RecordModel::~RecordModel()" << endl; + + 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(slot->getName ().c_str()); + case 1: return QVariant(slot->getDataString().c_str()); + } } + } + return QVariant(); +} + + +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::rowCount(const QModelIndex &parent) const { - return record->_getSlotList().size(); + +int RecordModel::rowCount ( const QModelIndex& parent ) const +{ + return _record->_getSlotList().size(); } -int RecordModel::columnCount(const QModelIndex &parent) const { - return 2; + +int RecordModel::columnCount ( const QModelIndex& parent ) const +{ + return 2; } diff --git a/hurricane/src/hinspector/hurricane/inspector/HInspectorWidget.h b/hurricane/src/hinspector/hurricane/inspector/HInspectorWidget.h index fc69c4c0..5c5d737a 100644 --- a/hurricane/src/hinspector/hurricane/inspector/HInspectorWidget.h +++ b/hurricane/src/hinspector/hurricane/inspector/HInspectorWidget.h @@ -1,39 +1,53 @@ -#ifndef HINSPECTORWIDGET_H -#define HINSPECTORWIDGET_H -#include "hurricane/Commons.h" +#ifndef __HINSPECTOR_WIDGET_H__ +#define __HINSPECTOR_WIDGET_H__ + + +#include "hurricane/Commons.h" + using namespace Hurricane; -#include +#include + class QSortFilterProxyModel; class QTableView; class QLineEdit; class QComboBox; +class QHeaderView; + +class RecordModel; + class HInspectorWidget : public QWidget { - Q_OBJECT + Q_OBJECT; - public: - typedef map FilterProxyModels; - typedef vector FilterProxyModelsHistory; - HInspectorWidget(QWidget* parent=0); - void setRecord(Record* record); + public: + typedef vector SlotsVector; - private slots: - void recordChanged(size_t index); - void textFilterChanged(); + public: + HInspectorWidget ( Record* rootRecord, QWidget* parent=NULL ); + ~HInspectorWidget (); + void setRootRecord ( Record* record ); + private slots: + void textFilterChanged (); + protected: + void keyPressEvent ( QKeyEvent * event ); + private: + void clearHistory (); + void pushSlot ( Slot* slot ); + void popSlot (); + bool setSlot ( Slot* slot ); - protected: - void keyPressEvent(QKeyEvent * event); - - private: - void internalSetRecord(Record* record); - FilterProxyModels filterProxyModels; - FilterProxyModelsHistory filterProxyModelsHistory; - QComboBox* recordsHistoryComboBox; - QTableView* slotsView; - QLineEdit* filterPatternLineEdit; + private: + SlotsVector _slotsHistory; + RecordModel* _recordModel; + QSortFilterProxyModel* _sortModel; + QComboBox* _recordsHistoryComboBox; + QTableView* _slotsView; + QLineEdit* _filterPatternLineEdit; + int _rowHeight; + Record* _rootRecord; }; -#endif // HINSPECTORWIDGET_H +#endif // __HINSPECTOR_WIDGET_H__ diff --git a/hurricane/src/hinspector/hurricane/inspector/RecordModel.h b/hurricane/src/hinspector/hurricane/inspector/RecordModel.h index 7a5ec0ef..0186fa0e 100644 --- a/hurricane/src/hinspector/hurricane/inspector/RecordModel.h +++ b/hurricane/src/hinspector/hurricane/inspector/RecordModel.h @@ -1,22 +1,39 @@ -#ifndef RECORDMODEL_H -#define RECORDMODEL_H -#include +#ifndef __RECORD_MODEL_H__ +#define __RECORD_MODEL_H__ + +#include + +#include "hurricane/Commons.h" -#include "hurricane/Commons.h" using namespace Hurricane; -class RecordModel : public QAbstractTableModel { - Q_OBJECT - public: - RecordModel(Record* record, QObject* parent=0); - 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; } - private: - Record* record; + +class RecordModel : public QAbstractTableModel { + Q_OBJECT; + + public: + 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; + QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const; + inline Record* getRecord (); + inline Slot* getSlot (); + + private: + 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__ diff --git a/hurricane/src/hurricane/Box.cpp b/hurricane/src/hurricane/Box.cpp index 899382ca..7478b142 100644 --- a/hurricane/src/hurricane/Box.cpp +++ b/hurricane/src/hurricane/Box.cpp @@ -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))); diff --git a/hurricane/src/hurricane/CMakeLists.txt b/hurricane/src/hurricane/CMakeLists.txt index b1231c12..5adfb26b 100644 --- a/hurricane/src/hurricane/CMakeLists.txt +++ b/hurricane/src/hurricane/CMakeLists.txt @@ -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} ) diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 1b9918a2..64da9d7d 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -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)); diff --git a/hurricane/src/hurricane/Commons.cpp b/hurricane/src/hurricane/Commons.cpp index a34cf960..769fa32a 100644 --- a/hurricane/src/hurricane/Commons.cpp +++ b/hurricane/src/hurricane/Commons.cpp @@ -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 diff --git a/hurricane/src/hurricane/Component.cpp b/hurricane/src/hurricane/Component.cpp index 22651d09..46261cb1 100644 --- a/hurricane/src/hurricane/Component.cpp +++ b/hurricane/src/hurricane/Component.cpp @@ -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()); } diff --git a/hurricane/src/hurricane/Contact.cpp b/hurricane/src/hurricane/Contact.cpp index 451a6e78..393a24ea 100644 --- a/hurricane/src/hurricane/Contact.cpp +++ b/hurricane/src/hurricane/Contact.cpp @@ -10,6 +10,7 @@ #include "hurricane/BasicLayer.h" #include "hurricane/Plug.h" #include "hurricane/Error.h" +# include "hurricane/Slot.h" namespace Hurricane { diff --git a/hurricane/src/hurricane/DBo.cpp b/hurricane/src/hurricane/DBo.cpp index 7b1de69a..66eb7d55 100644 --- a/hurricane/src/hurricane/DBo.cpp +++ b/hurricane/src/hurricane/DBo.cpp @@ -145,11 +145,9 @@ string DBo::_getString() const Record* DBo::_getRecord() const // ********************** { - Record* record = new Record(getString(this)); - if (record) { - record->add(getSlot("Properties", &_propertySet)); - } - return record; + Record* record = new Record(getString(this)); + record->add(getSlot("Properties", &_propertySet)); + return record; } void DBo::_onDestroyed(Property* property) diff --git a/hurricane/src/hurricane/DataBase.cpp b/hurricane/src/hurricane/DataBase.cpp index 29d4238a..abbbadde 100644 --- a/hurricane/src/hurricane/DataBase.cpp +++ b/hurricane/src/hurricane/DataBase.cpp @@ -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; diff --git a/hurricane/src/hurricane/DbU.cpp b/hurricane/src/hurricane/DbU.cpp index 9b4bb80c..5d73f9e0 100644 --- a/hurricane/src/hurricane/DbU.cpp +++ b/hurricane/src/hurricane/DbU.cpp @@ -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. diff --git a/hurricane/src/hurricane/Instance.cpp b/hurricane/src/hurricane/Instance.cpp index a9e123ee..a9c1d1bf 100644 --- a/hurricane/src/hurricane/Instance.cpp +++ b/hurricane/src/hurricane/Instance.cpp @@ -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)); diff --git a/hurricane/src/hurricane/Name.cpp b/hurricane/src/hurricane/Name.cpp index 524a29c7..26e05f3b 100644 --- a/hurricane/src/hurricane/Name.cpp +++ b/hurricane/src/hurricane/Name.cpp @@ -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 diff --git a/hurricane/src/hurricane/Net.cpp b/hurricane/src/hurricane/Net.cpp index 82fa1727..1067fbe9 100644 --- a/hurricane/src/hurricane/Net.cpp +++ b/hurricane/src/hurricane/Net.cpp @@ -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)); diff --git a/hurricane/src/hurricane/Record.cpp b/hurricane/src/hurricane/Record.cpp index 9814681a..baa833bd 100644 --- a/hurricane/src/hurricane/Record.cpp +++ b/hurricane/src/hurricane/Record.cpp @@ -1,64 +1,84 @@ -// **************************************************************************************************** -// 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". -// **************************************************************************************************** -// Record implementation -// **************************************************************************************************** -Record::Record(const string& name) -// ******************************* -: _name(name), - _slotList() -{ -} + size_t Record::_allocateds = 0; -Record::~Record() -// ************** -{ + + Record::Record ( const string& name ) + : _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; + Slot* slot = *_slotList.begin(); + _slotList.remove(slot); + delete slot; } -} + _allocateds--; + } -Slot* Record::getSlot(unsigned no) const -// ************************************* -{ + + 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; - return; } - _slotList.push_back(slot); -} -string Record::_getString() const -// ****************************** -{ - return "<" + _TName("Record") + " " + getName() + ">"; -} + void Record::add ( Slot* slot ) + { + if (!slot) { + cerr << "[ERROR] Record::add(): Attempt to add NULL Slot." << endl; + return; + } + _slotList.push_back(slot); + } } // End of Hurricane namespace. - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved -// **************************************************************************************************** diff --git a/hurricane/src/hurricane/Reference.cpp b/hurricane/src/hurricane/Reference.cpp index c43cf8be..725f32cd 100644 --- a/hurricane/src/hurricane/Reference.cpp +++ b/hurricane/src/hurricane/Reference.cpp @@ -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"); diff --git a/hurricane/src/hurricane/Region.cpp b/hurricane/src/hurricane/Region.cpp index 33bdeca0..6aaff4f7 100644 --- a/hurricane/src/hurricane/Region.cpp +++ b/hurricane/src/hurricane/Region.cpp @@ -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 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()); diff --git a/hurricane/src/hurricane/Slot.cpp b/hurricane/src/hurricane/Slot.cpp index 569be0bc..9b1d3b2b 100644 --- a/hurricane/src/hurricane/Slot.cpp +++ b/hurricane/src/hurricane/Slot.cpp @@ -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. diff --git a/hurricane/src/hurricane/SlotAdapter.cpp b/hurricane/src/hurricane/SlotAdapter.cpp index e7155bd6..38df345d 100644 --- a/hurricane/src/hurricane/SlotAdapter.cpp +++ b/hurricane/src/hurricane/SlotAdapter.cpp @@ -50,8 +50,7 @@ -# include -#include "hurricane/Commons.h" +# include "hurricane/Commons.h" diff --git a/hurricane/src/hurricane/Technology.cpp b/hurricane/src/hurricane/Technology.cpp index 77838ffd..8ba20e67 100644 --- a/hurricane/src/hurricane/Technology.cpp +++ b/hurricane/src/hurricane/Technology.cpp @@ -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; diff --git a/hurricane/src/hurricane/Transformation.cpp b/hurricane/src/hurricane/Transformation.cpp index d27e5868..4482c433 100644 --- a/hurricane/src/hurricane/Transformation.cpp +++ b/hurricane/src/hurricane/Transformation.cpp @@ -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; } @@ -276,7 +276,7 @@ string Transformation::Orientation::_getString() const Record* Transformation::Orientation::_getRecord() const // ********************************************** { - Record* record = new Record(getString(this)); + Record* record = new Record(getString(this)); record->add(getSlot("Code", &_code)); return record; } diff --git a/hurricane/src/hurricane/hurricane/BasicLayer.h b/hurricane/src/hurricane/hurricane/BasicLayer.h index 6faf0728..b988c669 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayer.h +++ b/hurricane/src/hurricane/hurricane/BasicLayer.h @@ -133,46 +133,46 @@ namespace Hurricane { void BasicLayer::setRealName ( const char* realName) { _realName = realName; } +} // End of Hurricane namespace. + + // ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> -inline string ProxyTypeName ( const BasicLayer::Material::Code* object ) -{ return ">"; } +// Inspector Support for : BasicLayer::Material::Code. template<> -inline string ProxyString ( const BasicLayer::Material::Code* object ) +inline std::string getString + ( 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 ( const BasicLayer::Material::Code* object ) +inline Hurricane::Record* getRecord + ( 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 diff --git a/hurricane/src/hurricane/hurricane/Box.h b/hurricane/src/hurricane/hurricane/Box.h index b530aceb..8206833a 100644 --- a/hurricane/src/hurricane/hurricane/Box.h +++ b/hurricane/src/hurricane/hurricane/Box.h @@ -120,7 +120,7 @@ class Box { } // End of Hurricane namespace. -ValueIOStreamSupport(Hurricane::Box) +INSPECTOR_PV_SUPPORT(Hurricane::Box); #endif // HURRICANE_BOX diff --git a/hurricane/src/hurricane/hurricane/Cell.h b/hurricane/src/hurricane/hurricane/Cell.h index ddea259a..162ae2bf 100644 --- a/hurricane/src/hurricane/hurricane/Cell.h +++ b/hurricane/src/hurricane/hurricane/Cell.h @@ -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 diff --git a/hurricane/src/hurricane/hurricane/Collection.h b/hurricane/src/hurricane/hurricane/Collection.h index 691d5a44..bc4c4b89 100644 --- a/hurricane/src/hurricane/hurricane/Collection.h +++ b/hurricane/src/hurricane/hurricane/Collection.h @@ -23,8 +23,8 @@ template class SubSetCollection; // Collection declaration // **************************************************************************************************** -template class Collection : public NestedSlotAdapter { -// ************************************************************* +template class Collection { +// ************************************ // Constructors // ************ @@ -813,17 +813,29 @@ template class SubSetCollection : public Collection { _locator->progress(); -template - class IsNestedSlotAdapter > { - public: - enum { True=1, False=0 }; - }; - - } // End of Hurricane namespace. +template inline std::string getString ( Hurricane::Collection& collection ) +{ return collection._getString(); } + +template inline std::string getString ( Hurricane::Collection* collection ) +{ return collection->_getString(); } + +template inline std::string getString ( const Hurricane::Collection* collection ) +{ return collection->_getString(); } + +template inline Hurricane::Record* getRecord ( Hurricane::Collection& collection ) +{ return collection._getRecord(); } + +template inline Hurricane::Record* getRecord ( Hurricane::Collection* collection ) +{ return collection->_getRecord(); } + +template inline Hurricane::Record* getRecord ( const Hurricane::Collection* collection ) +{ return collection->_getRecord(); } + + #include "hurricane/MultisetCollection.h" #include "hurricane/SetCollection.h" #include "hurricane/MapCollection.h" diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 3be7ad86..5b2cd0cb 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -30,8 +30,8 @@ #define __HURRICANE_COMMONS__ -#include -#include +#include +#include #include #include @@ -41,6 +41,7 @@ #include #include #include +#include @@ -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 inline Hurricane::Slot* getSlot ( std::string& name, Data d ); +template inline Hurricane::Slot* getSlot ( const std::string& name, Data d ); +template inline Hurricane::Slot* getSlot ( const std::string& name, Data* d ); + + +// ------------------------------------------------------------------- +// Inspector Support for : "POD types". + +// Default match. + +template inline std::string getString ( Data data ) +{ return ""; } + +// "const *" flavors. + +template<> inline std::string getString ( const bool* b ) +{ return (*b)?"True":"False" ; } + +template<> inline std::string getString ( const char* c ) +{ return c; } + +template<> inline std::string getString ( const int* i ) +{ std::ostringstream os (""); os << *i; return os.str(); } + +template<> inline std::string getString ( const long* l ) +{ std::ostringstream os (""); os << *l; return os.str(); } + +template<> inline std::string getString ( const unsigned int* u ) +{ std::ostringstream os (""); os << *u; return os.str(); } + +template<> inline std::string getString ( const unsigned long* ul ) +{ std::ostringstream os (""); os << *ul; return os.str(); } + +template<> inline std::string getString ( const unsigned long long* ull ) +{ std::ostringstream os (""); os << *ull; return os.str(); } + +template<> inline std::string getString ( const unsigned short int* us ) +{ std::ostringstream os (""); os << *us; return os.str(); } + +template<> inline std::string getString ( const float* f ) +{ std::ostringstream os (""); os << *f; return os.str(); } + +template<> inline std::string getString ( const double* d ) +{ std::ostringstream os; os << *d; return os.str(); } + +template<> inline std::string getString ( const void* p ) +{ std::ostringstream os ("0x"); os << std::hex << p; return os.str(); } + +template<> inline std::string getString ( const std::string* s ) +{ return *s; } + + +// "*" flavors. + +template<> inline std::string getString ( bool* b ) +{ return (*b)?"True":"False" ; } + +template<> inline std::string getString ( char* c ) +{ return c; } + +template<> inline std::string getString ( int* i ) +{ std::ostringstream os (""); os << *i; return os.str(); } + +template<> inline std::string getString ( long* l ) +{ std::ostringstream os (""); os << *l; return os.str(); } + +template<> inline std::string getString ( unsigned int* u ) +{ std::ostringstream os (""); os << *u; return os.str(); } + +template<> inline std::string getString ( unsigned long* ul ) +{ std::ostringstream os (""); os << *ul; return os.str(); } + +template<> inline std::string getString ( unsigned long long* ull ) +{ std::ostringstream os (""); os << *ull; return os.str(); } + +template<> inline std::string getString ( unsigned short int* us ) +{ std::ostringstream os (""); os << *us; return os.str(); } + +template<> inline std::string getString ( float* f ) +{ std::ostringstream os (""); os << *f; return os.str(); } + +template<> inline std::string getString ( double* d ) +{ std::ostringstream os; os << *d; return os.str(); } + +template<> inline std::string getString ( void* p ) +{ std::ostringstream os ("0x"); os << std::hex << p; return os.str(); } + +template<> inline std::string getString ( std::string* s ) +{ return *s; } + + +// "by value" flavors. + +template<> inline std::string getString ( bool b ) +{ return (b)?"True":"False" ; } + +template<> inline std::string getString ( const char c ) +{ return std::string(1,c); } + +template<> inline std::string getString ( int i ) +{ std::ostringstream os (""); os << i; return os.str(); } + +template<> inline std::string getString ( long l ) +{ std::ostringstream os (""); os << l; return os.str(); } + +template<> inline std::string getString ( unsigned int u ) +{ std::ostringstream os (""); os << u; return os.str(); } + +template<> inline std::string getString ( unsigned long ul ) +{ std::ostringstream os (""); os << ul; return os.str(); } + +template<> inline std::string getString ( unsigned long long ull ) +{ std::ostringstream os (""); os << ull; return os.str(); } + +template<> inline std::string getString ( unsigned short int us ) +{ std::ostringstream os (""); os << us; return os.str(); } + +template<> inline std::string getString ( float f ) +{ std::ostringstream os (""); os << f; return os.str(); } + +template<> inline std::string getString ( double d ) +{ std::ostringstream os; os << d; return os.str(); } + +template<> inline std::string getString ( std::string s ) +{ return s; } + + +template inline Hurricane::Record* getRecord ( Data data ) +{ return NULL; } + + +// ------------------------------------------------------------------- +// Inspector Support for : "const std::vector*". + + +template +inline std::string getString ( const std::vector* v ) +{ + std::string name = "const std::vector:"; + return name + getString(v->size()); +} + + +template +inline Hurricane::Record* getRecord ( const std::vector* v ) +{ + Hurricane::Record* record = NULL; + if ( !v->empty() ) { + record = new Hurricane::Record ( "const std::vector" ); + unsigned n = 1; + typename std::vector::const_iterator iterator = v->begin(); + while ( iterator != v->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; + } + } + return record; +} + + +// ------------------------------------------------------------------- +// Inspector Support for : "const std::list*". + + +template +inline std::string getString ( const std::list* l ) +{ + std::string name = "const std::list:"; + return name + getString(l->size()); +} + + +template +inline Hurricane::Record* getRecord ( const std::list* l ) +{ + Hurricane::Record* record = NULL; + if ( !l->empty() ) { + record = new Hurricane::Record ( "const std::list" ); + unsigned n = 1; + typename std::list::const_iterator iterator = l->begin(); + while ( iterator != l->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; + } + } + return record; +} + + +template +inline std::string getString ( std::list* l ) +{ + std::string name = "std::list:"; + return name + getString(l->size()); +} + + +template +inline Hurricane::Record* getRecord ( std::list* l ) +{ + Hurricane::Record* record = NULL; + if ( !l->empty() ) { + record = new Hurricane::Record ( "std::list" ); + unsigned n = 1; + typename std::list::iterator iterator = l->begin(); + while ( iterator != l->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; + } + } + return record; +} + + +// ------------------------------------------------------------------- +// Inspector Support for : "[const] std::map*. + + +template +inline std::string getString ( const std::map* m ) +{ + std::string name = "std::map:"; + return name + getString(m->size()); +} + + +template +inline Hurricane::Record* getRecord ( const std::map* m ) +{ + Hurricane::Record* record = NULL; + if ( !m->empty() ) { + record = new Hurricane::Record ( "std::map" ); + typename std::map::const_iterator iterator = m->begin(); + while ( iterator != m->end() ) { + record->add ( getSlot(getString(iterator->first), iterator->second) ); + ++iterator; + } + } + return record; +} + + +// ------------------------------------------------------------------- +// Inspector Support for : "[const] std::multimap*. + + +template +inline std::string getString ( const std::multimap* m ) +{ + std::string name = "std::multimap:"; + return name + getString(m->size()); +} + + +template +inline Hurricane::Record* getRecord ( const std::multimap* m ) +{ + Hurricane::Record* record = NULL; + if ( !m->empty() ) { + record = new Hurricane::Record ( "std::multimap" ); + typename std::multimap::const_iterator iterator = m->begin(); + while ( iterator != m->end() ) { + record->add ( getSlot(getString(iterator->first), iterator->second) ); + ++iterator; + } + } + return record; +} + + +template +inline std::string getString ( std::multimap* m ) +{ + std::string name = "std::multimap:"; + return name + getString(m->size()); +} + + +template +inline Hurricane::Record* getRecord ( std::multimap* m ) +{ + Hurricane::Record* record = NULL; + if ( !m->empty() ) { + record = new Hurricane::Record ( "std::multimap" ); + typename std::multimap::iterator iterator = m->begin(); + while ( iterator != m->end() ) { + record->add ( getSlot(getString(iterator->first), iterator->second) ); + ++iterator; + } + } + return record; +} + + +// ------------------------------------------------------------------- +// Inspector Support for : "[const] std::set*". + + +template +inline std::string getString ( const std::set* s ) +{ + std::string name = "const std::set:"; + return name + getString(s->size()); +} + + +template +inline Hurricane::Record* getRecord ( const std::set* s ) +{ + Hurricane::Record* record = NULL; + if ( !s->empty() ) { + record = new Hurricane::Record ( "const std::set" ); + unsigned n = 1; + typename std::set::const_iterator iterator = s->begin(); + while ( iterator != s->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; + } + } + return record; +} + + +template +inline std::string getString ( std::set* s ) +{ + std::string name = "std::set:"; + return name + getString(s->size()); +} + + +template +inline Hurricane::Record* getRecord ( std::set* s ) +{ + Hurricane::Record* record = NULL; + if ( !s->empty() ) { + record = new Hurricane::Record ( "std::set" ); + unsigned n = 1; + typename std::set::iterator iterator = s->begin(); + while ( iterator != s->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; + } + } + return record; +} + + +// ------------------------------------------------------------------- +// Inspector Support for : "const std::multiset*". + + +template +inline std::string getString ( const std::multiset* s ) +{ + std::string name = "std::multiset:"; + return name + getString(s->size()); +} + + +template +inline Hurricane::Record* getRecord ( const std::multiset* s ) +{ + Hurricane::Record* record = NULL; + if ( !s->empty() ) { + record = new Hurricane::Record ( "std::multiset" ); + unsigned n = 1; + typename std::multiset::const_iterator iterator = s->begin(); + while ( iterator != s->end() ) { + record->add ( getSlot(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(d); \ + } \ + inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \ + { \ + if (!d) return o << "NULL"; \ + return o << "&" << getString(d); \ + } + + +# define INSPECTOR_POINTER_SUPPORT(Data) \ + template<> inline std::string getString( Data* data ) \ + { if (!data) return "NULL " #Data; return data->_getString(); } \ + \ + template<> inline std::string getString( const Data* data ) \ + { if (!data) return "NULL const " #Data; return data->_getString(); } \ + \ + template<> inline Hurricane::Record* getRecord( Data* data ) \ + { if (!data) return NULL; return data->_getRecord(); } \ + \ + template<> inline Hurricane::Record* getRecord( 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(d); } \ + \ + inline std::ostream& operator<< ( std::ostream& o, const Data& d ) \ + { return o << getString(d); } + + +# define INSPECTOR_REFERENCE_SUPPORT(Data) \ + template<> inline std::string getString( Data& data ) \ + { return data._getString(); } \ + \ + template<> inline std::string getString( const Data& data ) \ + { return data._getString(); } \ + \ + template<> inline Hurricane::Record* getRecord( Data& data ) \ + { return data._getRecord(); } \ + \ + template<> inline Hurricane::Record* getRecord( const Data& data ) \ + { return data._getRecord(); } + + +# define IOSTREAM_VALUE_SUPPORT(Data) \ + inline std::ostream& operator<< ( std::ostream& o, Data d ) \ + { return o << getString(d); } + + +# define INSPECTOR_VALUE_SUPPORT(Data) \ + template<> inline std::string getString( Data data ) \ + { return data._getString(); } \ + \ + template<> inline Hurricane::Record* getRecord( 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" diff --git a/hurricane/src/hurricane/hurricane/Component.h b/hurricane/src/hurricane/hurricane/Component.h index daeccb07..6f2d6ee1 100644 --- a/hurricane/src/hurricane/hurricane/Component.h +++ b/hurricane/src/hurricane/hurricane/Component.h @@ -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 diff --git a/hurricane/src/hurricane/hurricane/CompositeLayer.h b/hurricane/src/hurricane/hurricane/CompositeLayer.h index a7a3bf21..bf77ca20 100644 --- a/hurricane/src/hurricane/hurricane/CompositeLayer.h +++ b/hurricane/src/hurricane/hurricane/CompositeLayer.h @@ -114,9 +114,6 @@ class CompositeLayer : public Layer { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::CompositeLayer) - - // **************************************************************************************************** // Generic functions diff --git a/hurricane/src/hurricane/hurricane/Contact.h b/hurricane/src/hurricane/hurricane/Contact.h index 848056b2..387dd631 100644 --- a/hurricane/src/hurricane/hurricane/Contact.h +++ b/hurricane/src/hurricane/hurricane/Contact.h @@ -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 diff --git a/hurricane/src/hurricane/hurricane/ContactLayer.h b/hurricane/src/hurricane/hurricane/ContactLayer.h index 672dc8c4..ab2e143b 100644 --- a/hurricane/src/hurricane/hurricane/ContactLayer.h +++ b/hurricane/src/hurricane/hurricane/ContactLayer.h @@ -108,7 +108,4 @@ namespace Hurricane { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::ContactLayer) - - # endif diff --git a/hurricane/src/hurricane/hurricane/DBo.h b/hurricane/src/hurricane/hurricane/DBo.h index 84bcdabc..2b93de75 100644 --- a/hurricane/src/hurricane/hurricane/DBo.h +++ b/hurricane/src/hurricane/hurricane/DBo.h @@ -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* s ) +{ + return new Hurricane::SlotTemplate*>(name,s); +} + + +template<> +inline Hurricane::Slot* getSlot ( const std::string& name, std::set* s ) +{ + return new Hurricane::SlotTemplate*>(name,s); +} + #endif // HURRICANE_DBO diff --git a/hurricane/src/hurricane/hurricane/DataBase.h b/hurricane/src/hurricane/hurricane/DataBase.h index 49a7ecbc..3f701c5b 100644 --- a/hurricane/src/hurricane/hurricane/DataBase.h +++ b/hurricane/src/hurricane/hurricane/DataBase.h @@ -73,7 +73,8 @@ class DataBase : public DBo { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::DataBase) +INSPECTOR_P_SUPPORT(Hurricane::DataBase); + #endif // HURRICANE_DATA_BASE diff --git a/hurricane/src/hurricane/hurricane/DbU.h b/hurricane/src/hurricane/hurricane/DbU.h index faa2a3b9..b827f7e4 100644 --- a/hurricane/src/hurricane/hurricane/DbU.h +++ b/hurricane/src/hurricane/hurricane/DbU.h @@ -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; } diff --git a/hurricane/src/hurricane/hurricane/DiffusionLayer.h b/hurricane/src/hurricane/hurricane/DiffusionLayer.h index c80a64f3..90776b65 100644 --- a/hurricane/src/hurricane/hurricane/DiffusionLayer.h +++ b/hurricane/src/hurricane/hurricane/DiffusionLayer.h @@ -109,7 +109,4 @@ namespace Hurricane { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::DiffusionLayer) - - # endif diff --git a/hurricane/src/hurricane/hurricane/Entity.h b/hurricane/src/hurricane/hurricane/Entity.h index 9635b799..b186c19f 100644 --- a/hurricane/src/hurricane/hurricane/Entity.h +++ b/hurricane/src/hurricane/hurricane/Entity.h @@ -61,7 +61,8 @@ class Entity : public DBo { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Entity) +INSPECTOR_P_SUPPORT(Hurricane::Entity); + #endif // HURRICANE_ENTITY diff --git a/hurricane/src/hurricane/hurricane/Error.h b/hurricane/src/hurricane/hurricane/Error.h index eb256956..fc794332 100644 --- a/hurricane/src/hurricane/hurricane/Error.h +++ b/hurricane/src/hurricane/hurricane/Error.h @@ -63,7 +63,4 @@ namespace Hurricane { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Error) - - # endif // __HURRICANE_ERROR__ diff --git a/hurricane/src/hurricane/hurricane/Exception.h b/hurricane/src/hurricane/hurricane/Exception.h index 2f029102..13d97ebf 100644 --- a/hurricane/src/hurricane/hurricane/Exception.h +++ b/hurricane/src/hurricane/hurricane/Exception.h @@ -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 // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Filter.h b/hurricane/src/hurricane/hurricane/Filter.h index 2c1f5e3d..d84d3f22 100644 --- a/hurricane/src/hurricane/hurricane/Filter.h +++ b/hurricane/src/hurricane/hurricane/Filter.h @@ -20,7 +20,7 @@ template class NotFilter; // Filter declaration // **************************************************************************************************** -template class Filter : public NestedSlotAdapter { +template class Filter { // ********************************************************* // Constructors @@ -286,13 +286,6 @@ template class NotFilter : public Filter { // **************************************************************************************************** -template - class IsNestedSlotAdapter > { - public: - enum { True=1, False=0 }; - }; - - } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/Go.h b/hurricane/src/hurricane/hurricane/Go.h index 6aa7661c..1ecb47cb 100644 --- a/hurricane/src/hurricane/hurricane/Go.h +++ b/hurricane/src/hurricane/hurricane/Go.h @@ -84,7 +84,8 @@ class Go : public Entity { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Go) +INSPECTOR_P_SUPPORT(Hurricane::Go); + #endif // HURRICANE_GO diff --git a/hurricane/src/hurricane/hurricane/Hook.h b/hurricane/src/hurricane/hurricane/Hook.h index 1dba6088..e89344c8 100644 --- a/hurricane/src/hurricane/hurricane/Hook.h +++ b/hurricane/src/hurricane/hurricane/Hook.h @@ -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 diff --git a/hurricane/src/hurricane/hurricane/Horizontal.h b/hurricane/src/hurricane/hurricane/Horizontal.h index e9fefa5e..4ee78340 100644 --- a/hurricane/src/hurricane/hurricane/Horizontal.h +++ b/hurricane/src/hurricane/hurricane/Horizontal.h @@ -101,7 +101,8 @@ class Horizontal : public Segment { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Horizontal) +INSPECTOR_P_SUPPORT(Hurricane::Horizontal); + #endif // HURRICANE_HORIZONTAL diff --git a/hurricane/src/hurricane/hurricane/HyperNet.h b/hurricane/src/hurricane/hurricane/HyperNet.h index 938b8327..b0eec948 100644 --- a/hurricane/src/hurricane/hurricane/HyperNet.h +++ b/hurricane/src/hurricane/hurricane/HyperNet.h @@ -71,7 +71,7 @@ bool IsHyperNetRootNetOccurrence(Occurrence netoccurrence); } // End of Hurricane namespace. -PointerIOStreamSupport(Hurricane::HyperNet) +INSPECTOR_P_SUPPORT(Hurricane::HyperNet); diff --git a/hurricane/src/hurricane/hurricane/Instance.h b/hurricane/src/hurricane/hurricane/Instance.h index 05f82844..36774173 100644 --- a/hurricane/src/hurricane/hurricane/Instance.h +++ b/hurricane/src/hurricane/hurricane/Instance.h @@ -172,42 +172,41 @@ class Instance : public Go { }; - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Instance::PlacementStatus::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( const Instance::PlacementStatus::Code* object ) - { - switch ( *object ) { - case Instance::PlacementStatus::UNPLACED: return "PLACED"; - case Instance::PlacementStatus::PLACED: return "PLACED"; - case Instance::PlacementStatus::FIXED: return "FIXED"; - } - return "ABNORMAL"; - } - -template<> - inline Record* ProxyRecord - ( const Instance::PlacementStatus::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Instance) +// ------------------------------------------------------------------- +// Inspector Support for : Instance::PlacementStatus::Code*". + +template<> +inline std::string getString + ( const Hurricane::Instance::PlacementStatus::Code* object ) + { + switch ( *object ) { + 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 Hurricane::Record* getRecord + ( const Hurricane::Instance::PlacementStatus::Code* object ) + { + Hurricane::Record* record = new Hurricane::Record(getString(object)); + record->add(getSlot("Code", (unsigned int*)object)); + return record; + } + + +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); + #endif // HURRICANE_INSTANCE diff --git a/hurricane/src/hurricane/hurricane/Interruption.h b/hurricane/src/hurricane/hurricane/Interruption.h index 1b9dfa2b..47e2c050 100644 --- a/hurricane/src/hurricane/hurricane/Interruption.h +++ b/hurricane/src/hurricane/hurricane/Interruption.h @@ -61,9 +61,6 @@ class Interruption : public Exception { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Interruption) - - #endif // HURRICANE_INTERRUPTION // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Interval.h b/hurricane/src/hurricane/hurricane/Interval.h index 90cd4942..0f54e532 100644 --- a/hurricane/src/hurricane/hurricane/Interval.h +++ b/hurricane/src/hurricane/hurricane/Interval.h @@ -93,7 +93,7 @@ class Interval { } // End of Hurricane namespace. -ValueIOStreamSupport(Hurricane::Interval) +INSPECTOR_PV_SUPPORT(Hurricane::Interval); #endif // HURRICANE_INTERVAL diff --git a/hurricane/src/hurricane/hurricane/IntrusiveMap.h b/hurricane/src/hurricane/hurricane/IntrusiveMap.h index aa252ebd..0b2abb68 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveMap.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveMap.h @@ -325,14 +325,10 @@ template 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)); - /**/ + record->add(getSlot(getString(index) + ":" + getString(n++), element)); element = _getNextElement(element); } } @@ -442,6 +438,24 @@ template class IntrusiveMap { } // End of Hurricane namespace. + +template +inline std::string getString ( Hurricane::IntrusiveMap* intrusiveMap ) + { return intrusiveMap->_getString(); } + +template +inline std::string getString ( const Hurricane::IntrusiveMap* intrusiveMap ) + { return intrusiveMap->_getString(); } + +template +inline Hurricane::Record* getRecord ( Hurricane::IntrusiveMap* intrusiveMap ) + { return intrusiveMap->_getRecord(); } + +template +inline Hurricane::Record* getRecord ( const Hurricane::IntrusiveMap* intrusiveMap ) + { return intrusiveMap->_getRecord(); } + + #endif // HURRICANE_INTRUSIVE_MAP // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/IntrusiveSet.h b/hurricane/src/hurricane/hurricane/IntrusiveSet.h index 85836708..747f0437 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveSet.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveSet.h @@ -20,8 +20,8 @@ namespace Hurricane { // IntrusiveSet declaration // **************************************************************************************************** -template class IntrusiveSet : public NestedSlotAdapter { -// ****************************************************************** +template class IntrusiveSet { +// ***************************************** // Types // ***** @@ -326,14 +326,10 @@ template 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)); - /**/ + record->add(getSlot(getString(index) + ":" + getString(n++), element)); element = _getNextElement(element); } } @@ -463,6 +459,16 @@ template class IntrusiveSet : public NestedSlotAdapter { } // End of Hurricane namespace. + +template +inline std::string getString ( Hurricane::IntrusiveSet& intrusiveSet ) +{ return intrusiveSet._getString(); } + +template +inline Hurricane::Record* getRecord ( Hurricane::IntrusiveSet& intrusiveSet ) +{ return intrusiveSet._getRecord(); } + + #endif // HURRICANE_INTRUSIVE_SET // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Layer.h b/hurricane/src/hurricane/hurricane/Layer.h index b2e85516..12cdbd26 100644 --- a/hurricane/src/hurricane/hurricane/Layer.h +++ b/hurricane/src/hurricane/hurricane/Layer.h @@ -45,16 +45,16 @@ namespace Hurricane { // Types. typedef unsigned long long Mask; // Accessors. - inline Technology* getTechnology () const; - inline const Name& getName () const; - inline const Mask& getMask () const; - inline const Mask& getExtractMask () const; + inline Technology* getTechnology () const; + inline const Name& getName () const; + inline const Mask& getMask () const; + inline const Mask& getExtractMask () const; inline const DbU::Unit& getMinimalSize () const; inline const DbU::Unit& getMinimalSpacing () const; inline DbU::Unit getPitch () const; - virtual BasicLayers getBasicLayers () const = 0; - virtual Layer* getConnectorLayer () const; - virtual Layer* getObstructionLayer () const; + virtual BasicLayers getBasicLayers () const = 0; + virtual Layer* getConnectorLayer () const; + virtual Layer* getObstructionLayer () const; virtual DbU::Unit getEnclosure () const; virtual DbU::Unit getExtentionCap () const; virtual DbU::Unit getExtentionWidth () const; @@ -62,46 +62,46 @@ namespace Hurricane { virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; // Predicates - bool contains ( const Layer* layer ) const; - bool intersect ( const Layer* layer ) const; + bool contains ( const Layer* layer ) const; + bool intersect ( const Layer* layer ) const; // Updators - void setName ( const Name& name ); - void setMinimalSize ( const DbU::Unit& minimalSize ); - void setMinimalSpacing ( const DbU::Unit& minimalSpacing ); - void setPitch ( const DbU::Unit& pitch ); - virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit ); - virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit ); - virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit ); + void setName ( const Name& name ); + void setMinimalSize ( const DbU::Unit& minimalSize ); + void setMinimalSpacing ( const DbU::Unit& minimalSpacing ); + void setPitch ( const DbU::Unit& pitch ); + virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit ); + virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit ); + virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit ); // Hurricane Managment. - virtual string _getString () const; - virtual Record* _getRecord () const; - inline Layer* _getNextOfTechnologyLayerMap () const; - inline void _setMask ( const Mask& mask ); - inline void _setExtractMask ( const Mask& extractMask ); - inline void _setNextOfTechnologyLayerMap ( Layer* layer ); + virtual string _getString () const; + virtual Record* _getRecord () const; + inline Layer* _getNextOfTechnologyLayerMap () const; + inline void _setMask ( const Mask& mask ); + inline void _setExtractMask ( const Mask& extractMask ); + inline void _setNextOfTechnologyLayerMap ( Layer* layer ); private: // Internal: Attributes - Technology* _technology; - Name _name; - Mask _mask; - Mask _extractMask; + Technology* _technology; + Name _name; + Mask _mask; + Mask _extractMask; DbU::Unit _minimalSize; DbU::Unit _minimalSpacing; DbU::Unit _pitch; - Layer* _nextOfTechnologyLayerMap; + Layer* _nextOfTechnologyLayerMap; protected: // Internal: Constructors & Destructors. - Layer ( Technology* technology - , const Name& name - , const DbU::Unit& minimalSize = 0 - , const DbU::Unit& minimalSpacing = 0 - , const DbU::Unit& pitch = 0 - ); - virtual void _postCreate (); - virtual void _preDestroy (); + Layer ( Technology* technology + , const Name& name + , const DbU::Unit& minimalSize = 0 + , const DbU::Unit& minimalSpacing = 0 + , const DbU::Unit& pitch = 0 + ); + virtual void _postCreate (); + virtual void _preDestroy (); }; @@ -110,9 +110,9 @@ namespace Hurricane { inline const Name& Layer::getName () const { return _name; } inline const Layer::Mask& Layer::getMask () const { return _mask; } inline const Layer::Mask& Layer::getExtractMask () const { return _extractMask; } - inline const DbU::Unit& Layer::getMinimalSize () const { return _minimalSize; } - inline const DbU::Unit& Layer::getMinimalSpacing () const { return _minimalSpacing; } - inline DbU::Unit Layer::getPitch () const { return (!_pitch?(_minimalSize + _minimalSpacing):_pitch); } + inline const DbU::Unit& Layer::getMinimalSize () const { return _minimalSize; } + inline const DbU::Unit& Layer::getMinimalSpacing () const { return _minimalSpacing; } + inline DbU::Unit Layer::getPitch () const { return (!_pitch?(_minimalSize + _minimalSpacing):_pitch); } inline Layer* Layer::_getNextOfTechnologyLayerMap () const { return _nextOfTechnologyLayerMap; } inline void Layer::_setMask ( const Mask& mask ) { _mask = mask; } inline void Layer::_setExtractMask ( const Mask& extractMask ) { _extractMask = extractMask; } @@ -123,7 +123,7 @@ namespace Hurricane { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Layer) +INSPECTOR_P_SUPPORT(Hurricane::Layer); # endif diff --git a/hurricane/src/hurricane/hurricane/Library.h b/hurricane/src/hurricane/hurricane/Library.h index 5fa78975..0ad6addf 100644 --- a/hurricane/src/hurricane/hurricane/Library.h +++ b/hurricane/src/hurricane/hurricane/Library.h @@ -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 diff --git a/hurricane/src/hurricane/hurricane/Locator.h b/hurricane/src/hurricane/hurricane/Locator.h index 92a22ce7..ef76a5de 100644 --- a/hurricane/src/hurricane/hurricane/Locator.h +++ b/hurricane/src/hurricane/hurricane/Locator.h @@ -18,8 +18,8 @@ namespace Hurricane { // Locator declaration // **************************************************************************************************** -template class Locator : public NestedSlotAdapter { -// ********************************************************** +template class Locator { +// ********************************* // Constructors // ************ @@ -249,14 +249,6 @@ template class GenericLocator : public Locator { // **************************************************************************************************** -template - class IsNestedSlotAdapter > { - public: - enum { True=1, False=0 }; - }; - - - } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/MapCollection.h b/hurricane/src/hurricane/hurricane/MapCollection.h index 11008343..87d32407 100644 --- a/hurricane/src/hurricane/hurricane/MapCollection.h +++ b/hurricane/src/hurricane/hurricane/MapCollection.h @@ -163,7 +163,7 @@ template > record = new Record(_GetString()); typename map::const_iterator iterator = _elementMap->begin(); // AD while (iterator != _elementMap->end()) { - record->add(GetSlot(GetString((*iterator).first), (*iterator).second)); + record->add(getSlot(GetString((*iterator).first), (*iterator).second)); ++iterator; } } diff --git a/hurricane/src/hurricane/hurricane/MultisetCollection.h b/hurricane/src/hurricane/hurricane/MultisetCollection.h index 9721b471..bc6bfdb1 100644 --- a/hurricane/src/hurricane/hurricane/MultisetCollection.h +++ b/hurricane/src/hurricane/hurricane/MultisetCollection.h @@ -9,10 +9,6 @@ #include "hurricane/Commons.h" -#include "hurricane/Tabulation.h" -#include "hurricane/Record.h" -#include "hurricane/Slot.h" - namespace Hurricane { diff --git a/hurricane/src/hurricane/hurricane/Name.h b/hurricane/src/hurricane/hurricane/Name.h index 3da93322..c4c352a6 100644 --- a/hurricane/src/hurricane/hurricane/Name.h +++ b/hurricane/src/hurricane/hurricane/Name.h @@ -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 // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Net.h b/hurricane/src/hurricane/hurricane/Net.h index db992117..26b75d6f 100644 --- a/hurricane/src/hurricane/hurricane/Net.h +++ b/hurricane/src/hurricane/hurricane/Net.h @@ -219,76 +219,70 @@ class Net : public Entity { -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Net::Type::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( 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 - ( const Net::Type::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Net::Direction::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( 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 - ( 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* 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* 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* 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* 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 diff --git a/hurricane/src/hurricane/hurricane/Occurrence.h b/hurricane/src/hurricane/hurricane/Occurrence.h index 655467f0..558194c9 100644 --- a/hurricane/src/hurricane/hurricane/Occurrence.h +++ b/hurricane/src/hurricane/hurricane/Occurrence.h @@ -92,7 +92,7 @@ class Occurrence { } // End of Hurricane namespace. -ValueIOStreamSupport(Hurricane::Occurrence) +INSPECTOR_PV_SUPPORT(Hurricane::Occurrence); #endif // HURRICANE_OCCURENCE diff --git a/hurricane/src/hurricane/hurricane/Pad.h b/hurricane/src/hurricane/hurricane/Pad.h index 188a9ae7..8ec2c089 100644 --- a/hurricane/src/hurricane/hurricane/Pad.h +++ b/hurricane/src/hurricane/hurricane/Pad.h @@ -69,7 +69,8 @@ class Pad : public Component { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Pad) +INSPECTOR_P_SUPPORT(Hurricane::Pad); + #endif // HURRICANE_PAD diff --git a/hurricane/src/hurricane/hurricane/Path.h b/hurricane/src/hurricane/hurricane/Path.h index ed583ce2..84a3ca76 100644 --- a/hurricane/src/hurricane/hurricane/Path.h +++ b/hurricane/src/hurricane/hurricane/Path.h @@ -97,7 +97,7 @@ class Path { } // End of Hurricane namespace. -ValueIOStreamSupport(Hurricane::Path) +INSPECTOR_PV_SUPPORT(Hurricane::Path); #endif // HURRICANE_PATH diff --git a/hurricane/src/hurricane/hurricane/Pin.h b/hurricane/src/hurricane/hurricane/Pin.h index c9f0515e..084fccb6 100644 --- a/hurricane/src/hurricane/hurricane/Pin.h +++ b/hurricane/src/hurricane/hurricane/Pin.h @@ -146,6 +146,4 @@ class Pin : public Contact { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Pin) - #endif // HURRICANE_PIN diff --git a/hurricane/src/hurricane/hurricane/Plug.h b/hurricane/src/hurricane/hurricane/Plug.h index 8ee3752d..2516c263 100644 --- a/hurricane/src/hurricane/hurricane/Plug.h +++ b/hurricane/src/hurricane/hurricane/Plug.h @@ -104,7 +104,8 @@ class Plug : public Component { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Plug) +INSPECTOR_P_SUPPORT(Hurricane::Plug); + #endif // HURRICANE_PLUG diff --git a/hurricane/src/hurricane/hurricane/Point.h b/hurricane/src/hurricane/hurricane/Point.h index b828172a..200f5b93 100644 --- a/hurricane/src/hurricane/hurricane/Point.h +++ b/hurricane/src/hurricane/hurricane/Point.h @@ -78,7 +78,7 @@ class Point { } // End of Hurricane namespace. -ValueIOStreamSupport(Hurricane::Point) +INSPECTOR_PV_SUPPORT(Hurricane::Point); #endif // HURRICANE_POINT diff --git a/hurricane/src/hurricane/hurricane/Property.h b/hurricane/src/hurricane/hurricane/Property.h index e4c8aab5..89356aac 100644 --- a/hurricane/src/hurricane/hurricane/Property.h +++ b/hurricane/src/hurricane/hurricane/Property.h @@ -20,8 +20,8 @@ namespace Hurricane { // Property declaration // **************************************************************************************************** -class Property : public NestedSlotAdapter { -// ************************************** +class Property { +// ************* // Constructors // ************ @@ -352,22 +352,12 @@ template class StandardSharedProperty : public SharedProperty { }; -template - class IsNestedSlotAdapter > { - public: - enum { True=1, False=0 }; - }; - - -template - class IsNestedSlotAdapter > { - public: - enum { True=1, False=0 }; - }; - - } // End of Hurricane namespace. + +INSPECTOR_P_SUPPORT(Hurricane::Property); + + #endif // HURRICANE_PROPERTY // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/QuadTree.h b/hurricane/src/hurricane/hurricane/QuadTree.h index d4a954f2..71a097f9 100644 --- a/hurricane/src/hurricane/hurricane/QuadTree.h +++ b/hurricane/src/hurricane/hurricane/QuadTree.h @@ -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 // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Quark.h b/hurricane/src/hurricane/hurricane/Quark.h index bf23d545..df3c18fd 100644 --- a/hurricane/src/hurricane/hurricane/Quark.h +++ b/hurricane/src/hurricane/hurricane/Quark.h @@ -64,7 +64,8 @@ class Quark : public DBo { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Quark) +INSPECTOR_P_SUPPORT(Hurricane::Quark); + #endif // HURRICANE_QUARK diff --git a/hurricane/src/hurricane/hurricane/Record.h b/hurricane/src/hurricane/hurricane/Record.h index 1f86d1cd..24ccb73f 100644 --- a/hurricane/src/hurricane/hurricane/Record.h +++ b/hurricane/src/hurricane/hurricane/Record.h @@ -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 { + public: // Types. + typedef list SlotList; + public: - typedef list SlotList; + // 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 (); - // Attributes private: - string _name; - SlotList _slotList; + // Internal: Static Attributes. + static size_t _allocateds; + // Internal: Attributes + string _name; + SlotList _slotList; - // Constructors - public: - Record ( const string& name ); private: - 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; }; - + // Forbidden: Constructors + Record ( const Record& record ); + Record& operator= ( const Record& record ); }; +// Inline Functions. + inline const string& Record::getName () const { return _name; } + inline Record::SlotList& Record::_getSlotList () { return _slotList; } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/RegularLayer.h b/hurricane/src/hurricane/hurricane/RegularLayer.h index e82d72a1..4a2c9fe4 100644 --- a/hurricane/src/hurricane/hurricane/RegularLayer.h +++ b/hurricane/src/hurricane/hurricane/RegularLayer.h @@ -110,7 +110,4 @@ namespace Hurricane { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::RegularLayer) - - # endif diff --git a/hurricane/src/hurricane/hurricane/Relation.h b/hurricane/src/hurricane/hurricane/Relation.h index 1d8f334a..19c4a899 100644 --- a/hurricane/src/hurricane/hurricane/Relation.h +++ b/hurricane/src/hurricane/hurricane/Relation.h @@ -101,9 +101,6 @@ class StandardRelation : public Relation { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Relation) -SetNestedSlotAdapter(Hurricane::StandardRelation) - #endif // HURRICANE_RELATION // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Rubber.h b/hurricane/src/hurricane/hurricane/Rubber.h index 40e4420f..0d9bfed3 100644 --- a/hurricane/src/hurricane/hurricane/Rubber.h +++ b/hurricane/src/hurricane/hurricane/Rubber.h @@ -96,7 +96,8 @@ class Rubber : public Go { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Rubber) +INSPECTOR_P_SUPPORT(Hurricane::Rubber); + #endif // HURRICANE_RUBBER diff --git a/hurricane/src/hurricane/hurricane/Segment.h b/hurricane/src/hurricane/hurricane/Segment.h index 7ed1d1db..b32f8bc1 100644 --- a/hurricane/src/hurricane/hurricane/Segment.h +++ b/hurricane/src/hurricane/hurricane/Segment.h @@ -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 diff --git a/hurricane/src/hurricane/hurricane/SetCollection.h b/hurricane/src/hurricane/hurricane/SetCollection.h index c949d3e7..a6796dfa 100644 --- a/hurricane/src/hurricane/hurricane/SetCollection.h +++ b/hurricane/src/hurricane/hurricane/SetCollection.h @@ -10,8 +10,6 @@ #include "hurricane/Commons.h" #include "hurricane/Tabulation.h" -#include "hurricane/Record.h" -#include "hurricane/Slot.h" namespace Hurricane { diff --git a/hurricane/src/hurricane/hurricane/SharedName.h b/hurricane/src/hurricane/hurricane/SharedName.h index 70ae57d7..82cd0547 100644 --- a/hurricane/src/hurricane/hurricane/SharedName.h +++ b/hurricane/src/hurricane/hurricane/SharedName.h @@ -84,6 +84,9 @@ class SharedName { } // End of Hurricane namespace. +INSPECTOR_P_SUPPORT(Hurricane::SharedName); + + #endif // HURRICANE_SHARED_NAME // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/SharedPath.h b/hurricane/src/hurricane/hurricane/SharedPath.h index 8e03588f..f49f0510 100644 --- a/hurricane/src/hurricane/hurricane/SharedPath.h +++ b/hurricane/src/hurricane/hurricane/SharedPath.h @@ -112,6 +112,9 @@ class SharedPath { } // End of Hurricane namespace. +INSPECTOR_P_SUPPORT(Hurricane::SharedPath); + + #endif // HURRICANE_SHARED_PATH diff --git a/hurricane/src/hurricane/hurricane/Slice.h b/hurricane/src/hurricane/hurricane/Slice.h index e48be061..648f0dbb 100644 --- a/hurricane/src/hurricane/hurricane/Slice.h +++ b/hurricane/src/hurricane/hurricane/Slice.h @@ -90,6 +90,10 @@ class Slice { } // End of Hurricane namespace. + +INSPECTOR_P_SUPPORT(Hurricane::Slice); + + #endif // HURRICANE_SLICE // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Slot.h b/hurricane/src/hurricane/hurricane/Slot.h index e3e4e1cb..0c19917c 100644 --- a/hurricane/src/hurricane/hurricane/Slot.h +++ b/hurricane/src/hurricane/hurricane/Slot.h @@ -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 - protected: - const string _name; - const SlotAdapter* _data; + class Slot { - // Constructors - protected: - Slot ( const string& name, const SlotAdapter* data ) : _name(name), _data(data) {}; - private: - Slot ( const Slot& slot ); // Not implemented to forbid copy. - - // 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 - { - return "<" + _getTypeName() - + " " + getName() + " " - + _data->_getString() + ">"; - }; - -}; - - - - -// ------------------------------------------------------------------- -// 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 PointerSlot : public Slot { - - // Constructors - public: - PointerSlot ( const string& name, const SlotAdapter* data ) : Slot(name,data) {}; - // Destructor. - public: - virtual ~PointerSlot () {}; - + 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; - // Accessors - public: - virtual string _getTypeName () const { return _TName("PointerSlot"); }; + protected: + // Internal: Static Attributes. + static size_t _allocateds; + // Internal: Attributes. + const string _name; + protected: + // Internal: Constructors & Destructors. + Slot ( const string& name ); }; +// Inline Member Functions. + inline Slot::Slot ( const string& name ) : _name(name) + { + _allocateds++; + //cerr << "Slot::Slot() - " << _name << " " << hex << (void*)this << endl; + } + + inline const string& Slot::getName () const { return _name; } // ------------------------------------------------------------------- -// 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 { + template + class SlotTemplate : public Slot { - // Constructors public: - ValueSlot (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* + getClone () const; - // Destructor. - public: - virtual ~ValueSlot () { delete _data; }; - - // Accessors - public: - virtual string _getTypeName () const { return _TName("ValueSlot"); }; + protected: + // Internal: Attributes. + const Data _data; + private: + // Internal: Constructors. + SlotTemplate ( const SlotTemplate& ); + SlotTemplate& operator= ( const SlotTemplate& ); }; +// Inline Member Functions. + template + SlotTemplate::SlotTemplate ( const string& name, const Data data ) + : Slot(name), _data(data) { } + + template + SlotTemplate::SlotTemplate ( string& name, const Data data ) + : Slot(name), _data(data) { } + + template + string SlotTemplate::getDataString () const { return getString(_data); } + + template + Record* SlotTemplate::getDataRecord () const { return getRecord(_data); } + + template + SlotTemplate* SlotTemplate::getClone () const + { return new SlotTemplate(_name,_data); } + + +// ------------------------------------------------------------------- +// Class : "SlotTemplate". + + + template + class SlotTemplate : public Slot { + + public: + // Constructor. + SlotTemplate ( const string& name, Data* data ); + SlotTemplate ( string& name, Data* data ); + // Accessors. + virtual string getDataString () const; + virtual Record* getDataRecord () const; + virtual SlotTemplate* + getClone () const; + + protected: + // Internal: Attributes. + Data* _data; + + private: + // Internal: Constructors. + SlotTemplate ( const SlotTemplate& ); + SlotTemplate& operator= ( const SlotTemplate& ); + }; + + +// Inline Member Functions. + template + SlotTemplate::SlotTemplate ( const string& name, Data* data ) + : Slot(name), _data(data) {} + + template + SlotTemplate::SlotTemplate ( string& name, Data* data ) + : Slot(name), _data(data) {} + + template + string SlotTemplate::getDataString () const { return getString(_data); } + + template + Record* SlotTemplate::getDataRecord () const { return getRecord(_data); } + + template + SlotTemplate* SlotTemplate::getClone () const + { return new SlotTemplate(_name,_data); } + + +// ------------------------------------------------------------------- +// Class : "SlotTemplate". + + + template<> + class SlotTemplate : 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* + getClone () const; + + protected: + // Internal: Attributes. + Record* _data; + + private: + // Internal: Constructors. + SlotTemplate ( const SlotTemplate& ); + SlotTemplate& operator= ( const SlotTemplate& ); + }; + + +// Inline Member Functions. + inline SlotTemplate::SlotTemplate ( const string& name, Record* data ) + : Slot(name), _data(data) {} + + inline SlotTemplate::SlotTemplate ( string& name, Record* data ) + : Slot(name), _data(data) {} + + inline string SlotTemplate::getDataString () const { return _name; } + inline Record* SlotTemplate::getDataRecord () const { return _data; } + + inline SlotTemplate* SlotTemplate::getClone () const + { return new SlotTemplate(_name,_data); } + + } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Slot) -SetNestedSlotAdapter(Hurricane::PointerSlot) -SetNestedSlotAdapter(Hurricane::ValueSlot) +template +inline Hurricane::Slot* getSlot( std::string& name, Data d ) +{ + return new Hurricane::SlotTemplate ( name, d ); +} +template +inline Hurricane::Slot* getSlot( const std::string& name, Data d ) +{ + return new Hurricane::SlotTemplate ( name, d ); +} + + +template +inline Hurricane::Slot* getSlot( const std::string& name, Data* d ) +{ + return new Hurricane::SlotTemplate ( name, d ); +} #endif diff --git a/hurricane/src/hurricane/hurricane/SlotAdapter.h b/hurricane/src/hurricane/hurricane/SlotAdapter.h index 469f13e6..6cbc195d 100644 --- a/hurricane/src/hurricane/hurricane/SlotAdapter.h +++ b/hurricane/src/hurricane/hurricane/SlotAdapter.h @@ -70,443 +70,7 @@ namespace Hurricane { using namespace std; - - -// ------------------------------------------------------------------- -// Template Functions : "Proxy...()". - -template - inline string ProxyTypeName ( const Type* object ) { return object->_getTypeName(); } - -template - inline string ProxyString ( const Type* object ) { return object->_getString(); } - -template - inline Record* ProxyRecord ( const Type* object ) { return object->_getRecord(); } - - - - -// ------------------------------------------------------------------- -// SlotAdapter Type Identification by Template. - - -template - class IsNestedSlotAdapter { - public: - enum { True=0, False=1 }; - }; - - -template - class IsNestedSlotAdapter { - 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 { \ - protected: \ - const T* t; \ - public: \ - const NestedSlotAdapter* _checkInheritance () const \ - { return static_cast(t); } \ - public: \ - enum { True=1, False=0 }; \ - }; \ - } - - - - -// ------------------------------------------------------------------- -// Templates Class : "PointerSlotAdapter". - -template - 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". - -template - 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...". - -template<> - inline string ProxyTypeName ( const string* object ) { return ">"; } - -template<> - inline string ProxyString ( const string* object ) { return *object; } - -template<> - inline Record* ProxyRecord ( const string* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "PointerSlotAdapter". - -template<> - inline string ProxyTypeName ( const char* object ) { return ">"; } - -template<> - inline string ProxyString ( const char* object ) { return object; } - -template<> - inline Record* ProxyRecord ( const char* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "ValueSlotAdapter". - -template<> - class ValueSlotAdapter : 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 ">"; }; - virtual string _getString () const { return string(1,_c); }; - }; - - - - -// ------------------------------------------------------------------- -// Class : "ValueSlotAdapter". - -template<> - class ValueSlotAdapter : 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 ">"; }; - virtual string _getString () const { return string(1,_c); }; - }; - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const bool* object ) { return ">"; } - -template<> - inline string ProxyString ( const bool* object ) { return (*object)?"True":"False" ; } - -template<> - inline Record* ProxyRecord ( const bool* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const void* object ) { return ">"; } - -template<> - inline string ProxyString ( const void* object ) - { - static ostringstream os; - os.str ( "0x" ); - os << hex << object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const void* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const int* object ) { return ">"; } - -template<> - inline string ProxyString ( const int* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const int* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const long* object ) { return ">"; } - -template<> - inline string ProxyString ( const long* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const long* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const unsigned int* object ) { return ">"; } - -template<> - inline string ProxyString ( const unsigned int* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const unsigned int* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const unsigned long* object ) { return ">"; } - -template<> - inline string ProxyString ( const unsigned long* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const unsigned long* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const unsigned long long* object ) { return ">"; } - -template<> - inline string ProxyString ( const unsigned long long* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const unsigned long long* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const unsigned short int* object ) { return ">"; } - -template<> - inline string ProxyString ( const unsigned short int* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const unsigned short int* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const float* object ) { return ">"; } - -template<> - inline string ProxyString ( const float* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const float* object ) { return NULL; } - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName ( const double* object ) { return ">"; } - -template<> - inline string ProxyString ( const double* object ) - { - static ostringstream os; - os.str ( "" ); - os << *object; - return os.str(); - } - -template<> - inline Record* ProxyRecord ( const double* object ) { return NULL; } - - + class Record; } // End of Hurricane namespace. @@ -522,419 +86,222 @@ template<> // Note 2: thoses templates manage all types. -template - inline Hurricane::Record* getRecord ( T* t ) { - if ( !t ) return NULL; - if ( Hurricane::IsNestedSlotAdapter::True ) - return ((const Hurricane::SlotAdapter*)((const void*)t))->_getRecord(); +template inline std::string getString ( Data* data ) { return "getString() - Unsupported data"; } +template inline std::string getString ( Data& data ) { return "getString() - Unsupported data"; } +template inline Hurricane::Record* getRecord ( Data* data ) { return NULL; } +template inline Hurricane::Record* getRecord ( Data& data ) { return NULL; } - return Hurricane::PointerSlotAdapter(t)._getRecord(); - } +template<> inline std::string getString ( const std::string* s ) { return *s; } +template<> inline std::string getString ( const char* c ) { return c; } +template<> inline std::string getString ( const char c) { return std::string(1,c); } +template<> inline std::string getString ( const char c) { return std::string(1,c); } +template<> inline std::string getString ( const bool* b ) { return (*b)?"True":"False" ; } + +template<> inline std::string getString ( const void* p ) +{ ostringstream os ("0x"); return (os << hex << p).str(); } + +template<> inline std::string getString ( const int* i ) +{ ostringstream os (""); return (os << *i).str(); } + +template<> inline std::string getString ( const long* l ) +{ ostringstream os (""); return (os << *l).str(); } + +template<> inline std::string getString ( const unsigned int* u ) +{ ostringstream os (""); return (os << *u).str(); } + +template<> inline std::string getString ( const unsigned long* ul ) +{ ostringstream os (""); return (os << *ul).str() } + +template<> inline std::string ProxyString ( const unsigned long long* ull ) +{ ostringstream os (""); return (os << *ull).str(); } + +template<> inline std::string getString ( const unsigned short int* us ) +{ ostringstream os (""); return (os << *us).str(); } + +template<> inline std::string getString ( const float* f ) +{ ostringstream os (""); return (os << *f).str(); } + +template<> inline std::string getString ( const double* d ) +{ ostringstream os; return (os << *d).str(); } -template - inline Hurricane::Record* getRecord ( T t ) { - if ( Hurricane::IsNestedSlotAdapter::True ) - return ((const Hurricane::SlotAdapter*)((const void*)&t))->_getRecord(); +template +inline Hurricane::Slot* getSlot ( const std::string& name, const Data* d ) +{ + if ( !d ) return getSlot ( name, "NULL pointer" ); - return Hurricane::ValueSlotAdapter(t)._getRecord(); - } + return new PointerSlot ( name, d ); +} + +template +inline Hurricane::Slot* getSlot( const std::string& name, const Data d ) +{ + return new Hurricane::ValueSlot ( name, d ); +} -template - inline string getString ( T* t ) { - if ( !t ) return "NULL"; - if ( Hurricane::IsNestedSlotAdapter::True ) - return ((const Hurricane::SlotAdapter*)((const void*)t))->_getString(); +template +inline ostream& operator<< ( ostream& o, const Data* d ) +{ + if (!d) return o << "NULL"; - return Hurricane::PointerSlotAdapter(t)._getString(); - } + return o << "&" << getString(d); +} -template - inline string getString ( T t ) - { - if ( Hurricane::IsNestedSlotAdapter::True ) - return ((const Hurricane::SlotAdapter*)((void*)&t))->_getString(); - - return Hurricane::ValueSlotAdapter(t)._getString(); - } +template +inline ostream& operator<< ( ostream& o, const Data d ) +{ + return o << "&" << getString(d); +} -template - inline Hurricane::Slot* getSlot(const string& name, T* t ) { - if ( !t ) return getSlot ( name, "NULL pointer" ); - if ( Hurricane::IsNestedSlotAdapter::True ) - return ((const Hurricane::SlotAdapter*)((const void*)t))->_getSlot(name); - - return (new Hurricane::PointerSlotAdapter(t))->_getSlot(name); - } - - -template - inline Hurricane::Slot* getSlot( const string& name, T t ) { - if ( Hurricane::IsNestedSlotAdapter::True ) - return ((const Hurricane::SlotAdapter*)((const void*)&t))->_getSlot(name); - - return (new Hurricane::ValueSlotAdapter(t))->_getSlot(name); - } - - -# define PointerIOStreamSupport(Type) \ - inline ostream& operator<< ( ostream& stream, const Type* t ) \ - { \ - if ( !t ) return stream << "NULL"; \ - if ( Hurricane::IsNestedSlotAdapter::True ) \ - return stream << "&" << ((const Hurricane::SlotAdapter*)((const void*)t))->_getString(); \ - \ - return stream << "&" << Hurricane::PointerSlotAdapter(t)._getString(); \ - } - - -# define ValueIOStreamSupport(Type) \ - inline ostream& operator<< ( ostream& stream, const Type& t ) \ - { \ - if ( Hurricane::IsNestedSlotAdapter::True ) \ - return stream << ((const Hurricane::SlotAdapter*)((const void*)&t))->_getString(); \ - \ - return stream << Hurricane::ValueSlotAdapter(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. +# include "hurricane/Record.h" +# include "hurricane/Slot.h" // ------------------------------------------------------------------- -// Class : "PointerSlotAdapter>". - -template - class PointerSlotAdapter > : public SlotAdapter { - - // Attributes. - protected: - const vector* _v; - - // Constructor. - public: - PointerSlotAdapter ( const vector* v ) : SlotAdapter(), _v(v) {}; - - // Destructor. - public: - virtual ~PointerSlotAdapter () {}; - - // Slot Management. - public: - virtual string _getTypeName () const { return ">"; }; - virtual string _getString () const; - virtual Record* _getRecord () const; - }; +// Inspector Support for : "const vector*". template - inline string PointerSlotAdapter >::_getString () const { - string name = "vector:"; - return name + getString(_v->size()); - } +inline std::string getString*>( const vector* v ) +{ + std::string name = "vector:"; + return name + getString(v->size()); +} template - inline Record* PointerSlotAdapter >::_getRecord () const { - Record* record = NULL; - if ( !_v->empty() ) { - record = new Record ( "vector" ); - unsigned n = 1; - typename vector::const_iterator iterator = _v->begin(); - while ( iterator != _v->end() ) { - record->add ( getSlot(getString(n++), *iterator) ); - ++iterator; - } +inline Hurricane::Record* getRecord*>( const vector* v ) +{ + Hurricane::Record* record = NULL; + if ( !v->empty() ) { + record = new Hurricane::Record ( "vector" ); + unsigned n = 1; + typename vector::const_iterator iterator = v->begin(); + while ( iterator != v->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; } - return record; } - - + return record; +} // ------------------------------------------------------------------- -// Class : "PointerSlotAdapter>". - -template - class PointerSlotAdapter > : public SlotAdapter { - - // Attributes. - protected: - const list* _l; - - // Constructor. - public: - PointerSlotAdapter ( const list* l ) : SlotAdapter(), _l(l) {}; - - // Destructor. - public: - virtual ~PointerSlotAdapter () {}; - - // Slot Management. - public: - virtual string _getTypeName () const { return ">"; }; - virtual string _getString () const; - virtual Record* _getRecord () const; - }; +// Inspector Support for : "const list*". template - inline string PointerSlotAdapter >::_getString () const - { - string name = "list:"; - return name + getString(_l->size()); - } +inline std::string getString*>( const list* l ) +{ + std::string name = "list:"; + return name + getString(l->size()); +} template - inline Record* PointerSlotAdapter >::_getRecord () const - { - Record* record = NULL; - if ( !_l->empty() ) { - record = new Record ( "list" ); - unsigned n = 1; - typename list::const_iterator iterator = _l->begin(); - while ( iterator != _l->end() ) { - record->add ( getSlot(getString(n++), *iterator) ); - ++iterator; - } +inline Hurricane::Record* getRecord*>( const list* l ) +{ + Hurricane::Record* record = NULL; + if ( !l->empty() ) { + record = new Hurricane::Record ( "list" ); + unsigned n = 1; + typename list::const_iterator iterator = l->begin(); + while ( iterator != l->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; } - return record; } - - + return record; +} // ------------------------------------------------------------------- -// Class : "PointerSlotAdapter>. - -template - class PointerSlotAdapter > : public SlotAdapter { - - // Attributes. - protected: - const map* _m; - - // Constructor. - public: - PointerSlotAdapter ( const map* m ) : _m(m) {}; - - // Destructor. - public: - virtual ~PointerSlotAdapter () {}; - - // Slot Management. - public: - virtual string _getTypeName () const { return ">"; }; - virtual string _getString () const; - virtual Record* _getRecord () const; - }; +// Inspector Support for : "const map*. template - inline string PointerSlotAdapter >::_getString () const { - string name = "map:"; - return name + getString(_m->size()); - } +inline std::string getString*>( const map* m ) +{ + std::string name = "map:"; + return name + getString(m->size()); +} template - inline Record* PointerSlotAdapter >::_getRecord () const { - Record* record = NULL; - if ( !_m->empty() ) { - record = new Record ( "map" ); - typename map::const_iterator iterator = _m->begin(); - while ( iterator != _m->end() ) { - record->add ( getSlot(getString(iterator->first), iterator->second) ); - ++iterator; - } +inline Hurricane::Record* getRecord*>( const map* m ) +{ + Hurricane::Record* record = NULL; + if ( !m->empty() ) { + record = new Hurricane::Record ( "map" ); + typename map::const_iterator iterator = m->begin(); + while ( iterator != m->end() ) { + record->add ( getSlot(getString(iterator->first), iterator->second) ); + ++iterator; } - return record; } - - + return record; +} // ------------------------------------------------------------------- -// Class : "SlotAdapterSet". - -template - class PointerSlotAdapter > : public SlotAdapter { - - // Attributes. - protected: - const set* _s; - - // Constructor. - public: - PointerSlotAdapter ( const set* m ) : _s(m) {}; - - // Destructor. - public: - virtual ~PointerSlotAdapter () {}; - - // Slot Management. - public: - virtual string _getTypeName () const { return ">"; }; - virtual string _getString () const; - virtual Record* _getRecord () const; - }; +// Inspector Support for : "const set*". template - inline string PointerSlotAdapter >::_getString () const { - string name = "set:"; - return name + getString(_s->size()); - } +inline std::string getString*>( const set* s ) +{ + std::string name = "set:"; + return name + getString(s->size()); +} template - inline Record* PointerSlotAdapter >::_getRecord () const { - Record* record = NULL; - if ( !_s->empty() ) { - record = new Record ( "set" ); - unsigned n = 1; - typename set::const_iterator iterator = _s->begin(); - while ( iterator != _s->end() ) { - record->add ( getSlot(getString(n++), *iterator) ); - ++iterator; - } +inline Hurricane::Record* getRecord*>( const set* s ) +{ + Hurricane::Record* record = NULL; + if ( !s->empty() ) { + record = new Hurricane::Record ( "set" ); + unsigned n = 1; + typename set::const_iterator iterator = s->begin(); + while ( iterator != s->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; } - return record; } - - + return record; +} // ------------------------------------------------------------------- -// Class : "SlotAdapterSet". - -template - class PointerSlotAdapter > : public SlotAdapter { - - // Attributes. - protected: - set* _s; - - // Constructor. - public: - PointerSlotAdapter ( set* m ) : _s(m) {}; - - // Destructor. - public: - virtual ~PointerSlotAdapter () {}; - - // Slot Management. - public: - virtual string _getTypeName () const { return ">"; }; - virtual string _getString () const; - virtual Record* _getRecord () const; - }; +// Inspector Support for : "const multiset*". template - inline string PointerSlotAdapter >::_getString () const { - string name = "set:"; - return name + getString(_s->size()); - } +inline std::string getString*>( const multiset* s ) +{ + std::string name = "multiset:"; + return name + getString(s->size()); +} template - inline Record* PointerSlotAdapter >::_getRecord () const { - Record* record = NULL; - if ( !_s->empty() ) { - record = new Record ( "set" ); - unsigned n = 1; - typename set::const_iterator iterator = _s->begin(); - while ( iterator != _s->end() ) { - record->add ( getSlot(getString(n++), *iterator) ); - ++iterator; - } +inline Hurricane::Record* getRecord*>( const multiset* s ) +{ + Hurricane::Record* record = NULL; + if ( !s->empty() ) { + record = new Hurricane::Record ( "multiset" ); + unsigned n = 1; + typename multiset::const_iterator iterator = s->begin(); + while ( iterator != s->end() ) { + record->add ( getSlot(getString(n++), *iterator) ); + ++iterator; } - return record; } - - - - -// ------------------------------------------------------------------- -// Class : "SlotAdapterMultiSet". - -template - class PointerSlotAdapter > : public SlotAdapter { - - // Attributes. - protected: - const multiset* _s; - - // Constructor. - public: - PointerSlotAdapter ( const multiset* m ) : _s(m) {}; - - // Destructor. - public: - virtual ~PointerSlotAdapter () {}; - - // Slot Management. - public: - virtual string _getTypeName () const { return ">"; }; - virtual string _getString () const; - virtual Record* _getRecord () const; - }; - - -template - inline string PointerSlotAdapter >::_getString () const { - string name = "multiset:"; - return name + getString(_s->size()); - } - - -template - inline Record* PointerSlotAdapter >::_getRecord () const { - Record* record = NULL; - if ( !_s->empty() ) { - record = new Record ( "multiset" ); - unsigned n = 1; - typename multiset::const_iterator iterator = _s->begin(); - while ( iterator != _s->end() ) { - record->add ( getSlot(getString(n++), *iterator) ); - ++iterator; - } - } - return record; - } - - - - -} // End of Hurricane namespace. - - + return record; +} #endif diff --git a/hurricane/src/hurricane/hurricane/Tabulation.h b/hurricane/src/hurricane/hurricane/Tabulation.h index e73e06b0..767a43f7 100644 --- a/hurricane/src/hurricane/hurricane/Tabulation.h +++ b/hurricane/src/hurricane/hurricane/Tabulation.h @@ -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); + // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Technology.h b/hurricane/src/hurricane/hurricane/Technology.h index c5632bd9..ab1bae78 100644 --- a/hurricane/src/hurricane/hurricane/Technology.h +++ b/hurricane/src/hurricane/hurricane/Technology.h @@ -105,7 +105,8 @@ class Technology : public DBo { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Technology) +INSPECTOR_P_SUPPORT(Hurricane::Technology); + #endif // HURRICANE_TECHNOLOGY diff --git a/hurricane/src/hurricane/hurricane/Timer.h b/hurricane/src/hurricane/hurricane/Timer.h index 094a726d..929759ec 100644 --- a/hurricane/src/hurricane/hurricane/Timer.h +++ b/hurricane/src/hurricane/hurricane/Timer.h @@ -51,7 +51,7 @@ class Timer { } // End of Hurricane namespace. -ValueIOStreamSupport(Hurricane::Timer) +INSPECTOR_PV_SUPPORT(Hurricane::Timer); #endif // HURRICANE_TIMER diff --git a/hurricane/src/hurricane/hurricane/Transformation.h b/hurricane/src/hurricane/hurricane/Transformation.h index 4e9d01f8..111a7615 100644 --- a/hurricane/src/hurricane/hurricane/Transformation.h +++ b/hurricane/src/hurricane/hurricane/Transformation.h @@ -127,47 +127,70 @@ class Transformation { - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Transformation::Orientation::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( const 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"; - } - return "ABNORMAL"; - } - -template<> - inline Record* ProxyRecord - ( const Transformation::Orientation::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - - } // End of Hurricane namespace. -ValueIOStreamSupport(Hurricane::Transformation) +// ------------------------------------------------------------------- +// Inspector Support for : "Transformation::Orientation::Code*". + +template<> +inline std::string getString + ( const Hurricane::Transformation::Orientation::Code* object ) + { + 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 + ( const Hurricane::Transformation::Orientation::Code* 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* 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* 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; + } + + +INSPECTOR_PV_SUPPORT(Hurricane::Transformation); +INSPECTOR_PV_SUPPORT(Hurricane::Transformation::Orientation); +IOSTREAM_POINTER_SUPPORT(Hurricane::Transformation::Orientation::Code); #endif // HURRICANE_TRANSFORMATION diff --git a/hurricane/src/hurricane/hurricane/TransistorLayer.h b/hurricane/src/hurricane/hurricane/TransistorLayer.h index bae362bb..9c6508f8 100644 --- a/hurricane/src/hurricane/hurricane/TransistorLayer.h +++ b/hurricane/src/hurricane/hurricane/TransistorLayer.h @@ -112,7 +112,4 @@ namespace Hurricane { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::TransistorLayer) - - # endif diff --git a/hurricane/src/hurricane/hurricane/UpdateSession.h b/hurricane/src/hurricane/hurricane/UpdateSession.h index 846e8516..b6b4a943 100644 --- a/hurricane/src/hurricane/hurricane/UpdateSession.h +++ b/hurricane/src/hurricane/hurricane/UpdateSession.h @@ -79,8 +79,6 @@ class UpdateSession : public SharedProperty { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::UpdateSession) - #endif // HURRICANE_UPDATE_SESSION // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Vertical.h b/hurricane/src/hurricane/hurricane/Vertical.h index 27e28699..15657d65 100644 --- a/hurricane/src/hurricane/hurricane/Vertical.h +++ b/hurricane/src/hurricane/hurricane/Vertical.h @@ -102,7 +102,8 @@ class Vertical : public Segment { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Vertical) +INSPECTOR_P_SUPPORT(Hurricane::Vertical); + #endif // HURRICANE_VERTICAL diff --git a/hurricane/src/hurricane/hurricane/ViaLayer.h b/hurricane/src/hurricane/hurricane/ViaLayer.h index b0609ed4..e9e66338 100644 --- a/hurricane/src/hurricane/hurricane/ViaLayer.h +++ b/hurricane/src/hurricane/hurricane/ViaLayer.h @@ -105,7 +105,4 @@ namespace Hurricane { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::ViaLayer) - - # endif diff --git a/hurricane/src/hurricane/hurricane/Warning.h b/hurricane/src/hurricane/hurricane/Warning.h index c155f12d..f90de68d 100644 --- a/hurricane/src/hurricane/hurricane/Warning.h +++ b/hurricane/src/hurricane/hurricane/Warning.h @@ -61,8 +61,6 @@ class Warning : public Exception { } // End of Hurricane namespace. -SetNestedSlotAdapter(Hurricane::Warning) - #endif // HURRICANE_WARNING // **************************************************************************************************** diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index eb987f2a..fe53c898 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -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 ) diff --git a/hurricane/src/hviewer/CellViewer.cpp b/hurricane/src/hviewer/CellViewer.cpp index 8cf429fb..1d074985 100644 --- a/hurricane/src/hviewer/CellViewer.cpp +++ b/hurricane/src/hviewer/CellViewer.cpp @@ -3,142 +3,185 @@ // -*- C++ -*- -# include -# include -# include -# include +#include +#include +#include +#include -# include "hurricane/Cell.h" +#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 "MapView.h" +#include "hurricane/viewer/Palette.h" +#include "hurricane/viewer/CellWidget.h" +#include "hurricane/viewer/CellViewer.h" +#include "hurricane/inspector/HInspectorWidget.h" namespace Hurricane { -CellViewer::CellViewer ( Cell* cell ) : QMainWindow() - , _openAction(NULL) - , _nextCellAction(NULL) - , _previousCellAction(NULL) - , _nextAction(NULL) - , _saveAction(NULL) - , _exitAction(NULL) - , _refreshAction(NULL) - , _fitToContentsAction(NULL) - , _showBoundariesAction(NULL) - , _fileMenu(NULL) - , _viewMenu(NULL) - //, _mapView(NULL) - , _palette(NULL) - , _cellWidget(NULL) -{ - createMenus (); - createLayout ( cell ); -} + CellViewer::CellViewer ( Cell* cell ) : QMainWindow() + , _openAction(NULL) + , _nextCellAction(NULL) + , _previousCellAction(NULL) + , _nextAction(NULL) + , _saveAction(NULL) + , _exitAction(NULL) + , _refreshAction(NULL) + , _fitToContentsAction(NULL) + , _showBoundariesAction(NULL) + , _runInspectorOnDataBase(NULL) + , _runInspectorOnCell(NULL) + , _fileMenu(NULL) + , _viewMenu(NULL) + , _toolsMenu(NULL) + //, _mapView(NULL) + , _palette(NULL) + , _cellWidget(NULL) + { + createMenus (); + createLayout ( cell ); + } -void CellViewer::createActions () -{ - if ( _openAction ) return; + void CellViewer::createActions () + { + if ( _openAction ) return; - _openAction = new QAction ( tr("&Open Cell"), this ); - _openAction->setIcon ( QIcon(":/images/stock_open.png") ); - _openAction->setStatusTip ( tr("Open (load) a new Cell") ); + _openAction = new QAction ( tr("&Open Cell"), this ); + _openAction->setIcon ( QIcon(":/images/stock_open.png") ); + _openAction->setStatusTip ( tr("Open (load) a new Cell") ); - _nextCellAction = new QAction ( tr("Next Cell"), this ); - _nextCellAction->setStatusTip ( tr("Go to the next Cell in history") ); + _nextCellAction = new QAction ( tr("Next Cell"), this ); + _nextCellAction->setStatusTip ( tr("Go to the next Cell in history") ); - _previousCellAction = new QAction ( tr("Previous Cell"), this ); - _previousCellAction->setStatusTip ( tr("Go to the previous Cell in history") ); + _previousCellAction = new QAction ( tr("Previous Cell"), this ); + _previousCellAction->setStatusTip ( tr("Go to the previous Cell in history") ); - _nextAction = new QAction ( tr("&Next Breakpoint"), this ); - _nextAction->setStatusTip ( tr("Proceed to the next breakpoint") ); + _nextAction = new QAction ( tr("&Next Breakpoint"), this ); + _nextAction->setStatusTip ( tr("Proceed to the next breakpoint") ); - _saveAction = new QAction ( tr("&Save Cell"), this ); - _saveAction->setIcon ( QIcon(":/images/stock_save.png") ); - _saveAction->setStatusTip ( tr("Save the current Cell") ); + _saveAction = new QAction ( tr("&Save Cell"), this ); + _saveAction->setIcon ( QIcon(":/images/stock_save.png") ); + _saveAction->setStatusTip ( tr("Save the current Cell") ); - _exitAction = new QAction ( tr("&Exit"), this ); - _exitAction->setStatusTip ( tr("Close Coriolis CellViewer") ); - _exitAction->setShortcut ( QKeySequence(tr("CTRL+Q")) ); - connect ( _exitAction, SIGNAL(triggered()), this, SLOT(close()) ); + _exitAction = new QAction ( tr("&Exit"), this ); + _exitAction->setStatusTip ( tr("Close Coriolis CellViewer") ); + _exitAction->setShortcut ( QKeySequence(tr("CTRL+Q")) ); + connect ( _exitAction, SIGNAL(triggered()), this, SLOT(close()) ); - _refreshAction = new QAction ( tr("&Refresh"), this ); - _refreshAction->setStatusTip ( tr("Force full redrawing of the display") ); - _refreshAction->setShortcut ( QKeySequence(tr("CTRL+L")) ); + _refreshAction = new QAction ( tr("&Refresh"), this ); + _refreshAction->setStatusTip ( tr("Force full redrawing of the display") ); + _refreshAction->setShortcut ( QKeySequence(tr("CTRL+L")) ); - _fitToContentsAction = new QAction ( tr("&Fit to Contents"), this ); - _fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") ); - _fitToContentsAction->setShortcut ( Qt::Key_F ); + _fitToContentsAction = new QAction ( tr("&Fit to Contents"), this ); + _fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") ); + _fitToContentsAction->setShortcut ( Qt::Key_F ); - _showBoundariesAction = new QAction ( tr("&Boundaries"), this ); - _showBoundariesAction->setCheckable ( true ); - _showBoundariesAction->setStatusTip ( tr("Show/hide cell & instances abutment boxes") ); -} + _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") ); + } -void CellViewer::createMenus () -{ - if ( _fileMenu ) return; - if ( !_openAction ) createActions (); + void CellViewer::createMenus () + { + if ( _fileMenu ) return; + if ( !_openAction ) createActions (); - _fileMenu = menuBar()->addMenu ( tr("File") ); - _fileMenu->addAction ( _openAction ); - _fileMenu->addAction ( _nextCellAction ); - _fileMenu->addAction ( _previousCellAction ); - _fileMenu->addAction ( _nextAction ); - _fileMenu->addAction ( _saveAction ); - _fileMenu->addAction ( _exitAction ); + _fileMenu = menuBar()->addMenu ( tr("File") ); + _fileMenu->addAction ( _openAction ); + _fileMenu->addAction ( _nextCellAction ); + _fileMenu->addAction ( _previousCellAction ); + _fileMenu->addAction ( _nextAction ); + _fileMenu->addAction ( _saveAction ); + _fileMenu->addAction ( _exitAction ); - _viewMenu = menuBar()->addMenu ( tr("View") ); - _viewMenu->addAction ( _refreshAction ); - _viewMenu->addAction ( _fitToContentsAction ); - _viewMenu->addAction ( _showBoundariesAction ); -} + _viewMenu = menuBar()->addMenu ( tr("View") ); + _viewMenu->addAction ( _refreshAction ); + _viewMenu->addAction ( _fitToContentsAction ); + //_viewMenu->addAction ( _showBoundariesAction ); + + _toolsMenu = menuBar()->addMenu ( tr("Tool") ); + _toolsMenu->addAction ( _runInspectorOnDataBase ); + _toolsMenu->addAction ( _runInspectorOnCell ); + } -void CellViewer::createLayout ( Cell* cell ) -{ - if ( _cellWidget ) return; + void CellViewer::createLayout ( Cell* cell ) + { + if ( _cellWidget ) return; - _cellWidget = new CellWidget ( cell ); - _palette = _cellWidget->getPalette(); -//_mapView = _cellWidget->getMapView (); + _cellWidget = new CellWidget ( cell ); + _palette = _cellWidget->getPalette(); + //_mapView = _cellWidget->getMapView (); - setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea ); - setCorner ( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea ); - setCorner ( Qt::TopRightCorner , Qt::RightDockWidgetArea ); - setCorner ( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); + setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea ); + setCorner ( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea ); + setCorner ( Qt::TopRightCorner , Qt::RightDockWidgetArea ); + setCorner ( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); -// QDockWidget* mapViewDock = new QDockWidget ( tr("Map") ); -// mapViewDock->setObjectName ( "MapView" ); -// mapViewDock->setWidget ( _mapView ); -// mapViewDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); -// addDockWidget ( Qt::RightDockWidgetArea, mapViewDock ); + // QDockWidget* mapViewDock = new QDockWidget ( tr("Map") ); + // mapViewDock->setObjectName ( "MapView" ); + // mapViewDock->setWidget ( _mapView ); + // mapViewDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + // addDockWidget ( Qt::RightDockWidgetArea, mapViewDock ); - QDockWidget* layerMapDock = new QDockWidget ( tr("Layers") ); - layerMapDock->setObjectName ( "Palette" ); - layerMapDock->setWidget ( _palette ); - layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - addDockWidget ( Qt::RightDockWidgetArea, layerMapDock ); + QDockWidget* layerMapDock = new QDockWidget ( tr("Layers") ); + layerMapDock->setObjectName ( "Palette" ); + layerMapDock->setWidget ( _palette ); + layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + addDockWidget ( Qt::RightDockWidgetArea, layerMapDock ); - setCentralWidget ( _cellWidget ); + setCentralWidget ( _cellWidget ); - connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(redraw ()) ); - connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents()) ); + 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 (); -} + _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. diff --git a/hurricane/src/hviewer/Graphics.cpp b/hurricane/src/hviewer/Graphics.cpp index eadd3de2..bf8cc5cf 100644 --- a/hurricane/src/hviewer/Graphics.cpp +++ b/hurricane/src/hviewer/Graphics.cpp @@ -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; } diff --git a/hurricane/src/hviewer/GroupPaletteEntry.cpp b/hurricane/src/hviewer/GroupPaletteEntry.cpp index 052fa6ed..e588d304 100644 --- a/hurricane/src/hviewer/GroupPaletteEntry.cpp +++ b/hurricane/src/hviewer/GroupPaletteEntry.cpp @@ -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, ' ' ); diff --git a/hurricane/src/hviewer/ScreenUtilities.cpp b/hurricane/src/hviewer/ScreenUtilities.cpp index 309838a4..3af4a9a0 100644 --- a/hurricane/src/hviewer/ScreenUtilities.cpp +++ b/hurricane/src/hviewer/ScreenUtilities.cpp @@ -36,7 +36,7 @@ namespace { } - bool getPattern ( uchar bits[], const string& pattern ) + bool getPattern ( uchar bits[], const std::string& pattern ) { bool isValid = true; diff --git a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h index d36e481a..c1ea2bd1 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h @@ -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 createActions (); + void createMenus (); + void createLayout ( Cell* cell ); + void runInspector ( Record* record ); }; - } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/Graphics.h b/hurricane/src/hviewer/hurricane/viewer/Graphics.h index b464ce41..bc789fbe 100644 --- a/hurricane/src/hviewer/hurricane/viewer/Graphics.h +++ b/hurricane/src/hviewer/hurricane/viewer/Graphics.h @@ -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 ); diff --git a/hurricane/src/isobar/PyDbU.cpp b/hurricane/src/isobar/PyDbU.cpp index 8a575c02..bc1ff7bc 100644 --- a/hurricane/src/isobar/PyDbU.cpp +++ b/hurricane/src/isobar/PyDbU.cpp @@ -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))) ); } diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 59e991ee..5cf4023f 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -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." } diff --git a/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h b/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h index 543eab21..ec756c74 100644 --- a/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h +++ b/hurricane/src/isobar/hurricane/isobar/ProxyProperty.h @@ -132,8 +132,5 @@ using namespace Hurricane; } // End of Isobar namespace. -SetNestedSlotAdapter(Isobar::ProxyProperty) - - #endif diff --git a/hurricane/src/isobar/hurricane/isobar/PyDbU.h b/hurricane/src/isobar/hurricane/isobar/PyDbU.h index 70030a26..88def5b2 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyDbU.h +++ b/hurricane/src/isobar/hurricane/isobar/PyDbU.h @@ -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 );