New Library Manager Widget. Access with Tools menu or CTRL+M.
* New: In CRL Core, created a LibraryManager widget. It provides a composite information based on what is present, for each Alliance library: 1. - A Cell in memory, without Catalog::State. 2. - A Catalog::State, with or whithout the Cell in memory. 3. - The files of the Cell in the librariy's directory. 4. - A file with a format referenced for one of the importers. File type recognition is based *only* on the file extension, so it may easily confused. Be careful about what you put in the library's directory. One of the big limitation is that it will not display Hurricane libraries that do not have the AllianceLibrary extension. This widget is put in a separate library <libmanager>, included in the default CRLCORE_LIBRARIES. * Change: In CRL Core, in State (through the loader), now sets the InMemory flag (event if nobody uses it yet...). Display it in the state _getString(). In AllianceFramework, new getAllianceLibraries() method. In CatalogExtension, make the static method "get()" publicly accessible, for sometimes we want the whole State. * Bug: In vlsisapd, in Path, the pathcache was not rebuild when it should, leading to incorrect results. * New: In vlsisapd, in Path, added a listdir() method to access the contents of a directory and a stat() method to poll the status of a file/directory. Rename the ".string()" method in ".toString()" to avoid tricky name resolution with std::string, refactor in all the other tools. * Change: In Hurricane, in Controller, no longer oversize the fonts of the table's headers. * New: In Unicorn, in UnicornGui, integrate LibraryManager.
This commit is contained in:
parent
06e5e3060c
commit
a2d4f01ca3
|
@ -31,6 +31,14 @@ IF(UNIX)
|
|||
DOC "The ${CORIOLIS_INCLUDE_PATH_DESCRIPTION}"
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LIBMANAGER_LIBRARY_PATH
|
||||
NAMES libmanager
|
||||
PATHS ${CORIOLIS_DIR_SEARCH}
|
||||
PATH_SUFFIXES lib${LIB_SUFFIX}
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${CORIOLIS_INCLUDE_PATH_DESCRIPTION}"
|
||||
)
|
||||
|
||||
FIND_PATH(CORIOLIS_PYTHON_INCLUDE_PATH
|
||||
NAMES crlcore/PyAllianceFramework.h
|
||||
PATHS ${CORIOLIS_DIR_SEARCH}
|
||||
|
@ -48,6 +56,7 @@ IF(UNIX)
|
|||
)
|
||||
|
||||
SET_LIBRARIES_PATH(CORIOLIS CRLCORE)
|
||||
SET_LIBRARIES_PATH(CORIOLIS LIBMANAGER)
|
||||
SET_LIBRARIES_PATH(CORIOLIS_PYTHON CORIOLIS_PYTHON)
|
||||
|
||||
HURRICANE_CHECK_LIBRARIES(CORIOLIS)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
add_subdirectory(ccore)
|
||||
add_subdirectory(LibraryManager)
|
||||
add_subdirectory(pyCRL)
|
||||
add_subdirectory(cyclop)
|
||||
add_subdirectory(x2y)
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
# -*- explicit-buffer-name: "CMakeLists.txt<crlcore/src/LibraryManager>" -*-
|
||||
|
||||
include_directories( ${CRLCORE_SOURCE_DIR}/src/LibraryManager
|
||||
${CRLCORE_SOURCE_DIR}/src/ccore
|
||||
${CRLCORE_SOURCE_DIR}/src/ccore/bookshelf
|
||||
${CRLCORE_SOURCE_DIR}/src/ccore/alliance/ap
|
||||
${CRLCORE_SOURCE_DIR}/src/ccore/alliance/vst
|
||||
${CONFIGURATION_INCLUDE_DIR}
|
||||
${HURRICANE_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
set( cpps ViewsModel.cpp
|
||||
ViewsWidget.cpp
|
||||
CellDatas.cpp
|
||||
CellsModel.cpp
|
||||
CellsWidget.cpp
|
||||
LibrariesModel.cpp
|
||||
LibrariesWidget.cpp
|
||||
LibraryManager.cpp
|
||||
)
|
||||
set( includes crlcore/CellDatas.h
|
||||
)
|
||||
set( mocincludes crlcore/ViewsModel.h
|
||||
crlcore/ViewsWidget.h
|
||||
crlcore/CellsModel.h
|
||||
crlcore/CellsWidget.h
|
||||
crlcore/LibrariesModel.h
|
||||
crlcore/LibrariesWidget.h
|
||||
crlcore/LibraryManager.h
|
||||
)
|
||||
|
||||
qtX_wrap_cpp( moccpps ${mocincludes} )
|
||||
|
||||
add_library( libmanager ${cpps} ${moccpps} )
|
||||
set_target_properties( libmanager PROPERTIES VERSION 1.0 SOVERSION 1 )
|
||||
target_link_libraries( libmanager crlcore
|
||||
${HURRICANE_PYTHON_LIBRARIES}
|
||||
${HURRICANE_GRAPHICAL_LIBRARIES}
|
||||
${HURRICANE_LIBRARIES}
|
||||
${BOOKSHELF_LIBRARY}
|
||||
${CONFIGURATION_LIBRARY}
|
||||
${CIF_LIBRARY}
|
||||
${AGDS_LIBRARY}
|
||||
${UTILITIES_LIBRARY}
|
||||
${LEFDEF_LIBRARIES}
|
||||
${OA_LIBRARIES}
|
||||
${QtX_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
||||
${LIBXML2_LIBRARIES}
|
||||
${PYTHON_LIBRARIES} -lutil
|
||||
)
|
||||
|
||||
install( TARGETS libmanager DESTINATION lib${LIB_SUFFIX} )
|
||||
install( FILES ${includes} ${mocincludes} DESTINATION include/coriolis2/crlcore )
|
|
@ -0,0 +1,123 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./CellDatas.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "crlcore/Catalog.h"
|
||||
#include "crlcore/CellDatas.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Error;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellLoaders".
|
||||
|
||||
|
||||
CellLoaders* CellLoaders::_singleton = NULL;
|
||||
unsigned int CellLoaders::_loaderBit = 16;
|
||||
unsigned int CellLoaders::_loaderBitMask = 0xFFFF0000;
|
||||
|
||||
|
||||
CellLoaders* CellLoaders::get ()
|
||||
{
|
||||
if (not _singleton) _singleton = new CellLoaders ();
|
||||
return _singleton;
|
||||
}
|
||||
|
||||
|
||||
CellLoaders::CellLoaders ()
|
||||
: _loaders()
|
||||
{ }
|
||||
|
||||
|
||||
CellLoaders::~CellLoaders ()
|
||||
{ for ( auto iloader : _loaders ) delete iloader; }
|
||||
|
||||
|
||||
unsigned int CellLoaders::lmask () { return _loaderBitMask; }
|
||||
|
||||
|
||||
const CellLoader* CellLoaders::getLoader ( string format ) const
|
||||
{
|
||||
CellLoader key ( format, "", CellLoader::NoFlags, 0 );
|
||||
auto iloader = _loaders.find( &key );
|
||||
if (iloader == _loaders.end()) return NULL;
|
||||
return *iloader;
|
||||
}
|
||||
|
||||
|
||||
const CellLoader* CellLoaders::getLoader ( unsigned int bit ) const
|
||||
{
|
||||
for ( auto iloader : _loaders ) {
|
||||
if (iloader->getFlags() & bit) return iloader;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CellLoaders::addLoader ( CellLoader* loader )
|
||||
{
|
||||
if (getLoader(loader->getFormat())) {
|
||||
cerr << Error( "CellLoaders::addLoader(): Attemp to add multiple loaders for format <%s>."
|
||||
, loader->getFormat().c_str()
|
||||
) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
loader->setFlags( (1 << _loaderBit++) );
|
||||
_loaders.insert( loader );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellDatas".
|
||||
|
||||
|
||||
Utilities::Path CellDatas::_libraryPath;
|
||||
|
||||
|
||||
CellDatas::CellDatas ( string name )
|
||||
: _name (name)
|
||||
, _flags (0)
|
||||
, _activeFlags(0)
|
||||
, _cell (NULL)
|
||||
, _state (NULL)
|
||||
{ }
|
||||
|
||||
|
||||
CellDatas::CellDatas ( Cell* cell )
|
||||
: _name ()
|
||||
, _flags (0)
|
||||
, _activeFlags(0)
|
||||
, _cell (cell)
|
||||
, _state (NULL)
|
||||
{
|
||||
if (cell) {
|
||||
_name = getString(_cell->getName());
|
||||
_state = CatalogExtension::get( cell );
|
||||
}
|
||||
else
|
||||
_name = "[ERROR] NULL Cell";
|
||||
}
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,260 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./CellsModel.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include "vlsisapd/utilities/Path.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/Cells.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "crlcore/Catalog.h"
|
||||
#include "crlcore/AcmSigda.h"
|
||||
#include "crlcore/Ispd05Bookshelf.h"
|
||||
#include "crlcore/Blif.h"
|
||||
#include "crlcore/Iccad04Lefdef.h"
|
||||
#include "crlcore/CellsModel.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::ForEachIterator;
|
||||
using Hurricane::Error;
|
||||
using Hurricane::Library;
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellsModel".
|
||||
|
||||
|
||||
ALibraryMap CellsModel::_libraries;
|
||||
|
||||
|
||||
void CellsModel::deleteStaticDatas ()
|
||||
{
|
||||
for ( auto ilibrary : _libraries ) {
|
||||
for ( auto cellDatas : ilibrary.second ) {
|
||||
delete cellDatas;
|
||||
}
|
||||
}
|
||||
_libraries.clear();
|
||||
}
|
||||
|
||||
|
||||
CellsModel::CellsModel ( QObject* parent )
|
||||
: QAbstractTableModel(parent)
|
||||
, _ilibrary (_libraries.end())
|
||||
{
|
||||
if (_libraries.empty()) {
|
||||
_ilibrary = _libraries.insert( make_pair((const AllianceLibrary*)NULL,vector<CellDatas*>()) ).first;
|
||||
}
|
||||
|
||||
CellLoaders* loaders = CellLoaders::get();
|
||||
if (loaders->empty()) {
|
||||
loaders->addLoader( new CellLoader("vbe"
|
||||
, "VHDL Behavioral"
|
||||
, CellLoader::Native
|
||||
, Catalog::State::Logical ) );
|
||||
loaders->addLoader( new CellLoader("vst"
|
||||
, "VHDL Structural"
|
||||
, CellLoader::Native
|
||||
, Catalog::State::Logical ) );
|
||||
loaders->addLoader( new CellLoader("ap"
|
||||
, "Alliance Physical"
|
||||
, CellLoader::Native
|
||||
, Catalog::State::Physical) );
|
||||
loaders->addLoader( new CellLoader("bench"
|
||||
, "ACM/SIGDA (aka MCNC)"
|
||||
, CellLoader::Importer
|
||||
, Catalog::State::Logical
|
||||
, std::bind( &AcmSigda::load, placeholders::_1 ) ) );
|
||||
loaders->addLoader( new CellLoader("aux"
|
||||
, "ISPD'05 (Bookshelf)"
|
||||
, CellLoader::Importer
|
||||
, Catalog::State::Logical|Catalog::State::Physical
|
||||
, std::bind( &Ispd05::load, placeholders::_1 ) ) );
|
||||
loaders->addLoader( new CellLoader("blif"
|
||||
, "BLIF (Yosys/ABC)"
|
||||
, CellLoader::Importer|CellLoader::MultiCell
|
||||
, Catalog::State::Logical
|
||||
, std::bind( &Blif::load, placeholders::_1 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CellsModel::~CellsModel ()
|
||||
{ }
|
||||
|
||||
|
||||
QVariant CellsModel::data ( const QModelIndex& index, int role ) const
|
||||
{
|
||||
static QFont nameFont = Graphics::getFixedFont( QFont::Bold );
|
||||
static QFont valueFont = Graphics::getFixedFont( QFont::Normal, false );
|
||||
static QFont loadedFont = Graphics::getFixedFont( QFont::Normal, true );
|
||||
|
||||
if (role == Qt::FontRole) {
|
||||
if (index.column() == 1) return valueFont;
|
||||
|
||||
const Catalog::State* state = getCellDatas(index.row())->getState();
|
||||
if (state and state->isInMemory() )
|
||||
return loadedFont;
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if ( (not getLibrary()) or (not index.isValid()) ) return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (index.column() == 0) return getCellDatas(index.row())->getName().c_str();
|
||||
if (index.column() == 1) {
|
||||
string s;
|
||||
const Catalog::State* state = getCellDatas(index.row())->getState();
|
||||
|
||||
if (state) s = getString(state);
|
||||
else s = ">>>>>>";
|
||||
s += (getCellDatas(index.row())->isInMemory()) ? "M" : "-";
|
||||
|
||||
return s.c_str();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QVariant CellsModel::headerData ( int section
|
||||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if (orientation == Qt::Vertical) return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont( QFont::Bold, false, false, +0 );
|
||||
|
||||
if (role == Qt::FontRole ) return headerFont;
|
||||
if (role != Qt::DisplayRole) return QVariant();
|
||||
|
||||
switch ( section ) {
|
||||
case 0: return QVariant("Name");
|
||||
case 1: return QVariant("State");
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
Qt::ItemFlags CellsModel::flags ( const QModelIndex& index ) const
|
||||
{
|
||||
Qt::ItemFlags flags = QAbstractTableModel::flags(index);
|
||||
|
||||
//if (index.isValid() and (getCellDatas(index.row())->getState()->isInMemory() ) )
|
||||
// return Qt::NoItemFlags;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
int CellsModel::rowCount ( const QModelIndex& parent ) const
|
||||
{ return getCellsDatas().size(); }
|
||||
|
||||
|
||||
int CellsModel::columnCount ( const QModelIndex& parent ) const
|
||||
{ return 2; }
|
||||
|
||||
|
||||
CellDatas* CellsModel::getCellDatas ( int row ) const
|
||||
{
|
||||
if (row >= (int)getCellsDatas().size()) return NULL;
|
||||
return const_cast<CellDatas*>( getCellsDatas()[row] );
|
||||
}
|
||||
|
||||
|
||||
void CellsModel::emitDataChanged ( const QModelIndex& index )
|
||||
{
|
||||
emit layoutAboutToBeChanged();
|
||||
emit dataChanged( index, index );
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
|
||||
void CellsModel::updateLibrary ()
|
||||
{
|
||||
const AllianceLibrary* library = getLibrary();
|
||||
_ilibrary = _libraries.end();
|
||||
|
||||
setLibrary( library );
|
||||
}
|
||||
|
||||
|
||||
void CellsModel::setLibrary ( const AllianceLibrary* library )
|
||||
{
|
||||
if (getLibrary() == library) return;
|
||||
|
||||
_ilibrary = _libraries.find( (const AllianceLibrary*)library );
|
||||
if (_ilibrary == _libraries.end()) {
|
||||
_ilibrary = _libraries.insert( make_pair(library,vector<CellDatas*>()) ).first;
|
||||
}
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
if (not getLibrary()) return;
|
||||
|
||||
Catalog* catalog = AllianceFramework::get()->getCatalog();
|
||||
CellLoaders* loaders = CellLoaders::get();
|
||||
|
||||
forEach ( Cell*, icell, library->getLibrary()->getCells() ) {
|
||||
CellDatas* datas = new CellDatas(*icell);
|
||||
getCellsDatas().push_back( datas );
|
||||
}
|
||||
std::sort( getCellsDatas().begin(), getCellsDatas().end(), LessCellDatas );
|
||||
|
||||
Utilities::Path libraryPath ( getString(getLibrary()->getPath()) );
|
||||
CellDatas::setLibraryPath( libraryPath );
|
||||
|
||||
vector<Utilities::Path> cellFiles = libraryPath.listdir();
|
||||
for ( Utilities::Path cellFile : cellFiles ) {
|
||||
const CellLoader* loader = loaders->getLoader( cellFile.ext() );
|
||||
if (not loader) continue;
|
||||
|
||||
bool added = false;
|
||||
string cellName = cellFile.basename("."+cellFile.ext()).toString();
|
||||
CellDatas* key = new CellDatas( cellName );
|
||||
|
||||
auto idatas = lower_bound( getCellsDatas().begin(), getCellsDatas().end(), key, LessCellDatas );
|
||||
if ( (idatas == getCellsDatas().end())
|
||||
or ((*idatas)->getName() != cellName ) ) {
|
||||
getCellsDatas().push_back( key );
|
||||
key->setState( catalog->getState(cellName) );
|
||||
|
||||
added = true;
|
||||
} else {
|
||||
delete key;
|
||||
key = *idatas;
|
||||
}
|
||||
|
||||
key->setFlags( loader->getFlags() & CellLoaders::lmask() );
|
||||
|
||||
if (added) std::sort( getCellsDatas().begin(), getCellsDatas().end(), LessCellDatas );
|
||||
}
|
||||
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,100 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./CellsWidget.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QVBoxLayout>
|
||||
#include <QAction>
|
||||
#include <QModelIndex>
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "crlcore/CellsModel.h"
|
||||
#include "crlcore/CellsWidget.h"
|
||||
#include "crlcore/LibraryManager.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
CellsWidget::CellsWidget ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _baseModel (new CellsModel(this))
|
||||
, _view (new QTableView(this))
|
||||
, _rowHeight (20)
|
||||
, _selected ()
|
||||
{
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setAttribute( Qt::WA_QuitOnClose, false );
|
||||
setContextMenuPolicy( Qt::ActionsContextMenu );
|
||||
|
||||
_rowHeight = QFontMetrics( Graphics::getFixedFont() ).height() + 4;
|
||||
|
||||
_view->setShowGrid ( false );
|
||||
_view->setAlternatingRowColors( true );
|
||||
_view->setSelectionMode ( QAbstractItemView::SingleSelection );
|
||||
_view->setSelectionBehavior ( QAbstractItemView::SelectRows );
|
||||
_view->setSortingEnabled ( true );
|
||||
_view->setModel ( _baseModel );
|
||||
_view->resizeColumnToContents ( 0 );
|
||||
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader();
|
||||
horizontalHeader->setStretchLastSection( true );
|
||||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader();
|
||||
verticalHeader->setVisible( false );
|
||||
verticalHeader->setDefaultSectionSize( _rowHeight );
|
||||
|
||||
QLabel* title = new QLabel( "Cells" );
|
||||
title->setFont( Graphics::getFixedFont(QFont::Bold,false,false,+1) );
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->addWidget( title, 0, Qt::AlignHCenter );
|
||||
vLayout->addWidget( _view );
|
||||
setLayout( vLayout );
|
||||
|
||||
connect( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&))
|
||||
, this , SLOT (selectCurrent (const QModelIndex&,const QModelIndex&)) );
|
||||
}
|
||||
|
||||
|
||||
void CellsWidget::setLibrary ( const AllianceLibrary* library )
|
||||
{
|
||||
_baseModel->setLibrary( library );
|
||||
_view->resizeColumnToContents ( 0 );
|
||||
_view->selectRow( 0 );
|
||||
|
||||
emit selectCurrent( _view->currentIndex(), _view->currentIndex() );
|
||||
}
|
||||
|
||||
|
||||
void CellsWidget::updateSelected ()
|
||||
{ if (_selected.isValid()) _baseModel->emitDataChanged(_selected); }
|
||||
|
||||
|
||||
void CellsWidget::selectCurrent ( const QModelIndex& index, const QModelIndex& )
|
||||
{
|
||||
if (index.isValid()) {
|
||||
_selected = index;
|
||||
emit selectedCell( _baseModel->getCellDatas(index.row()) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,107 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./LibrariesModel.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "crlcore/LibrariesModel.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
LibrariesModel::LibrariesModel ( QObject* parent )
|
||||
: QAbstractTableModel(parent)
|
||||
, _libraries (AllianceFramework::get()->getAllianceLibraries())
|
||||
{ }
|
||||
|
||||
|
||||
LibrariesModel::~LibrariesModel ()
|
||||
{ }
|
||||
|
||||
|
||||
QVariant LibrariesModel::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::FontRole) {
|
||||
// if (index.row() == 0) return QVariant();
|
||||
// switch (index.column()) {
|
||||
// case 0: return nameFont;
|
||||
// default: return valueFont;
|
||||
// }
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (not index.isValid()) return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
int column = index.column ();
|
||||
if (column == 0) return index.row();
|
||||
if (column == 1) return getString( _libraries[index.row()]->getLibrary()->getName() ).c_str();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QVariant LibrariesModel::headerData ( int section
|
||||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if (orientation == Qt::Vertical) return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont( QFont::Bold, false, false, +0 );
|
||||
|
||||
if (role == Qt::FontRole ) return headerFont;
|
||||
if (role != Qt::DisplayRole) return QVariant();
|
||||
|
||||
switch ( section ) {
|
||||
case 0: return QVariant("Order");
|
||||
case 1: return QVariant("Name");
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
int LibrariesModel::rowCount ( const QModelIndex& parent ) const
|
||||
{ return _libraries.size(); }
|
||||
|
||||
|
||||
int LibrariesModel::columnCount ( const QModelIndex& parent ) const
|
||||
{ return 2; }
|
||||
|
||||
|
||||
const AllianceLibrary* LibrariesModel::getLibrary ( const QModelIndex& index )
|
||||
{
|
||||
if ( (not index.isValid()) or (index.row() >= (int)_libraries.size()) ) return NULL;
|
||||
return _libraries[index.row()];
|
||||
}
|
||||
|
||||
|
||||
const AllianceLibrary* LibrariesModel::getLibrary ( size_t index )
|
||||
{
|
||||
if (index > _libraries.size()) return NULL;
|
||||
return _libraries[index];
|
||||
}
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,91 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./LibrariesWidget.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QVBoxLayout>
|
||||
#include <QAction>
|
||||
#include <QModelIndex>
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "crlcore/LibrariesModel.h"
|
||||
#include "crlcore/LibrariesWidget.h"
|
||||
#include "crlcore/LibraryManager.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
LibrariesWidget::LibrariesWidget ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _baseModel (new LibrariesModel(this))
|
||||
, _view (new QTableView(this))
|
||||
, _rowHeight (20)
|
||||
{
|
||||
setAttribute ( Qt::WA_DeleteOnClose );
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
setContextMenuPolicy ( Qt::ActionsContextMenu );
|
||||
|
||||
_rowHeight = QFontMetrics( Graphics::getFixedFont() ).height() + 4;
|
||||
|
||||
_view->setShowGrid ( false );
|
||||
_view->setAlternatingRowColors( true );
|
||||
_view->setSelectionMode ( QAbstractItemView::SingleSelection );
|
||||
_view->setSelectionBehavior ( QAbstractItemView::SelectRows );
|
||||
_view->setSortingEnabled ( true );
|
||||
_view->setModel ( _baseModel );
|
||||
_view->resizeColumnToContents ( 1 );
|
||||
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader();
|
||||
horizontalHeader->setStretchLastSection( true );
|
||||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader();
|
||||
verticalHeader->setVisible( false );
|
||||
verticalHeader->setDefaultSectionSize( _rowHeight );
|
||||
|
||||
QLabel* title = new QLabel( "Libraries" );
|
||||
title->setFont( Graphics::getFixedFont(QFont::Bold,false,false,+1) );
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->addWidget( title, 0, Qt::AlignHCenter );
|
||||
vLayout->addWidget( _view );
|
||||
setLayout( vLayout );
|
||||
|
||||
connect( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&))
|
||||
, this , SLOT (selectCurrent (const QModelIndex&,const QModelIndex&)) );
|
||||
|
||||
resize( 100, 300 );
|
||||
}
|
||||
|
||||
|
||||
void LibrariesWidget::initSelection ()
|
||||
{ _view->selectRow( 0 ); }
|
||||
|
||||
|
||||
void LibrariesWidget::selectCurrent ( const QModelIndex& index, const QModelIndex& )
|
||||
{
|
||||
if (index.isValid())
|
||||
emit selectedLibrary( _baseModel->getLibrary(index) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,140 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./LibraryManager.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QAction>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSplitter>
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/CellViewer.h"
|
||||
#include "crlcore/LibraryManager.h"
|
||||
#include "crlcore/LibrariesWidget.h"
|
||||
#include "crlcore/CellsWidget.h"
|
||||
#include "crlcore/CellsModel.h"
|
||||
#include "crlcore/ViewsWidget.h"
|
||||
#include "crlcore/ViewsModel.h"
|
||||
#include "crlcore/CellDatas.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Error;
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
LibraryManager::LibraryManager ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _librariesWidget(new LibrariesWidget())
|
||||
, _cellsWidget (new CellsWidget())
|
||||
, _viewsWidget (new ViewsWidget())
|
||||
, _cellViewer (NULL)
|
||||
, _libPath (NULL)
|
||||
{
|
||||
setObjectName ( "libraryManager" );
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
setWindowTitle( tr("Library Manager") );
|
||||
|
||||
QSplitter* splitter = new QSplitter();
|
||||
splitter->addWidget( _librariesWidget );
|
||||
splitter->addWidget( _cellsWidget );
|
||||
splitter->addWidget( _viewsWidget );
|
||||
|
||||
QFrame* separator = new QFrame ();
|
||||
separator->setFrameShape ( QFrame::HLine );
|
||||
separator->setFrameShadow( QFrame::Sunken );
|
||||
|
||||
QLabel* libTitle = new QLabel ();
|
||||
libTitle->setTextFormat( Qt::RichText );
|
||||
libTitle->setText( "<b>Library Path:</b>" );
|
||||
|
||||
_libPath = new QLabel ();
|
||||
_libPath->setFont ( Graphics::getFixedFont() );
|
||||
_libPath->setTextFormat( Qt::RichText );
|
||||
_libPath->setText( "<undefined>" );
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout ();
|
||||
vLayout->addWidget( splitter, 1, 0 );
|
||||
vLayout->addWidget( separator );
|
||||
vLayout->addWidget( libTitle, 0, Qt::AlignLeft );
|
||||
vLayout->addWidget( _libPath, 0, Qt::AlignLeft );
|
||||
setLayout( vLayout );
|
||||
|
||||
QAction* toggleShow = new QAction ( tr("Library Manager"), this );
|
||||
toggleShow->setObjectName( "libraryManager.action.hideShow" );
|
||||
toggleShow->setShortcut ( QKeySequence(tr("CTRL+M")) );
|
||||
addAction( toggleShow );
|
||||
|
||||
connect( toggleShow, SIGNAL(triggered()), this, SLOT(toggleShow()) );
|
||||
connect( _librariesWidget , SIGNAL(selectedLibrary(const AllianceLibrary*))
|
||||
, _cellsWidget , SLOT( setLibrary (const AllianceLibrary*)) );
|
||||
connect( _librariesWidget , SIGNAL(selectedLibrary(const AllianceLibrary*))
|
||||
, this , SLOT( setLibrary (const AllianceLibrary*)) );
|
||||
connect( _cellsWidget , SIGNAL(selectedCell (CellDatas*))
|
||||
, _viewsWidget , SLOT( setCellDatas (CellDatas*)) );
|
||||
connect( _viewsWidget->getModel(), SIGNAL(selectedCell (Cell*,unsigned int))
|
||||
, this , SLOT( openCell (Cell*,unsigned int)) );
|
||||
connect( _viewsWidget->getModel(), SIGNAL(loadedCell ())
|
||||
, _cellsWidget , SLOT( updateSelected ()) );
|
||||
connect( _viewsWidget->getModel(), SIGNAL(updatedLibrary ())
|
||||
, _cellsWidget->getModel(), SLOT( updateLibrary ()) );
|
||||
|
||||
_librariesWidget->initSelection();
|
||||
|
||||
resize( 750, 550 );
|
||||
}
|
||||
|
||||
|
||||
void LibraryManager::toggleShow ()
|
||||
{ setVisible( not isVisible() ); }
|
||||
|
||||
|
||||
void LibraryManager::setLibrary ( const AllianceLibrary* library )
|
||||
{
|
||||
string s = " <undefined>";
|
||||
if (library)
|
||||
s = " <" + getString(library->getPath()) + ">";
|
||||
_libPath->setText( s.c_str() );
|
||||
}
|
||||
|
||||
|
||||
CellViewer* LibraryManager::openCell ( Cell* cell, unsigned int flags )
|
||||
{
|
||||
if (not _cellViewer) {
|
||||
_cellViewer = new CellViewer ();
|
||||
cerr << Error( "LibraryManager::openCell(): Not attached to a CellViewer, using default." ) << endl;
|
||||
}
|
||||
|
||||
CellViewer* viewer = _cellViewer;
|
||||
|
||||
if (cell) {
|
||||
if (flags & CellLoader::NewViewer) {
|
||||
viewer = _cellViewer->vcreate();
|
||||
viewer->show();
|
||||
}
|
||||
viewer->setCell( cell );
|
||||
} else
|
||||
cerr << Error( "LibraryManager::openCell(): NULL <cell> parameter." ) << endl;
|
||||
|
||||
return viewer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,255 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./ViewsModel.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "crlcore/ViewsModel.h"
|
||||
#include "crlcore/CellDatas.h"
|
||||
#include "crlcore/LibraryManager.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
ViewsModel::ViewsModel ( QObject* parent )
|
||||
: QAbstractTableModel(parent)
|
||||
, _cellDatas (NULL)
|
||||
, _viewLoaders ()
|
||||
, _viewSizes ()
|
||||
{ }
|
||||
|
||||
|
||||
ViewsModel::~ViewsModel ()
|
||||
{ }
|
||||
|
||||
|
||||
Qt::ItemFlags ViewsModel::flags ( const QModelIndex& index ) const
|
||||
{
|
||||
if (index.isValid() and _cellDatas->isLoaded() )
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
Qt::ItemFlags result = QAbstractTableModel::flags(index);
|
||||
if (index.column() == 0) result |= Qt::ItemIsUserCheckable;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
QVariant ViewsModel::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::FontRole) {
|
||||
// if (index.row() == 0) return QVariant();
|
||||
// switch (index.column()) {
|
||||
// case 0: return nameFont;
|
||||
// default: return valueFont;
|
||||
// }
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (not index.isValid()) return QVariant();
|
||||
|
||||
if (role == Qt::TextAlignmentRole) {
|
||||
int column = index.column();
|
||||
if (column == 1) return Qt::AlignRight;
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
int column = index.column();
|
||||
if (column == 0) {
|
||||
const CellLoader* loader = _viewLoaders[ index.row() ];
|
||||
string label = loader->getFormat() + " [";
|
||||
size_t count = 0;
|
||||
if (loader->getViewFlags() & Catalog::State::Logical ) { label += "Lo"; ++count; }
|
||||
if (loader->getViewFlags() & Catalog::State::Physical) { label += ((count++)?"+":""); label += "Ph"; }
|
||||
label += "]";
|
||||
return label.c_str();
|
||||
}
|
||||
if (column == 1) {
|
||||
double value = (double)_viewSizes[index.row()] / 1024.0;
|
||||
char unit = 'K';
|
||||
|
||||
if (value >= 1024.0) { value /= 1024.0; unit = 'M'; }
|
||||
if (value >= 1024.0) { value /= 1024.0; unit = 'G'; }
|
||||
|
||||
ostringstream os;
|
||||
os << setprecision(2) << value << " " << unit << "iB";
|
||||
|
||||
return os.str().c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (role == Qt::CheckStateRole) {
|
||||
if (index.column() == 0) {
|
||||
return (_cellDatas->getActiveFlags() & _viewLoaders[index.row()]->getFlags())
|
||||
? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
bool ViewsModel::setData ( const QModelIndex& index, const QVariant& value, int role )
|
||||
{
|
||||
if (index.isValid()) {
|
||||
if ( (index.column() == 0) and (role == Qt::CheckStateRole) ) {
|
||||
if (_cellDatas->getActiveFlags() & _viewLoaders[index.row()]->getFlags()) {
|
||||
_cellDatas->resetActiveFlags( _viewLoaders[index.row()]->getFlags() & CellLoaders::lmask() );
|
||||
} else {
|
||||
_cellDatas->setActiveFlags( _viewLoaders[index.row()]->getFlags() & CellLoaders::lmask() );
|
||||
}
|
||||
emit dataChanged( index, index );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QVariant ViewsModel::headerData ( int section
|
||||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if (orientation == Qt::Vertical) return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont( QFont::Bold, false, false, +0 );
|
||||
|
||||
if (role == Qt::FontRole ) return headerFont;
|
||||
if (role != Qt::DisplayRole) return QVariant();
|
||||
|
||||
switch ( section ) {
|
||||
case 0: return QVariant("View [type]");
|
||||
case 1: return QVariant("Size");
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
int ViewsModel::rowCount ( const QModelIndex& parent ) const
|
||||
{ return _viewLoaders.size(); }
|
||||
|
||||
|
||||
int ViewsModel::columnCount ( const QModelIndex& parent ) const
|
||||
{ return 2; }
|
||||
|
||||
|
||||
void ViewsModel::setCellDatas ( CellDatas* cellDatas )
|
||||
{
|
||||
_cellDatas = cellDatas;
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
_viewLoaders.clear();
|
||||
_viewSizes .clear();
|
||||
if (_cellDatas != NULL) {
|
||||
unsigned int flags = _cellDatas->getFlags() & CellLoaders::lmask();
|
||||
|
||||
CellLoaders* loaders = CellLoaders::get();
|
||||
for ( size_t bit=16 ; bit<32 ; ++bit ) {
|
||||
unsigned int bitmask = 1 << bit;
|
||||
|
||||
if (not (flags & bitmask)) continue;
|
||||
const CellLoader* loader = loaders->getLoader( bitmask );
|
||||
if (loader) {
|
||||
_viewLoaders.push_back( loader );
|
||||
|
||||
string file = _cellDatas->getName() + "." + loader->getFormat();
|
||||
Utilities::Path path = CellDatas::getLibraryPath() / file;
|
||||
Utilities::Path::Stat stat = path.stat();
|
||||
_viewSizes.push_back( stat.size() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
|
||||
void ViewsModel::setNewViewer ( int state )
|
||||
{
|
||||
if (state == Qt::Checked ) _cellDatas->setActiveFlags ( CellLoader::NewViewer );
|
||||
if (state == Qt::Unchecked) _cellDatas->resetActiveFlags( CellLoader::NewViewer );
|
||||
}
|
||||
|
||||
|
||||
void ViewsModel::loadCell ()
|
||||
{
|
||||
if (not _cellDatas) return;
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
Cell* cell = NULL;
|
||||
const CellLoader* activeLoader = NULL;
|
||||
|
||||
cell = _cellDatas->getCell();
|
||||
if ( cell or _cellDatas->isLoaded() ) {
|
||||
emit selectedCell( cell, _cellDatas->getActiveFlags() );
|
||||
} else {
|
||||
unsigned int loadFlags = 0;
|
||||
unsigned int viewFlags = 0;
|
||||
CellLoaders* loaders = CellLoaders::get();
|
||||
for ( size_t bit=16 ; bit<32 ; ++bit ) {
|
||||
unsigned int bitmask = 1 << bit;
|
||||
|
||||
if (not (_cellDatas->getActiveFlags() & bitmask)) continue;
|
||||
const CellLoader* loader = loaders->getLoader( bitmask );
|
||||
if (loader) {
|
||||
if (not activeLoader) activeLoader = loader;
|
||||
loadFlags |= loader->getFlags();
|
||||
viewFlags |= loader->getViewFlags();
|
||||
}
|
||||
|
||||
if (not loadFlags or not viewFlags) return;
|
||||
|
||||
if ( (loadFlags & CellLoader::Native) and (loadFlags & CellLoader::Importer) )
|
||||
return;
|
||||
}
|
||||
|
||||
if (loadFlags & CellLoader::Native) {
|
||||
cell = AllianceFramework::get()->getCell( _cellDatas->getName(), viewFlags );
|
||||
}
|
||||
|
||||
if (loadFlags & CellLoader::Importer) {
|
||||
cell = activeLoader->getCallback()( _cellDatas->getName() );
|
||||
}
|
||||
|
||||
if (cell) {
|
||||
_cellDatas->setActiveFlags( CellLoader::Loaded );
|
||||
_cellDatas->setCell ( cell );
|
||||
|
||||
emit selectedCell( cell, _cellDatas->getActiveFlags() );
|
||||
emit loadedCell();
|
||||
|
||||
if (loadFlags & CellLoader::MultiCell)
|
||||
emit updatedLibrary();
|
||||
}
|
||||
}
|
||||
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,137 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./ViewsWidget.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <sstream>
|
||||
#include <QFontMetrics>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QVBoxLayout>
|
||||
#include <QAction>
|
||||
#include <QModelIndex>
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "crlcore/ViewsModel.h"
|
||||
#include "crlcore/ViewsWidget.h"
|
||||
#include "crlcore/CellDatas.h"
|
||||
#include "crlcore/LibraryManager.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
ViewsWidget::ViewsWidget ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _baseModel (new ViewsModel(this))
|
||||
, _view (new QTableView(this))
|
||||
, _rowHeight (20)
|
||||
, _note (new QLabel())
|
||||
{
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setAttribute( Qt::WA_QuitOnClose, false );
|
||||
setContextMenuPolicy( Qt::ActionsContextMenu );
|
||||
|
||||
_note->setTextFormat( Qt::RichText );
|
||||
|
||||
_rowHeight = QFontMetrics( Graphics::getFixedFont() ).height() + 4;
|
||||
|
||||
_view->setShowGrid ( true );
|
||||
_view->setAlternatingRowColors( true );
|
||||
_view->setSelectionMode ( QAbstractItemView::NoSelection );
|
||||
_view->setSelectionBehavior ( QAbstractItemView::SelectRows );
|
||||
_view->setSortingEnabled ( true );
|
||||
_view->setModel ( _baseModel );
|
||||
_view->setMinimumSize ( 150, 50 );
|
||||
_view->resizeColumnToContents ( 0 );
|
||||
|
||||
QHeaderView* horizontalHeader = _view->horizontalHeader();
|
||||
horizontalHeader->setStretchLastSection( true );
|
||||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader();
|
||||
verticalHeader->setVisible( false );
|
||||
verticalHeader->setDefaultSectionSize( _rowHeight );
|
||||
|
||||
QLabel* title = new QLabel( "Views" );
|
||||
title->setFont( Graphics::getFixedFont(QFont::Bold,false,false,+1) );
|
||||
|
||||
QFrame* separator = new QFrame ();
|
||||
separator->setFrameShape ( QFrame::HLine );
|
||||
separator->setFrameShadow( QFrame::Sunken );
|
||||
|
||||
QCheckBox* viewerCheckBox = new QCheckBox ();
|
||||
viewerCheckBox->setText ( tr("Open in new Viewer") );
|
||||
|
||||
QPushButton* loadButton = new QPushButton ();
|
||||
loadButton->setText ( "Load" );
|
||||
loadButton->setDefault ( true );
|
||||
|
||||
ostringstream os;
|
||||
for ( auto iloader : CellLoaders::get()->getLoaders() ) {
|
||||
string comment = iloader->getComment();
|
||||
string format = iloader->getFormat ();
|
||||
os << "<b>." << format << "</b> ";
|
||||
for ( size_t i=comment.size()+format.size() ; i<27 ; ++i ) os << ".";
|
||||
os << " " << comment << "<br>";
|
||||
|
||||
}
|
||||
|
||||
QLabel* formatsComments = new QLabel ();
|
||||
formatsComments->setFont ( Graphics::getFixedFont() );
|
||||
formatsComments->setTextFormat( Qt::RichText );
|
||||
formatsComments->setText ( os.str().c_str() );
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->addWidget ( title, 0, Qt::AlignHCenter );
|
||||
vLayout->addWidget ( _view );
|
||||
vLayout->addWidget ( formatsComments );
|
||||
vLayout->addStretch();
|
||||
vLayout->addWidget ( _note );
|
||||
vLayout->addWidget ( separator );
|
||||
vLayout->addWidget ( viewerCheckBox );
|
||||
vLayout->addWidget ( loadButton, 0, Qt::AlignHCenter );
|
||||
setLayout( vLayout );
|
||||
|
||||
connect( loadButton , SIGNAL(clicked () ), _baseModel, SLOT(loadCell () ) );
|
||||
connect( viewerCheckBox, SIGNAL(stateChanged(int)), _baseModel, SLOT(setNewViewer(int)) );
|
||||
}
|
||||
|
||||
|
||||
void ViewsWidget::setCellDatas ( CellDatas* datas )
|
||||
{
|
||||
_baseModel->setCellDatas( datas );
|
||||
_view->resizeColumnToContents( 0 );
|
||||
|
||||
if ( datas and datas->getState() and datas->getState()->isInMemory() ) {
|
||||
string message
|
||||
= "The Cell<br>"
|
||||
"<b><" + datas->getName() + "></b><br>"
|
||||
" is already loaded in memory.<br>"
|
||||
" You can only open it in a<br>"
|
||||
"(new) viewer";
|
||||
_note->setText( message.c_str() );
|
||||
} else {
|
||||
_note->setText( "" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,191 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/CellDatas.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_CELL_DATAS_H
|
||||
#define CRL_CELL_DATAS_H
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include "vlsisapd/utilities/Path.h"
|
||||
#include "crlcore/Catalog.h"
|
||||
namespace Hurricane {
|
||||
class Cell;
|
||||
}
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Cell;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellLoader".
|
||||
|
||||
class CellLoader {
|
||||
public:
|
||||
typedef std::function<Cell*(std::string)> Callback;
|
||||
enum Flags { NoFlags = 0x0000
|
||||
, Native = 0x0001
|
||||
, Importer = 0x0002
|
||||
, MultiCell = 0x0004
|
||||
, Loaded = 0x0008
|
||||
, NewViewer = 0x0010
|
||||
};
|
||||
public:
|
||||
inline CellLoader ( std::string format
|
||||
, std::string comment
|
||||
, unsigned int flags
|
||||
, unsigned int viewFlags
|
||||
, Callback callback=nullptr
|
||||
);
|
||||
inline std::string getFormat () const;
|
||||
inline std::string getComment () const;
|
||||
inline unsigned int getFlags () const;
|
||||
inline unsigned int getViewFlags () const;
|
||||
inline const Callback& getCallback () const;
|
||||
inline void setFlags ( unsigned int mask );
|
||||
inline void resetFlags ( unsigned int mask );
|
||||
private:
|
||||
std::string _format;
|
||||
std::string _comment;
|
||||
unsigned int _flags;
|
||||
unsigned int _viewFlags;
|
||||
Callback _callback;
|
||||
};
|
||||
|
||||
|
||||
inline CellLoader::CellLoader ( std::string format
|
||||
, std::string comment
|
||||
, unsigned int flags
|
||||
, unsigned int viewFlags
|
||||
, Callback callback
|
||||
)
|
||||
: _format (format)
|
||||
, _comment (comment)
|
||||
, _flags (flags)
|
||||
, _viewFlags(viewFlags)
|
||||
, _callback (callback)
|
||||
{
|
||||
if (_callback != nullptr) _flags |= Importer;
|
||||
}
|
||||
|
||||
inline std::string CellLoader::getFormat () const { return _format; }
|
||||
inline std::string CellLoader::getComment () const { return _comment; }
|
||||
inline unsigned int CellLoader::getFlags () const { return _flags; }
|
||||
inline unsigned int CellLoader::getViewFlags () const { return _viewFlags; }
|
||||
inline const CellLoader::Callback& CellLoader::getCallback () const { return _callback; }
|
||||
inline void CellLoader::setFlags ( unsigned int mask ) { _flags |= mask; }
|
||||
inline void CellLoader::resetFlags ( unsigned int mask ) { _flags &= ~mask; }
|
||||
|
||||
|
||||
class LessCellLoader {
|
||||
public:
|
||||
inline bool operator() ( const CellLoader* lhs, const CellLoader* rhs ) const
|
||||
{ return lhs->getFormat() < rhs->getFormat(); }
|
||||
};
|
||||
|
||||
|
||||
typedef std::set<CellLoader*,LessCellLoader> CellLoaderSet;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellLoaders".
|
||||
|
||||
class CellLoaders {
|
||||
public:
|
||||
static CellLoaders* get ();
|
||||
public:
|
||||
CellLoaders ();
|
||||
~CellLoaders ();
|
||||
inline bool empty () const;
|
||||
inline size_t size () const;
|
||||
static unsigned int lmask ();
|
||||
const CellLoader* getLoader ( std::string format ) const;
|
||||
const CellLoader* getLoader ( unsigned int bit ) const;
|
||||
inline const CellLoaderSet& getLoaders () const;
|
||||
void addLoader ( CellLoader* );
|
||||
private:
|
||||
static unsigned int _loaderBit;
|
||||
static unsigned int _loaderBitMask;
|
||||
static CellLoaders* _singleton;
|
||||
CellLoaderSet _loaders;
|
||||
};
|
||||
|
||||
|
||||
inline size_t CellLoaders::size () const { return _loaders.size(); }
|
||||
inline bool CellLoaders::empty () const { return _loaders.empty(); }
|
||||
inline const CellLoaderSet& CellLoaders::getLoaders () const { return _loaders; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellDatas".
|
||||
|
||||
class CellDatas {
|
||||
public:
|
||||
inline static void setLibraryPath ( const Utilities::Path& path );
|
||||
inline static const Utilities::Path& getLibraryPath ();
|
||||
public:
|
||||
CellDatas ( std::string name );
|
||||
CellDatas ( Cell* );
|
||||
inline bool isLoaded () const;
|
||||
inline bool isInMemory () const;
|
||||
inline std::string getName () const;
|
||||
inline Cell* getCell () const;
|
||||
inline const Catalog::State* getState () const;
|
||||
inline unsigned int getFlags () const;
|
||||
inline unsigned int getActiveFlags () const;
|
||||
inline void setFlags ( unsigned int flags );
|
||||
inline void setActiveFlags ( unsigned int flags );
|
||||
inline void resetActiveFlags ( unsigned int flags );
|
||||
inline void setCell ( Cell* );
|
||||
inline void setState ( const Catalog::State* );
|
||||
private:
|
||||
static Utilities::Path _libraryPath;
|
||||
std::string _name;
|
||||
unsigned int _flags; // Tells what is *available* to be loaded.
|
||||
unsigned int _activeFlags; // Tells what has *actually* be loaded.
|
||||
Cell* _cell;
|
||||
const Catalog::State* _state;
|
||||
};
|
||||
|
||||
|
||||
inline bool operator< ( const CellDatas& lhs, const CellDatas& rhs )
|
||||
{ return lhs.getName() < rhs.getName(); }
|
||||
|
||||
|
||||
inline bool LessCellDatas ( const CellDatas* lhs, const CellDatas* rhs )
|
||||
{ return lhs->getName() < rhs->getName(); }
|
||||
|
||||
|
||||
inline void CellDatas::setLibraryPath ( const Utilities::Path& path ) { _libraryPath = path; }
|
||||
inline const Utilities::Path& CellDatas::getLibraryPath () { return _libraryPath; }
|
||||
inline bool CellDatas::isLoaded () const { return (_activeFlags & CellLoader::Loaded) or (_cell != NULL); }
|
||||
inline bool CellDatas::isInMemory () const { return _cell != NULL; }
|
||||
inline std::string CellDatas::getName () const { return _name; }
|
||||
inline Cell* CellDatas::getCell () const { return _cell; }
|
||||
inline const Catalog::State* CellDatas::getState () const { return _state; }
|
||||
inline unsigned int CellDatas::getFlags () const { return _flags; }
|
||||
inline unsigned int CellDatas::getActiveFlags () const { return _activeFlags; }
|
||||
inline void CellDatas::setFlags ( unsigned int flags ) { _flags |= flags; }
|
||||
inline void CellDatas::setActiveFlags ( unsigned int flags ) { _activeFlags |= flags; }
|
||||
inline void CellDatas::resetActiveFlags ( unsigned int flags ) { _activeFlags &= ~flags; }
|
||||
inline void CellDatas::setState ( const Catalog::State* state ) { _state = state; }
|
||||
inline void CellDatas::setCell ( Cell* cell ) { _cell = cell; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // CRL_CELL_DATAS_H
|
|
@ -0,0 +1,70 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/CellsModel.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_CELLS_MODEL_H
|
||||
#define CRL_CELLS_MODEL_H
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <QAbstractTableModel>
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
#include "crlcore/CellDatas.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellsModel".
|
||||
|
||||
typedef std::map<const AllianceLibrary*, std::vector<CellDatas*> > ALibraryMap;
|
||||
|
||||
|
||||
class CellsModel : public QAbstractTableModel {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
void deleteStaticDatas ();
|
||||
public:
|
||||
CellsModel ( QObject* parent=NULL );
|
||||
~CellsModel ();
|
||||
int rowCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
int columnCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
Qt::ItemFlags flags ( const QModelIndex& ) const;
|
||||
QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const;
|
||||
QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const;
|
||||
CellDatas* getCellDatas ( int row ) const;
|
||||
void emitDataChanged ( const QModelIndex& );
|
||||
public slots:
|
||||
void updateLibrary ();
|
||||
void setLibrary ( const AllianceLibrary* );
|
||||
private:
|
||||
inline const std::vector<CellDatas*>& getCellsDatas () const;
|
||||
inline std::vector<CellDatas*>& getCellsDatas ();
|
||||
inline const AllianceLibrary* getLibrary () const;
|
||||
private:
|
||||
static ALibraryMap _libraries;
|
||||
ALibraryMap::iterator _ilibrary;
|
||||
};
|
||||
|
||||
|
||||
inline const AllianceLibrary* CellsModel::getLibrary () const { return (const AllianceLibrary*)_ilibrary->first; }
|
||||
inline const std::vector<CellDatas*>& CellsModel::getCellsDatas () const { return _ilibrary->second; }
|
||||
inline std::vector<CellDatas*>& CellsModel::getCellsDatas () { return _ilibrary->second; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // CRL_CELLS_MODEL_H
|
|
@ -0,0 +1,65 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/CellsWidget.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_CELLS_WIDGET_H
|
||||
#define CRL_CELLS_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QItemDelegate>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
|
||||
class QModelIndex;
|
||||
class QTableView;
|
||||
class QHeaderView;
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
class CellDatas;
|
||||
class CellsModel;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CellsWidget".
|
||||
|
||||
|
||||
class CellsWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
CellsWidget ( QWidget* parent=NULL );
|
||||
inline CellsModel* getModel () const;
|
||||
signals:
|
||||
void selectedCell ( CellDatas* );
|
||||
public slots:
|
||||
void updateSelected ();
|
||||
void selectCurrent ( const QModelIndex& index, const QModelIndex& );
|
||||
void setLibrary ( const AllianceLibrary* );
|
||||
private:
|
||||
CellsModel* _baseModel;
|
||||
QTableView* _view;
|
||||
int _rowHeight;
|
||||
QModelIndex _selected;
|
||||
};
|
||||
|
||||
|
||||
inline CellsModel* CellsWidget::getModel () const { return _baseModel; }
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
#endif // CRL_CELLS_WIDGET_H
|
|
@ -0,0 +1,49 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/LibrariesModel.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_LIBRARIES_MODEL_H
|
||||
#define CRL_LIBRARIES_MODEL_H
|
||||
|
||||
#include <vector>
|
||||
#include <QAbstractTableModel>
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "LibrariesModel".
|
||||
|
||||
|
||||
class LibrariesModel : public QAbstractTableModel {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
LibrariesModel ( QObject* parent=NULL );
|
||||
~LibrariesModel ();
|
||||
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;
|
||||
const AllianceLibrary* getLibrary ( const QModelIndex& );
|
||||
const AllianceLibrary* getLibrary ( size_t );
|
||||
private:
|
||||
const AllianceLibraries& _libraries;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // CRL_LIBRARIES_MODEL_H
|
|
@ -0,0 +1,58 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/LibrariesWidget.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_LIBRARIES_WIDGET_H
|
||||
#define CRL_LIBRARIES_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QItemDelegate>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
|
||||
class QModelIndex;
|
||||
class QTableView;
|
||||
class QHeaderView;
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
class LibrariesModel;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "LibrariesWidget".
|
||||
|
||||
|
||||
class LibrariesWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
LibrariesWidget ( QWidget* parent=NULL );
|
||||
void initSelection ();
|
||||
signals:
|
||||
void selectedLibrary ( const AllianceLibrary* );
|
||||
public slots:
|
||||
void selectCurrent ( const QModelIndex& index, const QModelIndex& );
|
||||
private:
|
||||
LibrariesModel* _baseModel;
|
||||
QTableView* _view;
|
||||
int _rowHeight;
|
||||
};
|
||||
|
||||
|
||||
} // CRL namepsace.
|
||||
|
||||
#endif // CRL_LIBRARIES_WIDGET_H
|
|
@ -0,0 +1,72 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/LibraryManager.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_LIBRARY_MANAGER_H
|
||||
#define CRL_LIBRARY_MANAGER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
class QModelIndex;
|
||||
class QTableView;
|
||||
class QHeaderView;
|
||||
|
||||
namespace Hurricane {
|
||||
class Cell;
|
||||
class CellViewer;
|
||||
}
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Cell;
|
||||
using Hurricane::CellViewer;
|
||||
class AllianceLibrary;
|
||||
class ViewsWidget;
|
||||
class CellsWidget;
|
||||
class LibrariesWidget;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "LibraryManager".
|
||||
|
||||
|
||||
class LibraryManager : public QWidget {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
LibraryManager ( QWidget* parent=NULL );
|
||||
inline void setCellViewer ( CellViewer* );
|
||||
inline CellViewer* getCellViewer () const;
|
||||
public slots:
|
||||
void toggleShow ();
|
||||
void setLibrary ( const AllianceLibrary* library );
|
||||
CellViewer* openCell ( Cell*, unsigned int flags );
|
||||
private:
|
||||
LibrariesWidget* _librariesWidget;
|
||||
CellsWidget* _cellsWidget;
|
||||
ViewsWidget* _viewsWidget;
|
||||
CellViewer* _cellViewer;
|
||||
QLabel* _libPath;
|
||||
};
|
||||
|
||||
|
||||
inline void LibraryManager::setCellViewer ( CellViewer* cw ) { _cellViewer=cw; }
|
||||
inline CellViewer* LibraryManager::getCellViewer () const { return _cellViewer; }
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
#endif // CRL_LIBRARY_WIDGET_H
|
|
@ -0,0 +1,68 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/ViewsModel.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_VIEWS_MODEL_H
|
||||
#define CRL_VIEWS_MODEL_H
|
||||
|
||||
#include <vector>
|
||||
#include <QAbstractTableModel>
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
|
||||
namespace Hurricane {
|
||||
class Cell;
|
||||
}
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Cell;
|
||||
class CellDatas;
|
||||
class CellLoader;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "ViewsModel".
|
||||
|
||||
|
||||
class ViewsModel : public QAbstractTableModel {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
ViewsModel ( QObject* parent=NULL );
|
||||
~ViewsModel ();
|
||||
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;
|
||||
Qt::ItemFlags flags ( const QModelIndex& index ) const;
|
||||
bool setData ( const QModelIndex& index, const QVariant& value, int role );
|
||||
signals:
|
||||
void updatedLibrary ();
|
||||
void selectedCell ( Cell*, unsigned int );
|
||||
void loadedCell ();
|
||||
public slots:
|
||||
void setCellDatas ( CellDatas* );
|
||||
void loadCell ();
|
||||
void setNewViewer ( int state );
|
||||
private:
|
||||
CellDatas* _cellDatas;
|
||||
std::vector<const CellLoader*> _viewLoaders;
|
||||
std::vector<size_t> _viewSizes;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // CRL_VIEWS_MODEL_H
|
|
@ -0,0 +1,65 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2015-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/ViewsWidget.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_VIEWS_WIDGET_H
|
||||
#define CRL_VIEWS_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QItemDelegate>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
namespace Hurricane {
|
||||
class Cell;
|
||||
}
|
||||
|
||||
class QLabel;
|
||||
class QModelIndex;
|
||||
class QTableView;
|
||||
class QHeaderView;
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Cell;
|
||||
class ViewsModel;
|
||||
class CellDatas;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "ViewsWidget".
|
||||
|
||||
class ViewsWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
ViewsWidget ( QWidget* parent=NULL );
|
||||
inline ViewsModel* getModel () const;
|
||||
public slots:
|
||||
void setCellDatas ( CellDatas* );
|
||||
private:
|
||||
ViewsModel* _baseModel;
|
||||
QTableView* _view;
|
||||
int _rowHeight;
|
||||
QLabel* _note;
|
||||
};
|
||||
|
||||
|
||||
inline ViewsModel* ViewsWidget::getModel () const { return _baseModel; }
|
||||
|
||||
|
||||
} // CRL namepsace.
|
||||
|
||||
#endif // CRL_VIEWS_WIDGET_H
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2008-2013, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
@ -310,7 +309,10 @@ namespace CRL {
|
|||
}
|
||||
|
||||
// At least one view must have been loaded.
|
||||
if ( state->getFlags(Catalog::State::Views) != 0 ) return state->getCell();
|
||||
if ( state->getFlags(Catalog::State::Views) != 0 ) {
|
||||
state->setFlags( Catalog::State::InMemory, true );
|
||||
return state->getCell();
|
||||
}
|
||||
|
||||
// Delete the empty cell.
|
||||
if ( state->getCell() ) state->getCell()->destroy ();
|
||||
|
|
|
@ -55,11 +55,12 @@ namespace CRL {
|
|||
{
|
||||
string s;
|
||||
|
||||
if ( isFlattenLeaf() ) s += 'C';
|
||||
if ( isFeed() ) s += 'F';
|
||||
if ( isPad() ) s += 'P';
|
||||
if ( isGds() ) s += 'G';
|
||||
if ( isDelete() ) s += 'D';
|
||||
s += (isFlattenLeaf()) ? 'C' : '-';
|
||||
s += (isFeed() ) ? 'F' : '-';
|
||||
s += (isPad() ) ? 'P' : '-';
|
||||
s += (isGds() ) ? 'G' : '-';
|
||||
s += (isDelete() ) ? 'D' : '-';
|
||||
s += (isInMemory() ) ? 'm' : '-';
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -303,7 +304,7 @@ namespace CRL {
|
|||
Catalog::State* CatalogExtension::_cache = NULL;
|
||||
|
||||
|
||||
Catalog::State* CatalogExtension::_get ( const Cell* cell )
|
||||
Catalog::State* CatalogExtension::get ( const Cell* cell )
|
||||
{
|
||||
if ( cell == _owner ) return _cache;
|
||||
_owner = cell;
|
||||
|
|
|
@ -112,10 +112,10 @@ namespace CRL {
|
|||
void Histogram::toGnuplot ( const string& basename )
|
||||
{
|
||||
Utilities::Path datFile ( basename+_fileExtension+".dat" );
|
||||
toFile ( datFile.string() );
|
||||
toFile ( datFile.toString() );
|
||||
|
||||
Utilities::Path pltFile ( basename+_fileExtension+".plt" );
|
||||
ofstream fd ( pltFile.string().c_str() );
|
||||
ofstream fd ( pltFile.toString().c_str() );
|
||||
|
||||
if ( not _mainTitle.empty() )
|
||||
fd << "set title \"" << _mainTitle << "\"\n";
|
||||
|
@ -142,7 +142,7 @@ namespace CRL {
|
|||
|
||||
for ( size_t iset=0 ; iset<_sets.size() ; ++iset ) {
|
||||
fd << ((iset) ? " " : "plot ");
|
||||
fd << "\"" << datFile.string() << "\" using " << (iset+1);
|
||||
fd << "\"" << datFile.toString() << "\" using " << (iset+1);
|
||||
|
||||
if ( not _titles[iset].empty() ) fd << " title \"" << _titles[iset] << "\"";
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace {
|
|||
if ( not stratusMappingName.absolute() ) {
|
||||
stratusMappingName = System::getPath("etc") / stratusMappingName;
|
||||
}
|
||||
setenv ( "STRATUS_MAPPING_NAME", stratusMappingName.string().c_str(), 1 );
|
||||
setenv ( "STRATUS_MAPPING_NAME", stratusMappingName.toString().c_str(), 1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,18 +306,18 @@ namespace CRL {
|
|||
// Early setting of python pathes to be able to execute configuration scripts.
|
||||
Utilities::Path pythonSitePackages ( PYTHON_SITE_PACKAGES );
|
||||
pythonSitePackages = arguments["coriolis_top"].as<string>() / pythonSitePackages;
|
||||
_pathes.insert ( make_pair("pythonSitePackages",pythonSitePackages.string()) );
|
||||
_pathes.insert ( make_pair("pythonSitePackages",pythonSitePackages.toString()) );
|
||||
Utilities::Path crlcoreDir = pythonSitePackages / "crlcore";
|
||||
Utilities::Path stratusDir = pythonSitePackages / "stratus";
|
||||
Utilities::Path cumulusDir = pythonSitePackages / "cumulus";
|
||||
Utilities::Path pharosDir = pythonSitePackages / "pharos";
|
||||
|
||||
Isobar::Script::addPath ( sysConfDir.string() );
|
||||
Isobar::Script::addPath ( pythonSitePackages.string() );
|
||||
Isobar::Script::addPath ( crlcoreDir.string() );
|
||||
Isobar::Script::addPath ( stratusDir.string() );
|
||||
Isobar::Script::addPath ( cumulusDir.string() );
|
||||
Isobar::Script::addPath ( pharosDir.string() );
|
||||
Isobar::Script::addPath ( sysConfDir.toString() );
|
||||
Isobar::Script::addPath ( pythonSitePackages.toString() );
|
||||
Isobar::Script::addPath ( crlcoreDir.toString() );
|
||||
Isobar::Script::addPath ( stratusDir.toString() );
|
||||
Isobar::Script::addPath ( cumulusDir.toString() );
|
||||
Isobar::Script::addPath ( pharosDir.toString() );
|
||||
|
||||
// Triggers Configuration singleton creation.
|
||||
Cfg::Configuration::get ();
|
||||
|
@ -453,12 +453,12 @@ namespace CRL {
|
|||
//cout << " o Reading python dot configuration:" << endl;
|
||||
//cout << " - <" << systemConfFile.string() << ">." << endl;
|
||||
|
||||
Isobar::Script* systemScript = Isobar::Script::create(systemConfFile.stem().string());
|
||||
Isobar::Script* systemScript = Isobar::Script::create(systemConfFile.stem().toString());
|
||||
systemScript->runFunction("coriolisConfigure",NULL,Isobar::Script::NoScriptArgs);
|
||||
systemScript->destroy();
|
||||
} else {
|
||||
cerr << Warning("System configuration file:\n <%s> not found."
|
||||
,systemConfFile.string().c_str()) << endl;
|
||||
,systemConfFile.toString().c_str()) << endl;
|
||||
}
|
||||
|
||||
bool homeConfFound = false;
|
||||
|
@ -466,14 +466,14 @@ namespace CRL {
|
|||
homeConfFile /= ".coriolis2.configuration.xml";
|
||||
if ( homeConfFile.exists() ) {
|
||||
homeConfFound = true;
|
||||
conf->readFromFile ( homeConfFile.string() );
|
||||
conf->readFromFile ( homeConfFile.toString() );
|
||||
}
|
||||
|
||||
bool dotConfFound = false;
|
||||
Utilities::Path dotConfFile = "./.coriolis2.configuration.xml";
|
||||
if ( dotConfFile.exists() ) {
|
||||
dotConfFound = true;
|
||||
conf->readFromFile ( dotConfFile.string() );
|
||||
conf->readFromFile ( dotConfFile.toString() );
|
||||
}
|
||||
|
||||
// Delayed printing, as we known only now whether VerboseLevel1 is requested.
|
||||
|
|
|
@ -41,61 +41,62 @@ namespace CRL {
|
|||
enum LibraryFlags { CreateLibrary=0x1, InSearchPath=0x2, HasCatalog=0x4 };
|
||||
public:
|
||||
// Constructors.
|
||||
static AllianceFramework* create ();
|
||||
// Destructors.
|
||||
void destroy ();
|
||||
static AllianceFramework* create ();
|
||||
// Destructors.
|
||||
void destroy ();
|
||||
// Accessors.
|
||||
static AllianceFramework* get ();
|
||||
string getPrint () const;
|
||||
// Predicates.
|
||||
inline bool isPOWER ( const char* name );
|
||||
inline bool isPOWER ( const string& name );
|
||||
inline bool isPOWER ( const Name& name );
|
||||
inline bool isGROUND ( const char* name );
|
||||
inline bool isGROUND ( const string& name );
|
||||
inline bool isGROUND ( const Name& name );
|
||||
inline bool isCLOCK ( const char* name );
|
||||
inline bool isCLOCK ( const string& name );
|
||||
inline bool isCLOCK ( const Name& name );
|
||||
inline bool isBLOCKAGE ( const char* name );
|
||||
inline bool isBLOCKAGE ( const string& name );
|
||||
inline bool isBLOCKAGE ( const Name& name );
|
||||
inline bool isBLOCKAGE ( const Net* net );
|
||||
inline bool isPad ( const char* name );
|
||||
inline bool isPad ( const string& name );
|
||||
inline bool isPad ( const Name& name );
|
||||
inline bool isPad ( const Cell* );
|
||||
// Accessors.
|
||||
static AllianceFramework* get ();
|
||||
string getPrint () const;
|
||||
// Predicates.
|
||||
inline bool isPOWER ( const char* name );
|
||||
inline bool isPOWER ( const string& name );
|
||||
inline bool isPOWER ( const Name& name );
|
||||
inline bool isGROUND ( const char* name );
|
||||
inline bool isGROUND ( const string& name );
|
||||
inline bool isGROUND ( const Name& name );
|
||||
inline bool isCLOCK ( const char* name );
|
||||
inline bool isCLOCK ( const string& name );
|
||||
inline bool isCLOCK ( const Name& name );
|
||||
inline bool isBLOCKAGE ( const char* name );
|
||||
inline bool isBLOCKAGE ( const string& name );
|
||||
inline bool isBLOCKAGE ( const Name& name );
|
||||
inline bool isBLOCKAGE ( const Net* net );
|
||||
inline bool isPad ( const char* name );
|
||||
inline bool isPad ( const string& name );
|
||||
inline bool isPad ( const Name& name );
|
||||
inline bool isPad ( const Cell* );
|
||||
// Accessors.
|
||||
inline Environment* getEnvironment ();
|
||||
inline Catalog* getCatalog ();
|
||||
inline const Name& getParentLibraryName () const;
|
||||
inline Library* getParentLibrary ();
|
||||
Library* getLibrary ( unsigned int index );
|
||||
AllianceLibrary* getAllianceLibrary ( unsigned int index );
|
||||
AllianceLibrary* getAllianceLibrary ( const Name& libName, unsigned int& flags );
|
||||
AllianceLibrary* getAllianceLibrary ( Library* );
|
||||
AllianceLibrary* createLibrary ( const string& path, unsigned int& flags, string libName="" );
|
||||
void saveLibrary ( Library* );
|
||||
void saveLibrary ( AllianceLibrary* );
|
||||
RoutingGauge* getRoutingGauge ( const Name& name="" );
|
||||
CellGauge* getCellGauge ( const Name& name="" );
|
||||
inline const Name getDefaultCGPinLayerName () const;
|
||||
// Modifiers.
|
||||
void addRoutingGauge ( RoutingGauge* );
|
||||
void addCellGauge ( CellGauge* );
|
||||
// Cell Management.
|
||||
Cell* getCell ( const string& name
|
||||
, unsigned int mode
|
||||
, unsigned int depth=(unsigned int)-1 );
|
||||
Cell* createCell ( const string& name, AllianceLibrary* library=NULL );
|
||||
void saveCell ( Cell* , unsigned int mode );
|
||||
unsigned int loadLibraryCells ( Library* );
|
||||
unsigned int loadLibraryCells ( const Name& );
|
||||
static size_t getInstancesCount ( Cell*, unsigned int flags );
|
||||
// Hurricane Managment.
|
||||
inline string _getTypeName () const;
|
||||
string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
inline Environment* getEnvironment ();
|
||||
inline Catalog* getCatalog ();
|
||||
inline const Name& getParentLibraryName () const;
|
||||
inline Library* getParentLibrary ();
|
||||
Library* getLibrary ( unsigned int index );
|
||||
AllianceLibrary* getAllianceLibrary ( unsigned int index );
|
||||
AllianceLibrary* getAllianceLibrary ( const Name& libName, unsigned int& flags );
|
||||
AllianceLibrary* getAllianceLibrary ( Library* );
|
||||
AllianceLibrary* createLibrary ( const string& path, unsigned int& flags, string libName="" );
|
||||
inline const AllianceLibraries& getAllianceLibraries () const;
|
||||
void saveLibrary ( Library* );
|
||||
void saveLibrary ( AllianceLibrary* );
|
||||
RoutingGauge* getRoutingGauge ( const Name& name="" );
|
||||
CellGauge* getCellGauge ( const Name& name="" );
|
||||
inline const Name getDefaultCGPinLayerName () const;
|
||||
// Modifiers.
|
||||
void addRoutingGauge ( RoutingGauge* );
|
||||
void addCellGauge ( CellGauge* );
|
||||
// Cell Management.
|
||||
Cell* getCell ( const string& name
|
||||
, unsigned int mode
|
||||
, unsigned int depth=(unsigned int)-1 );
|
||||
Cell* createCell ( const string& name, AllianceLibrary* library=NULL );
|
||||
void saveCell ( Cell* , unsigned int mode );
|
||||
unsigned int loadLibraryCells ( Library* );
|
||||
unsigned int loadLibraryCells ( const Name& );
|
||||
static size_t getInstancesCount ( Cell*, unsigned int flags );
|
||||
// Hurricane Managment.
|
||||
inline string _getTypeName () const;
|
||||
string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
|
||||
// Internals - Attributes.
|
||||
protected:
|
||||
|
@ -127,32 +128,34 @@ namespace CRL {
|
|||
void _bindLibraries ();
|
||||
};
|
||||
|
||||
inline bool AllianceFramework::isPOWER ( const char* name ) { return _environment.isPOWER(name); }
|
||||
inline bool AllianceFramework::isPOWER ( const string& name ) { return isPOWER(name.c_str()); }
|
||||
inline bool AllianceFramework::isPOWER ( const Name& name ) { return isPOWER(getString(name)); }
|
||||
inline bool AllianceFramework::isGROUND ( const char* name ) { return _environment.isGROUND(name); }
|
||||
inline bool AllianceFramework::isGROUND ( const string& name ) { return isGROUND(name.c_str()); }
|
||||
inline bool AllianceFramework::isGROUND ( const Name& name ) { return isGROUND(getString(name)); }
|
||||
inline bool AllianceFramework::isCLOCK ( const char* name ) { return _environment.isCLOCK(name); }
|
||||
inline bool AllianceFramework::isCLOCK ( const string& name ) { return isCLOCK(name.c_str()); }
|
||||
inline bool AllianceFramework::isCLOCK ( const Name& name ) { return isCLOCK(getString(name)); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const char* name ) { return _environment.isBLOCKAGE(name); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const string& name ) { return isBLOCKAGE(name.c_str()); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const Name& name ) { return isBLOCKAGE(getString(name)); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const Net* net ) { return isBLOCKAGE(net->getName()); }
|
||||
inline bool AllianceFramework::isPad ( const char* name ) { return _environment.isPad(name); }
|
||||
inline bool AllianceFramework::isPad ( const string& name ) { return isPad(name.c_str()); }
|
||||
inline bool AllianceFramework::isPad ( const Name& name ) { return isPad(getString(name)); }
|
||||
inline bool AllianceFramework::isPad ( const Cell* cell ) { return isPad(cell->getName()); }
|
||||
inline Environment* AllianceFramework::getEnvironment () { return &_environment; }
|
||||
inline Catalog* AllianceFramework::getCatalog () { return &_catalog; }
|
||||
inline bool AllianceFramework::isPOWER ( const char* name ) { return _environment.isPOWER(name); }
|
||||
inline bool AllianceFramework::isPOWER ( const string& name ) { return isPOWER(name.c_str()); }
|
||||
inline bool AllianceFramework::isPOWER ( const Name& name ) { return isPOWER(getString(name)); }
|
||||
inline bool AllianceFramework::isGROUND ( const char* name ) { return _environment.isGROUND(name); }
|
||||
inline bool AllianceFramework::isGROUND ( const string& name ) { return isGROUND(name.c_str()); }
|
||||
inline bool AllianceFramework::isGROUND ( const Name& name ) { return isGROUND(getString(name)); }
|
||||
inline bool AllianceFramework::isCLOCK ( const char* name ) { return _environment.isCLOCK(name); }
|
||||
inline bool AllianceFramework::isCLOCK ( const string& name ) { return isCLOCK(name.c_str()); }
|
||||
inline bool AllianceFramework::isCLOCK ( const Name& name ) { return isCLOCK(getString(name)); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const char* name ) { return _environment.isBLOCKAGE(name); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const string& name ) { return isBLOCKAGE(name.c_str()); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const Name& name ) { return isBLOCKAGE(getString(name)); }
|
||||
inline bool AllianceFramework::isBLOCKAGE ( const Net* net ) { return isBLOCKAGE(net->getName()); }
|
||||
inline bool AllianceFramework::isPad ( const char* name ) { return _environment.isPad(name); }
|
||||
inline bool AllianceFramework::isPad ( const string& name ) { return isPad(name.c_str()); }
|
||||
inline bool AllianceFramework::isPad ( const Name& name ) { return isPad(getString(name)); }
|
||||
inline bool AllianceFramework::isPad ( const Cell* cell ) { return isPad(cell->getName()); }
|
||||
inline Environment* AllianceFramework::getEnvironment () { return &_environment; }
|
||||
inline Catalog* AllianceFramework::getCatalog () { return &_catalog; }
|
||||
inline const Name& AllianceFramework::getParentLibraryName
|
||||
() const { return _parentLibraryName; }
|
||||
inline Library* AllianceFramework::getParentLibrary () { return _parentLibrary; }
|
||||
() const { return _parentLibraryName; }
|
||||
inline Library* AllianceFramework::getParentLibrary () { return _parentLibrary; }
|
||||
inline const AllianceLibraries&
|
||||
AllianceFramework::getAllianceLibraries () const { return _libraries; }
|
||||
// TEMPORARY.
|
||||
inline const Name AllianceFramework::getDefaultCGPinLayerName
|
||||
() const { return "CALU1"; }
|
||||
inline string AllianceFramework::_getTypeName () const { return "AllianceFramework"; }
|
||||
() const { return "CALU1"; }
|
||||
inline string AllianceFramework::_getTypeName () const { return "AllianceFramework"; }
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/AllianceLibrary.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_ALLIANCE_LIBRARY_H
|
||||
#define CRL_ALLIANCE_LIBRARY_H
|
||||
|
||||
|
||||
# ifndef __CRL_ALLIANCE_LIBRARY_H__
|
||||
# define __CRL_ALLIANCE_LIBRARY_H__
|
||||
|
||||
# include <string>
|
||||
# include <vector>
|
||||
|
||||
# include "hurricane/Name.h"
|
||||
# include "hurricane/Slot.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "hurricane/Name.h"
|
||||
#include "hurricane/Slot.h"
|
||||
|
||||
namespace Hurricane {
|
||||
class Library;
|
||||
|
@ -33,7 +29,6 @@ namespace Hurricane {
|
|||
|
||||
namespace CRL {
|
||||
|
||||
|
||||
using std::vector;
|
||||
|
||||
using Hurricane::Name;
|
||||
|
@ -79,10 +74,9 @@ namespace CRL {
|
|||
inline std::string AllianceLibrary::_getTypeName () const { return _TName("AllianceLibrary"); }
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
} // CRL namespace.
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(CRL::AllianceLibrary);
|
||||
|
||||
|
||||
#endif
|
||||
#endif // CRL_ALLIANCE_LIBRARY_H
|
||||
|
|
|
@ -95,6 +95,7 @@ namespace CRL {
|
|||
inline bool isDelete () const;
|
||||
inline bool isPhysical () const;
|
||||
inline bool isLogical () const;
|
||||
inline bool isInMemory () const;
|
||||
// Flags management.
|
||||
inline unsigned int getFlags ( unsigned int mask=(unsigned int)-1 ) const;
|
||||
inline bool setFlags ( unsigned int mask, bool value );
|
||||
|
@ -178,6 +179,7 @@ namespace CRL {
|
|||
inline bool Catalog::State::isDelete () const { return (_flags&Delete )?1:0; }
|
||||
inline bool Catalog::State::isPhysical () const { return (_flags&Physical )?1:0; }
|
||||
inline bool Catalog::State::isLogical () const { return (_flags&Logical )?1:0; }
|
||||
inline bool Catalog::State::isInMemory () const { return (_flags&InMemory )?1:0; }
|
||||
inline unsigned int Catalog::State::getFlags ( unsigned int mask ) const { return ( _flags & mask ); }
|
||||
inline bool Catalog::State::setFlags ( unsigned int mask, bool value ) {
|
||||
if (value) { _flags |= mask; }
|
||||
|
@ -214,6 +216,8 @@ namespace CRL {
|
|||
|
||||
|
||||
class CatalogExtension {
|
||||
public:
|
||||
static Catalog::State* get ( const Cell* );
|
||||
public:
|
||||
static inline bool isFlattenLeaf ( const Cell* );
|
||||
static inline bool isFeed ( const Cell* );
|
||||
|
@ -238,8 +242,6 @@ namespace CRL {
|
|||
// Modifiers.
|
||||
static inline Library* setLibrary ( const Cell*, Library* library );
|
||||
static inline void setDepth ( const Cell*, unsigned int depth );
|
||||
private:
|
||||
static Catalog::State* _get ( const Cell* );
|
||||
private:
|
||||
static const Cell* _owner;
|
||||
static Catalog::State* _cache;
|
||||
|
@ -248,140 +250,140 @@ namespace CRL {
|
|||
|
||||
inline bool CatalogExtension::isFlattenLeaf ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->isFlattenLeaf();
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::isFeed ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->isFeed();
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::isGds ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->isGds();
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::isPad ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->isPad();
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::isDelete ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->isDelete();
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::isPhysical ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->isPhysical();
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::isLogical ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->isLogical();
|
||||
}
|
||||
|
||||
|
||||
inline unsigned int CatalogExtension::getFlags ( const Cell* cell, unsigned int mask )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? 0 : state->getFlags();
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setFlags ( const Cell* cell, unsigned int mask, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setFlags(mask,value);
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setFlattenLeaf ( const Cell* cell, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setFlattenLeaf(value);
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setFeed ( const Cell* cell, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setFeed(value);
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setPad ( const Cell* cell, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setPad(value);
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setGds ( const Cell* cell, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setGds(value);
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setDelete ( const Cell* cell, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setDelete(value);
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setPhysical ( const Cell* cell, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setPhysical(value);
|
||||
}
|
||||
|
||||
|
||||
inline bool CatalogExtension::setLogical ( const Cell* cell, bool value )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? false : state->setLogical(value);
|
||||
}
|
||||
|
||||
|
||||
inline Library* CatalogExtension::getLibrary ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? NULL : state->getLibrary();
|
||||
}
|
||||
|
||||
|
||||
inline unsigned int CatalogExtension::getDepth ( const Cell* cell )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? 0 : state->getDepth();
|
||||
}
|
||||
|
||||
|
||||
inline Library* CatalogExtension::setLibrary ( const Cell* cell, Library* library )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
return (state == NULL) ? NULL : state->setLibrary(library);
|
||||
}
|
||||
|
||||
|
||||
inline void CatalogExtension::setDepth ( const Cell* cell, unsigned int depth )
|
||||
{
|
||||
Catalog::State* state = _get(cell);
|
||||
Catalog::State* state = get(cell);
|
||||
if ( state == NULL ) state->setDepth(depth);
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ int main ( int argc, char *argv[] )
|
|||
boptions::notify ( arguments );
|
||||
|
||||
Utilities::Path userConfFile ( "ma/configuration" );
|
||||
cerr << "Mark:" << userConfFile.string() << endl;
|
||||
cerr << "Mark:" << userConfFile.toString() << endl;
|
||||
|
||||
if ( arguments.count("help") ) {
|
||||
cout << options << endl;
|
||||
|
|
|
@ -171,6 +171,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
CellViewer* CellViewer::vcreate () const
|
||||
{ return new CellViewer(); }
|
||||
|
||||
|
||||
QString CellViewer::_getAbsWidgetPath ( const QString& relPath ) const
|
||||
{
|
||||
if (relPath.startsWith("viewer.")) return relPath;
|
||||
|
@ -776,14 +780,14 @@ namespace Hurricane {
|
|||
if (not userDirectory.absolute())
|
||||
userDirectory = Utilities::Path::cwd() / userDirectory;
|
||||
|
||||
Isobar::Script::addPath( userDirectory.string() );
|
||||
Isobar::Script::addPath( userDirectory.toString() );
|
||||
|
||||
dbo_ptr<Isobar::Script> script = Isobar::Script::create(userScript.basename().string());
|
||||
dbo_ptr<Isobar::Script> script = Isobar::Script::create(userScript.basename().toString());
|
||||
script->addKwArgument( "cell" , (PyObject*)PyCell_Link(getCell()) );
|
||||
script->addKwArgument( "editor" , (PyObject*)PyCellViewer_Link(this) );
|
||||
script->runFunction ( "ScriptMain", getCell() );
|
||||
|
||||
Isobar::Script::removePath( userDirectory.string() );
|
||||
Isobar::Script::removePath( userDirectory.toString() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, 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 |
|
||||
// | |
|
||||
|
@ -17,21 +11,17 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./NetlistModel.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 "hurricane/viewer/NetlistModel.h"
|
||||
#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 "hurricane/viewer/NetlistModel.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -80,7 +70,7 @@ namespace Hurricane {
|
|||
{
|
||||
if ( orientation == Qt::Vertical ) return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +0 );
|
||||
|
||||
if ( role == Qt::FontRole ) return headerFont;
|
||||
if ( role != Qt::DisplayRole ) return QVariant();
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, 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 |
|
||||
// | |
|
||||
|
@ -17,16 +11,12 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PaletteItem.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
# include <QPainter>
|
||||
|
||||
# include "hurricane/viewer/Graphics.h"
|
||||
# include "hurricane/viewer/PaletteItem.h"
|
||||
#include <QPainter>
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/PaletteItem.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, 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 |
|
||||
// | |
|
||||
|
@ -17,20 +11,14 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PaletteLayerItem.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
#include "hurricane/BasicLayer.h"
|
||||
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/PaletteLayerItem.h"
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace Hurricane {
|
|||
if ( ( orientation == Qt::Vertical ) or ( section > 1 ) )
|
||||
return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +0 );
|
||||
|
||||
if ( role == Qt::FontRole ) return headerFont;
|
||||
if ( role != Qt::DisplayRole ) return QVariant();
|
||||
|
|
|
@ -221,7 +221,7 @@ namespace Hurricane {
|
|||
if ( orientation == Qt::Vertical )
|
||||
return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +0 );
|
||||
|
||||
if ( role == Qt::FontRole ) return headerFont;
|
||||
if ( role != Qt::DisplayRole ) return QVariant();
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace Hurricane {
|
|||
if ( orientation == Qt::Vertical )
|
||||
return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +0 );
|
||||
|
||||
if ( role == Qt::FontRole ) return headerFont;
|
||||
if ( role != Qt::DisplayRole ) return QVariant();
|
||||
|
|
|
@ -1,43 +1,33 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, 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 |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./SelectionWidget.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QAction>
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
#include <QKeyEvent>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QAction>
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Cell.h"
|
||||
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/SelectionModel.h"
|
||||
#include "hurricane/viewer/SelectionWidget.h"
|
||||
|
|
|
@ -127,6 +127,7 @@ namespace Hurricane {
|
|||
void unselectAll ();
|
||||
inline void setLayerVisible ( const Name& layer, bool visible );
|
||||
void runScript ( QString scriptPath );
|
||||
virtual CellViewer* vcreate () const;
|
||||
virtual std::string _getString () const;
|
||||
public slots:
|
||||
void doAction ();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
@ -15,8 +15,8 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_CONTROLLER_WIDGET__
|
||||
#define __HURRICANE_CONTROLLER_WIDGET__
|
||||
#ifndef HURRICANE_CONTROLLER_WIDGET_H
|
||||
#define HURRICANE_CONTROLLER_WIDGET_H
|
||||
|
||||
|
||||
#include <QTabWidget>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | H U R R I C A N E |
|
||||
|
@ -15,31 +15,26 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_GRAPHICS__
|
||||
#define __HURRICANE_GRAPHICS__
|
||||
#ifndef HURRICANE_GRAPHICS_H
|
||||
#define HURRICANE_GRAPHICS_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "hurricane/Breakpoint.h"
|
||||
#include "hurricane/TextTranslator.h"
|
||||
#include "hurricane/viewer/DisplayStyle.h"
|
||||
#include "hurricane/viewer/ColorScale.h"
|
||||
#include "hurricane/viewer/BreakpointWidget.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <QFont>
|
||||
#include "hurricane/Breakpoint.h"
|
||||
#include "hurricane/TextTranslator.h"
|
||||
#include "hurricane/viewer/DisplayStyle.h"
|
||||
#include "hurricane/viewer/ColorScale.h"
|
||||
#include "hurricane/viewer/BreakpointWidget.h"
|
||||
|
||||
class QColor;
|
||||
class QPen;
|
||||
class QBrush;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Name;
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | H U R R I C A N E |
|
||||
|
@ -15,14 +15,13 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_INSPECTOR_WIDGET__
|
||||
#define __HURRICANE_INSPECTOR_WIDGET__
|
||||
#ifndef HURRICANE_INSPECTOR_WIDGET_H
|
||||
#define HURRICANE_INSPECTOR_WIDGET_H
|
||||
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include <QWidget>
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
|
|
|
@ -1,68 +1,29 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||
//
|
||||
// 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 |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./NetInformations.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// | C++ Header : "./hurricane/viewer/NetInformations.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __NET_INFORMATIONS_H__
|
||||
#define __NET_INFORMATIONS_H__
|
||||
#ifndef HURRICANE_NET_INFORMATIONS_H
|
||||
#define HURRICANE_NET_INFORMATIONS_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include <vector>
|
||||
#include <QVariant>
|
||||
#include "hurricane/Commons.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Net;
|
||||
class Cell;
|
||||
|
||||
|
@ -193,7 +154,6 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __NET_INFORMATIONS_H__
|
||||
#endif // HURRICANE_NET_INFORMATIONS_H
|
||||
|
|
|
@ -1,47 +1,36 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, 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 |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./NetlistModel.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// | C++ Header : "./hurricane/viewer/NetlistModel.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_NETLIST_MODEL__
|
||||
#define __HURRICANE_NETLIST_MODEL__
|
||||
#ifndef HURRICANE_NETLIST_MODEL_H
|
||||
#define HURRICANE_NETLIST_MODEL_H
|
||||
|
||||
#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 "hurricane/viewer/NetInformations.h"
|
||||
#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 "hurricane/viewer/NetInformations.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Net;
|
||||
class Cell;
|
||||
|
||||
|
|
|
@ -2,43 +2,33 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, 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 : "./NetlistWidget.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// | C++ Header : "./hurricane/viewer/NetlistWidget.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_NETLIST_WIDGET__
|
||||
#define __HURRICANE_NETLIST_WIDGET__
|
||||
#ifndef HURRICANE_NETLIST_WIDGET_H
|
||||
#define HURRICANE_NETLIST_WIDGET_H
|
||||
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QItemDelegate>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Bug.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
#include "hurricane/viewer/NetlistModel.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
#include <set>
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QItemDelegate>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Bug.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
#include "hurricane/viewer/NetlistModel.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
|
@ -204,7 +194,6 @@ namespace Hurricane {
|
|||
inline Cell* NetlistWidget::getCell () { return _cell; }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_NETLIST_WIDGET_H__
|
||||
#endif // HURRICANE_NETLIST_WIDGET_H
|
||||
|
|
|
@ -134,16 +134,16 @@ namespace Kite {
|
|||
Utilities::Path systemConfFile = systemConfDir / "kiteInit.py";
|
||||
|
||||
if (systemConfFile.exists()) {
|
||||
Isobar::Script::addPath( systemConfDir.string() );
|
||||
Isobar::Script::addPath( systemConfDir.toString() );
|
||||
|
||||
dbo_ptr<Isobar::Script> script = Isobar::Script::create( systemConfFile.stem().string() );
|
||||
dbo_ptr<Isobar::Script> script = Isobar::Script::create( systemConfFile.stem().toString() );
|
||||
script->addKwArgument( "kite" , (PyObject*)PyKiteEngine_Link(this) );
|
||||
script->runFunction ( "kiteHook", getCell() );
|
||||
|
||||
Isobar::Script::removePath( systemConfDir.string() );
|
||||
Isobar::Script::removePath( systemConfDir.toString() );
|
||||
} else {
|
||||
cerr << Warning("Kite system configuration file:\n <%s> not found."
|
||||
,systemConfFile.string().c_str()) << endl;
|
||||
,systemConfFile.toString().c_str()) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,10 +186,10 @@ int main ( int argc, char *argv[] )
|
|||
Utilities::Path userConfFile ( arguments["conf"].as<string>() );
|
||||
if ( userConfFile.exists() ) {
|
||||
Cfg::Configuration* conf = Cfg::Configuration::get ();
|
||||
conf->readFromFile ( userConfFile.string() );
|
||||
conf->readFromFile ( userConfFile.toString() );
|
||||
} else {
|
||||
cerr << Warning("User defined configuration file:\n <%s> not found."
|
||||
,userConfFile.string().c_str()) << endl;
|
||||
,userConfFile.toString().c_str()) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,13 @@ int main ( int argc, char *argv[] )
|
|||
dbo_ptr<AllianceFramework> af ( AllianceFramework::create() );
|
||||
Cell* cell = NULL;
|
||||
|
||||
Utilities::Path path = Utilities::Path::cwd();
|
||||
vector<Utilities::Path> cwdEntries = path.listdir();
|
||||
cerr << "Contents of cwd:" << path.toString() << endl;
|
||||
for ( Utilities::Path entry : cwdEntries ) {
|
||||
cerr << "- " << entry.toString() << endl;
|
||||
}
|
||||
|
||||
if ( arguments.count("cell") ) {
|
||||
cell = af->getCell (arguments["cell"].as<string>().c_str(), Catalog::State::Views );
|
||||
if (!cell) {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
@ -15,29 +14,25 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
|
||||
#include "crlcore/Environment.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "unicorn/OpenCellDialog.h"
|
||||
#include <iostream>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "crlcore/Environment.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "unicorn/OpenCellDialog.h"
|
||||
|
||||
|
||||
namespace Unicorn {
|
||||
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Warning;
|
||||
using Hurricane::Graphics;
|
||||
using CRL::Environment;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "crlcore/Utilities.h"
|
||||
#include "crlcore/Catalog.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "crlcore/LibraryManager.h"
|
||||
#include "crlcore/GraphicToolEngine.h"
|
||||
#include "crlcore/AcmSigda.h"
|
||||
#include "crlcore/Ispd04Bookshelf.h"
|
||||
|
@ -49,6 +50,7 @@ namespace Unicorn {
|
|||
using CRL::System;
|
||||
using CRL::Catalog;
|
||||
using CRL::AllianceFramework;
|
||||
using CRL::LibraryManager;
|
||||
using CRL::AcmSigda;
|
||||
using CRL::Ispd04;
|
||||
using CRL::Ispd05;
|
||||
|
@ -73,11 +75,12 @@ namespace Unicorn {
|
|||
|
||||
|
||||
UnicornGui::UnicornGui ( QWidget* parent )
|
||||
: CellViewer (parent)
|
||||
, _tools ()
|
||||
, _importCell ()
|
||||
, _importDialog (new ImportCellDialog(this))
|
||||
, _exportDialog (new ExportCellDialog(this))
|
||||
: CellViewer (parent)
|
||||
, _tools ()
|
||||
, _importCell ()
|
||||
, _importDialog (new ImportCellDialog(this))
|
||||
, _exportDialog (new ExportCellDialog(this))
|
||||
, _libraryManager(new LibraryManager ())
|
||||
{
|
||||
addMenu ( "placeAndRoute" , "P&&R" , CellViewer::TopMenu );
|
||||
addMenu ( "placeAndRoute.stepByStep", "&Step by Step" );
|
||||
|
@ -92,6 +95,8 @@ namespace Unicorn {
|
|||
_importCell.addImporter( "BLIF (Yosys/ABC)" , std::bind( &Blif::load , placeholders::_1 ) );
|
||||
_importCell.addImporter( "ICCAD'04 (LEF/DEF)" , std::bind( &Iccad04Lefdef::load, placeholders::_1, 0 ) );
|
||||
_importCell.addImporter( "Alliance compliant DEF" , std::bind( &DefImport::load , placeholders::_1, DefImport::FitAbOnCells) );
|
||||
|
||||
_libraryManager->setCellViewer( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,16 +111,16 @@ namespace Unicorn {
|
|||
Utilities::Path systemConfFile = systemConfDir / "unicornInit.py";
|
||||
|
||||
if (systemConfFile.exists()) {
|
||||
Isobar::Script::addPath( systemConfDir.string() );
|
||||
Isobar::Script::addPath( systemConfDir.toString() );
|
||||
|
||||
dbo_ptr<Isobar::Script> script = Isobar::Script::create( systemConfFile.stem().string() );
|
||||
dbo_ptr<Isobar::Script> script = Isobar::Script::create( systemConfFile.stem().toString() );
|
||||
script->addKwArgument( "editor" , (PyObject*)PyCellViewer_Link(this) );
|
||||
script->runFunction ( "unicornConfigure", getCell() );
|
||||
|
||||
Isobar::Script::removePath( systemConfDir.string() );
|
||||
Isobar::Script::removePath( systemConfDir.toString() );
|
||||
} else {
|
||||
cerr << Warning("Unicorn system configuration file:\n <%s> not found."
|
||||
,systemConfFile.string().c_str()) << endl;
|
||||
,systemConfFile.toString().c_str()) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,6 +135,10 @@ namespace Unicorn {
|
|||
}
|
||||
|
||||
|
||||
UnicornGui* UnicornGui::vcreate () const
|
||||
{ return UnicornGui::create(); }
|
||||
|
||||
|
||||
void UnicornGui::destroy ()
|
||||
{
|
||||
_preDestroy ();
|
||||
|
@ -162,6 +171,13 @@ namespace Unicorn {
|
|||
if ( exportAction ) {
|
||||
connect ( exportAction, SIGNAL(triggered()), this, SLOT(exportCell()) );
|
||||
}
|
||||
|
||||
QAction* action = addToMenu( "tools.libraryManager"
|
||||
, tr("Library Manager")
|
||||
, tr("Browse through Views, Cells & Libraries")
|
||||
, QKeySequence(tr("CTRL+M"))
|
||||
);
|
||||
connect( action, SIGNAL(triggered()), _libraryManager, SLOT(toggleShow()) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "crlcore/Banner.h"
|
||||
namespace CRL {
|
||||
class GraphicTool;
|
||||
class LibraryManager;
|
||||
}
|
||||
|
||||
#include "unicorn/ImportCell.h"
|
||||
|
@ -40,6 +41,7 @@ namespace Unicorn {
|
|||
using Hurricane::Cell;
|
||||
using CRL::Banner;
|
||||
using CRL::GraphicTool;
|
||||
using CRL::LibraryManager;
|
||||
|
||||
class ImportCellDialog;
|
||||
class ExportCellDialog;
|
||||
|
@ -54,6 +56,7 @@ namespace Unicorn {
|
|||
virtual Cell* getCellFromDb ( const char* name );
|
||||
inline ImportCell* getImportCell ();
|
||||
void registerTool ( GraphicTool* );
|
||||
virtual UnicornGui* vcreate () const;
|
||||
virtual std::string _getString () const;
|
||||
public slots:
|
||||
void openCell ();
|
||||
|
@ -72,6 +75,7 @@ namespace Unicorn {
|
|||
ImportCell _importCell;
|
||||
ImportCellDialog* _importDialog;
|
||||
ExportCellDialog* _exportDialog;
|
||||
LibraryManager* _libraryManager;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace Bookshelf {
|
|||
bool Parser::_openStream ( const Utilities::Path& filePath )
|
||||
{
|
||||
if ( _stream.is_open() ) _closeStream();
|
||||
_stream.open ( filePath.string().c_str() );
|
||||
_stream.open ( filePath.toString().c_str() );
|
||||
_lineno = 0;
|
||||
|
||||
return _stream.is_open();
|
||||
|
@ -237,7 +237,7 @@ namespace Bookshelf {
|
|||
|
||||
void Parser::_parseNodes ( const Utilities::Path& nodesPath )
|
||||
{
|
||||
_circuit->setNodesName ( nodesPath.string());
|
||||
_circuit->setNodesName ( nodesPath.toString());
|
||||
|
||||
_state = NodesFormatRevision;
|
||||
_openStream ( nodesPath );
|
||||
|
@ -342,7 +342,7 @@ namespace Bookshelf {
|
|||
|
||||
void Parser::_parseNets ( const Utilities::Path& netsPath )
|
||||
{
|
||||
_circuit->setNetsName ( netsPath.string());
|
||||
_circuit->setNetsName ( netsPath.toString());
|
||||
|
||||
_state = NetsFormatRevision;
|
||||
_openStream ( netsPath );
|
||||
|
@ -478,7 +478,7 @@ namespace Bookshelf {
|
|||
|
||||
void Parser::_parseScl ( const Utilities::Path& sclPath )
|
||||
{
|
||||
_circuit->setSclName ( sclPath.string());
|
||||
_circuit->setSclName ( sclPath.toString());
|
||||
|
||||
_state = SclFormatRevision;
|
||||
_openStream ( sclPath );
|
||||
|
@ -583,7 +583,7 @@ namespace Bookshelf {
|
|||
|
||||
void Parser::_parsePl ( const Utilities::Path& plPath )
|
||||
{
|
||||
_circuit->setPlName ( plPath.string());
|
||||
_circuit->setPlName ( plPath.toString());
|
||||
|
||||
_state = PlFormatRevision;
|
||||
_openStream ( plPath );
|
||||
|
@ -610,13 +610,13 @@ namespace Bookshelf {
|
|||
|
||||
Utilities::Path auxPath ( designName+".aux" );
|
||||
if ( not auxPath.exists() ) {
|
||||
throw Exception ( "%s .aux file not found.", auxPath.string().c_str() );
|
||||
throw Exception ( "%s .aux file not found.", auxPath.toString().c_str() );
|
||||
}
|
||||
|
||||
_circuit = new Circuit ();
|
||||
_circuit->setDesignName ( designName );
|
||||
|
||||
std::cout << " o Reading Bookshelf: <" << auxPath.string() << ">." << std::endl;
|
||||
std::cout << " o Reading Bookshelf: <" << auxPath.toString() << ">." << std::endl;
|
||||
|
||||
_openStream ( auxPath );
|
||||
_readLine ();
|
||||
|
@ -669,7 +669,7 @@ namespace Bookshelf {
|
|||
|
||||
Utilities::Path slotPath ( ordereds[iext] );
|
||||
if ( slotPath.exists() ) {
|
||||
std::cout << " - Reading <" << slotPath.string() << ">" << std::endl;
|
||||
std::cout << " - Reading <" << slotPath.toString() << ">" << std::endl;
|
||||
|
||||
switch ( iext ) {
|
||||
case 0: _parseNodes ( slotPath ); break;
|
||||
|
@ -679,7 +679,7 @@ namespace Bookshelf {
|
|||
case 4: _parsePl ( slotPath ); break;
|
||||
}
|
||||
} else {
|
||||
Exception e ( "Bookshelf::parser(): Slot file <%s> not found", slotPath.string().c_str() );
|
||||
Exception e ( "Bookshelf::parser(): Slot file <%s> not found", slotPath.toString().c_str() );
|
||||
if ( iext < 2 ) throw e;
|
||||
else std::cerr << e.what() << std::endl;
|
||||
}
|
||||
|
|
|
@ -75,17 +75,17 @@ int main ( int argc, char* argv[] )
|
|||
if ( arguments.count("conf") ) {
|
||||
Utilities::Path confPath = ( arguments["conf"].as<string>() );
|
||||
if ( confPath.exists() ) {
|
||||
cout << "Reading configuration: <" << confPath.string() << ">." << endl;
|
||||
conf->readFromFile ( confPath.string() );
|
||||
cout << "Reading configuration: <" << confPath.toString() << ">." << endl;
|
||||
conf->readFromFile ( confPath.toString() );
|
||||
} else {
|
||||
cout << "Configuration file: <" << confPath.string() << "> doesn't exists." << endl;
|
||||
cout << "Configuration file: <" << confPath.toString() << "> doesn't exists." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Utilities::Path dotConfPath ( "./.coriolis2.configuration.xml" );
|
||||
if ( dotConfPath.exists() ) {
|
||||
cout << "Reading dot configuration: <" << dotConfPath.string() << ">." << endl;
|
||||
conf->readFromFile ( dotConfPath.string() );
|
||||
cout << "Reading dot configuration: <" << dotConfPath.toString() << ">." << endl;
|
||||
conf->readFromFile ( dotConfPath.toString() );
|
||||
}
|
||||
|
||||
//cout << "misc.catchCore: " << conf->getParameter("misc.catchCore" )->asBool() << endl;
|
||||
|
@ -93,14 +93,14 @@ int main ( int argc, char* argv[] )
|
|||
|
||||
Utilities::Path pyDotConfPath ( "./.coriolis2.configuration.py" );
|
||||
if ( pyDotConfPath.exists() ) {
|
||||
cout << "Reading python dot configuration: <" << pyDotConfPath.string() << ">." << endl;
|
||||
cout << "Reading python dot configuration: <" << pyDotConfPath.toString() << ">." << endl;
|
||||
Py_Initialize ();
|
||||
FILE* fd = fopen ( pyDotConfPath.string().c_str(), "r" );
|
||||
FILE* fd = fopen ( pyDotConfPath.toString().c_str(), "r" );
|
||||
if ( fd ) {
|
||||
PyRun_SimpleFile ( fd, pyDotConfPath.string().c_str() );
|
||||
PyRun_SimpleFile ( fd, pyDotConfPath.toString().c_str() );
|
||||
fclose ( fd );
|
||||
} else {
|
||||
cout << "Cannot open Python configuration file: <" << pyDotConfPath.string() << ">." << endl;
|
||||
cout << "Cannot open Python configuration file: <" << pyDotConfPath.toString() << ">." << endl;
|
||||
}
|
||||
Py_Finalize ();
|
||||
}
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
|
||||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the VSLSI Stand-Alone Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
// Copyright (c) UPMC 2010-2015, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | C o n f i g u r a t i o n D a t a - B a s e |
|
||||
// | |
|
||||
|
@ -18,10 +11,7 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./ConfTabWidget.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <QLabel>
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the VSLSI Stand-Alone Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
// Copyright (c) UPMC 2010-2015, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | C o n f i g u r a t i o n D a t a - B a s e |
|
||||
// | |
|
||||
|
@ -17,10 +11,7 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./ConfigurationWidget.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the VSLSI Stand-Alone Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2011, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
// Copyright (c) UPMC 2010-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the VLSI Stand-Alone Software.
|
||||
// Copyright (c) UPMC 2013-2013, All Rights Reserved
|
||||
// Copyright (c) UPMC 2013-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | V L S I Stand - Alone Parsers / Drivers |
|
||||
|
@ -15,19 +15,19 @@
|
|||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "vlsisapd/utilities/Path.h"
|
||||
|
||||
|
||||
namespace Utilities {
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int Path::_toUnistd ( unsigned int mode )
|
||||
{
|
||||
|
@ -58,10 +58,10 @@ namespace Utilities {
|
|||
}
|
||||
|
||||
|
||||
void Path::_split ( const std::string& path, vector<std::string>& elements, unsigned int& flags )
|
||||
void Path::_split ( const string& path, vector<string>& elements, unsigned int& flags )
|
||||
{
|
||||
if (path.empty()) return;
|
||||
|
||||
|
||||
size_t begin = 0;
|
||||
if (path[0] == '/') {
|
||||
flags |= Absolute;
|
||||
|
@ -81,19 +81,21 @@ namespace Utilities {
|
|||
void Path::_normalize ()
|
||||
{
|
||||
if ( (size() == 1) and (_elements[0] == ".") ) return;
|
||||
|
||||
_flags |= Invalidated;
|
||||
|
||||
if (not _elements.empty() and (_elements[0] == "~")) {
|
||||
char* home = getenv( "HOME" );
|
||||
if (home) {
|
||||
vector<std::string> vhome;
|
||||
unsigned int vflags = 0;
|
||||
vector<string> vhome;
|
||||
unsigned int vflags = 0;
|
||||
_split( home, vhome, vflags );
|
||||
_flags |= vflags;
|
||||
_elements.insert( _elements.begin(), vhome.begin(), vhome.end() );
|
||||
}
|
||||
}
|
||||
|
||||
vector<std::string>::iterator ie = _elements.begin();
|
||||
vector<string>::iterator ie = _elements.begin();
|
||||
while ( ie != _elements.end() ) {
|
||||
if ( ((*ie) == ".") or (*ie).empty()) {
|
||||
_elements.erase(ie);
|
||||
|
@ -112,7 +114,7 @@ namespace Utilities {
|
|||
}
|
||||
}
|
||||
|
||||
if (not _elements.empty() and (_elements.back().find_last_of('.') != std::string::npos))
|
||||
if (not _elements.empty() and (_elements.back().find_last_of('.') != string::npos))
|
||||
_flags |= Extension;
|
||||
|
||||
// cout << "_normalize(" << path << ")" << endl;
|
||||
|
@ -123,14 +125,14 @@ namespace Utilities {
|
|||
}
|
||||
|
||||
|
||||
void Path::_normalize ( const std::string& path )
|
||||
void Path::_normalize ( const string& path )
|
||||
{
|
||||
_split( path, _elements, _flags );
|
||||
_normalize();
|
||||
}
|
||||
|
||||
|
||||
std::string Path::ext () const
|
||||
string Path::ext () const
|
||||
{
|
||||
if (not (_flags&Extension)) return "";
|
||||
return _elements.back().substr(_elements.back().find_last_of('.')+1);
|
||||
|
@ -142,19 +144,41 @@ namespace Utilities {
|
|||
int status = ::mkdir( c_str(), _toMode_T(mode) );
|
||||
return (status == 0);
|
||||
}
|
||||
|
||||
|
||||
const std::string& Path::string () const
|
||||
|
||||
|
||||
vector<Path> Path::listdir () const
|
||||
{
|
||||
_pathcache.clear();
|
||||
|
||||
for ( size_t i=0 ; i<size() ; ++i ) {
|
||||
if ((i != 0) or (_flags & Absolute)) {
|
||||
_pathcache += '/';
|
||||
vector<Path> entries;
|
||||
|
||||
if (isdir()) {
|
||||
DIR* fdir = NULL;
|
||||
struct dirent* fentry = NULL;
|
||||
fdir = opendir( toString().c_str() );
|
||||
if (fdir) {
|
||||
while ( (fentry = readdir(fdir)) != NULL ) {
|
||||
string name = fentry->d_name;
|
||||
if ( (name == ".") or (name == "..") ) continue;
|
||||
|
||||
entries.push_back( join(name) );
|
||||
}
|
||||
}
|
||||
_pathcache += _elements[i];
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
const string& Path::toString () const
|
||||
{
|
||||
if (_flags & Invalidated) {
|
||||
_pathcache.clear();
|
||||
|
||||
for ( size_t i=0 ; i<size() ; ++i ) {
|
||||
if ((i != 0) or (_flags & Absolute)) {
|
||||
_pathcache += '/';
|
||||
}
|
||||
_pathcache += _elements[i];
|
||||
}
|
||||
}
|
||||
return _pathcache;
|
||||
}
|
||||
|
||||
|
@ -175,17 +199,17 @@ namespace Utilities {
|
|||
|
||||
Path Path::stem () const
|
||||
{
|
||||
std::string dotext = ext();
|
||||
string dotext = ext();
|
||||
if (not dotext.empty()) dotext.insert( 0, "." );
|
||||
return basename(dotext);
|
||||
}
|
||||
|
||||
|
||||
Path Path::basename ( const std::string& ext ) const
|
||||
Path Path::basename ( const string& ext ) const
|
||||
{
|
||||
if (empty()) return Path();
|
||||
|
||||
std::string basename = _elements.back();
|
||||
string basename = _elements.back();
|
||||
if (not ext.empty() and (basename.substr(basename.size()-ext.size()) == ext))
|
||||
basename = basename.substr(0,basename.size()-ext.size());
|
||||
return Path(basename);
|
||||
|
@ -205,7 +229,7 @@ namespace Utilities {
|
|||
struct stat statinfos;
|
||||
int status = 0;
|
||||
|
||||
status = stat( string().c_str(), &statinfos );
|
||||
status = ::stat( toString().c_str(), &statinfos );
|
||||
if (not status) return true;
|
||||
|
||||
return false;
|
||||
|
@ -216,18 +240,36 @@ namespace Utilities {
|
|||
{
|
||||
int status = 0;
|
||||
|
||||
status = ::access( string().c_str(), _toUnistd(mode) );
|
||||
status = ::access( toString().c_str(), _toUnistd(mode) );
|
||||
if (not status) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
unsigned int Path::mode () const
|
||||
{
|
||||
struct stat bstat;
|
||||
int status = 0;
|
||||
status = ::stat( toString().c_str(), &bstat );
|
||||
// Should check for errno here.
|
||||
|
||||
return bstat.st_mode;
|
||||
}
|
||||
|
||||
|
||||
Path::Stat Path::stat () const
|
||||
{
|
||||
Stat stat;
|
||||
if (exists()) ::stat( _pathcache.c_str(), stat.c_stat() );
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
Path Path::join ( const Path& tail ) const
|
||||
{
|
||||
Path result ( *this );
|
||||
result._elements.insert( result._elements.end(), tail._elements.begin(), tail._elements.end() );
|
||||
|
||||
result._normalize();
|
||||
return result;
|
||||
}
|
||||
|
@ -243,7 +285,7 @@ namespace Utilities {
|
|||
|
||||
Path& Path::operator= ( const Path& other )
|
||||
{
|
||||
vector<std::string>().swap( _elements );
|
||||
vector<string>().swap( _elements );
|
||||
_elements = other._elements;
|
||||
_flags = other._flags;
|
||||
_pathcache = other._pathcache;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the VSLSI Stand-Alone Software.
|
||||
// Copyright (c) UPMC 2013-2013, All Rights Reserved
|
||||
// Copyright (c) UPMC 2013-2015, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | V L S I Stand - Alone Parsers / Drivers |
|
||||
|
@ -18,6 +18,9 @@
|
|||
#ifndef VLSISAPD_UTILITIES_PATH_H
|
||||
#define VLSISAPD_UTILITIES_PATH_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -34,31 +37,54 @@ namespace Utilities {
|
|||
, PermWrite = 0x00000008
|
||||
, PermExecute = 0x00000010
|
||||
, PermAll = PermRead|PermWrite|PermExecute
|
||||
, Invalidated = 0x00000020
|
||||
};
|
||||
enum Mode_T { s_ifmt = 0x00170000
|
||||
, s_ifsock = 0x00140000
|
||||
, s_iflnk = 0x00120000
|
||||
, s_ifreg = 0x00100000
|
||||
, s_ifblk = 0x00060000
|
||||
, s_ifdir = 0x00040000
|
||||
, s_ifchr = 0x00020000
|
||||
, s_ififo = 0x00010000
|
||||
, s_isuid = 0x00004000
|
||||
, s_isgid = 0x00002000
|
||||
, s_isvtx = 0x00001000
|
||||
, s_irusr = 0x00000400
|
||||
, s_iwusr = 0x00000200
|
||||
, s_ixusr = 0x00000100
|
||||
enum Mode_T { s_ifmt = S_IFMT // 0x00170000
|
||||
, s_ifsock = S_IFSOCK // 0x00140000
|
||||
, s_iflnk = S_IFLNK // 0x00120000
|
||||
, s_ifreg = S_IFREG // 0x00100000
|
||||
, s_ifblk = S_IFBLK // 0x00060000
|
||||
, s_ifdir = S_IFDIR // 0x00040000
|
||||
, s_ifchr = S_IFCHR // 0x00020000
|
||||
, s_ififo = S_IFIFO // 0x00010000
|
||||
, s_isuid = S_ISUID // 0x00004000
|
||||
, s_isgid = S_ISGID // 0x00002000
|
||||
, s_isvtx = S_ISVTX // 0x00001000
|
||||
, s_irusr = S_IWUSR // 0x00000400
|
||||
, s_iwusr = S_IWUSR // 0x00000200
|
||||
, s_ixusr = S_IXUSR // 0x00000100
|
||||
, s_irwxu = s_irusr|s_iwusr|s_ixusr
|
||||
, s_irgrp = 0x00000040
|
||||
, s_iwgrp = 0x00000020
|
||||
, s_ixgrp = 0x00000010
|
||||
, s_irgrp = S_IRGRP // 0x00000040
|
||||
, s_iwgrp = S_IWGRP // 0x00000020
|
||||
, s_ixgrp = S_IXGRP // 0x00000010
|
||||
, s_irwxg = s_irgrp|s_iwgrp|s_ixgrp
|
||||
, s_iroth = 0x00000004
|
||||
, s_iwoth = 0x00000002
|
||||
, s_ixoth = 0x00000001
|
||||
, s_iroth = S_IROTH // 0x00000004
|
||||
, s_iwoth = S_IWOTH // 0x00000002
|
||||
, s_ixoth = S_IXOTH // 0x00000001
|
||||
, s_irwxo = s_iroth|s_iwoth|s_ixoth
|
||||
};
|
||||
public:
|
||||
class Stat {
|
||||
public:
|
||||
inline Stat ();
|
||||
inline Stat ( const Stat& );
|
||||
inline dev_t dev () const;
|
||||
inline ino_t ino () const;
|
||||
inline mode_t mode () const;
|
||||
inline nlink_t nlink () const;
|
||||
inline uid_t uid () const;
|
||||
inline gid_t gid () const;
|
||||
inline dev_t rdev () const;
|
||||
inline off_t size () const;
|
||||
inline blksize_t blksize() const;
|
||||
inline blkcnt_t blocks () const;
|
||||
inline time_t atime () const;
|
||||
inline time_t mtime () const;
|
||||
inline time_t ctime () const;
|
||||
inline struct stat* c_stat ();
|
||||
private:
|
||||
struct stat _stat;
|
||||
};
|
||||
public:
|
||||
static Path cwd ();
|
||||
public:
|
||||
|
@ -69,6 +95,11 @@ namespace Utilities {
|
|||
inline bool extension () const;
|
||||
bool exists () const;
|
||||
bool access ( unsigned int mode ) const;
|
||||
unsigned int mode () const;
|
||||
Stat stat () const;
|
||||
inline bool isfile () const;
|
||||
inline bool isdir () const;
|
||||
inline bool islink () const;
|
||||
inline bool empty () const;
|
||||
inline size_t size () const;
|
||||
inline Path head () const;
|
||||
|
@ -80,7 +111,8 @@ namespace Utilities {
|
|||
Path join ( const Path& tail ) const;
|
||||
std::string ext () const;
|
||||
bool mkdir ( unsigned int mode=s_irwxu|s_irwxg|s_irwxo ) const;
|
||||
const std::string& string () const;
|
||||
std::vector<Path> listdir () const;
|
||||
const std::string& toString () const;
|
||||
inline const char* c_str () const;
|
||||
Path& operator= ( const Path& );
|
||||
Path& operator/= ( const Path& );
|
||||
|
@ -93,23 +125,76 @@ namespace Utilities {
|
|||
void _normalize ();
|
||||
void _normalize ( const std::string& );
|
||||
private:
|
||||
unsigned int _flags;
|
||||
mutable unsigned int _flags;
|
||||
std::vector<std::string> _elements;
|
||||
mutable std::string _pathcache;
|
||||
};
|
||||
|
||||
|
||||
inline Path::Stat::Stat ()
|
||||
{
|
||||
_stat.st_dev = 0;
|
||||
_stat.st_ino = 0;
|
||||
_stat.st_mode = 0;
|
||||
_stat.st_nlink = 0;
|
||||
_stat.st_uid = 0;
|
||||
_stat.st_gid = 0;
|
||||
_stat.st_rdev = 0;
|
||||
_stat.st_size = 0;
|
||||
_stat.st_blksize = 0;
|
||||
_stat.st_blocks = 0;
|
||||
_stat.st_atime = 0;
|
||||
_stat.st_mtime = 0;
|
||||
_stat.st_ctime = 0;
|
||||
}
|
||||
|
||||
inline Path::Stat::Stat ( const Stat& other )
|
||||
{
|
||||
_stat.st_dev = other._stat.st_dev;
|
||||
_stat.st_ino = other._stat.st_ino;
|
||||
_stat.st_mode = other._stat.st_mode;
|
||||
_stat.st_nlink = other._stat.st_nlink;
|
||||
_stat.st_uid = other._stat.st_uid;
|
||||
_stat.st_gid = other._stat.st_gid;
|
||||
_stat.st_rdev = other._stat.st_rdev;
|
||||
_stat.st_size = other._stat.st_size;
|
||||
_stat.st_blksize = other._stat.st_blksize;
|
||||
_stat.st_blocks = other._stat.st_blocks;
|
||||
_stat.st_atime = other._stat.st_atime;
|
||||
_stat.st_mtime = other._stat.st_mtime;
|
||||
_stat.st_ctime = other._stat.st_ctime;
|
||||
}
|
||||
|
||||
inline dev_t Path::Stat::dev () const { return _stat.st_dev; }
|
||||
inline ino_t Path::Stat::ino () const { return _stat.st_ino; }
|
||||
inline mode_t Path::Stat::mode () const { return _stat.st_mode; }
|
||||
inline nlink_t Path::Stat::nlink () const { return _stat.st_nlink; }
|
||||
inline uid_t Path::Stat::uid () const { return _stat.st_uid; }
|
||||
inline gid_t Path::Stat::gid () const { return _stat.st_gid; }
|
||||
inline dev_t Path::Stat::rdev () const { return _stat.st_rdev; }
|
||||
inline off_t Path::Stat::size () const { return _stat.st_size; }
|
||||
inline blksize_t Path::Stat::blksize() const { return _stat.st_blksize; }
|
||||
inline blkcnt_t Path::Stat::blocks () const { return _stat.st_blocks; }
|
||||
inline time_t Path::Stat::atime () const { return _stat.st_atime; }
|
||||
inline time_t Path::Stat::mtime () const { return _stat.st_mtime; }
|
||||
inline time_t Path::Stat::ctime () const { return _stat.st_ctime; }
|
||||
inline struct stat* Path::Stat::c_stat () { return &_stat; }
|
||||
|
||||
|
||||
inline Path::Path ( const char* path ) : _flags(NoFlag), _elements(), _pathcache() { _normalize(path); }
|
||||
inline Path::Path ( const std::string& path ) : _flags(NoFlag), _elements(), _pathcache() { _normalize(path); }
|
||||
inline Path::Path ( const char* path ) : _flags(Invalidated), _elements(), _pathcache() { _normalize(path); }
|
||||
inline Path::Path ( const std::string& path ) : _flags(Invalidated), _elements(), _pathcache() { _normalize(path); }
|
||||
inline Path::Path ( const Path& path ) : _flags(path._flags), _elements(path._elements), _pathcache(path._pathcache) {}
|
||||
|
||||
inline bool Path::isfile () const { return mode() & s_ifmt; }
|
||||
inline bool Path::isdir () const { return mode() & s_ifdir; }
|
||||
inline bool Path::islink () const { return mode() & s_iflnk; }
|
||||
inline bool Path::absolute () const { return _flags&Absolute; }
|
||||
inline bool Path::extension () const { return _flags&Extension; }
|
||||
inline bool Path::empty () const { return _elements.empty(); }
|
||||
inline size_t Path::size () const { return _elements.size(); }
|
||||
inline Path Path::head () const { return (size() > 1) ? subpath(0,size()-1) : *this; }
|
||||
inline Path Path::tail () const { return (size() > 1) ? subpath(1,size()) : *this; }
|
||||
inline const char* Path::c_str () const { return Path::string().c_str(); }
|
||||
inline const char* Path::c_str () const { return Path::toString().c_str(); }
|
||||
inline Path& Path::operator/= ( const std::string& tail ) { (*this) /= Path(tail); return *this; }
|
||||
inline Path& Path::operator/= ( const char* tail ) { (*this) /= Path(tail); return *this; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue