* ./hurricane/src/hviewer,

./coriolis/src/crlcore,
     ./coriolis/src/knik,
     ./coriolis/src/katabatic,
     ./coriolis/src/kite,
     ./coriolis/src/equinox,
     ./coriolis/src/solstice,
     ./coriolis/src/ispd:
     - SVN MOVE: Source tree simplification & uniformisation. Now all tools
         are at the same level, directly under the root of the repository.
         No more "coriolis/src".
This commit is contained in:
Jean-Paul Chaput 2010-03-09 15:25:53 +00:00
parent a1726771b6
commit 05036113bf
35 changed files with 4475 additions and 0 deletions

27
solstice/CMakeLists.txt Normal file
View File

@ -0,0 +1,27 @@
PROJECT(SOLSTICE)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
SET(CMAKE_C_FLAGS_DEBUG "-g -Wall" CACHE STRING "Debug options." FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
SET(CMAKE_MODULE_PATH "$ENV{HURRICANE_TOP}/share/cmake_modules/")
SET(QT_USE_QTXML "true")
FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project
FIND_PACKAGE(HURRICANE REQUIRED)
FIND_PACKAGE(CORIOLIS REQUIRED)
FIND_PACKAGE(EQUINOX REQUIRED)
SET_LIB_LINK_MODE()
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(cmake_modules)

View File

@ -0,0 +1 @@
install ( FILES FindSOLSTICE.cmake DESTINATION /share/cmake_modules )

View File

@ -0,0 +1,47 @@
# - Find the Solstice includes and libraries.
# The following variables are set if Coriolis is found. If SOLSTICE is not
# found, SOLSTICE_FOUND is set to false.
# SOLSTICE_FOUND - True when the Coriolis include directory is found.
# SOLSTICE_INCLUDE_DIR - the path to where the Coriolis include files are.
# SOLSTICE_LIBRARIES - The path to where the Coriolis library files are.
SET(SOLSTICE_INCLUDE_PATH_DESCRIPTION "directory containing the Solstice include files. E.g /usr/local/include/coriolis or /asim/coriolis/include/coriolis")
SET(SOLSTICE_DIR_MESSAGE "Set the SOLSTICE_INCLUDE_DIR cmake cache entry to the ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}")
# don't even bother under WIN32
IF(UNIX)
SET(SOLSTICE_DIR_SEARCH $ENV{CORIOLIS_TOP} $ENV{HURRICANE_TOP})
#
# Look for an installation.
#
FIND_PATH(SOLSTICE_INCLUDE_PATH NAMES solstice/Equi.h PATHS
# Look in other places.
${SOLSTICE_DIR_SEARCH}
PATH_SUFFIXES include/coriolis
# Help the user find it if we cannot.
DOC "The ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_LIBRARY(SOLSTICE_LIBRARY_PATH
NAMES solstice
PATHS ${SOLSTICE_DIR_SEARCH}
PATH_SUFFIXES lib
# Help the user find it if we cannot.
DOC "The ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_LIBRARY(SOLSTICE_STATIC_LIBRARY_PATH
NAMES solstice-static
PATHS ${SOLSTICE_DIR_SEARCH}
PATH_SUFFIXES lib
# Help the user find it if we cannot.
DOC "The ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}"
)
SET_LIBRARIES_PATH(SOLSTICE SOLSTICE)
HURRICANE_CHECK_LIBRARIES(SOLSTICE)
ENDIF(UNIX)

98
solstice/src/Brick.cpp Normal file
View File

@ -0,0 +1,98 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./Brick.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <string>
#include "hurricane/Occurrence.h"
#include "hurricane/Box.h"
#include "hurricane/BasicLayer.h"
#include "hurricane/DbU.h"
#include "hurricane/Error.h"
#include "crlcore/Utilities.h"
#include<equinox/Interval.h>
#include<solstice/Brick.h>
namespace Solstice {
using namespace Hurricane;
using namespace std;
const DbU::Unit& Brick::getXmin() const { return _box.getXMin(); };
const DbU::Unit& Brick::getYmin() const { return _box.getYMin(); };
const DbU::Unit& Brick::getXmax() const { return _box.getXMax(); };
const DbU::Unit& Brick::getYmax() const { return _box.getYMax(); };
long Brick::GetLowPoint() const { return _box.getYMin(); }
long Brick::GetHighPoint() const { return _box.getYMax(); }
bool Brick::isEmpty () const { return _box.isEmpty(); };
Brick::Brick(const Occurrence& hypernet, const Occurrence& componentoccurrence, const Box& box,
BasicLayer* basiclayer)
: _hypernet(hypernet)
, _componentoccurrence(componentoccurrence)
, _box(box)
, _basicLayer(basiclayer)
{
}
Brick::~Brick() {};
Brick* Brick::create(const Occurrence& hypernet, const Occurrence& componentoccurrence, const Box& box,
BasicLayer* basiclayer)
{
Brick* brick = new Brick(hypernet, componentoccurrence, box, basiclayer);
if(!brick) {
throw Error("can't create Brick : allocation failed");
}
return brick;
}
void Brick::destroy() {
delete this;
}
string Brick::_getString() const {
string s = "< Brick " + getString(_hypernet) + " " + getString(_componentoccurrence) + " ";
s += "\n" + getString(_box) + " " + getString(_basicLayer->getName()) + " >";
return s;
}
}// End of namespace Solstice

View File

@ -0,0 +1,45 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./BrickSweepLine.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <hurricane/ExtensionGo.h>
#include <hurricane/DataBase.h>
#include <hurricane/Technology.h>
#include <hurricane/Occurrence.h>
#include <hurricane/Component.h>
#include <equinox/Strategy.h>
#include <equinox/IntervalTree.h>
#include <equinox/Tiles.h>
#include <equinox/SweepLine.h>
#include <equinox/TileSweepLine.h>
#include <solstice/RoutingError.h>
#include "solstice/SolsticeEngine.h"
#include "solstice/Brick.h"
namespace Equinox {
using Solstice::SolsticeEngine;
using Solstice::Brick;
template class SweepLine<Brick*,SolsticeEngine*>;
}

View File

@ -0,0 +1,52 @@
include ( ${QT_USE_FILE} )
include_directories ( ${SOLSTICE_SOURCE_DIR}/src
${HURRICANE_INCLUDE_DIR}
${CORIOLIS_INCLUDE_DIR}
)
set ( includes solstice/Brick.h
solstice/ShortCircuitError.h
solstice/DisconnectError.h
solstice/SolsticeEngine.h
solstice/RoutingError.h
solstice/BrickSweepLine.h
solstice/RoutingErrorInformations.h
)
set ( mocIncludes solstice/RoutingErrorListModel.h
solstice/RoutingErrorListWidget.h
solstice/TabRoutingErrorList.h
solstice/GraphicSolsticeEngine.h )
set ( cpps Brick.cpp
RoutingError.cpp
BrickSweepLine.cpp
SolsticeEngine.cpp
ShortCircuitError.cpp
GraphicSolsticeEngine.cpp
RoutingErrorListModel.cpp
DisconnectError.cpp
RoutingErrorListWidget.cpp
TabRoutingErrorList.cpp
RoutingErrorInformations.cpp
)
qt4_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( solstice ${cpps} ${mocCpps} )
target_link_libraries ( solstice ${EQUINOX_LIBRARIES}
${CORIOLIS_LIBRARIES}
${HURRICANE_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${QT_LIBRARIES}
${LEFDEF_LIBRARIES}
${OA_LIBRARIES}
)
install ( TARGETS solstice DESTINATION /lib)
install ( FILES ${includes}
${mocIncludes} DESTINATION /include/coriolis/solstice )

View File

@ -0,0 +1,59 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | |
// | Updater : Bodin bruno |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./DisconnectError.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <hurricane/Cell.h>
#include <hurricane/Net.h>
#include <equinox/Strategy.h>
#include <solstice/SolsticeEngine.h>
#include <solstice/DisconnectError.h>
#include <string>
namespace Solstice {
using namespace Hurricane;
DisconnectError::DisconnectError(Cell*cell, const Occurrence& occurrence, int count) :
RoutingError(cell,count),
_occurrence(occurrence)
{
if (dynamic_cast<Net*>(occurrence.getEntity()))
forEach ( Component*, component, dynamic_cast<Net*>(occurrence.getEntity())->getComponents() ) {
_occurrences->insert(Occurrence ( *component ) );
}
// _area = occurrence.getBoundingBox();
_area = Box();
}
DisconnectError::~DisconnectError() {};
string DisconnectError::getErrorDescription () const
{
return "Deconnexion du Net " + _occurrence.getEntity()->_getString() ;
} ;
} // End of Solstice namespace.

View File

@ -0,0 +1,249 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./GraphicSolsticeEngine.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QAction>
#include <QMenu>
#include <QMenuBar>
#include <hurricane/Warning.h>
#include <hurricane/Go.h>
#include <hurricane/Error.h>
#include <hurricane/Cell.h>
#include <hurricane/viewer/Graphics.h>
#include <hurricane/viewer/CellWidget.h>
#include <hurricane/viewer/PaletteWidget.h>
#include <hurricane/viewer/CellViewer.h>
#include <hurricane/viewer/ControllerWidget.h>
#include <crlcore/AllianceFramework.h>
#include <crlcore/GraphicToolEngine.h>
#include <solstice/GraphicSolsticeEngine.h>
#include <solstice/SolsticeEngine.h>
#include <solstice/TabRoutingErrorList.h>
namespace Solstice {
using namespace std;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::Graphics;
using CRL::AllianceFramework;
// -------------------------------------------------------------------
// Class : "CRL::GraphicSolsticeEngine".
size_t GraphicSolsticeEngine::_references = 0;
GraphicSolsticeEngine* GraphicSolsticeEngine::_singleton = NULL;
SolsticeEngine* GraphicSolsticeEngine::createEngine ( )
{
Cell* cell = getCell ();
SolsticeEngine* solstice = SolsticeEngine::get ( cell );
if ( !solstice ) {
solstice = SolsticeEngine::create ( cell );
}
return solstice;
}
void GraphicSolsticeEngine::initSolsticeRoutingError ( CellWidget* widget )
{
// QPainter& painter = widget->getPainter();
}
void GraphicSolsticeEngine::drawSolsticeRoutingError ( CellWidget* widget
, const Go* go
, const BasicLayer* basicLayer
, const Box& box
, const Transformation& transformation
)
{
const RoutingError* error = static_cast<const RoutingError*>(go);
QPainter& painter = widget->getPainter();
QColor c = QColor(Qt::red);
c.setAlpha(100);
c = c.darker(widget->getDarkening());
painter.setPen (QPen(c,15));
painter.setBrush(c);
painter.drawRect ( widget->dbuToDisplayRect(error->getBoundingBox()) );
}
GraphicSolsticeEngine* GraphicSolsticeEngine::grab ()
{
if ( !_references )
_singleton = new GraphicSolsticeEngine ();
_references++;
return _singleton;
}
const Name& GraphicSolsticeEngine::getName () const
{ return SolsticeEngine::getStaticName(); }
Cell* GraphicSolsticeEngine::getCell ()
{
if ( !_viewer ) {
throw Error ( "<b>Solstice:</b> GraphicSolsticeEngine not bound to any Viewer." );
return NULL;
}
if ( !_viewer->getCell() ) {
throw Error ( "<b>Solstice:</b> No Cell is loaded into the Viewer." );
return NULL;
}
return _viewer->getCell();
}
size_t GraphicSolsticeEngine::release ()
{
_references--;
if ( !_references ) {
delete _singleton;
_singleton = NULL;
}
return _references;
}
void GraphicSolsticeEngine::addToMenu ( CellViewer* viewer )
{
assert ( _viewer == NULL );
_viewer = viewer;
QMenu* prMenu = _viewer->findChild<QMenu*>("viewer.menuBar.extract");
if ( !prMenu ) {
throw("Solstice doit être chargé avant Equinox (c'est plus convenable , Non ??");
}
QAction* gTestAction = _viewer->findChild<QAction*>("viewer.menuBar.extract.solstice.test");
if ( gTestAction )
cerr << Warning("GraphicSolsticeEngine::addToMenu() - Solstice test already hooked in.") << endl;
else {
gTestAction = new QAction ( tr("Solstice - Testing"), _viewer );
gTestAction->setObjectName ( "viewer.menuBar.extract.test" );
gTestAction->setStatusTip ( tr("Run the <b>Solstice</b> Test") );
gTestAction->setVisible ( true );
prMenu->addAction ( gTestAction );
connect ( gTestAction, SIGNAL(triggered()), this, SLOT(test()) );
}
// fin du sous menu
connect ( this, SIGNAL(cellPreModificated ()), _viewer->getCellWidget(), SLOT(cellPreModificate ()) );
connect ( this, SIGNAL(cellPostModificated()), _viewer->getCellWidget(), SLOT(cellPostModificate()) );
}
void GraphicSolsticeEngine::test ()
{
SolsticeEngine* solstice = createEngine ( );
if ( !solstice ) return;
emit cellPreModificated ();
solstice->compare ();
emit cellPostModificated ();
_viewer->dumpObjectTree();
QTabWidget* ctrlTab = _viewer->getControllerWidget();
if (ctrlTab) {
ctrlTab->addTab ( _tabRoutingErrorList , "RoutingError" );
(static_cast<ControllerTab*>((_tabRoutingErrorList)))->setCellWidget ( _viewer->getCellWidget() );
PaletteWidget* palette = ctrlTab->findChild<PaletteWidget*>("controller.tabPalette.palette");
if (palette)
{
palette->setItemVisible(RoutingError::_extensionName,true);
} else {
throw Warning("l'onglet controller.tabPalette.palette n'existe pas");
}
}else {
throw Warning("Le panel des erreurs de s'affichera pas");
}
}
GraphicSolsticeEngine::GraphicSolsticeEngine ()
: GraphicTool ()
, _viewer (NULL)
, _tabRoutingErrorList (new TabRoutingErrorList())
{
_tabRoutingErrorList ->setObjectName ( "controller.tabRoutingErrorList" );
addDrawGo ( RoutingError::_extensionName , initSolsticeRoutingError , drawSolsticeRoutingError );
}
GraphicSolsticeEngine::~GraphicSolsticeEngine()
{
// destruction des outils graphiques
//removeDrawGo ( RoutingError::_extensionName );
//_tabRoutingErrorList->destroy();
// destruction de solstice
cout << "get cell" <<endl;
Cell* cell = getCell ();
cout << "get cell (bis)" <<endl;
SolsticeEngine* solstice = SolsticeEngine::get ( cell );
cout << "destroy" <<endl;
if (solstice)
solstice->destroy();
}
} // End of Solstice namespace.

View File

@ -0,0 +1,55 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | |
// | Updater : Bodin bruno |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./RoutingError.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <hurricane/Name.h>
#include <hurricane/Box.h>
#include <solstice/RoutingError.h>
namespace Solstice {
const Name RoutingError::_extensionName = "Solstice::RoutingError";
RoutingError::~RoutingError() {};
RoutingError::RoutingError(Cell* cell,int count):
ExtensionGo(cell),
_cell(cell),
_area(),
_count(count)
{
_occurrences = new set<Occurrence>;
}
void RoutingError::translate ( const DbU::Unit& dx, const DbU::Unit& dy )
{
// cout << "Translate !! " << endl;
}
} // End of Solstice namespace.

View File

@ -0,0 +1,124 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./RoutingErrorInformations.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QObject>
#include "hurricane/Name.h"
#include "solstice/RoutingError.h"
#include "solstice/RoutingErrorInformations.h"
namespace Solstice {
// -------------------------------------------------------------------
// Class : "RoutingErrorInformations"
int RoutingErrorInformations::getColumnCount ()
{ return 1; }
QVariant RoutingErrorInformations::getColumnName ( int column )
{
switch ( column ) {
case 0: return QVariant(QObject::tr("RoutingError"));
}
return QVariant(QObject::tr("Column Out of Bound"));
}
QVariant RoutingErrorInformations::getColumn ( int column )
{
switch ( column ) {
case 0: return QVariant(getString(getName()).c_str());
}
return QVariant(QObject::tr("Column Out of Bound"));
}
RoutingErrorInformations::RoutingErrorInformations ( const RoutingError* routingError )
: _routingError(routingError)
{ }
RoutingErrorInformations::~RoutingErrorInformations ()
{ }
// -------------------------------------------------------------------
// Class : "SimpleRoutingErrorInformations"
string SimpleRoutingErrorInformations::getDescription() const {
return _routingError->getErrorDescription();
}
int SimpleRoutingErrorInformations::getColumnCount ()
{ return 3; }
QVariant SimpleRoutingErrorInformations::getColumnName ( int column )
{
switch ( column ) {
case 0: return QVariant(QObject::tr("RoutingError"));
case 1: return QVariant(QObject::tr("Equipotentials"));
case 2: return QVariant(QObject::tr("Description"));
}
return QVariant(QObject::tr("Column Out of Bound"));
}
QVariant SimpleRoutingErrorInformations::getColumn ( int column )
{
switch ( column ) {
case 0: return QVariant(getString(getName()).c_str());
case 1: return QVariant((unsigned int)_routingError->getCount());
case 2: return QVariant(getString( getDescription()).c_str());
}
return QVariant(QObject::tr("Column Out of Bound"));
}
SimpleRoutingErrorInformations::SimpleRoutingErrorInformations ( const RoutingError* routingError )
: RoutingErrorInformations(routingError)
, _plugsCount(_routingError->getAllOccurrences()->size())
{ }
SimpleRoutingErrorInformations::~SimpleRoutingErrorInformations ()
{ }
// -------------------------------------------------------------------
// Class : "AbstractRoutingErrorInformationsVector"
AbstractRoutingErrorInformationsVector::~AbstractRoutingErrorInformationsVector ()
{ }
} // End of Hurricane namespace.

View File

@ -0,0 +1,123 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./RoutingErrorlistModel.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QFont>
#include <QApplication>
#include "hurricane/Name.h"
#include "hurricane/Cell.h"
#include "hurricane/viewer/Graphics.h"
#include "solstice/RoutingError.h"
#include "solstice/RoutingErrorInformations.h"
#include "solstice/RoutingErrorListModel.h"
namespace Solstice {
RoutingErrorListModel::RoutingErrorListModel ( QObject* parent )
: QAbstractTableModel(parent)
, _cell(NULL)
, _routingErrorList(NULL)
{ }
RoutingErrorListModel::~RoutingErrorListModel ()
{
if ( _routingErrorList ) delete _routingErrorList;
}
QVariant RoutingErrorListModel::data ( const QModelIndex& index, int role ) const
{
static QFont nameFont = Graphics::getFixedFont ( QFont::Bold );
static QFont valueFont = Graphics::getFixedFont ( QFont::Normal, true );
if ( role == Qt::SizeHintRole ) {
switch (index.column()) {
case 0: return 200;
default: return -1;
}
}
if ( role == Qt::FontRole ) {
switch (index.column()) {
case 0: return nameFont;
default: return valueFont;
}
}
if ( !index.isValid() ) return QVariant ();
if ( role == Qt::DisplayRole ) {
int row = index.row ();
return _routingErrorList->getRow(row)->getColumn(index.column());
}
return QVariant();
}
QVariant RoutingErrorListModel::headerData ( int section
, Qt::Orientation orientation
, int role ) const
{
if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) )
return QVariant();
if ( !_routingErrorList ) {
if ( section == 0 ) return QVariant("RoutingError");
return QVariant();
}
if ( section < _routingErrorList->getColumnCount() )
return _routingErrorList->getColumnName(section);
return QVariant();
}
int RoutingErrorListModel::rowCount ( const QModelIndex& parent ) const
{
return (_routingErrorList) ? _routingErrorList->size() : 0;
}
int RoutingErrorListModel::columnCount ( const QModelIndex& parent ) const
{
return (_routingErrorList) ? _routingErrorList->getColumnCount() : 1;
}
const RoutingError* RoutingErrorListModel::getRoutingError ( int row )
{
if ( !_routingErrorList || ( row >= (int)_routingErrorList->size() ) ) return NULL;
return _routingErrorList->getRow(row)->getRoutingError();
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,218 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./RoutingErrorListWidget.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QFontMetrics>
#include <QLabel>
#include <QLineEdit>
#include <QHeaderView>
#include <QKeyEvent>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QAction>
#include <hurricane/Commons.h>
#include <crlcore/Utilities.h>
#include <solstice/RoutingError.h>
#include <hurricane/viewer/Graphics.h>
#include <solstice/RoutingErrorListModel.h>
#include <solstice/RoutingErrorListWidget.h>
namespace Solstice {
RoutingErrorListWidget::RoutingErrorListWidget ( QWidget* parent )
: QWidget (parent)
, _cellWidget (NULL)
, _cell (NULL)
, _baseModel (new RoutingErrorListModel(this))
, _sortModel (new QSortFilterProxyModel(this))
, _view (new QTableView(this))
, _rowHeight (20)
, _selecteds ()
, _forceReselect(false)
{
setAttribute ( Qt::WA_DeleteOnClose );
setAttribute ( Qt::WA_QuitOnClose, false );
setContextMenuPolicy ( Qt::ActionsContextMenu );
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
_sortModel->setSourceModel ( _baseModel );
_sortModel->setDynamicSortFilter ( true );
_sortModel->setFilterKeyColumn ( 0 );
_view->setShowGrid(false);
_view->setAlternatingRowColors(true);
_view->setSelectionBehavior(QAbstractItemView::SelectRows);
_view->setSortingEnabled(true);
_view->setModel ( _sortModel );
_view->horizontalHeader()->setStretchLastSection ( true );
QHeaderView* horizontalHeader = _view->horizontalHeader ();
horizontalHeader->setStretchLastSection ( true );
horizontalHeader->setMinimumSectionSize ( 200 );
QHeaderView* verticalHeader = _view->verticalHeader ();
verticalHeader->setVisible ( false );
_filterPatternLineEdit = new QLineEdit(this);
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
filterPatternLabel->setBuddy(_filterPatternLineEdit);
QGridLayout* gLayout = new QGridLayout();
gLayout->addWidget(_view , 1, 0, 1, 2);
gLayout->addWidget(filterPatternLabel , 2, 0);
gLayout->addWidget(_filterPatternLineEdit, 2, 1);
setLayout ( gLayout );
QAction* fitErrorAction = new QAction ( tr("&Fit to Error"), this );
fitErrorAction->setShortcut ( QKeySequence(tr("CTRL+F")) );
fitErrorAction->setStatusTip ( tr("Fit the view to the Routing Error bounding box") );
addAction ( fitErrorAction );
connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &))
, this , SLOT (textFilterChanged()) );
connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&))
, this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) );
connect ( _baseModel, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight ()) );
connect ( fitErrorAction , SIGNAL(triggered ()), this, SLOT(fitToError ()) );
resize(300, 300);
}
void RoutingErrorListWidget::fitToError ()
{
const RoutingError* routingError = _baseModel->getRoutingError ( _sortModel->mapToSource(_view->currentIndex()).row() );
if ( routingError )
{
_cellWidget->reframe(routingError->getBoundingBox().getInflated(DbU::lambda(30)),true);
}
}
void RoutingErrorListWidget::forceRowHeight ()
{
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
_view->setRowHeight ( rows, _rowHeight );
}
void RoutingErrorListWidget::goTo ( int delta )
{
if ( delta == 0 ) return;
QModelIndex newIndex = _sortModel->index ( _view->currentIndex().row()+delta, 0, QModelIndex() );
if ( newIndex.isValid() )
_view->selectRow ( newIndex.row() );
}
void RoutingErrorListWidget::updateSelecteds ()
{
_forceReselect = true;
QItemSelection dummy;
updateSelecteds ( dummy, dummy );
}
void RoutingErrorListWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& )
{
if ( _cellWidget ) _cellWidget->openRefreshSession ();
_selecteds.resetAccesses ();
const RoutingError* routingError;
QModelIndexList iList = _view->selectionModel()->selectedRows();
for ( int i=0 ; i<iList.size() ; i++ ) {
routingError = _baseModel->getRoutingError ( _sortModel->mapToSource(iList[i]).row() );
if ( routingError ) {
_selecteds.insert ( routingError );
}
}
if ( _forceReselect ) {
_selecteds.forceInserteds();
_forceReselect = false;
}
SelectedRoutingErrorSet::iterator remove;
SelectedRoutingErrorSet::iterator isel = _selecteds.begin ();
while ( isel != _selecteds.end() ) {
switch ( isel->getAccesses() ) {
case 1: break;
case 64:
for(set<Occurrence>::iterator i = isel->getRoutingError()->getAllOccurrences()->begin();i != isel->getRoutingError()->getAllOccurrences()->end();i++)
{
emit occurrenceSelected ( *i );
}
break;
case 0:
for(set<Occurrence>::iterator i = isel->getRoutingError()->getAllOccurrences()->begin();i != isel->getRoutingError()->getAllOccurrences()->end();i++)
{
emit occurrenceUnselected ( *i );
}
remove = isel;
++isel;
_selecteds.erase ( remove );
continue;
default:
cerr << Bug("RoutingErrorListWidget::updateSelecteds(): invalid code %d"
,isel->getAccesses()) << endl;
}
++isel;
}
if ( _cellWidget ) _cellWidget->closeRefreshSession ();
_cellWidget->refresh();
}
void RoutingErrorListWidget::textFilterChanged ()
{
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
forceRowHeight ();
}
} // End of Hurricane namespace.

View File

@ -0,0 +1,105 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | |
// | Updater : Bodin bruno |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./ShortCircuitError.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <hurricane/Cell.h>
#include <solstice/SolsticeEngine.h>
#include <solstice/ShortCircuitError.h>
#include <string>
namespace Solstice {
using namespace Hurricane;
ShortCircuitError::ShortCircuitError(Cell*cell, const Occurrence&occurrence1, const Occurrence&occurrence2)
: RoutingError(cell,1)
{
_errorOccurrences = new set<Occurrence>;
_errorOccurrences->insert(occurrence1);
_errorOccurrences->insert(occurrence2);
if(occurrence1 < occurrence2) {
_occurrence1 = occurrence2;
_occurrence2 = occurrence1;
}
else {
_occurrence1 = occurrence1;
_occurrence2 = occurrence2;
}
_hypernet1 = SolsticeEngine::getTopNetOccurrence(_occurrence1);
_hypernet2 = SolsticeEngine::getTopNetOccurrence(_occurrence2);
_shortcircuitarea = _occurrence1.getBoundingBox().getIntersection(_occurrence2.getBoundingBox());
// forEach ( Component*, component, dynamic_cast<Net*>(_hypernet1.getEntity())->getComponents() ) {
// _occurrences->insert(Occurrence ( *component , _hypernet1.getPath() ) );
// }
//
// forEach ( Component*, component, dynamic_cast<Net*>(_hypernet2.getEntity())->getComponents() ) {
// _occurrences->insert(Occurrence ( *component , _hypernet2.getPath()) );
// }
//_occurrences->insert(Occurrence(this));
_occurrences->insert(_hypernet1);
_occurrences->insert(_hypernet2);
_area = _occurrence1.getBoundingBox().getUnion(_occurrence2.getBoundingBox());
_area = _shortcircuitarea;
};
string ShortCircuitError::getErrorDescription ()const
{
return "contact invalide entre "
+ (_hypernet1).getEntity()->_getString() + " et "
+ (_hypernet2).getEntity()->_getString() ;
};
const Name& ShortCircuitError::getName () const {return _extensionName;} ;
int ShortCircuitError::getCount() const {return 1;};
set<Occurrence>* ShortCircuitError::getErrorOccurrences () const {return _errorOccurrences;};
string ShortCircuitError::_getString() const
// *****************************************
{
string s = " " + getString(getCell()->getName()) + " : Short-Circuit happen at the position : ";
s += getString(_shortcircuitarea) ;
s += "\n between " + getString(_occurrence1) + " of " + getString(_occurrence1.getBoundingBox()) + " of HyperNet " + getString(_hypernet1);
s += "\n and " + getString(_occurrence2) + " of " + getString(_occurrence2.getBoundingBox()) + " of HyperNet " + getString(_hypernet2);
return s;
}
} // End of Solstice namespace.

View File

@ -0,0 +1,487 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./SolsticeEngine.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <hurricane/DataBase.h>
#include <hurricane/Cell.h>
#include <hurricane/Technology.h>
#include <crlcore/Utilities.h>
#include <crlcore/ToolEngine.h>
#include <equinox/Equi.h>
#include <equinox/Strategy.h>
#include <equinox/IntervalTree.h>
#include <equinox/Tiles.h>
#include <equinox/EquinoxEngine.h>
#include <solstice/Brick.h>
#include <solstice/SolsticeEngine.h>
#include <solstice/BrickSweepLine.h>
#include <solstice/RoutingError.h>
#include <solstice/ShortCircuitError.h>
#include <solstice/DisconnectError.h>
namespace Solstice {
using namespace std;
using namespace Hurricane;
using Equinox::DefaultStrategy;
using Equinox::EquinoxEngine;
using Equinox::Equi;
using Equinox::CompByXmin;
using Equinox::CompByXmax;
// -------------------------------------------------------------------
// Class : "Solstice::SolsticeEngine".
Name SolsticeEngine::_toolName = "Solstice";
Strategy * SolsticeEngine::_strategy = NULL;
void SolsticeEngine::setStrategy (Strategy * s)
{
if (_strategy)
delete _strategy;
_strategy = s;
};
Strategy* SolsticeEngine::getStrategy ()
{
if (!_strategy) {
_strategy = new DefaultStrategy();
}
return _strategy;
}
Cell* SolsticeEngine::getCommonPath(Path path1, Path path2, Path& newpath1, Path& newpath2)
{
Instance * instance1 = path1.getHeadInstance();
Instance * instance2 = path2.getHeadInstance();
Path commonpath;
while(instance1==instance2)
{
if(!instance1) break;
path1 = path1.getTailPath();
path2 = path2.getTailPath();
commonpath = commonpath.isEmpty()?Path(instance1):Path(commonpath, instance1);
if(path1.isEmpty()) break;
if(path2.isEmpty()) break;
instance1 = path1.getHeadInstance();
instance2 = path2.getHeadInstance();
}
newpath1 = path1;
newpath2 = path2;
if (commonpath.isEmpty())
{
return NULL;
}
else
{
return commonpath.getMasterCell();
}
}
SolsticeEngine* SolsticeEngine::create (Cell* cell)
{
SolsticeEngine* solstice = new SolsticeEngine ( cell );
if(!solstice){
throw Error("can't create Solstice : allocation failed");
}
solstice->_postCreate ();
return solstice;
}
void SolsticeEngine::_depthCreate(Cell * cell)
{
forEach(Instance*,instance, cell->getInstances())
{
Cell * subcell = (*instance)->getMasterCell();
SolsticeEngine * solstice = get(subcell);
if( (!(subcell->isLeaf())) && (!solstice) ) {
_depthCreate(subcell);
}
}
SolsticeEngine * solstice = get(cell);
if(!solstice)
create(cell);
}
SolsticeEngine* SolsticeEngine::get (const Cell* cell )
{
return static_cast<SolsticeEngine*>(ToolEngine::get(cell,_toolName));
}
Record* SolsticeEngine::_getRecord () const
{
Record* record = ToolEngine::_getRecord ();
return ( record );
}
SolsticeEngine::~SolsticeEngine ()
{
}
SolsticeEngine::SolsticeEngine (Cell* cell):
ToolEngine(cell),
_isCompared(false),
_routingErrors()
{
_routingErrors = new set<RoutingError*>;
}
void SolsticeEngine::_depthDestroy()
{
if(_cell->isLeaf())
return ;
else {
forEach(Instance*,instance, _cell->getInstances())
{
Cell * cell = (*instance)->getMasterCell();
SolsticeEngine * solstice = get(cell);
if(solstice) solstice->_depthDestroy();
}
this->destroy();
}
}
void SolsticeEngine::compare()
{
// Verify the extractor Equinox
// ******************************
EquinoxEngine * equinox = EquinoxEngine::get(_cell);
if(!equinox){
throw Error("Can't do comparison, because the extractor haven't been created");
}
if(!(equinox->isExtracted())) {
throw Error("Can't do comparison, because the extraction haven't been done");
}
// Create CEngine Solstice for all models except standards models.
// *****************************************************************
_depthCreate(_cell);
// If repeat Comparison, flush those olds errors and reset flags to false.
// *************************************************************************
if(isCompared()) flushErrors();
// Run comparison and Print Statistique datas.
// *********************************************
runComparison();
}
void SolsticeEngine::runComparison()
{
map<Occurrence, set<Equi*> > map_hypernet2hyperequi;
set<Occurrence> hypernets;
EquinoxEngine * equinox = Equinox::EquinoxEngine::get(_cell);
forEach(Equi*,equi, equinox->getRoutingEquis())
{
forEach(Occurrence,occurrence, (*equi)->getAllOccurrences())
{
// Check Net Power/Ground/Global
//*******************************
Net * net = dynamic_cast<Net*>((*occurrence).getEntity());
if(!net)
net = dynamic_cast<Component*>((*occurrence).getEntity())->getNet();
if(net->isGlobal() || net->isGround() || net->isPower()) {
continue;
}
// Add HyperNet
//**************
Occurrence hypernet = getTopNetOccurrence((*occurrence));
#ifdef ASSERT
assert(isHyperNetRootNetOccurrence(hypernet));
#endif
hypernets.insert(hypernet);
map_hypernet2hyperequi[hypernet].insert((*equi));
} //end of forEach occurrence
// ShortCircuits Detection
//*************************
if(hypernets.size() > 1) {
cmess1 << "[BUG] ShortCircuit Detection with " << hypernets.size() << " nets on same Equi" << endl;
for (set<Occurrence>::iterator i = hypernets.begin() ; i!= hypernets.end();i++)
cmess1 << " - Net " << (*i).getEntity()->_getString() << endl;
detectShortCircuit((*equi));
}
hypernets.clear();
} //end of forEach equi
// Disconnects Detection
//***********************
for (map<Occurrence, set<Equi*> >::iterator i = map_hypernet2hyperequi.begin();
i != map_hypernet2hyperequi.end();
i++)
{
if( (*i).second.size()>1 ) {
cmess1 << "[BUG] Disconnection Detection with " << (*i).second.size() << " equi for net " << (*i).first.getEntity()->_getString() << endl;
for (set<Equi*>::iterator j = (*i).second.begin();
j != (*i).second.end();
j++)
{
cmess1 << " - " << (*j) << endl ;
forEach(Occurrence,k,(*j)->getAllOccurrences()) {
cmess1 << " - " << (*k) << endl ;
}
}
this->_routingErrors->insert(DisconnectError::create(getCell(),Occurrence((*i).first),(*i).second.size()));
}
}
map_hypernet2hyperequi.clear();
setIsComparedTrue(_cell);
}
Occurrence SolsticeEngine::getTopNetOccurrence(Occurrence occurrence)
{
Path path = occurrence.getPath();
if( path.isEmpty() ) {
Net * net = dynamic_cast<Net*>(occurrence.getEntity());
if(net) {
return occurrence;
}
else {
Component * component = dynamic_cast<Component*>(occurrence.getEntity());
if(!component)
throw Error("Unknow occurrence in EQUINOX::GetUpperNetOccurrence()");
return Occurrence(component->getNet());
}
}
else {
Net * net = dynamic_cast<Net*>(occurrence.getEntity());
if(net) {
if( !(net->isExternal()) )
return occurrence;
Instance * tailinstance = path.getTailInstance();
Plug * plug = tailinstance->getPlug(net);
if( !(plug->isConnected()) )
return occurrence;
Net * uppernet = plug->getNet();
return getTopNetOccurrence(Occurrence(uppernet, path.getHeadPath()));
}
else {
Component* component = dynamic_cast<Component*>(occurrence.getEntity());
return getTopNetOccurrence(Occurrence(component->getNet(), occurrence.getPath()));
}
}
}
void SolsticeEngine::detectShortCircuit(Equi* equi)
{
// Create Bricks for all component occurrences in this hyper-equi.
// ***************************************************************
vector<Brick*>* BricksByXmin = new vector<Brick*> ;
vector<Brick*>* BricksByXmax = new vector<Brick*> ;
forEach(Occurrence,occurrence, equi->getEquiComponentOccurrences()) {
Occurrence hypernet = getTopNetOccurrence((*occurrence));
Component* component = dynamic_cast<Component*>((*occurrence).getEntity());
Box box = (*occurrence).getBoundingBox();
forEach ( BasicLayer*, i, component->getLayer()->getBasicLayers() )
if (Strategy::isExtractableLayer(*i))
{
Brick * brick = Brick::create(hypernet, (*occurrence), box, *i);
BricksByXmin->push_back(brick);
BricksByXmax->push_back(brick);
}
}
// Sort these two tables.
// *********************
sort< vector<Brick*>::iterator , CompByXmin<Brick*> > ( BricksByXmin->begin(), BricksByXmin->end(), CompByXmin<Brick*>() );
sort< vector<Brick*>::iterator , CompByXmax<Brick*> > ( (BricksByXmax->begin()), BricksByXmax->end(), CompByXmax<Brick*>() );
BrickSweepLine* sweepLine = BrickSweepLine::create(this,getStrategy());
sweepLine->run(BricksByXmin,BricksByXmax,false,0);
}
void SolsticeEngine::setIsComparedTrue(Cell * cell)
{
SolsticeEngine * solstice = get(cell);
solstice->setIsCompared(true);
forEach(Instance*,instance, cell->getInstances())
{
Cell * subcell = (*instance)->getMasterCell();
SolsticeEngine * solstice = get(subcell);
if( (!(subcell->isLeaf())) && (!(solstice->isCompared())) )
setIsComparedTrue(subcell);
}
}
void SolsticeEngine::getAllSolstices(Cell* cell, set<SolsticeEngine*>& solstices)
{
SolsticeEngine* solstice = get(cell);
solstices.insert(solstice);
forEach(Instance*,instance, cell->getInstances())
{
Cell * subcell = (*instance)->getMasterCell();
if( (!(subcell->isLeaf())) )
getAllSolstices(subcell, solstices);
}
}
void SolsticeEngine::insertInterval ( Brick*brick ,stack <Equinox::Interval*>* enumResultStack)
{
while( !(enumResultStack->empty()) ) {
Brick* findedbrick = dynamic_cast<Brick*>(enumResultStack->top());
enumResultStack->pop();
if(findedbrick->getHyperNet()!=brick->getHyperNet()) { // Shorts-Circuits
Occurrence occurrence1 = brick->getComponentOccurrence();
Occurrence occurrence2 = findedbrick->getComponentOccurrence();
Path newpath1;
Path newpath2;
Cell * errorcell = getCommonPath(occurrence1.getPath(), occurrence2.getPath(), newpath1, newpath2);
SolsticeEngine * solstice = NULL;
if(errorcell) {
solstice = get(errorcell);
if(!solstice) {
cout << getString(errorcell) <<endl;
throw Error("Can't get CEngine solstice in function SolsticeEngine::insertInterval");
}
}
else { // If errorcell is Null, the top-model is current model.
solstice = this;
errorcell = _cell;
}
ShortCircuitError* error = ShortCircuitError::create(
errorcell,
Occurrence(occurrence1.getEntity(), newpath1),
Occurrence(occurrence2.getEntity(), newpath2)
);
solstice->_routingErrors->insert(error);
}
}
}
void SolsticeEngine::removeInterval (Brick* item)
{
item->destroy();
}
void SolsticeEngine::clearErrors() {
for(set<RoutingError*>::iterator e = _routingErrors->begin();
e != _routingErrors->end() ;
e++)
(*e)->destroy();
_routingErrors->clear();
};
void SolsticeEngine::flushErrors()
{
forEach(Instance*,instance, _cell->getInstances())
{
Cell * cell = (*instance)->getMasterCell();
SolsticeEngine * solstice = get(cell);
if( (!(cell->isLeaf())) && (solstice->isCompared()) ) {
solstice->flushErrors();
}
}
clearErrors();
setIsCompared(false);
}
}// End of namespace Solstice

View File

@ -0,0 +1,184 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./TabRoutingError.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QComboBox>
#include <hurricane/DataBase.h>
#include <hurricane/Cell.h>
#include <hurricane/Occurrence.h>
#include <hurricane/viewer/Graphics.h>
#include <hurricane/viewer/CellWidget.h>
#include <hurricane/viewer/ControllerWidget.h>
#include "hurricane/viewer/NetInformations.h"
#include <solstice/RoutingError.h>
#include <solstice/RoutingErrorListWidget.h>
#include <solstice/TabRoutingError.h>
namespace Solstice {
// -------------------------------------------------------------------
// Class : "Hurricane::TabRoutingError".
void TabRoutingError::select ( const RoutingError* error)
{
// cout << " TabRoutingError::SELECT" << flush;
forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) {
// cout << " + 1" << flush;
getCellWidget()->select((*occurrence));
}
};
void TabRoutingError::unselect ( const RoutingError* error)
{
// cout << " TabRoutingError::UNSELECT" << flush;
forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) {
// cout << " - 1" << flush;
getCellWidget()->unselect((*occurrence));
}
};
TabRoutingError::TabRoutingError ( QWidget* parent )
: ControllerTab (parent)
, _routingErrorBrowser (new RoutingErrorListWidget())
, _syncRoutingError (new QCheckBox())
, _syncSelection (new QCheckBox())
, _cwCumulativeSelection (false)
{
_routingErrorBrowser->setObjectName ( "controller.tabRoutingError.routingErrorBrowser" );
QVBoxLayout* wLayout = new QVBoxLayout ();
wLayout->setContentsMargins ( 10, 0, 10, 0 );
wLayout->setSpacing ( 0 );
_syncRoutingError->setText ( tr("Sync RoutingError") );
_syncRoutingError->setChecked ( false );
_syncRoutingError->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect ( _syncRoutingError, SIGNAL(toggled(bool)), this, SLOT(setSyncRoutingError(bool)) );
_syncSelection->setText ( tr("Sync Selection") );
_syncSelection->setChecked ( false );
_syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect ( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) );
QHBoxLayout* commands = new QHBoxLayout ();
commands->setContentsMargins ( 0, 0, 0, 0 );
commands->addStretch ();
commands->addWidget ( _syncRoutingError );
commands->addStretch ();
commands->addWidget ( _syncSelection );
commands->addStretch ();
wLayout->addLayout ( commands );
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
wLayout->addWidget ( separator );
wLayout->addWidget ( _routingErrorBrowser );
setLayout ( wLayout );
}
void TabRoutingError::setSyncRoutingError ( bool state )
{
if ( state && getCellWidget() ) {
_routingErrorBrowser->setCell<SimpleNetInformations> ( getCellWidget()->getCell() );
} else {
_routingErrorBrowser->setCell<SimpleNetInformations> ( NULL );
}
}
void TabRoutingError::setSyncSelection ( bool state )
{
if ( state && getCellWidget() && _syncRoutingError->isChecked() ) {
_cwCumulativeSelection = getCellWidget()->cumulativeSelection();
if ( !_cwCumulativeSelection ) {
getCellWidget()->openRefreshSession ();
getCellWidget()->unselectAll ();
getCellWidget()->closeRefreshSession ();
}
getCellWidget()->setShowSelection ( true );
connect ( _routingErrorBrowser,
SIGNAL(routingErrorSelected (const RoutingError*)),
this,
SLOT(select (const RoutingError*)) );
connect ( _routingErrorBrowser,
SIGNAL(routingErrorUnselected(const RoutingError*)),
this,
SLOT(unselect(const RoutingError*)) );
_routingErrorBrowser->updateSelecteds ();
} else {
getCellWidget()->setShowSelection ( false );
getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection );
_routingErrorBrowser->disconnect ( this, SLOT(select (const RoutingError*)) );
_routingErrorBrowser->disconnect ( this, SLOT(unselect(const RoutingError*)) );
}
}
void TabRoutingError::setCell ( Cell* cell )
{
setSyncRoutingError ( _syncRoutingError->isChecked() );
}
void TabRoutingError::setCellWidget ( CellWidget* cellWidget )
{
if ( getCellWidget() != cellWidget ) {
ControllerTab::setCellWidget ( cellWidget );
_routingErrorBrowser->setCellWidget<SimpleNetInformations> ( cellWidget );
if ( getCellWidget() ) {
connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) );
}
setSyncRoutingError ( _syncRoutingError->isChecked() );
}
}
void TabRoutingError::cellPreModificate ()
{
_routingErrorBrowser->setCell<SimpleNetInformations> ( NULL );
}
void TabRoutingError::cellPostModificate ()
{
setSyncRoutingError ( _syncRoutingError->isChecked() );
}
} // End of Solstice namespace.

View File

@ -0,0 +1,143 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./TabRoutingErrorList.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <solstice/TabRoutingErrorList.h>
namespace Solstice {
// -------------------------------------------------------------------
// Class : "Hurricane::TabRoutingErrorList".
TabRoutingErrorList::TabRoutingErrorList ( QWidget* parent )
: ControllerTab (parent)
, _routingErrorListBrowser (new RoutingErrorListWidget())
, _syncRoutingErrorList (new QCheckBox())
, _syncSelection (new QCheckBox())
, _cwCumulativeSelection(false)
{
_routingErrorListBrowser->setObjectName ( "controller.tabRoutingErrorList.routingErrorListBrowser" );
QVBoxLayout* wLayout = new QVBoxLayout ();
wLayout->setContentsMargins ( 10, 0, 10, 0 );
wLayout->setSpacing ( 0 );
_syncRoutingErrorList->setText ( tr("Sync RoutingErrorList") );
_syncRoutingErrorList->setChecked ( false );
_syncRoutingErrorList->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect ( _syncRoutingErrorList, SIGNAL(toggled(bool)), this, SLOT(setSyncRoutingErrorList(bool)) );
_syncSelection->setText ( tr("Sync Selection") );
_syncSelection->setChecked ( false );
_syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect ( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) );
QHBoxLayout* commands = new QHBoxLayout ();
commands->setContentsMargins ( 0, 0, 0, 0 );
commands->addStretch ();
commands->addWidget ( _syncRoutingErrorList );
commands->addStretch ();
commands->addWidget ( _syncSelection );
commands->addStretch ();
wLayout->addLayout ( commands );
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
wLayout->addWidget ( separator );
wLayout->addWidget ( _routingErrorListBrowser );
setLayout ( wLayout );
}
void TabRoutingErrorList::setSyncRoutingErrorList ( bool state )
{
if ( state && getCellWidget() ) {
_routingErrorListBrowser->setCell<SimpleRoutingErrorInformations> ( getCellWidget()->getCell() );
} else {
_routingErrorListBrowser->setCell<SimpleRoutingErrorInformations> ( NULL );
}
}
void TabRoutingErrorList::setSyncSelection ( bool state )
{
if ( state && getCellWidget() && _syncRoutingErrorList->isChecked() ) {
_cwCumulativeSelection = getCellWidget()->cumulativeSelection();
if ( !_cwCumulativeSelection ) {
getCellWidget()->openRefreshSession ();
getCellWidget()->unselectAll ();
getCellWidget()->closeRefreshSession ();
}
getCellWidget()->setShowSelection ( true );
connect ( _routingErrorListBrowser, SIGNAL(occurrenceSelected (const Occurrence)), getCellWidget(), SLOT(select (const Occurrence)) );
connect ( _routingErrorListBrowser, SIGNAL(occurrenceUnselected(const Occurrence)), getCellWidget(), SLOT(unselect(const Occurrence)) );
_routingErrorListBrowser->updateSelecteds ();
} else {
getCellWidget()->setShowSelection ( false );
getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection );
_routingErrorListBrowser->disconnect ( getCellWidget(), SLOT(select (const Occurrence)) );
_routingErrorListBrowser->disconnect ( getCellWidget(), SLOT(unselect(const Occurrence)) );
}
}
void TabRoutingErrorList::setCell ( Cell* cell )
{
setSyncRoutingErrorList ( _syncRoutingErrorList->isChecked() );
}
void TabRoutingErrorList::setCellWidget ( CellWidget* cellWidget )
{
if ( getCellWidget() != cellWidget ) {
ControllerTab::setCellWidget ( cellWidget );
_routingErrorListBrowser->setCellWidget<SimpleRoutingErrorInformations> ( cellWidget );
if ( getCellWidget() ) {
connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) );
}
setSyncRoutingErrorList ( _syncRoutingErrorList->isChecked() );
}
}
void TabRoutingErrorList::cellPreModificate ()
{
_routingErrorListBrowser->setCell<SimpleRoutingErrorInformations> ( NULL );
}
void TabRoutingErrorList::cellPostModificate ()
{
setSyncRoutingErrorList ( _syncRoutingErrorList->isChecked() );
}
} // End of Solstice namespace.

View File

@ -0,0 +1,131 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./GraphicSolsticeEngine.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QObject>
#include "hurricane/Name.h"
#include "hurricane/Net.h"
#include "hurricane/Cell.h"
#include "solstice/RoutingErrorInformations.h"
namespace Solstice {
// -------------------------------------------------------------------
// Class : "RoutingErrorInformations"
RoutingErrorInformations::RoutingErrorInformations ( const RoutingError* error )
: _error(error)
{ }
RoutingErrorInformations::~RoutingErrorInformations ()
{ }
// -------------------------------------------------------------------
// Class : "SimpleRoutingErrorInformations"
int RoutingErrorInformations::getColumnCount ()
{ return 3; }
QVariant RoutingErrorInformations::getColumnName ( int column )
{
switch ( column ) {
case 0: return QVariant(QObject::tr("Cell"));
case 1: return QVariant(QObject::tr("Type"));
case 2: return QVariant(QObject::tr("Description"));
}
return QVariant(QObject::tr("Column Out of Bound"));
}
QVariant RoutingErrorInformations::getColumn ( int column )
{
switch ( column ) {
case 0: return QVariant(getString(getCell()->getName()).c_str());
case 1: return QVariant(getString(getName()).c_str());
case 2: return QVariant(getString(getDescription()).c_str());
}
return QVariant(QObject::tr("Column Out of Bound"));
}
RoutingErrorInformationsVector::~RoutingErrorInformationsVector ()
{ }
void RoutingErrorInformationsVector::addRoutingError ( const RoutingError* error )
{
_errorlist.push_back ( (error) );
}
RoutingErrorInformations* RoutingErrorInformationsVector::getRow ( int row )
{
if ( row >= (int)_errorlist.size() ) return NULL;
return &_errorlist[row];
}
int RoutingErrorInformationsVector::getColumnCount () const
{
return RoutingErrorInformations::getColumnCount();
}
QVariant RoutingErrorInformationsVector::getColumnName ( int column ) const
{
return RoutingErrorInformations::getColumnName ( column );
}
int RoutingErrorInformationsVector::size () const
{
return _errorlist.size();
}
} // End of Solstice namespace.

View File

@ -0,0 +1,145 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./RoutingErrorModel.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QFont>
#include <QApplication>
#include "hurricane/Name.h"
#include "hurricane/Net.h"
#include "hurricane/Cell.h"
#include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/NetInformations.h"
#include "solstice/RoutingErrorModel.h"
#include "solstice/RoutingError.h"
#include "solstice/ShortCircuitError.h"
namespace Solstice {
RoutingErrorModel::RoutingErrorModel ( QObject* parent )
: QAbstractTableModel(parent)
, _cell(NULL)
, _routingError(NULL)
{ }
RoutingErrorModel::~RoutingErrorModel ()
{
if ( _routingError ) delete _routingError;
}
QVariant RoutingErrorModel::data ( const QModelIndex& index, int role ) const
{
static QFont nameFont = Graphics::getFixedFont ( QFont::Bold );
static QFont valueFont = Graphics::getFixedFont ( QFont::Normal, true );
if ( role == Qt::SizeHintRole ) {
switch (index.column()) {
case 0: return 200;
default: return -1;
}
}
if ( role == Qt::FontRole ) {
switch (index.column()) {
case 0: return nameFont;
default: return valueFont;
}
}
if ( !index.isValid() ) return QVariant ();
if ( role == Qt::DisplayRole ) {
int row = index.row ();
return _routingError->getRow(row)->getColumn(index.column());
}
return QVariant();
}
QVariant RoutingErrorModel::headerData ( int section
, Qt::Orientation orientation
, int role ) const
{
if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) )
return QVariant();
if ( !_routingError ) {
if ( section == 0 ) return QVariant("RoutingError");
return QVariant();
}
if ( section < _routingError->getColumnCount() )
return _routingError->getColumnName(section);
return QVariant();
}
int RoutingErrorModel::rowCount ( const QModelIndex& parent ) const
{
return (_routingError) ? _routingError->size() : 0;
}
int RoutingErrorModel::columnCount ( const QModelIndex& parent ) const
{
return (_routingError) ? _routingError->getColumnCount() : 1;
}
const RoutingError* RoutingErrorModel::getRoutingError ( int row )
{
if ( !_routingError || ( row >= (int)_routingError->size() ) ) return NULL;
return _routingError->getRow(row)->getRoutingError();
}
void RoutingErrorModel::setCell ( Cell* cell )
{
if ( _cell != cell ) {
if ( _cell )
delete _routingError;
_cell = cell;
_routingError = new RoutingErrorInformationsVector();
if ( _cell ) {
SolsticeEngine* solstice = SolsticeEngine::get(_cell);
if (solstice) {
forEach(RoutingError*, sce ,getCollection(solstice->getRoutingErrorSet()))
{
_routingError->addRoutingError((*sce));
}
}
}
emit layoutChanged ();
}
}
} // End of Solstice namespace.

View File

@ -0,0 +1,247 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./RoutingErrorWidget.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QFontMetrics>
#include <QLabel>
#include <QLineEdit>
#include <QHeaderView>
#include <QKeyEvent>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QAction>
#include "hurricane/Commons.h"
#include "hurricane/Net.h"
#include "hurricane/viewer/Graphics.h"
#include "solstice/RoutingErrorModel.h"
#include "solstice/RoutingErrorWidget.h"
namespace {
using namespace Hurricane;
} // End of anonymous namespace.
namespace Solstice {
RoutingErrorWidget::RoutingErrorWidget ( QWidget* parent )
: QWidget (parent)
, _cellWidget (NULL)
, _cell (NULL)
, _baseModel (new RoutingErrorModel(this))
, _sortModel (new QSortFilterProxyModel(this))
, _view (new QTableView(this))
, _rowHeight (20)
, _selecteds ()
, _forceReselect(false)
{
setAttribute ( Qt::WA_DeleteOnClose );
setAttribute ( Qt::WA_QuitOnClose, false );
setContextMenuPolicy ( Qt::ActionsContextMenu );
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
_sortModel->setSourceModel ( _baseModel );
_sortModel->setDynamicSortFilter ( true );
_sortModel->setFilterKeyColumn ( 0 );
_view->setShowGrid(false);
_view->setAlternatingRowColors(true);
_view->setSelectionBehavior(QAbstractItemView::SelectRows);
_view->setSortingEnabled(true);
_view->setModel ( _sortModel );
_view->horizontalHeader()->setStretchLastSection ( true );
QHeaderView* horizontalHeader = _view->horizontalHeader ();
horizontalHeader->setStretchLastSection ( true );
horizontalHeader->setMinimumSectionSize ( 200 );
QHeaderView* verticalHeader = _view->verticalHeader ();
verticalHeader->setVisible ( false );
_filterPatternLineEdit = new QLineEdit(this);
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
filterPatternLabel->setBuddy(_filterPatternLineEdit);
QGridLayout* gLayout = new QGridLayout();
gLayout->addWidget(_view , 1, 0, 1, 2);
gLayout->addWidget(filterPatternLabel , 2, 0);
gLayout->addWidget(_filterPatternLineEdit, 2, 1);
setLayout ( gLayout );
QAction* fitAction = new QAction ( tr("&Fit to Error"), this );
fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) );
fitAction->setStatusTip ( tr("Fit the view to the Error's bounding box") );
addAction ( fitAction );
connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &))
, this , SLOT (textFilterChanged()) );
connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&))
, this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) );
connect ( _baseModel, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight ()) );
connect ( fitAction , SIGNAL(triggered ()), this, SLOT(fitToRoutingError ()) );
resize(300, 300);
}
void RoutingErrorWidget::forceRowHeight ()
{
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
_view->setRowHeight ( rows, _rowHeight );
}
void RoutingErrorWidget::goTo ( int delta )
{
if ( delta == 0 ) return;
QModelIndex newIndex = _sortModel->index ( _view->currentIndex().row()+delta, 0, QModelIndex() );
if ( newIndex.isValid() )
_view->selectRow ( newIndex.row() );
}
void RoutingErrorWidget::updateSelecteds ()
{
_forceReselect = true;
QItemSelection dummy;
updateSelecteds ( dummy, dummy );
}
void RoutingErrorWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& )
{
if ( _cellWidget ) _cellWidget->openRefreshSession ();
_selecteds.resetAccesses ();
const RoutingError* error;
QModelIndexList iList = _view->selectionModel()->selectedRows();
for ( int i=0 ; i<iList.size() ; i++ ) {
cout << "yuvhchgc" <<flush;
error = _baseModel->getRoutingError ( _sortModel->mapToSource(iList[i]).row() );
cout << error->getName();
if ( error ) {
_selecteds.insert ( error );
}
}
if ( _forceReselect ) {
_selecteds.forceInserteds();
_forceReselect = false;
}
SelectedRoutingErrorSet::iterator remove;
SelectedRoutingErrorSet::iterator isel = _selecteds.begin ();
while ( isel != _selecteds.end() ) {
switch ( isel->getAccesses() ) {
case 1:
emit routingErrorSelected ( isel->getRoutingError() );
cout << "EMIT NONE" << flush; break;
case 64:
cout << "EMIT SELECT" << flush;
emit routingErrorSelected ( isel->getRoutingError() );
break;
case 0:
cout << "EMIT UNSELECT" << flush;
emit routingErrorUnselected ( isel->getRoutingError() );
remove = isel;
++isel;
_selecteds.erase ( remove );
continue;
default:
cerr << Bug("RoutingErrorWidget::updateSelecteds(): invalid code %d"
,isel->getAccesses()) << endl;
}
++isel;
}
if ( _cellWidget ) _cellWidget->closeRefreshSession ();
}
void RoutingErrorWidget::textFilterChanged ()
{
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
forceRowHeight ();
}
void RoutingErrorWidget::fitToRoutingError ()
{
const RoutingError* routingError = _baseModel->getRoutingError ( _sortModel->mapToSource(_view->currentIndex()).row() );
if ( routingError ) emit routingErrorFitted ( routingError );
}
void RoutingErrorWidget::setCellWidget ( CellWidget* cw )
{
if ( _cellWidget ) {
disconnect ( this, 0, _cellWidget, 0 );
}
_cellWidget = cw;
if ( _cellWidget ) {
setCell ( _cellWidget->getCell() );
/*TODO*/
// connect ( this, SIGNAL(routingErrorFitted(const RoutingError*)), _cellWidget, SLOT(fitToNet (const Net*)) );
} else
setCell ( NULL );
}
void RoutingErrorWidget::setCell ( Cell* cell )
{
_cell = cell;
_view->selectionModel()->clear ();
_baseModel->setCell ( cell );
string windowTitle = "RoutingError" + getString(cell);
setWindowTitle ( tr(windowTitle.c_str()) );
int rows = _sortModel->rowCount ();
for ( rows-- ; rows >= 0 ; rows-- )
_view->setRowHeight ( rows, _rowHeight );
_view->selectRow ( 0 );
_view->resizeColumnToContents ( 0 );
}
} // End of Solstice namespace.

View File

@ -0,0 +1,184 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./TabRoutingError.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QComboBox>
#include <hurricane/DataBase.h>
#include <hurricane/Cell.h>
#include <hurricane/Occurrence.h>
#include <hurricane/viewer/Graphics.h>
#include <hurricane/viewer/CellWidget.h>
#include <hurricane/viewer/ControllerWidget.h>
#include "hurricane/viewer/NetInformations.h"
#include <solstice/RoutingError.h>
#include <solstice/RoutingErrorListWidget.h>
#include <solstice/TabRoutingError.h>
namespace Solstice {
// -------------------------------------------------------------------
// Class : "Hurricane::TabRoutingError".
void TabRoutingError::select ( const RoutingError* error)
{
cout << " TabRoutingError::SELECT" << flush;
forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) {
cout << " + 1" << flush;
getCellWidget()->select((*occurrence));
}
};
void TabRoutingError::unselect ( const RoutingError* error)
{
cout << " TabRoutingError::UNSELECT" << flush;
forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) {
cout << " - 1" << flush;
getCellWidget()->unselect((*occurrence));
}
};
TabRoutingError::TabRoutingError ( QWidget* parent )
: ControllerTab (parent)
, _routingErrorBrowser (new RoutingErrorListWidget())
, _syncRoutingError (new QCheckBox())
, _syncSelection (new QCheckBox())
, _cwCumulativeSelection (false)
{
_routingErrorBrowser->setObjectName ( "controller.tabRoutingError.routingErrorBrowser" );
QVBoxLayout* wLayout = new QVBoxLayout ();
wLayout->setContentsMargins ( 10, 0, 10, 0 );
wLayout->setSpacing ( 0 );
_syncRoutingError->setText ( tr("Sync RoutingError") );
_syncRoutingError->setChecked ( false );
_syncRoutingError->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect ( _syncRoutingError, SIGNAL(toggled(bool)), this, SLOT(setSyncRoutingError(bool)) );
_syncSelection->setText ( tr("Sync Selection") );
_syncSelection->setChecked ( false );
_syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect ( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) );
QHBoxLayout* commands = new QHBoxLayout ();
commands->setContentsMargins ( 0, 0, 0, 0 );
commands->addStretch ();
commands->addWidget ( _syncRoutingError );
commands->addStretch ();
commands->addWidget ( _syncSelection );
commands->addStretch ();
wLayout->addLayout ( commands );
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
wLayout->addWidget ( separator );
wLayout->addWidget ( _routingErrorBrowser );
setLayout ( wLayout );
}
void TabRoutingError::setSyncRoutingError ( bool state )
{
if ( state && getCellWidget() ) {
_routingErrorBrowser->setCell<SimpleNetInformations> ( getCellWidget()->getCell() );
} else {
_routingErrorBrowser->setCell<SimpleNetInformations> ( NULL );
}
}
void TabRoutingError::setSyncSelection ( bool state )
{
if ( state && getCellWidget() && _syncRoutingError->isChecked() ) {
_cwCumulativeSelection = getCellWidget()->cumulativeSelection();
if ( !_cwCumulativeSelection ) {
getCellWidget()->openRefreshSession ();
getCellWidget()->unselectAll ();
getCellWidget()->closeRefreshSession ();
}
getCellWidget()->setShowSelection ( true );
connect ( _routingErrorBrowser,
SIGNAL(routingErrorSelected (const RoutingError*)),
this,
SLOT(select (const RoutingError*)) );
connect ( _routingErrorBrowser,
SIGNAL(routingErrorUnselected(const RoutingError*)),
this,
SLOT(unselect(const RoutingError*)) );
_routingErrorBrowser->updateSelecteds ();
} else {
getCellWidget()->setShowSelection ( false );
getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection );
_routingErrorBrowser->disconnect ( this, SLOT(select (const RoutingError*)) );
_routingErrorBrowser->disconnect ( this, SLOT(unselect(const RoutingError*)) );
}
}
void TabRoutingError::setCell ( Cell* cell )
{
setSyncRoutingError ( _syncRoutingError->isChecked() );
}
void TabRoutingError::setCellWidget ( CellWidget* cellWidget )
{
if ( getCellWidget() != cellWidget ) {
ControllerTab::setCellWidget ( cellWidget );
_routingErrorBrowser->setCellWidget<SimpleNetInformations> ( cellWidget );
if ( getCellWidget() ) {
connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) );
}
setSyncRoutingError ( _syncRoutingError->isChecked() );
}
}
void TabRoutingError::cellPreModificate ()
{
_routingErrorBrowser->setCell<SimpleNetInformations> ( NULL );
}
void TabRoutingError::cellPostModificate ()
{
setSyncRoutingError ( _syncRoutingError->isChecked() );
}
} // End of Solstice namespace.

View File

@ -0,0 +1,110 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./Brick.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_BRICK__
#define __SOLSTICE_BRICK__
namespace Hurricane {
class Occurrence;
class Box;
class BasicLayer;
class Unit;
}
namespace Equinox {
class Interval;
}
namespace Solstice {
using namespace std;
using Equinox::Interval;
using Hurricane::Occurrence;
using Hurricane::Box;
using Hurricane::BasicLayer;
using Hurricane::DbU;
class Brick : public Interval
{
public :
static Brick* create(const Occurrence&, const Occurrence&, const Box&, BasicLayer*);
void destroy();
public :
/**/ bool isEmpty () const;
/**/ string _getString() const;
/**/ const DbU::Unit& getXmin() const;
/**/ const DbU::Unit& getYmin() const;
/**/ const DbU::Unit& getXmax() const;
/**/ const DbU::Unit& getYmax() const;
inline const Box& getBoundingBox();
inline const Occurrence& getHyperNet();
inline const Occurrence& getComponentOccurrence() const;
inline BasicLayer* getBasicLayer();
virtual long GetLowPoint() const;
virtual long GetHighPoint() const;
private :
Occurrence _hypernet;
Occurrence _componentoccurrence;
Box _box;
BasicLayer* _basicLayer;
protected :
Brick(const Occurrence& ,const Occurrence&, const Box&, BasicLayer*);
virtual ~Brick();
private :
Brick(const Brick&);
Brick& operator=(const Brick&);
}; // End of class Brick
// Inline Functions.
inline const Box& Brick::getBoundingBox() { return _box; };
inline const Occurrence& Brick::getHyperNet() { return _hypernet; };
inline const Occurrence& Brick::getComponentOccurrence() const { return _componentoccurrence; };
inline BasicLayer* Brick::getBasicLayer(){ return _basicLayer; };
} // End of Equinox namespace.
#endif // __SOLSTICE_BRICK__

View File

@ -0,0 +1,45 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./BrickSweepLine.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef _SOLSTICE_BRICKSWEEPLINE_H
#define _SOLSTICE_BRICKSWEEPLINE_H
#include "equinox/SweepLine.h"
namespace Equinox {
template<typename ITEM,typename ENGINE>
class SweepLine;
}
namespace Solstice {
class Brick;
class SolsticeEngine;
typedef Equinox::SweepLine<Brick*,SolsticeEngine*> BrickSweepLine;
}
#endif //_SOLSTICE_BRICKSWEEPLINE_H

View File

@ -0,0 +1,76 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | |
// | Updater : Bodin bruno |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./solstice/DisconnectError.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_DISCONNECT_ERROR__
#define __SOLSTICE_DISCONNECT_ERROR__
#include <solstice/RoutingError.h>
namespace Solstice {
class DisconnectError : public RoutingError
{
public :
inline static DisconnectError* create (Cell* cell,
const Occurrence& occurrence,
int count);
public :
//Champs ListBox
inline virtual const Name& getName () const ;
inline virtual string getErrorName () const ;
/**/ virtual string getErrorDescription () const ;
inline virtual set<Occurrence>* getErrorOccurrences () const ;
private :
/**/ DisconnectError (Cell* cell,
const Occurrence& occurrence,
int count);
/**/ virtual ~DisconnectError () ;
private :
/**/ Occurrence _occurrence;
};
//inlines
inline set<Occurrence>* DisconnectError::getErrorOccurrences () const {return _occurrences;};
inline const Name& DisconnectError::getName () const {return _extensionName;} ;
inline string DisconnectError::getErrorName () const {return "Deconnexion";};
inline DisconnectError* DisconnectError::create (Cell* cell, const Occurrence& occurrence, int count) { DisconnectError* de = new DisconnectError (cell,occurrence,count); de->_postCreate(); return de;};
} // End of Solstice namespace.
#endif // __SOLSTICE_DISCONNECT_ERROR__

View File

@ -0,0 +1,112 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./GraphicSolsticeEngine.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_GRAPHIC_SOLSTICE_ENGINE__
#define __SOLSTICE_GRAPHIC_SOLSTICE_ENGINE__
#include <QObject>
#include "crlcore/GraphicToolEngine.h"
// #include "solstice/TabRoutingError.h"
namespace Hurricane {
class Go;
class BasicLayer;
class Transformation;
class CellWidget;
class CellViewer;
}
namespace Solstice {
using Hurricane::Cell;
using Hurricane::Go;
using Hurricane::Box;
using Hurricane::BasicLayer;
using Hurricane::Transformation;
using Hurricane::CellWidget;
using Hurricane::CellViewer;
using CRL::GraphicTool;
using CRL::Name;
class SolsticeEngine;
class TabRoutingErrorList;
// -------------------------------------------------------------------
// Class : "Solstice::GraphicSolsticeEngine".
class GraphicSolsticeEngine : public GraphicTool {
Q_OBJECT;
public:
/**/ static void initSolsticeRoutingError ( CellWidget* );
/**/ static void drawSolsticeRoutingError ( CellWidget*
, const Go*
, const BasicLayer*
, const Box&
, const Transformation&
);
/**/ SolsticeEngine* createEngine ();
/**/ static GraphicSolsticeEngine* grab ();
/**/ virtual const Name& getName () const;
/**/ Cell* getCell ();
/**/ virtual size_t release ();
/**/ virtual void addToMenu ( CellViewer* );
public slots:
/**/ void test ();
private:
static size_t _references;
static GraphicSolsticeEngine*_singleton;
/**/ CellViewer* _viewer;
/**/ TabRoutingErrorList* _tabRoutingErrorList;
protected:
/**/ GraphicSolsticeEngine ();
virtual ~GraphicSolsticeEngine ();
}; //end of class GraphicSolsticeEngine
} // End of Solstice namespace.
#endif // _SOLSTICE__GRAPHIC_SOLSTICE_ENGINE__

View File

@ -0,0 +1,104 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | |
// | Updater : Bodin bruno |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./solstice/RoutingError.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_ROUTING_ERROR__
#define __SOLSTICE_ROUTING_ERROR__
#include <string>
#include <set>
#include <hurricane/DbU.h>
#include <hurricane/Occurrence.h>
#include <hurricane/ExtensionGo.h>
namespace Hurricane {
class Box;
class Net;
class Cell;
class Name;
class Occurrence;
}
namespace Solstice {
using namespace std;
using namespace Hurricane;
class RoutingError : public ExtensionGo
{
public :
inline Cell * getCell () const ;
inline Box getBoundingBox () const ;
inline int getCount () const ;
inline set<Occurrence>* getAllOccurrences () const ;
/**/ virtual set<Occurrence>* getErrorOccurrences () const = 0;
inline void destroy ();
//Champs ListBox
/**/ virtual const Name& getName () const = 0;
/**/ virtual string getErrorName () const = 0;
/**/ virtual string getErrorDescription () const = 0;
//ExtensionGO inherited
/**/ void translate ( const DbU::Unit& dx,
const DbU::Unit& dy );
protected:
inline void _postCreate ();
inline void _preDestroy ();
/**/ RoutingError (Cell * cell,
int count);
virtual ~RoutingError ();
public :
static const Name _extensionName;
protected :
/**/ Cell * _cell;
/**/ Box _area;
/**/ int _count;
/**/ set<Occurrence>* _occurrences;
};
inline Cell * RoutingError::getCell () const { return _cell;};
inline Box RoutingError::getBoundingBox () const { return _area;};
inline set<Occurrence>* RoutingError::getAllOccurrences () const { return _occurrences;};
inline int RoutingError::getCount () const { return _count;};
inline void RoutingError::_postCreate () { ExtensionGo::_postCreate();};
inline void RoutingError::_preDestroy () { ExtensionGo::_preDestroy(); _occurrences->clear(); };
inline void RoutingError::destroy () { _preDestroy(); delete this; };
} // End of Solstice namespace.
INSPECTOR_P_SUPPORT(Solstice::RoutingError);
#endif // __SOLSTICE_ROUTING_ERROR__

View File

@ -0,0 +1,205 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./RoutingErrorInformations.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __ROUTINGERROR_INFORMATIONS_H__
#define __ROUTINGERROR_INFORMATIONS_H__
#include <vector>
#include <QVariant>
#include "hurricane/Commons.h"
namespace Hurricane {
class Cell;
class Name;
}
namespace Solstice {
using Hurricane::Name;
class RoutingError;
// -------------------------------------------------------------------
// Class : "RoutingErrorInformations"
class RoutingErrorInformations {
public:
RoutingErrorInformations ( const RoutingError* routingError );
virtual ~RoutingErrorInformations ();
static int getColumnCount ();
static QVariant getColumnName ( int column );
virtual QVariant getColumn ( int column );
inline const RoutingError* getRoutingError () const;
inline const Name getName () const;
protected:
const RoutingError* _routingError;
};
inline const RoutingError* RoutingErrorInformations::getRoutingError () const
{ return _routingError; }
inline const Name RoutingErrorInformations::getName () const
{ return _routingError->getErrorName(); }
// -------------------------------------------------------------------
// Class : "SimpleRoutingErrorInformations"
class SimpleRoutingErrorInformations : public RoutingErrorInformations {
public:
SimpleRoutingErrorInformations ( const RoutingError* routingError );
virtual ~SimpleRoutingErrorInformations ();
static int getColumnCount ();
static QVariant getColumnName ( int column );
virtual QVariant getColumn ( int column );
inline size_t getPlugsCount () const;
/**/ string getDescription () const;
protected:
size_t _plugsCount;
};
inline size_t SimpleRoutingErrorInformations::getPlugsCount () const
{ return _plugsCount; }
// -------------------------------------------------------------------
// Class : "AbstractRoutingErrorInformationsVector"
class AbstractRoutingErrorInformationsVector {
public:
virtual ~AbstractRoutingErrorInformationsVector ();
virtual void addRoutingError ( const RoutingError* routingError ) = 0;
virtual RoutingErrorInformations* getRow ( int row ) = 0;
virtual int getColumnCount () const = 0;
virtual QVariant getColumnName ( int column ) const = 0;
virtual int size () const = 0;
};
// -------------------------------------------------------------------
// Template Class : "RoutingErrorInformationsVector"
template<typename InformationType>
class RoutingErrorInformationsVector : public AbstractRoutingErrorInformationsVector {
public:
virtual ~RoutingErrorInformationsVector ();
virtual void addRoutingError ( const RoutingError* routingError );
virtual InformationType* getRow ( int row );
virtual int getColumnCount () const;
virtual QVariant getColumnName ( int column ) const;
virtual int size () const;
protected:
vector<InformationType> _routingErrorlist;
};
template<typename InformationType>
RoutingErrorInformationsVector<InformationType>::~RoutingErrorInformationsVector ()
{ }
template<typename InformationType>
void RoutingErrorInformationsVector<InformationType>::addRoutingError ( const RoutingError* routingError )
{
_routingErrorlist.push_back ( InformationType(routingError) );
}
template<typename InformationType>
InformationType* RoutingErrorInformationsVector<InformationType>::getRow ( int row )
{
if ( row >= (int)_routingErrorlist.size() ) return NULL;
return &_routingErrorlist[row];
}
template<typename InformationType>
int RoutingErrorInformationsVector<InformationType>::getColumnCount () const
{
return InformationType::getColumnCount();
}
template<typename InformationType>
QVariant RoutingErrorInformationsVector<InformationType>::getColumnName ( int column ) const
{
return InformationType::getColumnName ( column );
}
template<typename InformationType>
int RoutingErrorInformationsVector<InformationType>::size () const
{
return _routingErrorlist.size();
}
} // End of Hurricane namespace.
#endif // __ROUTINGERROR_INFORMATIONS_H__

View File

@ -0,0 +1,110 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./RoutingErrorListModel.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_ROUTINGERRORLIST_MODEL__
#define __HURRICANE_ROUTINGERRORLIST_MODEL__
#include <vector>
#include <QFont>
#include <QApplication>
#include <QAbstractTableModel>
#include "hurricane/Commons.h"
#include "hurricane/Name.h"
#include "hurricane/Cell.h"
#include "hurricane/viewer/Graphics.h"
#include "solstice/RoutingError.h"
#include "solstice/SolsticeEngine.h"
#include "solstice/RoutingErrorInformations.h"
namespace Hurricane {
class Cell;
}
namespace Solstice {
class RoutingErrorListModel : public QAbstractTableModel {
Q_OBJECT;
public:
RoutingErrorListModel ( QObject* parent=NULL );
~RoutingErrorListModel ();
template<typename InformationType>
void setCell ( Cell* cell );
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 Cell* getCell ();
const RoutingError* getRoutingError ( int row );
private:
Cell* _cell;
AbstractRoutingErrorInformationsVector* _routingErrorList;
};
// Inline Functions.
inline Cell* RoutingErrorListModel::getCell () { return _cell; }
// Template Functions.
template<typename InformationType>
void RoutingErrorListModel::setCell ( Cell* cell )
{
if ( _cell != cell ) {
if ( _cell )
delete _routingErrorList;
_cell = cell;
_routingErrorList = new RoutingErrorInformationsVector<InformationType>();
if ( _cell ) {
SolsticeEngine* solstice = SolsticeEngine::get(_cell);
forEach(RoutingError*, routingError ,getCollection(solstice->getRoutingErrorSet()))
{
_routingErrorList->addRoutingError ( *routingError );
}
}
emit layoutChanged ();
}
}
} // End of Hurricane namespace.
#endif // __ROUTINGERRORLIST_MODEL_H__

View File

@ -0,0 +1,221 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./solstice/RoutingErrorListWidget.h.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_ROUTINGERRORLIST_WIDGET__
#define __HURRICANE_ROUTINGERRORLIST_WIDGET__
#include <set>
#include <QWidget>
#include <QTableView>
#include <QSortFilterProxyModel>
#include "hurricane/Commons.h"
#include "hurricane/Bug.h"
#include "hurricane/viewer/CellWidget.h"
#include "solstice/RoutingErrorListModel.h"
#include "hurricane/viewer/CellWidget.h"
class QSortFilterProxyModel;
class QModelIndex;
class QTableView;
class QLineEdit;
class QComboBox;
class QHeaderView;
namespace Hurricane {
class Cell;
}
namespace Solstice {
using std::set;
class RoutingError;
// -------------------------------------------------------------------
// Class : "SelectedRoutingError".
class SelectedRoutingError {
public:
inline SelectedRoutingError ();
inline SelectedRoutingError ( const RoutingError*, size_t access=0 );
inline const RoutingError* getRoutingError () const;
inline size_t getAccesses () const;
inline void incAccesses () const;
inline void setInserted () const;
inline void resetAccesses () const;
private:
const RoutingError* _routingError;
mutable size_t _accesses;
};
inline SelectedRoutingError::SelectedRoutingError () : _routingError(NULL), _accesses(0) { }
inline SelectedRoutingError::SelectedRoutingError ( const RoutingError* routingError, size_t accesses ) : _routingError(routingError), _accesses(accesses) { }
inline const RoutingError* SelectedRoutingError::getRoutingError () const { return _routingError; }
inline void SelectedRoutingError::setInserted () const { _accesses = 64; }
inline size_t SelectedRoutingError::getAccesses () const { return _accesses; }
inline void SelectedRoutingError::incAccesses () const { ++_accesses; }
inline void SelectedRoutingError::resetAccesses () const { _accesses = 0; }
struct SelectedRoutingErrorCompare {
inline bool operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs );
};
inline bool SelectedRoutingErrorCompare::operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs )
{
return lhs.getRoutingError() < rhs.getRoutingError();
}
// -------------------------------------------------------------------
// Class : "SelectedRoutingErrorSet".
class SelectedRoutingErrorSet : public set<SelectedRoutingError,SelectedRoutingErrorCompare>{
public:
void insert ( const RoutingError* );
void forceInserteds ();
void resetAccesses ();
};
inline void SelectedRoutingErrorSet::insert ( const RoutingError* routingError )
{
iterator iselected = find(SelectedRoutingError(routingError));
if ( iselected != end() ) {
iselected->incAccesses ();
}
else
set<SelectedRoutingError,SelectedRoutingErrorCompare>::insert ( SelectedRoutingError(routingError,64) );
}
inline void SelectedRoutingErrorSet::forceInserteds ()
{
for ( iterator iselected=begin() ; iselected != end() ; ++iselected )
iselected->setInserted ();
}
inline void SelectedRoutingErrorSet::resetAccesses ()
{
for ( iterator iselected=begin() ; iselected != end() ; ++iselected )
iselected->resetAccesses ();
}
// -------------------------------------------------------------------
// Class : "RoutingErrorListWidget".
class RoutingErrorListWidget : public QWidget {
Q_OBJECT;
public:
RoutingErrorListWidget ( QWidget* parent=NULL );
inline Cell* getCell ();
template<typename InformationType>
void setCellWidget ( CellWidget* );
template<typename InformationType>
void setCell ( Cell* );
void goTo ( int );
void updateSelecteds ();
signals:
/**/ void occurrenceSelected ( const Occurrence );
/**/ void occurrenceUnselected ( const Occurrence );
/**/ void routingErrorFitted ( const RoutingError* );
public slots:
void forceRowHeight ();
private slots:
/**/ void fitToError ();
void textFilterChanged ();
void updateSelecteds ( const QItemSelection& , const QItemSelection& );
private:
CellWidget* _cellWidget;
Cell* _cell;
RoutingErrorListModel* _baseModel;
QSortFilterProxyModel* _sortModel;
QTableView* _view;
QLineEdit* _filterPatternLineEdit;
int _rowHeight;
SelectedRoutingErrorSet _selecteds;
bool _forceReselect;
};
template<typename InformationType>
void RoutingErrorListWidget::setCellWidget ( CellWidget* cw )
{
if ( _cellWidget ) {
disconnect ( this, 0, _cellWidget, 0 );
}
_cellWidget = cw;
if ( _cellWidget ) {
setCell<InformationType> ( _cellWidget->getCell() );
/*TODO*/
//connect ( this, SIGNAL(routingErrorFitted(const RoutingError*)), _cellWidget, SLOT(fitToRoutingError (const RoutingError*)) );
} else
setCell<InformationType> ( NULL );
}
template<typename InformationType>
void RoutingErrorListWidget::setCell ( Cell* cell )
{
_cell = cell;
_view->selectionModel()->clear ();
_baseModel->setCell<InformationType> ( cell );
string windowTitle = "RoutingErrorList" + getString(cell);
setWindowTitle ( tr(windowTitle.c_str()) );
int rows = _sortModel->rowCount ();
for ( rows-- ; rows >= 0 ; rows-- )
_view->setRowHeight ( rows, _rowHeight );
_view->selectRow ( 0 );
_view->resizeColumnToContents ( 0 );
}
inline Cell* RoutingErrorListWidget::getCell () { return _cell; }
} // End of Hurricane namespace.
#endif // __HURRICANE_ROUTINGERRORLIST_WIDGET_H__

View File

@ -0,0 +1,117 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | |
// | Updater : Bodin bruno |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./solstice/ShortCircuitError.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_SHORT_CIRCUIT_ERROR__
#define __SOLSTICE_SHORT_CIRCUIT_ERROR__
#include <hurricane/Box.h>
#include <hurricane/Occurrence.h>
#include <solstice/RoutingError.h>
namespace Hurricane {
class Point;
}
namespace Equinox {
class Equi;
}
namespace Solstice {
using Hurricane::Occurrence;
using Hurricane::Point;
using Hurricane::Box;
using namespace std;
class ShortCircuitError : public RoutingError {
public :
inline static ShortCircuitError* create (Cell*,
const Occurrence&,
const Occurrence&);
// Accessors
public:
/**/ virtual const Name& getName () const ;
inline virtual string getErrorName () const ;
/**/ string getErrorDescription () const ;
inline virtual int getCount () const ;
inline virtual set<Occurrence>* getErrorOccurrences () const ;
inline const Occurrence& getOccurrence1 () const;
inline const Occurrence& getOccurrence2 () const;
inline const Box& getShortCircuitArea () const;
inline const Occurrence& getHyperNet1 () const;
inline const Occurrence& getHyperNet2 () const;
inline void setOccurrence1 (const Occurrence occurrence);
inline void setOccurrence2 (const Occurrence occurrence);
/**/ string _getString () const;
/**/ const Point getShortCircuitAreaCenter() const;
private :
/**/ ShortCircuitError (Cell*,
const Occurrence&,
const Occurrence&);
inline ~ShortCircuitError ();
// Attributs
private :
/**/ Occurrence _occurrence1;
/**/ Occurrence _occurrence2;
/**/ Occurrence _hypernet1;
/**/ Occurrence _hypernet2;
/**/ Box _shortcircuitarea;
/**/ set<Occurrence>* _errorOccurrences;
}; // End of class ShortCircuitError
//inline functions
inline string ShortCircuitError::getErrorName () const {return "Court-circuit";};
inline const Occurrence& ShortCircuitError::getOccurrence1 () const { return _occurrence1; };
inline const Occurrence& ShortCircuitError::getOccurrence2 () const { return _occurrence2; };
inline const Box& ShortCircuitError::getShortCircuitArea () const { return _shortcircuitarea; };
inline const Occurrence& ShortCircuitError::getHyperNet1 () const { return _hypernet1; };
inline const Occurrence& ShortCircuitError::getHyperNet2 () const { return _hypernet2; };
inline void ShortCircuitError::setOccurrence1 (const Occurrence occurrence) { _occurrence1 = occurrence; };
inline void ShortCircuitError::setOccurrence2 (const Occurrence occurrence) { _occurrence2 = occurrence; };
inline ShortCircuitError::~ShortCircuitError () {};
inline ShortCircuitError*ShortCircuitError::create (Cell* cell, const Occurrence& o1,const Occurrence& o2) { ShortCircuitError* de = new ShortCircuitError (cell,o1,o2); de->_postCreate(); return de;};
} // End of Solstice namespace.
#endif // __SOLSTICE_SHORT_CIRCUIT_ERROR__

View File

@ -0,0 +1,137 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./solstice/SolsticeEngine.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_SOLSTICE_ENGINE__
#define __SOLSTICE_SOLSTICE_ENGINE__
#include "crlcore/ToolEngine.h"
namespace Hurricane {
class Occurrence;
class Cell;
class Path;
}
namespace Equinox {
class Equi;
class Interval;
class Strategy;
}
namespace Solstice {
using namespace std;
using namespace Hurricane;
using CRL::ToolEngine;
using Equinox::Equi;
using Equinox::Strategy;
class Brick;
class ShortCircuitError;
class RoutingError;
class SolsticeEngine : public ToolEngine {
public:
static SolsticeEngine* create (Cell*);
static SolsticeEngine* get (const Cell* );
static inline Name& getStaticName ();
static Occurrence getTopNetOccurrence (Occurrence occurrence);
protected:
static Strategy * getStrategy ();
static void setStrategy (Strategy *);
static void _depthCreate ( Cell*);
static Cell* getCommonPath (Path path1,
Path path2,
Path& newpath1,
Path& newpath2);
static void setIsComparedTrue (Cell * cell);
static void getAllSolstices (Cell* cell,
set<SolsticeEngine*>& solstices);
public:
virtual inline const Name& getName () const;
virtual Record* _getRecord () const;
virtual inline string _getString () const;
virtual inline string _getTypeName () const;
public :
/**/ inline void destroy ();
/**/ void flushErrors ();
/**/ void compare ();
/**/ void insertInterval (Brick*,
stack <Equinox::Interval*>*enumResultStack);
/**/ void removeInterval (Brick* item);
inline const set<RoutingError*>* getRoutingErrorSet ();
protected :
/**/ void clearErrors ();
inline void setIsCompared (const bool flag);
/**/ void runComparison ();
/**/ void detectShortCircuit (Equi* equi);
inline bool isCompared () const;
private:
// Attributes.
static Strategy * _strategy;
static Name _toolName;
/**/ bool _isCompared;
/**/ set<RoutingError*>* _routingErrors;
protected:
// Constructors & Destructors.
/**/ SolsticeEngine (Cell*);
virtual ~SolsticeEngine ();
virtual inline void _postCreate ();
virtual inline void _preDestroy ();
/**/ void _depthDestroy ();
private:
/**/ SolsticeEngine (const SolsticeEngine&);
/**/ SolsticeEngine& operator= (const SolsticeEngine&);
}; // End of class SolsticeEngine
//inline functions
inline Name& SolsticeEngine::getStaticName () { return _toolName;};
inline bool SolsticeEngine::isCompared () const { return _isCompared; };
inline void SolsticeEngine::setIsCompared (const bool flag) { _isCompared = flag; };
inline const set<RoutingError*>* SolsticeEngine::getRoutingErrorSet () { return _routingErrors;};
inline const Name& SolsticeEngine::getName () const { return _toolName;};
inline string SolsticeEngine::_getString () const { return "<Solstice>";};
inline string SolsticeEngine::_getTypeName () const { return "Solstice";};
inline void SolsticeEngine::_postCreate () { ToolEngine::_postCreate ();};
inline void SolsticeEngine::_preDestroy () { ToolEngine::_preDestroy ();flushErrors();};
inline void SolsticeEngine::destroy () { _preDestroy(); delete this;};
} // End of Solstice namespace.
#endif // __SOLSTICE_SOLSTICE_ENGINE__

View File

@ -0,0 +1,86 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./solstice/TabRoutingError.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_TAB_ROUTINGERROR__
#define __SOLSTICE_TAB_ROUTINGERROR__
#include <QTabWidget>
#include <hurricane/viewer/ControllerWidget.h>
class QCheckBox;
class QComboBox;
namespace Hurricane {
class Cell;
class Occurrence;
}
namespace Solstice {
using Hurricane::Cell;
using Hurricane::CellWidget;
using Hurricane::ControllerTab;
class RoutingError;
class RoutingErrorListWidget;
class TabRoutingError : public ControllerTab {
Q_OBJECT;
public:
TabRoutingError ( QWidget* parent=NULL );
inline RoutingErrorListWidget* getRoutingErrorBrowser ();
inline QCheckBox* getSyncRoutingError ();
inline QCheckBox* getSyncSelection ();
virtual void cellPreModificate ();
virtual void cellPostModificate ();
public slots:
virtual void setCell ( Cell* );
virtual void setCellWidget ( CellWidget* );
virtual void setSyncRoutingError ( bool );
virtual void setSyncSelection ( bool );
void select ( const RoutingError* );
void unselect ( const RoutingError* );
protected:
RoutingErrorListWidget* _routingErrorBrowser;
QCheckBox* _syncRoutingError;
QCheckBox* _syncSelection;
bool _cwCumulativeSelection;
};
inline RoutingErrorListWidget* TabRoutingError::getRoutingErrorBrowser () { return _routingErrorBrowser; }
inline QCheckBox* TabRoutingError::getSyncRoutingError () { return _syncRoutingError; }
inline QCheckBox* TabRoutingError::getSyncSelection () { return _syncSelection; }
}//end of namespace solstice
#endif //TAB_ROUTINGERROR

View File

@ -0,0 +1,65 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./TabRoutingErrorList.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <hurricane/viewer/ControllerWidget.h>
#include <solstice/RoutingErrorListWidget.h>
namespace Solstice {
using Hurricane::ControllerTab;
// -------------------------------------------------------------------
// Class : "Hurricane::TabRoutingErrorList".
class TabRoutingErrorList : public ControllerTab {
Q_OBJECT;
public:
TabRoutingErrorList ( QWidget* parent=NULL );
inline RoutingErrorListWidget* getRoutingErrorListBrowser ();
inline QCheckBox* getSyncRoutingErrorList ();
inline QCheckBox* getSyncSelection ();
virtual void cellPreModificate ();
virtual void cellPostModificate ();
public slots:
virtual void setCell ( Cell* );
virtual void setCellWidget ( CellWidget* );
virtual void setSyncRoutingErrorList ( bool );
virtual void setSyncSelection ( bool );
protected:
RoutingErrorListWidget* _routingErrorListBrowser;
QCheckBox* _syncRoutingErrorList;
QCheckBox* _syncSelection;
bool _cwCumulativeSelection;
};
inline RoutingErrorListWidget* TabRoutingErrorList::getRoutingErrorListBrowser () { return _routingErrorListBrowser; }
inline QCheckBox* TabRoutingErrorList::getSyncRoutingErrorList () { return _syncRoutingErrorList; }
inline QCheckBox* TabRoutingErrorList::getSyncSelection () { return _syncSelection; }
} // End of Solstice namespace.

View File

@ -0,0 +1,110 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Wu Yife |
// | E-mail : Wu.Yifei@lip6.fr |
// | =============================================================== |
// | C++ Header : "./RoutingErrorInformations.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_ROUTINGERROR_INFORMATIONS__
#define __SOLSTICE_ROUTINGERROR_INFORMATIONS__
#include <vector>
#include <QVariant>
#include "hurricane/Commons.h"
#include "solstice/RoutingError.h"
namespace Hurricane {
}
namespace Solstice {
using Hurricane::Name;
using std::vector;
class Cell;
// -------------------------------------------------------------------
// Class : "RoutingErrorInformations"
class RoutingErrorInformations {
public:
RoutingErrorInformations ( const RoutingError* error );
virtual ~RoutingErrorInformations ();
static int getColumnCount ();
static QVariant getColumnName ( int column );
virtual QVariant getColumn ( int column );
inline const RoutingError* getRoutingError () const;
inline const Name getName () const;
inline const string getDescription () const;
inline const Cell* getCell () const;
protected:
const RoutingError* _error;
};
inline const RoutingError* RoutingErrorInformations::getRoutingError () const
{ return _error; }
inline const Name RoutingErrorInformations::getName () const
{
return _error->getName();
}
inline const string RoutingErrorInformations::getDescription () const
{
return _error->getDescription();
}
inline const Cell* RoutingErrorInformations::getCell () const
{
return _error->getCell();
}
// -------------------------------------------------------------------
// Class : "RoutingErrorInformationsVector"
class RoutingErrorInformationsVector {
public:
virtual ~RoutingErrorInformationsVector ();
virtual void addRoutingError ( const RoutingError* error );
virtual RoutingErrorInformations* getRow ( int row );
virtual int getColumnCount () const ;
virtual QVariant getColumnName ( int column ) const ;
virtual int size () const ;
vector<RoutingErrorInformations> _errorlist;
};
} // End of Solstice namespace.
#endif // __ROUTING_ERROR_INFORMATIONS_H__

View File

@ -0,0 +1,80 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./RoutingErrorModel.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_ROUTINGERROR_MODEL__
#define __SOLSTICE_ROUTINGERROR_MODEL__
#include <vector>
#include <QFont>
#include <QApplication>
#include <QAbstractTableModel>
#include "hurricane/Commons.h"
#include "hurricane/Name.h"
#include "hurricane/Net.h"
#include "hurricane/Cell.h"
#include "hurricane/viewer/Graphics.h"
#include "solstice/RoutingErrorInformations.h"
#include "solstice/SolsticeEngine.h"
namespace {
using namespace Hurricane;
} // End of anonymous namespace.
namespace Solstice {
class RoutingErrorModel : public QAbstractTableModel {
Q_OBJECT;
public:
RoutingErrorModel ( QObject* parent=NULL );
~RoutingErrorModel ();
void setCell ( Cell* cell );
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 Cell* getCell ();
const RoutingError* getRoutingError ( int row );
private:
Cell* _cell;
RoutingErrorInformationsVector* _routingError;
};
// Inline Functions.
inline Cell* RoutingErrorModel::getCell () { return _cell; }
} // End of Solstice namespace.
#endif // _SOLSTICE_ROUTINGERROR_MODEL__

View File

@ -0,0 +1,173 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | S O L S T I C E - C o m p a r a t o r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./solstice/RoutingErrorWidget.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __SOLSTICE_ROUTINGERROR_WIDGET__
#define __SOLSTICE_ROUTINGERROR_WIDGET__
#include <set>
#include <QWidget>
#include <QTableView>
#include <QSortFilterProxyModel>
#include "hurricane/Commons.h"
#include "hurricane/Bug.h"
#include "hurricane/viewer/CellWidget.h"
#include "solstice/RoutingErrorModel.h"
class QSortFilterProxyModel;
class QModelIndex;
class QTableView;
class QLineEdit;
class QComboBox;
class QHeaderView;
namespace Solstice {
using std::set;
// -------------------------------------------------------------------
// Class : "SelectedRoutingError".
class SelectedRoutingError {
public:
inline SelectedRoutingError ();
inline SelectedRoutingError ( const RoutingError*,
size_t access=0 );
inline const RoutingError* getRoutingError () const;
inline size_t getAccesses () const;
inline void incAccesses () const;
inline void setInserted () const;
inline void resetAccesses () const;
private:
const RoutingError* _routingError;
mutable size_t _accesses;
};
inline SelectedRoutingError::SelectedRoutingError () : _routingError(NULL), _accesses(0) { }
inline SelectedRoutingError::SelectedRoutingError ( const RoutingError* RoutingError, size_t accesses ) : _routingError(RoutingError), _accesses(accesses) { }
inline const RoutingError* SelectedRoutingError::getRoutingError () const { return _routingError; }
inline void SelectedRoutingError::setInserted () const { _accesses = 64; }
inline size_t SelectedRoutingError::getAccesses () const { return _accesses; }
inline void SelectedRoutingError::incAccesses () const { ++_accesses; }
inline void SelectedRoutingError::resetAccesses () const { _accesses = 0; }
struct SelectedRoutingErrorCompare {
inline bool operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs );
};
inline bool SelectedRoutingErrorCompare::operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs )
{
return lhs.getRoutingError()->getName() < rhs.getRoutingError()->getName();
}
// -------------------------------------------------------------------
// Class : "SelectedRoutingErrorSet".
class SelectedRoutingErrorSet : public set<SelectedRoutingError,SelectedRoutingErrorCompare>{
public:
void insert ( const RoutingError* );
void forceInserteds ();
void resetAccesses ();
};
inline void SelectedRoutingErrorSet::insert ( const RoutingError* RoutingError )
{
iterator iselected = find(SelectedRoutingError(RoutingError));
if ( iselected != end() )
iselected->incAccesses ();
else
set<SelectedRoutingError,SelectedRoutingErrorCompare>::insert ( SelectedRoutingError(RoutingError,64) );
}
inline void SelectedRoutingErrorSet::forceInserteds ()
{
for ( iterator iselected=begin() ; iselected != end() ; ++iselected )
iselected->setInserted ();
}
inline void SelectedRoutingErrorSet::resetAccesses ()
{
for ( iterator iselected=begin() ; iselected != end() ; ++iselected )
iselected->resetAccesses ();
}
// -------------------------------------------------------------------
// Class : "RoutingErrorWidget".
class RoutingErrorWidget : public QWidget {
Q_OBJECT;
public:
RoutingErrorWidget ( QWidget* parent=NULL );
inline Cell* getCell ();
/**/ void setCellWidget ( CellWidget* );
/**/ void setCell ( Cell* );
/**/ void goTo ( int );
/**/ void updateSelecteds ();
signals:
/**/ void routingErrorSelected ( const RoutingError* );
/**/ void routingErrorUnselected ( const RoutingError* );
/**/ void routingErrorFitted ( const RoutingError* );
public slots:
/**/ void forceRowHeight ();
private slots:
/**/ void textFilterChanged ();
/**/ void updateSelecteds ( const QItemSelection& , const QItemSelection& );
/**/ void fitToRoutingError ();
private:
/**/ CellWidget* _cellWidget;
/**/ Cell* _cell;
/**/ RoutingErrorModel* _baseModel;
/**/ QSortFilterProxyModel* _sortModel;
/**/ QTableView* _view;
/**/ QLineEdit* _filterPatternLineEdit;
/**/ int _rowHeight;
/**/ SelectedRoutingErrorSet _selecteds;
/**/ bool _forceReselect;
};
inline Cell* RoutingErrorWidget::getCell () { return _cell; }
} // End of Hurricane namespace.
#endif // __SOLSTICE_ROUTINGERROR_WIDGET_H__