Implementation of DataBase native save/restore in JSON (step 3).
* New: In VLSISAPD, in Parameter, callback have now a tag, which the pointer to the caller. This allow for the callback removal when the caller is destroyed. * New: In VLSISAPD, in WidgetDescription, when associated to a parameter, the destructor must remove the associated callback function on the Parameter. * New: In Hurricane, added JSON support for Configuration, separated from vlsisapd, as the support is not available at this point. JSON support for Configuration, Parameter & LayoutDescription. * Change: In Hurricane, in JsonStack, the stack of JsonObjects has been displaced here from HurricaneHandler. This way, all JsonObject::toData() can access the JsonOjects in the context of the parser. * New: In Hurricane, in DBo::toJson() added support for Entity by reference (ids). * New: In Hurricane, added JSON support for all Layer sub-class types. * New: In Hurricane, in Technology, export the Layers, but must be sorted by increasing mask value. * New: In Hurricane, in Entity, added support for Entity by reference (ids). * New: In Hurricane, in DataBase, added technology full support. * New: In Hurricane, In JsonNet, move the ring rebuild management from JsonStack to JsonNet. * New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents (not cleanly implemented as a Relation). * New: In Hurricane, new method Cell::fromJson() to load a cell from a JSON file. * New: In Hurricane, In Graphics, make it an observable, for when JSON fully reload the graphic state, it must be able to notify other objects (namely the Controller). * New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate the palette as needed. New method ControllerTab::graphicsUpdated(). * New: In Hurricane, in RawDrawingStyle added a destructor to release the Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup, & DisplayStyle. * New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics() to erase the previous widgets and re-create the new ones. * New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets in case of Graphics change. * New: In CRL Core, in System, register the parameters callbacks with the address of the object, for later deletion. * New: In CRL Core, in AllianceFramework, make it observable, to notify library changes. For the AllianceFramework creation, now allow to completly bypass the Python initialization system, when we expect to restore it from a full blob. Added methods to sets the default RoutingGauge & CellGauge. * New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge & RoutingGauge. * New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update the list of libraries in case of change (for JSON full reload).
This commit is contained in:
parent
f508bb0d20
commit
e064358e0d
|
@ -24,6 +24,7 @@
|
|||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
|
@ -37,6 +38,10 @@ namespace CRL {
|
|||
{ }
|
||||
|
||||
|
||||
void LibrariesModel::update ()
|
||||
{ emit layoutChanged(); }
|
||||
|
||||
|
||||
QVariant LibrariesModel::data ( const QModelIndex& index, int role ) const
|
||||
{
|
||||
static QFont nameFont = Graphics::getFixedFont( QFont::Bold );
|
||||
|
|
|
@ -75,6 +75,10 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void LibrariesWidget::update ()
|
||||
{ _baseModel->update(); }
|
||||
|
||||
|
||||
void LibrariesWidget::initSelection ()
|
||||
{ _view->selectRow( 0 ); }
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "hurricane/Error.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/CellViewer.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
#include "crlcore/LibraryManager.h"
|
||||
#include "crlcore/LibrariesWidget.h"
|
||||
#include "crlcore/CellsWidget.h"
|
||||
|
@ -39,13 +40,30 @@ namespace CRL {
|
|||
using Hurricane::Graphics;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "FrameworkObserver".
|
||||
|
||||
void FrameworkObserver::notify ( unsigned int flags )
|
||||
{
|
||||
LibraryManager* manager = getOwner();
|
||||
if (flags & (AllianceFramework::AddedLibrary
|
||||
|AllianceFramework::RemovedLibrary)) {
|
||||
manager->getLibrariesWidget()->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "LibraryManager".
|
||||
|
||||
LibraryManager::LibraryManager ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _librariesWidget(new LibrariesWidget())
|
||||
, _cellsWidget (new CellsWidget())
|
||||
, _viewsWidget (new ViewsWidget())
|
||||
, _cellViewer (NULL)
|
||||
, _libPath (NULL)
|
||||
: QWidget (parent)
|
||||
, _frameworkObserver(this)
|
||||
, _librariesWidget (new LibrariesWidget())
|
||||
, _cellsWidget (new CellsWidget())
|
||||
, _viewsWidget (new ViewsWidget())
|
||||
, _cellViewer (NULL)
|
||||
, _libPath (NULL)
|
||||
{
|
||||
setObjectName ( "libraryManager" );
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
|
@ -100,10 +118,18 @@ namespace CRL {
|
|||
|
||||
_librariesWidget->initSelection();
|
||||
|
||||
AllianceFramework::get()->addObserver( &_frameworkObserver );
|
||||
|
||||
resize( Graphics::toHighDpi(750), Graphics::toHighDpi(550) );
|
||||
}
|
||||
|
||||
|
||||
LibraryManager::~LibraryManager ()
|
||||
{
|
||||
AllianceFramework::get()->removeObserver( &_frameworkObserver );
|
||||
}
|
||||
|
||||
|
||||
void LibraryManager::toggleShow ()
|
||||
{ setVisible( not isVisible() ); }
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace CRL {
|
|||
QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const;
|
||||
const AllianceLibrary* getLibrary ( const QModelIndex& );
|
||||
const AllianceLibrary* getLibrary ( size_t );
|
||||
void update ();
|
||||
private:
|
||||
const AllianceLibraries& _libraries;
|
||||
};
|
||||
|
|
|
@ -36,12 +36,12 @@ namespace CRL {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "LibrariesWidget".
|
||||
|
||||
|
||||
class LibrariesWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
LibrariesWidget ( QWidget* parent=NULL );
|
||||
void initSelection ();
|
||||
void update ();
|
||||
signals:
|
||||
void selectedLibrary ( const AllianceLibrary* );
|
||||
public slots:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define CRL_LIBRARY_MANAGER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "hurricane/Observer.h"
|
||||
|
||||
class QLabel;
|
||||
class QModelIndex;
|
||||
|
@ -34,10 +35,29 @@ namespace CRL {
|
|||
|
||||
using Hurricane::Cell;
|
||||
using Hurricane::CellViewer;
|
||||
using Hurricane::Observer;
|
||||
class AllianceLibrary;
|
||||
class ViewsWidget;
|
||||
class CellsWidget;
|
||||
class LibrariesWidget;
|
||||
class LibraryManager;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "FrameworkObserver".
|
||||
|
||||
class FrameworkObserver : public Observer<LibraryManager> {
|
||||
public:
|
||||
inline FrameworkObserver ( LibraryManager* );
|
||||
virtual void notify ( unsigned int flags );
|
||||
private:
|
||||
FrameworkObserver ( const FrameworkObserver& );
|
||||
};
|
||||
|
||||
|
||||
inline FrameworkObserver::FrameworkObserver ( LibraryManager* owner )
|
||||
: Observer<LibraryManager>(owner)
|
||||
{ }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -47,25 +67,29 @@ namespace CRL {
|
|||
class LibraryManager : public QWidget {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
LibraryManager ( QWidget* parent=NULL );
|
||||
inline void setCellViewer ( CellViewer* );
|
||||
inline CellViewer* getCellViewer () const;
|
||||
LibraryManager ( QWidget* parent=NULL );
|
||||
~LibraryManager ();
|
||||
inline void setCellViewer ( CellViewer* );
|
||||
inline CellViewer* getCellViewer () const;
|
||||
inline LibrariesWidget* getLibrariesWidget () const;
|
||||
public slots:
|
||||
void toggleShow ();
|
||||
void setLibrary ( const AllianceLibrary* library );
|
||||
CellViewer* openCell ( Cell*, unsigned int flags );
|
||||
void updateLibrary ( Cell* );
|
||||
void toggleShow ();
|
||||
void setLibrary ( const AllianceLibrary* library );
|
||||
CellViewer* openCell ( Cell*, unsigned int flags );
|
||||
void updateLibrary ( Cell* );
|
||||
private:
|
||||
LibrariesWidget* _librariesWidget;
|
||||
CellsWidget* _cellsWidget;
|
||||
ViewsWidget* _viewsWidget;
|
||||
CellViewer* _cellViewer;
|
||||
QLabel* _libPath;
|
||||
FrameworkObserver _frameworkObserver;
|
||||
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; }
|
||||
inline void LibraryManager::setCellViewer ( CellViewer* cw ) { _cellViewer=cw; }
|
||||
inline CellViewer* LibraryManager::getCellViewer () const { return _cellViewer; }
|
||||
inline LibrariesWidget* LibraryManager::getLibrariesWidget () const { return _librariesWidget; }
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
|
|
@ -183,12 +183,16 @@ namespace CRL {
|
|||
|
||||
|
||||
AllianceFramework::AllianceFramework ()
|
||||
: _environment()
|
||||
, _parsers()
|
||||
, _drivers()
|
||||
, _catalog()
|
||||
, _parentLibrary(NULL)
|
||||
, _routingGauges()
|
||||
: _observers ()
|
||||
, _environment ()
|
||||
, _parsers ()
|
||||
, _drivers ()
|
||||
, _catalog ()
|
||||
, _parentLibrary (NULL)
|
||||
, _routingGauges ()
|
||||
, _defaultRoutingGauge(NULL)
|
||||
, _cellGauges ()
|
||||
, _defaultCellGauge (NULL)
|
||||
{
|
||||
DataBase* db = DataBase::getDB ();
|
||||
if ( not db )
|
||||
|
@ -255,7 +259,8 @@ namespace CRL {
|
|||
for ( unsigned i=0 ; i<LIBRARIES.getSize() ; i++ ) {
|
||||
createLibrary ( LIBRARIES[i].getPath(), flags, LIBRARIES[i].getName() );
|
||||
|
||||
//cmess2 << " - \"" << LIBRARIES[i].getPath() << "\"";
|
||||
//cmess2 << " - " << LIBRARIES[i].getName()
|
||||
// << " \"" << LIBRARIES[i].getPath() << "\"" << endl;
|
||||
//cmess2.flush();
|
||||
|
||||
//if ( flags&HasCatalog ) cmess2 << " [have CATAL]." << endl;
|
||||
|
@ -264,13 +269,14 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
AllianceFramework* AllianceFramework::create ()
|
||||
AllianceFramework* AllianceFramework::create ( unsigned long flags )
|
||||
{
|
||||
if ( !_singleton ) {
|
||||
if (not _singleton) {
|
||||
// Triggers System singleton creation.
|
||||
System::get ();
|
||||
_singleton = new AllianceFramework ();
|
||||
System::runPythonInit();
|
||||
if (not (flags & NoPythonInit))
|
||||
System::runPythonInit();
|
||||
_singleton->_bindLibraries();
|
||||
}
|
||||
|
||||
|
@ -280,7 +286,7 @@ namespace CRL {
|
|||
|
||||
AllianceFramework* AllianceFramework::get ()
|
||||
{
|
||||
return create ();
|
||||
return create();
|
||||
}
|
||||
|
||||
|
||||
|
@ -296,6 +302,18 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void AllianceFramework::addObserver ( BaseObserver* observer )
|
||||
{ _observers.addObserver( observer ); }
|
||||
|
||||
|
||||
void AllianceFramework::removeObserver ( BaseObserver* observer )
|
||||
{ _observers.removeObserver( observer ); }
|
||||
|
||||
|
||||
void AllianceFramework::notify ( unsigned flags )
|
||||
{ _observers.notify( flags ); }
|
||||
|
||||
|
||||
AllianceLibrary* AllianceFramework::getAllianceLibrary ( unsigned index )
|
||||
{
|
||||
if ( index >= _libraries.size() )
|
||||
|
@ -444,7 +462,10 @@ namespace CRL {
|
|||
|
||||
ParserFormatSlot& parser = _parsers.getParserSlot ( path, Catalog::State::Physical, _environment );
|
||||
|
||||
if ( not parser.loadByLib() ) return alibrary;
|
||||
if ( not parser.loadByLib() ) {
|
||||
notify ( AddedLibrary );
|
||||
return alibrary;
|
||||
}
|
||||
|
||||
// Load the whole library.
|
||||
if ( ! _readLocate(dupLibName,Catalog::State::State::Logical,true) ) return alibrary;
|
||||
|
@ -452,6 +473,7 @@ namespace CRL {
|
|||
// Call the parser function.
|
||||
(parser.getParsLib())( _environment.getLIBRARIES().getSelected() , alibrary->getLibrary() , _catalog );
|
||||
|
||||
notify ( AddedLibrary );
|
||||
return alibrary;
|
||||
}
|
||||
|
||||
|
@ -643,6 +665,18 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
RoutingGauge* AllianceFramework::setRoutingGauge ( const Name& name )
|
||||
{
|
||||
RoutingGauge* gauge = getRoutingGauge( name );
|
||||
if (gauge) _defaultRoutingGauge = gauge;
|
||||
else
|
||||
cerr << Error( "AllianceFramework::setRoutingGauge(): No gauge named \"%s\"."
|
||||
, getString(name).c_str() ) << endl;
|
||||
|
||||
return _defaultRoutingGauge;
|
||||
}
|
||||
|
||||
|
||||
RoutingGauge* AllianceFramework::getRoutingGauge ( const Name& name )
|
||||
{
|
||||
if ( name.isEmpty() ) return _defaultRoutingGauge;
|
||||
|
@ -674,6 +708,18 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
CellGauge* AllianceFramework::setCellGauge ( const Name& name )
|
||||
{
|
||||
CellGauge* gauge = getCellGauge( name );
|
||||
if (gauge) _defaultCellGauge = gauge;
|
||||
else
|
||||
cerr << Error( "AllianceFramework::setCellGauge(): No gauge named \"%s\"."
|
||||
, getString(name).c_str() ) << endl;
|
||||
|
||||
return _defaultCellGauge;
|
||||
}
|
||||
|
||||
|
||||
CellGauge* AllianceFramework::getCellGauge ( const Name& name )
|
||||
{
|
||||
if ( name.isEmpty() ) return _defaultCellGauge;
|
||||
|
@ -735,13 +781,13 @@ namespace CRL {
|
|||
Record *AllianceFramework::_getRecord () const
|
||||
{
|
||||
Record* record = new Record ( "<AllianceFramework>" );
|
||||
record->add ( getSlot ( "_environment" , &_environment ) );
|
||||
record->add ( getSlot ( "_libraries" , &_libraries ) );
|
||||
record->add ( getSlot ( "_catalog" , &_catalog ) );
|
||||
record->add ( getSlot ( "_defaultRroutingGauge", _defaultRoutingGauge ) );
|
||||
record->add ( getSlot ( "_routingGauges" , _routingGauges ) );
|
||||
record->add ( getSlot ( "_defaultCellGauge" , _defaultCellGauge ) );
|
||||
record->add ( getSlot ( "_cellGauges" , _cellGauges ) );
|
||||
record->add ( getSlot ( "_environment" , &_environment ) );
|
||||
record->add ( getSlot ( "_libraries" , &_libraries ) );
|
||||
record->add ( getSlot ( "_catalog" , &_catalog ) );
|
||||
record->add ( getSlot ( "_defaultRoutingGauge", _defaultRoutingGauge ) );
|
||||
record->add ( getSlot ( "_routingGauges" , _routingGauges ) );
|
||||
record->add ( getSlot ( "_defaultCellGauge" , _defaultCellGauge ) );
|
||||
record->add ( getSlot ( "_cellGauges" , _cellGauges ) );
|
||||
return record;
|
||||
}
|
||||
|
||||
|
@ -749,10 +795,13 @@ namespace CRL {
|
|||
void AllianceFramework::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename" , _getTypeName() );
|
||||
jsonWrite( w, "_environment", &_environment );
|
||||
jsonWrite( w, "+libraries" , getCollection(getAllianceLibraries()) );
|
||||
// Environement & Catalog...
|
||||
jsonWrite( w, "@typename" , _getTypeName() );
|
||||
jsonWrite( w, "_environment" , &_environment );
|
||||
jsonWrite( w, "_defaultRoutingGauge", _defaultRoutingGauge->getName() );
|
||||
jsonWrite( w, "_defaultCellGauge" , _defaultCellGauge->getName() );
|
||||
jsonWrite( w, "+libraries" , getAllianceLibraries() );
|
||||
jsonWrite( w, "+routingGauges" , _routingGauges );
|
||||
jsonWrite( w, "+cellGauges" , _cellGauges );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
@ -763,12 +812,25 @@ namespace CRL {
|
|||
Initializer<JsonAllianceFramework> jsonFrameworkInit ( 20 );
|
||||
|
||||
|
||||
JsonAllianceFramework::JsonAllianceFramework (unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
JsonAllianceFramework::JsonAllianceFramework ( unsigned long flags )
|
||||
: JsonObject (flags)
|
||||
, _defaultRoutingGauge()
|
||||
, _defaultCellGauge ()
|
||||
{
|
||||
// Environement & Catalog...
|
||||
add( "_environment", typeid(Environment*) );
|
||||
add( "+libraries" , typeid(JsonArray) );
|
||||
add( "_environment" , typeid(Environment*) );
|
||||
add( "_defaultRoutingGauge", typeid(string) );
|
||||
add( "_defaultCellGauge" , typeid(string) );
|
||||
add( "+libraries" , typeid(JsonArray) );
|
||||
add( "+routingGauges" , typeid(JsonArray) );
|
||||
add( "+cellGauges" , typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
JsonAllianceFramework::~JsonAllianceFramework ()
|
||||
{
|
||||
AllianceFramework* framework = AllianceFramework::get();
|
||||
framework->setRoutingGauge( _defaultRoutingGauge );
|
||||
framework->setCellGauge ( _defaultCellGauge );
|
||||
}
|
||||
|
||||
|
||||
|
@ -791,6 +853,9 @@ namespace CRL {
|
|||
// It's a singleton. Do not create it...
|
||||
AllianceFramework* framework = AllianceFramework::get();
|
||||
|
||||
string _defaultRoutingGauge = get<string>( stack, "_defaultRoutingGauge" );
|
||||
string _defaultCellGauge = get<string>( stack, "_defaultCellGauge" );
|
||||
|
||||
update( stack, framework );
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::tab;
|
||||
using Hurricane::inltrace;
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::JsonTypes;
|
||||
using Hurricane::Warning;
|
||||
|
@ -78,8 +80,8 @@ namespace CRL {
|
|||
Record* AllianceLibrary::_getRecord() const
|
||||
{
|
||||
Record* record = new Record ( getString(this) );
|
||||
record->add ( getSlot("Path" ,&_path ) );
|
||||
record->add ( getSlot("Library", _library) );
|
||||
record->add ( getSlot("_path" ,&_path ) );
|
||||
record->add ( getSlot("_library", _library) );
|
||||
return ( record );
|
||||
}
|
||||
|
||||
|
@ -123,14 +125,16 @@ namespace CRL {
|
|||
{
|
||||
check( stack, "JsonAllianceLibrary::toData" );
|
||||
|
||||
string libDbPath = get<string>( stack,"_library" );
|
||||
string libOsPath = get<string>( stack,"_path" );
|
||||
string libDbPath = get<string>( stack, "_library" );
|
||||
string libOsPath = get<string>( stack, "_path" );
|
||||
|
||||
AllianceFramework* af = AllianceFramework::get();
|
||||
Library* library = DataBase::getDB()->getLibrary( libDbPath
|
||||
, DataBase::CreateLib|DataBase::WarnCreateLib );
|
||||
AllianceLibrary* aLibrary = NULL;
|
||||
|
||||
ltrace(51) << "| " << libDbPath << " : " << library << endl;
|
||||
|
||||
if (library) {
|
||||
aLibrary = af->getAllianceLibrary( library );
|
||||
}
|
||||
|
@ -148,6 +152,8 @@ namespace CRL {
|
|||
if (not library) library = aLibrary->getLibrary();
|
||||
}
|
||||
|
||||
ltrace(51) << "| Associates to: " << aLibrary << endl;
|
||||
|
||||
if (aLibrary->getLibrary() != library) {
|
||||
cerr << Warning( "JsonAllianceLibrary::toData(): Underlying Hurricane Library discrepency for \"%s\".\n"
|
||||
" (may be caused by a change in search path order)"
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
|
||||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
|
@ -18,24 +11,16 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./CellGauge.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "crlcore/CellGauge.h"
|
||||
|
||||
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
// const char *missingMandatoryAttr =
|
||||
// "CRoutingGauge::createFromXml () :\n\n"
|
||||
// " Can't found mandatory attribute \"%s\".\n";
|
||||
|
@ -57,19 +42,18 @@ namespace {
|
|||
// "::createCellGaugeFromXml () :\n\n"
|
||||
// " cellgauge name tag attribute is empty.\n";
|
||||
|
||||
|
||||
} // End of Anonymous namespace.
|
||||
|
||||
|
||||
} // Anonymous namespace.
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::JsonTypes;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CRL::CellGauge".
|
||||
|
||||
|
||||
CellGauge::CellGauge ( const char* name
|
||||
, const char* pinLayerName
|
||||
, const DbU::Unit pitch
|
||||
|
@ -151,4 +135,84 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void CellGauge::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename" , "CellGauge" );
|
||||
jsonWrite( w, "_name" , _name );
|
||||
jsonWrite( w, "_pinLayerName", _pinLayerName );
|
||||
jsonWrite( w, "_pitch" , _pitch );
|
||||
jsonWrite( w, "_sliceHeight" , _sliceHeight );
|
||||
jsonWrite( w, "_sliceStep" , _sliceStep );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonCellGauge"
|
||||
|
||||
Initializer<JsonCellGauge> jsonCellGaugeInit ( 0 );
|
||||
|
||||
|
||||
void JsonCellGauge::initialize ()
|
||||
{ JsonTypes::registerType( new JsonCellGauge (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonCellGauge::JsonCellGauge( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_name" , typeid(string) );
|
||||
add( "_pinLayerName", typeid(string) );
|
||||
add( "_pitch" , typeid(int64_t) );
|
||||
add( "_sliceHeight" , typeid(int64_t) );
|
||||
add( "_sliceStep" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
string JsonCellGauge::getTypeName () const
|
||||
{ return "CellGauge"; }
|
||||
|
||||
|
||||
JsonCellGauge* JsonCellGauge::clone ( unsigned long flags ) const
|
||||
{ return new JsonCellGauge ( flags ); }
|
||||
|
||||
|
||||
void JsonCellGauge::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonCellGauge::toData" );
|
||||
|
||||
AllianceFramework* af = get<AllianceFramework*>( stack, "_framework" );
|
||||
CellGauge* cg = NULL;
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string pinLayerName = get<string> ( stack, "_pinLayerName" );
|
||||
DbU::Unit pitch = get<int64_t>( stack, "_pitch" );
|
||||
DbU::Unit sliceHeight = get<int64_t>( stack, "_sliceHeight" );
|
||||
DbU::Unit sliceStep = get<int64_t>( stack, "_sliceStep" );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
if (af) {
|
||||
if (not name.empty()) {
|
||||
cg = CellGauge::create( name.c_str()
|
||||
, pinLayerName.c_str()
|
||||
, pitch
|
||||
, sliceHeight
|
||||
, sliceStep
|
||||
);
|
||||
af->addCellGauge( cg );
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonCellGauge::toData(): Missing \"_framework\" in stack context." ) << endl;
|
||||
}
|
||||
} else {
|
||||
if (af) {
|
||||
cg = af->getCellGauge( name );
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, cg );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -530,7 +530,7 @@ namespace CRL {
|
|||
setBLOCKAGE ( "^obs$" );
|
||||
setPad ( "^.*_px$" );
|
||||
|
||||
_LIBRARIES.append ( "." );
|
||||
_LIBRARIES.append ( ".", "working" );
|
||||
|
||||
_inConstructor = false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "crlcore/XmlParser.h"
|
||||
#include "crlcore/RoutingLayerGauge.h"
|
||||
#include "crlcore/RoutingGauge.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -40,9 +41,11 @@ namespace {
|
|||
|
||||
namespace CRL {
|
||||
|
||||
|
||||
using Hurricane::JsonTypes;
|
||||
using Hurricane::JsonArray;
|
||||
using Hurricane::DataBase;
|
||||
using Hurricane::ViaLayer;
|
||||
using Hurricane::getCollection;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -264,4 +267,65 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void RoutingGauge::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "RoutingGauge" );
|
||||
jsonWrite( w, "_name" , _name );
|
||||
jsonWrite( w, "+routingLayerGauges", getCollection(getLayerGauges()) );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonRoutingGauge"
|
||||
|
||||
Initializer<JsonRoutingGauge> jsonRoutingGaugeInit ( 0 );
|
||||
|
||||
|
||||
void JsonRoutingGauge::initialize ()
|
||||
{ JsonTypes::registerType( new JsonRoutingGauge (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonRoutingGauge::JsonRoutingGauge( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_name" , typeid(string) );
|
||||
add( "+routingLayerGauges", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
string JsonRoutingGauge::getTypeName () const
|
||||
{ return "RoutingGauge"; }
|
||||
|
||||
|
||||
JsonRoutingGauge* JsonRoutingGauge::clone ( unsigned long flags ) const
|
||||
{ return new JsonRoutingGauge ( flags ); }
|
||||
|
||||
|
||||
void JsonRoutingGauge::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonRoutingGauge::toData" );
|
||||
|
||||
AllianceFramework* af = get<AllianceFramework*>( stack, "_framework" );
|
||||
string name = get<string> ( stack, "_name" );
|
||||
RoutingGauge* rg = NULL;
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
if (af) {
|
||||
if (not name.empty()) {
|
||||
rg = RoutingGauge::create( name.c_str() );
|
||||
af->addRoutingGauge( rg );
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonRoutingGauge::toData(): Missing \"_framework\" in stack context." ) << endl;
|
||||
}
|
||||
} else {
|
||||
rg = af->getRoutingGauge( name );
|
||||
}
|
||||
|
||||
update( stack, rg );
|
||||
}
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#include "hurricane/BasicLayer.h"
|
||||
|
||||
#include "crlcore/RoutingLayerGauge.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "crlcore/RoutingLayerGauge.h"
|
||||
#include "crlcore/RoutingGauge.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -86,28 +88,29 @@ namespace CRL {
|
|||
|
||||
|
||||
using namespace std;
|
||||
|
||||
using Hurricane::JsonTypes;
|
||||
using Hurricane::Tabulation;
|
||||
using Hurricane::BasicLayer;
|
||||
using Hurricane::trace_in;
|
||||
using Hurricane::trace_out;
|
||||
using Hurricane::in_trace;
|
||||
using Hurricane::tab;
|
||||
using Hurricane::DataBase;
|
||||
using Hurricane::Technology;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "RoutingLayerGauge"
|
||||
|
||||
|
||||
RoutingLayerGauge::RoutingLayerGauge ( const Layer* layer
|
||||
, unsigned int direction
|
||||
, unsigned int type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth )
|
||||
RoutingLayerGauge::RoutingLayerGauge ( const Layer* layer
|
||||
, Constant::Direction direction
|
||||
, Constant::LayerGaugeType type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth )
|
||||
: _layer (layer)
|
||||
, _blockageLayer(layer->getBlockageLayer())
|
||||
, _direction (direction)
|
||||
|
@ -121,15 +124,15 @@ namespace CRL {
|
|||
{ }
|
||||
|
||||
|
||||
RoutingLayerGauge* RoutingLayerGauge::create ( const Layer* layer
|
||||
, unsigned int direction
|
||||
, unsigned int type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth )
|
||||
RoutingLayerGauge* RoutingLayerGauge::create ( const Layer* layer
|
||||
, Constant::Direction direction
|
||||
, Constant::LayerGaugeType type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth )
|
||||
{
|
||||
// Temporary: must write a more smart check.
|
||||
// BasicLayer* basicLayer = dynamic_cast<BasicLayer*>(layer);
|
||||
|
@ -302,4 +305,103 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
} // End of Coriolis namespace.
|
||||
void RoutingLayerGauge::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "RoutingLayerGauge" );
|
||||
jsonWrite( w, "_layer" , _layer->getName() );
|
||||
jsonWrite( w, "_direction" , getString(&_direction) );
|
||||
jsonWrite( w, "_type" , getString(&_type ) );
|
||||
jsonWrite( w, "_depth" , _depth );
|
||||
jsonWrite( w, "_density" , _density );
|
||||
jsonWrite( w, "_offset" , _offset );
|
||||
jsonWrite( w, "_pitch" , _pitch );
|
||||
jsonWrite( w, "_wireWidth" , _wireWidth );
|
||||
jsonWrite( w, "_viaWidth" , _viaWidth );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonRoutingLayerGauge"
|
||||
|
||||
Initializer<JsonRoutingLayerGauge> jsonRoutingLayerGaugeInit ( 0 );
|
||||
|
||||
|
||||
void JsonRoutingLayerGauge::initialize ()
|
||||
{ JsonTypes::registerType( new JsonRoutingLayerGauge (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonRoutingLayerGauge::JsonRoutingLayerGauge( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( ".RoutingGauge" , typeid(RoutingGauge*) );
|
||||
add( "_layer" , typeid(string) );
|
||||
add( "_direction" , typeid(string) );
|
||||
add( "_type" , typeid(string) );
|
||||
add( "_depth" , typeid(unsigned int) );
|
||||
add( "_density" , typeid(double) );
|
||||
add( "_offset" , typeid(int64_t) );
|
||||
add( "_pitch" , typeid(int64_t) );
|
||||
add( "_wireWidth" , typeid(int64_t) );
|
||||
add( "_viaWidth" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
string JsonRoutingLayerGauge::getTypeName () const
|
||||
{ return "RoutingLayerGauge"; }
|
||||
|
||||
|
||||
JsonRoutingLayerGauge* JsonRoutingLayerGauge::clone ( unsigned long flags ) const
|
||||
{ return new JsonRoutingLayerGauge ( flags ); }
|
||||
|
||||
|
||||
void JsonRoutingLayerGauge::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonRoutingLayerGauge::toData" );
|
||||
|
||||
Technology* techno = DataBase::getDB()->getTechnology();
|
||||
RoutingGauge* rg = get<RoutingGauge*>( stack, ".RoutingGauge" );
|
||||
RoutingLayerGauge* rlg = NULL;
|
||||
string layer = get<string> ( stack, "_layer" );
|
||||
unsigned int depth = get<int64_t> ( stack, "_depth" );
|
||||
double density = get<double> ( stack, "_density" );
|
||||
DbU::Unit offset = get<int64_t> ( stack, "_offset" );
|
||||
DbU::Unit pitch = get<int64_t> ( stack, "_pitch" );
|
||||
DbU::Unit wireWidth = get<int64_t> ( stack, "_wireWidth" );
|
||||
DbU::Unit viaWidth = get<int64_t> ( stack, "_viaWidth" );
|
||||
|
||||
Constant::Direction direction;
|
||||
Constant::LayerGaugeType type;
|
||||
from( direction, get<string>(stack,"_direction") );
|
||||
from( type , get<string>(stack,"_type" ) );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
if (rg) {
|
||||
if (not layer.empty()) {
|
||||
rlg = RoutingLayerGauge::create( techno->getLayer(layer)
|
||||
, direction
|
||||
, type
|
||||
, depth
|
||||
, density
|
||||
, offset
|
||||
, pitch
|
||||
, wireWidth
|
||||
, viaWidth
|
||||
);
|
||||
rg->addLayerGauge( rlg );
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonRoutingLayerGauge::toData(): Missing \".RoutingGauge\" in stack context." ) << endl;
|
||||
}
|
||||
} else {
|
||||
if (rg) {
|
||||
rlg = rg->getLayerGauge( techno->getLayer(layer) );
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, rlg );
|
||||
}
|
||||
|
||||
|
||||
} // Coriolis namespace.
|
||||
|
|
|
@ -322,25 +322,25 @@ namespace CRL {
|
|||
// Triggers Configuration singleton creation.
|
||||
Cfg::Configuration::get ();
|
||||
|
||||
Cfg::getParamBool ("misc.catchCore" ,true )->registerCb ( catchCoreChanged );
|
||||
Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( verboseLevel1Changed );
|
||||
Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( verboseLevel2Changed );
|
||||
Cfg::getParamBool ("misc.info" ,false)->registerCb ( infoChanged );
|
||||
Cfg::getParamBool ("misc.paranoid" ,false)->registerCb ( paranoidChanged );
|
||||
Cfg::getParamBool ("misc.bug" ,false)->registerCb ( bugChanged );
|
||||
Cfg::getParamBool ("misc.logMode" ,false)->registerCb ( logModeChanged );
|
||||
Cfg::getParamInt ("misc.traceLevel" ,1000 )->registerCb ( traceLevelChanged );
|
||||
Cfg::getParamString("stratus1.mappingName","./stratus2sxlib.xml")->registerCb ( stratus1MappingNameChanged );
|
||||
Cfg::getParamBool ("misc.catchCore" ,false)->registerCb ( this, catchCoreChanged );
|
||||
Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( this, verboseLevel1Changed );
|
||||
Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( this, verboseLevel2Changed );
|
||||
Cfg::getParamBool ("misc.info" ,false)->registerCb ( this, infoChanged );
|
||||
Cfg::getParamBool ("misc.paranoid" ,false)->registerCb ( this, paranoidChanged );
|
||||
Cfg::getParamBool ("misc.bug" ,false)->registerCb ( this, bugChanged );
|
||||
Cfg::getParamBool ("misc.logMode" ,false)->registerCb ( this, logModeChanged );
|
||||
Cfg::getParamInt ("misc.traceLevel" ,1000 )->registerCb ( this, traceLevelChanged );
|
||||
Cfg::getParamString("stratus1.mappingName","./stratus2sxlib.xml")->registerCb ( this, stratus1MappingNameChanged );
|
||||
|
||||
// Immediate update from the configuration.
|
||||
catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) );
|
||||
verboseLevel1Changed ( Cfg::getParamBool("misc.verboseLevel1") );
|
||||
verboseLevel2Changed ( Cfg::getParamBool("misc.verboseLevel2") );
|
||||
infoChanged ( Cfg::getParamBool("misc.info" ) );
|
||||
paranoidChanged ( Cfg::getParamBool("misc.paranoid" ) );
|
||||
bugChanged ( Cfg::getParamBool("misc.bug" ) );
|
||||
logModeChanged ( Cfg::getParamBool("misc.logMode" ) );
|
||||
traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) );
|
||||
//catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) );
|
||||
//verboseLevel1Changed ( Cfg::getParamBool("misc.verboseLevel1") );
|
||||
//verboseLevel2Changed ( Cfg::getParamBool("misc.verboseLevel2") );
|
||||
//infoChanged ( Cfg::getParamBool("misc.info" ) );
|
||||
//paranoidChanged ( Cfg::getParamBool("misc.paranoid" ) );
|
||||
//bugChanged ( Cfg::getParamBool("misc.bug" ) );
|
||||
//logModeChanged ( Cfg::getParamBool("misc.logMode" ) );
|
||||
//traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) );
|
||||
|
||||
Utilities::Path stratusMappingName;
|
||||
if ( arguments.count("stratus_mapping_name") ) {
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Observable;
|
||||
using Hurricane::BaseObserver;
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
using Hurricane::Cell;
|
||||
|
@ -38,16 +40,23 @@ namespace CRL {
|
|||
|
||||
class AllianceFramework {
|
||||
public:
|
||||
enum InstancesCountFlags { Recursive = (1<<0)
|
||||
, IgnoreFeeds = (1<<1)
|
||||
enum FunctionsFlags { NoFlags = 0
|
||||
, NoPythonInit = (1<<0)
|
||||
};
|
||||
enum LibraryFlags { CreateLibrary = (1<<0)
|
||||
, AppendLibrary = (1<<1)
|
||||
, HasCatalog = (1<<2)
|
||||
enum InstancesCountFlags { Recursive = (1<<0)
|
||||
, IgnoreFeeds = (1<<1)
|
||||
};
|
||||
enum LibraryFlags { CreateLibrary = (1<<0)
|
||||
, AppendLibrary = (1<<1)
|
||||
, HasCatalog = (1<<2)
|
||||
};
|
||||
enum NotifyFlags { AddedLibrary = (1<<0)
|
||||
, RemovedLibrary = (1<<1)
|
||||
, ConfigChanged = (1<<2)
|
||||
};
|
||||
public:
|
||||
// Constructors.
|
||||
static AllianceFramework* create ();
|
||||
static AllianceFramework* create ( unsigned long flags=NoFlags );
|
||||
// Destructors.
|
||||
void destroy ();
|
||||
// Accessors.
|
||||
|
@ -88,8 +97,13 @@ namespace CRL {
|
|||
CellGauge* getCellGauge ( const Name& name="" );
|
||||
inline const Name getDefaultCGPinLayerName () const;
|
||||
// Modifiers.
|
||||
RoutingGauge* setRoutingGauge ( const Name& name="" );
|
||||
CellGauge* setCellGauge ( const Name& name="" );
|
||||
void addRoutingGauge ( RoutingGauge* );
|
||||
void addCellGauge ( CellGauge* );
|
||||
void addObserver ( BaseObserver* );
|
||||
void removeObserver ( BaseObserver* );
|
||||
void notify ( unsigned int flags );
|
||||
// Cell Management.
|
||||
Cell* cellLoader ( const string& rpath );
|
||||
Cell* getCell ( const string& name
|
||||
|
@ -110,15 +124,16 @@ namespace CRL {
|
|||
protected:
|
||||
static const Name _parentLibraryName;
|
||||
static AllianceFramework* _singleton;
|
||||
Observable _observers;
|
||||
Environment _environment;
|
||||
ParsersMap _parsers;
|
||||
DriversMap _drivers;
|
||||
Catalog _catalog;
|
||||
AllianceLibraries _libraries;
|
||||
Library* _parentLibrary;
|
||||
RoutingGauge* _defaultRoutingGauge;
|
||||
map<const Name,RoutingGauge*>
|
||||
_routingGauges;
|
||||
RoutingGauge* _defaultRoutingGauge;
|
||||
map<const Name,CellGauge*>
|
||||
_cellGauges;
|
||||
CellGauge* _defaultCellGauge;
|
||||
|
@ -170,9 +185,13 @@ namespace CRL {
|
|||
public:
|
||||
static void initialize ();
|
||||
JsonAllianceFramework( unsigned long );
|
||||
virtual ~JsonAllianceFramework();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonAllianceFramework* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
private:
|
||||
std::string _defaultRoutingGauge;
|
||||
std::string _defaultCellGauge;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
@ -29,7 +29,9 @@ namespace CRL {
|
|||
|
||||
using std::string;
|
||||
using std::map;
|
||||
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::Record;
|
||||
using Hurricane::DbU;
|
||||
using Hurricane::Name;
|
||||
|
@ -38,7 +40,6 @@ namespace CRL {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "CRL::CellGauge".
|
||||
|
||||
|
||||
class CellGauge {
|
||||
|
||||
public:
|
||||
|
@ -57,6 +58,7 @@ namespace CRL {
|
|||
inline const DbU::Unit getSliceStep () const;
|
||||
CellGauge* getClone () const;
|
||||
// Hurricane management.
|
||||
void toJson ( JsonWriter* ) const;
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
@ -96,6 +98,19 @@ namespace CRL {
|
|||
inline const DbU::Unit CellGauge::getSliceStep () const { return _sliceStep; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonCellGauge".
|
||||
|
||||
class JsonCellGauge : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonCellGauge ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonCellGauge* clone ( unsigned long flags ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // namespace CRL.
|
||||
|
||||
|
||||
|
|
|
@ -34,12 +34,15 @@ namespace Hurricane {
|
|||
|
||||
namespace CRL {
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using Hurricane::Name;
|
||||
using Hurricane::Record;
|
||||
using Hurricane::Layer;
|
||||
using Hurricane::Technology;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::Name;
|
||||
using Hurricane::Record;
|
||||
using Hurricane::Layer;
|
||||
using Hurricane::Technology;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -78,6 +81,7 @@ namespace CRL {
|
|||
void addLayerGauge ( RoutingLayerGauge* layerGauge );
|
||||
void checkConnexity () const;
|
||||
// Hurricane Managment.
|
||||
void toJson ( JsonWriter* ) const;
|
||||
virtual Record* _getRecord ( Record* record=NULL ) const;
|
||||
virtual string _getString () const;
|
||||
virtual string _getTypeName () const;
|
||||
|
@ -109,6 +113,19 @@ namespace CRL {
|
|||
inline DbU::Unit RoutingGauge::getViaWidth ( size_t depth ) const { return getLayerGauge(depth)->getViaWidth(); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonRoutingGauge".
|
||||
|
||||
class JsonRoutingGauge : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonRoutingGauge ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonRoutingGauge* clone ( unsigned long flags ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
INSPECTOR_P_SUPPORT(CRL::RoutingGauge);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <map>
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/DbU.h"
|
||||
#include "hurricane/Collection.h"
|
||||
#include "hurricane/Slot.h"
|
||||
|
@ -32,9 +33,9 @@ namespace Hurricane {
|
|||
|
||||
namespace Constant {
|
||||
|
||||
enum Direction { Horizontal = (1<<0)
|
||||
, Vertical = (1<<1)
|
||||
};
|
||||
enum Direction { Horizontal = (1<<0)
|
||||
, Vertical = (1<<1)
|
||||
};
|
||||
|
||||
enum LayerGaugeType { Default = (1<<0)
|
||||
, PinOnly = (1<<1)
|
||||
|
@ -54,9 +55,10 @@ namespace Constant {
|
|||
|
||||
namespace CRL {
|
||||
|
||||
|
||||
using std::map;
|
||||
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::GenericCollection;
|
||||
using Hurricane::GenericLocator;
|
||||
using Hurricane::GenericFilter;
|
||||
|
@ -76,62 +78,63 @@ namespace CRL {
|
|||
|
||||
public:
|
||||
// Constructors & Destructors.
|
||||
static RoutingLayerGauge* create ( const Layer* layer
|
||||
, unsigned int direction
|
||||
, unsigned int type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth );
|
||||
virtual void destroy ();
|
||||
// Accessors.
|
||||
inline const Layer* getLayer () const;
|
||||
inline const Layer* getBlockageLayer () const;
|
||||
inline unsigned int getDepth () const;
|
||||
inline unsigned int getDirection () const;
|
||||
inline unsigned int getType () const;
|
||||
inline double getDensity () const;
|
||||
inline DbU::Unit getOffset () const;
|
||||
inline DbU::Unit getPitch () const;
|
||||
inline DbU::Unit getHalfPitch () const;
|
||||
inline DbU::Unit getWireWidth () const;
|
||||
inline DbU::Unit getHalfWireWidth () const;
|
||||
inline DbU::Unit getViaWidth () const;
|
||||
inline DbU::Unit getHalfViaWidth () const;
|
||||
void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const;
|
||||
unsigned int getTrackNumber ( DbU::Unit start, DbU::Unit stop ) const;
|
||||
unsigned int getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const;
|
||||
DbU::Unit getTrackPosition ( DbU::Unit start, unsigned depth ) const;
|
||||
// Hurricane Managment.
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
static RoutingLayerGauge* create ( const Layer* layer
|
||||
, Constant::Direction direction
|
||||
, Constant::LayerGaugeType type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth );
|
||||
virtual void destroy ();
|
||||
// Accessors.
|
||||
inline const Layer* getLayer () const;
|
||||
inline const Layer* getBlockageLayer () const;
|
||||
inline unsigned int getDepth () const;
|
||||
inline Constant::Direction getDirection () const;
|
||||
inline Constant::LayerGaugeType getType () const;
|
||||
inline double getDensity () const;
|
||||
inline DbU::Unit getOffset () const;
|
||||
inline DbU::Unit getPitch () const;
|
||||
inline DbU::Unit getHalfPitch () const;
|
||||
inline DbU::Unit getWireWidth () const;
|
||||
inline DbU::Unit getHalfWireWidth () const;
|
||||
inline DbU::Unit getViaWidth () const;
|
||||
inline DbU::Unit getHalfViaWidth () const;
|
||||
void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const;
|
||||
unsigned int getTrackNumber ( DbU::Unit start, DbU::Unit stop ) const;
|
||||
unsigned int getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const;
|
||||
DbU::Unit getTrackPosition ( DbU::Unit start, unsigned depth ) const;
|
||||
// Hurricane Managment.
|
||||
void toJson ( JsonWriter* ) const;
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
||||
protected:
|
||||
// Internal - Attributes.
|
||||
const Layer* _layer;
|
||||
const Layer* _blockageLayer;
|
||||
unsigned int _direction;
|
||||
unsigned int _type;
|
||||
unsigned int _depth;
|
||||
double _density;
|
||||
DbU::Unit _offset;
|
||||
DbU::Unit _pitch;
|
||||
DbU::Unit _wireWidth;
|
||||
DbU::Unit _viaWidth;
|
||||
const Layer* _layer;
|
||||
const Layer* _blockageLayer;
|
||||
Constant::Direction _direction;
|
||||
Constant::LayerGaugeType _type;
|
||||
unsigned int _depth;
|
||||
double _density;
|
||||
DbU::Unit _offset;
|
||||
DbU::Unit _pitch;
|
||||
DbU::Unit _wireWidth;
|
||||
DbU::Unit _viaWidth;
|
||||
|
||||
// Internal - Constructors & Destructors.
|
||||
RoutingLayerGauge ( const Layer* layer
|
||||
, unsigned int direction
|
||||
, unsigned int type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth );
|
||||
RoutingLayerGauge ( const Layer* layer
|
||||
, Constant::Direction direction
|
||||
, Constant::LayerGaugeType type
|
||||
, unsigned int depth
|
||||
, double density
|
||||
, DbU::Unit offset
|
||||
, DbU::Unit pitch
|
||||
, DbU::Unit wireWidth
|
||||
, DbU::Unit viaWidth );
|
||||
virtual ~RoutingLayerGauge ();
|
||||
virtual void _preDestroy();
|
||||
RoutingLayerGauge& operator= ( const RoutingLayerGauge& );
|
||||
|
@ -156,23 +159,35 @@ namespace CRL {
|
|||
// -------------------------------------------------------------------
|
||||
// Inline Functions.
|
||||
|
||||
inline const Layer* RoutingLayerGauge::getLayer () const { return ( _layer ); }
|
||||
inline const Layer* RoutingLayerGauge::getBlockageLayer () const { return ( _blockageLayer ); }
|
||||
inline unsigned int RoutingLayerGauge::getDirection () const { return ( _direction ); }
|
||||
inline unsigned int RoutingLayerGauge::getType () const { return ( _type ); }
|
||||
inline unsigned int RoutingLayerGauge::getDepth () const { return ( _depth ); }
|
||||
inline double RoutingLayerGauge::getDensity () const { return ( _density ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getOffset () const { return ( _offset ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getPitch () const { return ( _pitch ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getHalfPitch () const { return ( _pitch>>1 ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getWireWidth () const { return ( _wireWidth ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getHalfWireWidth () const { return ( _wireWidth>>1 ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getViaWidth () const { return ( _viaWidth ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getHalfViaWidth () const { return ( _viaWidth>>1 ); }
|
||||
inline const Layer* RoutingLayerGauge::getLayer () const { return ( _layer ); }
|
||||
inline const Layer* RoutingLayerGauge::getBlockageLayer () const { return ( _blockageLayer ); }
|
||||
inline Constant::Direction RoutingLayerGauge::getDirection () const { return ( _direction ); }
|
||||
inline Constant::LayerGaugeType RoutingLayerGauge::getType () const { return ( _type ); }
|
||||
inline unsigned int RoutingLayerGauge::getDepth () const { return ( _depth ); }
|
||||
inline double RoutingLayerGauge::getDensity () const { return ( _density ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getOffset () const { return ( _offset ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getPitch () const { return ( _pitch ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getHalfPitch () const { return ( _pitch>>1 ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getWireWidth () const { return ( _wireWidth ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getHalfWireWidth () const { return ( _wireWidth>>1 ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getViaWidth () const { return ( _viaWidth ); }
|
||||
inline DbU::Unit RoutingLayerGauge::getHalfViaWidth () const { return ( _viaWidth>>1 ); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonRoutingLayerGauge".
|
||||
|
||||
} // End of CRL namespace.
|
||||
class JsonRoutingLayerGauge : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonRoutingLayerGauge ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonRoutingLayerGauge* clone ( unsigned long flags ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(CRL::RoutingLayerGauge);
|
||||
|
@ -182,6 +197,18 @@ INSPECTOR_P_SUPPORT(CRL::RoutingLayerGauge);
|
|||
// Inspector Support for : "const ::Constant::Direction*".
|
||||
|
||||
|
||||
inline void from ( Constant::Direction& direction, const std::string& s )
|
||||
{
|
||||
if (s == "Vertical") direction = Constant::Vertical;
|
||||
else {
|
||||
if (s != "Horizontal")
|
||||
std::cerr << Hurricane::Error( "::from(Direction&,string&): Unknown value \"%s\"."
|
||||
, s.c_str() ) << std::endl;
|
||||
direction = Constant::Horizontal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline std::string getString<const Constant::Direction*>
|
||||
( const Constant::Direction* direction )
|
||||
|
@ -190,7 +217,7 @@ inline std::string getString<const Constant::Direction*>
|
|||
case Constant::Horizontal: return "Horizontal";
|
||||
case Constant::Vertical: return "Vertical";
|
||||
}
|
||||
return ( "Unknown Constant::Direction" );
|
||||
return "Unknown Constant::Direction";
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,7 +229,7 @@ inline std::string getString<Constant::Direction>
|
|||
case Constant::Horizontal: return "Horizontal";
|
||||
case Constant::Vertical: return "Vertical";
|
||||
}
|
||||
return ( "Unknown Constant::Direction" );
|
||||
return "Unknown Constant::Direction";
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,19 +240,43 @@ IOSTREAM_POINTER_SUPPORT(Constant::Direction);
|
|||
// Inspector Support for : "const Constant::LayerGaugeType*".
|
||||
|
||||
|
||||
inline void from ( Constant::LayerGaugeType& type, const std::string& s )
|
||||
{
|
||||
if (s == "PinOnly") type = Constant::PinOnly;
|
||||
else {
|
||||
if (s != "Default")
|
||||
std::cerr << Hurricane::Error( "::from(LayerGaugeType&,string&): Unknown value \"%s\"."
|
||||
, s.c_str() ) << std::endl;
|
||||
type = Constant::Default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline std::string getString<const Constant::LayerGaugeType*>
|
||||
( const Constant::LayerGaugeType* layerGaugeType )
|
||||
{
|
||||
switch ( *layerGaugeType ) {
|
||||
case Constant::Horizontal: return "Horizontal";
|
||||
case Constant::Vertical: return "Vertical";
|
||||
case Constant::Default: return "Default";
|
||||
case Constant::PinOnly: return "PinOnly";
|
||||
}
|
||||
return ( "Unknown Constant::LayerGaugeType" );
|
||||
return "Unknown Constant::LayerGaugeType";
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline std::string getString<const Constant::LayerGaugeType>
|
||||
( const Constant::LayerGaugeType layerGaugeType )
|
||||
{
|
||||
switch ( layerGaugeType ) {
|
||||
case Constant::Default: return "Default";
|
||||
case Constant::PinOnly: return "PinOnly";
|
||||
}
|
||||
return "Unknown Constant::LayerGaugeType";
|
||||
}
|
||||
|
||||
|
||||
IOSTREAM_POINTER_SUPPORT(Constant::LayerGaugeType);
|
||||
|
||||
|
||||
# endif // __CRL_ROUTING_LAYER_GAUGE_H__
|
||||
#endif // CRL_ROUTING_LAYER_GAUGE_H
|
||||
|
|
|
@ -132,7 +132,7 @@ int main ( int argc, char *argv[] )
|
|||
if (verbose1) mstream::enable ( mstream::Verbose0|mstream::Verbose1 );
|
||||
if (verbose2) mstream::enable ( mstream::Verbose0|mstream::Verbose1|mstream::Verbose2 );
|
||||
|
||||
dbo_ptr<AllianceFramework> af ( AllianceFramework::create() );
|
||||
dbo_ptr<AllianceFramework> af ( AllianceFramework::get() );
|
||||
|
||||
Technology* technology = DataBase::getDB()->getTechnology();
|
||||
// technology->setWorkingLayer ( "cut0" );
|
||||
|
|
|
@ -64,18 +64,44 @@ extern "C" {
|
|||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
static PyObject* PyAllianceFramework_get ( PyObject* )
|
||||
static PyObject* PyAllianceFramework_create ( PyObject*, PyObject* args )
|
||||
{
|
||||
trace << "PyAllianceFramework_create()" << endl;
|
||||
|
||||
AllianceFramework* af = NULL;
|
||||
PyAllianceFramework* pyAf = NULL;
|
||||
unsigned long flags = AllianceFramework::NoFlags;
|
||||
|
||||
HTRY
|
||||
PyObject* arg0;
|
||||
if (ParseOneArg("AllianceFramework.create()", args, INT_ARG, &arg0)) {
|
||||
flags = PyInt_AsUnsignedLongMask(arg0);
|
||||
}
|
||||
|
||||
af = AllianceFramework::create( flags );
|
||||
|
||||
pyAf = PyObject_NEW( PyAllianceFramework, &PyTypeAllianceFramework );
|
||||
if (pyAf == NULL) return NULL;
|
||||
|
||||
pyAf->_object = af;
|
||||
HCATCH
|
||||
|
||||
return (PyObject*)pyAf;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyAllianceFramework_get ( PyObject* args )
|
||||
{
|
||||
trace << "PyAllianceFramework_get()" << endl;
|
||||
|
||||
AllianceFramework* af = NULL;
|
||||
PyAllianceFramework* pyAf = NULL;
|
||||
AllianceFramework* af = NULL;
|
||||
PyAllianceFramework* pyAf = NULL;
|
||||
|
||||
HTRY
|
||||
af = AllianceFramework::get ();
|
||||
af = AllianceFramework::get();
|
||||
|
||||
pyAf = PyObject_NEW ( PyAllianceFramework, &PyTypeAllianceFramework );
|
||||
if ( pyAf == NULL ) return NULL;
|
||||
pyAf = PyObject_NEW( PyAllianceFramework, &PyTypeAllianceFramework );
|
||||
if (pyAf == NULL) return NULL;
|
||||
|
||||
pyAf->_object = af;
|
||||
HCATCH
|
||||
|
@ -298,7 +324,9 @@ extern "C" {
|
|||
|
||||
|
||||
PyMethodDef PyAllianceFramework_Methods[] =
|
||||
{ { "get" , (PyCFunction)PyAllianceFramework_get , METH_NOARGS|METH_STATIC
|
||||
{ { "create" , (PyCFunction)PyAllianceFramework_create , METH_VARARGS|METH_STATIC
|
||||
, "Gets the Alliance Framework." }
|
||||
, { "get" , (PyCFunction)PyAllianceFramework_get , METH_NOARGS|METH_STATIC
|
||||
, "Gets the Alliance Framework." }
|
||||
, { "getEnvironment" , (PyCFunction)PyAllianceFramework_getEnvironment , METH_NOARGS
|
||||
, "Gets the Alliance Environment." }
|
||||
|
@ -310,7 +338,7 @@ extern "C" {
|
|||
, "Saves an Alliance Cell." }
|
||||
, { "createCell" , (PyCFunction)PyAllianceFramework_createCell , METH_VARARGS
|
||||
, "Create a Cell in the Alliance framework." }
|
||||
, { "isPad" , (PyCFunction)PyAllianceFramework_isPad , METH_VARARGS
|
||||
, { "isPad" , (PyCFunction)PyAllianceFramework_isPad , METH_VARARGS
|
||||
, "Tells if a cell name is a Pad." }
|
||||
, { "addCellGauge" , (PyCFunction)PyAllianceFramework_addCellGauge , METH_VARARGS
|
||||
, "Add a new cell gauge." }
|
||||
|
@ -338,11 +366,18 @@ extern "C" {
|
|||
// x=================================================================x
|
||||
|
||||
|
||||
|
||||
// Link/Creation Method.
|
||||
PyTypeObjectDefinitions(AllianceFramework)
|
||||
|
||||
|
||||
extern void PyAllianceFramework_postModuleInit ()
|
||||
{
|
||||
PyObject* constant;
|
||||
|
||||
LoadObjectConstant(PyTypeAllianceFramework.tp_dict,AllianceFramework::NoPythonInit,"NoPythonInit");
|
||||
}
|
||||
|
||||
|
||||
#endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
|
|
|
@ -185,6 +185,7 @@ extern "C" {
|
|||
PyCatalog_postModuleInit ();
|
||||
PyEnvironment_postModuleInit ();
|
||||
PyRoutingLayerGauge_postModuleInit ();
|
||||
PyAllianceFramework_postModuleInit ();
|
||||
|
||||
//PyObject* dictionnary = PyModule_GetDict ( module );
|
||||
//DbULoadConstants ( dictionnary );
|
||||
|
|
|
@ -107,8 +107,8 @@ extern "C" {
|
|||
}
|
||||
|
||||
rlg = RoutingLayerGauge::create( PYLAYER_O(pyLayer)
|
||||
, direction
|
||||
, type
|
||||
, (Constant::Direction)direction
|
||||
, (Constant::LayerGaugeType)type
|
||||
, depth
|
||||
, density
|
||||
, offset
|
||||
|
|
|
@ -42,8 +42,9 @@ extern "C" {
|
|||
extern PyTypeObject PyTypeAllianceFramework;
|
||||
extern PyMethodDef PyAllianceFramework_Methods[];
|
||||
|
||||
extern PyObject* PyAllianceFramework_Link ( CRL::AllianceFramework* );
|
||||
extern void PyAllianceFramework_LinkPyType ();
|
||||
extern PyObject* PyAllianceFramework_Link ( CRL::AllianceFramework* );
|
||||
extern void PyAllianceFramework_LinkPyType ();
|
||||
extern void PyAllianceFramework_postModuleInit ();
|
||||
|
||||
|
||||
#define IsPyAllianceFramework(v) ( (v)->ob_type == &PyTypeAllianceFramework )
|
||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc, char *argv[]) {
|
|||
if (verbose1) mstream::enable ( mstream::Verbose0|mstream::Verbose1 );
|
||||
if (verbose2) mstream::enable ( mstream::Verbose0|mstream::Verbose1|mstream::Verbose2 );
|
||||
|
||||
AllianceFramework* af = AllianceFramework::create ();
|
||||
AllianceFramework* af = AllianceFramework::get ();
|
||||
|
||||
Cell* cell = NULL;
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
//! \addtogroup JsonSupport
|
||||
//! \{
|
||||
|
||||
|
||||
/*! \class JsonObject
|
||||
* \brief Support for JSON export.
|
||||
*
|
||||
*/
|
||||
|
||||
//! \}
|
||||
|
||||
//! \function JsonObject::JsonObject ( unsigned long flags );
|
||||
//! \param flags Flags sets by derived classes.
|
||||
//!
|
||||
|
@ -31,6 +32,9 @@
|
|||
//!
|
||||
//! For adding a requirement/attribute, see JsonObject::add().
|
||||
|
||||
//! \function bool JsonObject::isDummy () const;
|
||||
//! \Return \true if the concrete object is of type \c JsonDummy, \false otherwise.
|
||||
|
||||
//! \function string JsonObject::getTypeName () const;
|
||||
//! \Return The typename of the concrete object, that is, the value
|
||||
//! of the \c @typename key of the JSON object.
|
||||
|
@ -109,6 +113,16 @@
|
|||
//! - If an element matching the key is found, \b but it's type do not
|
||||
//! match \c T, an exception from \c any_cast<> will be thrown.
|
||||
|
||||
//! \function T* JsonObject::jget ( JsonStack& stack ) const;
|
||||
//! \param stack The parser stack.
|
||||
//! \Return the first JsonObject that can be cast into type \c T*.
|
||||
//!
|
||||
//! Search the JsonObject stack, from the top, the first object that
|
||||
//! can be cast into type \c T*. Base classes can be used here, as the
|
||||
//! \c dynamic_cast<> operator is used to perform the casts.
|
||||
//!
|
||||
//! This function \b always return a pointer (never a value).
|
||||
|
||||
//! \function void JsonObject::copyAttrs ( const JsonObject* other, bool reset=false );
|
||||
//! \param other The object from which to copy attributes.
|
||||
//! \param reset Whether to keep or erase the original attributes of the object.
|
||||
|
@ -173,7 +187,7 @@
|
|||
//! is created from them and the result is then pushed back.
|
||||
|
||||
//! \function unsigned int JsonObject::presetId ( JsonStack& stack );
|
||||
//! \param The parser object stack.
|
||||
//! \param stack The parser object stack.
|
||||
//! \Return the <em>next id</em> that has been set.
|
||||
//!
|
||||
//! \Remark This is a helper for JsonStack::toData().
|
||||
|
@ -184,7 +198,7 @@
|
|||
//! and sets it so that the next Entity created will use it.
|
||||
|
||||
//! \function void JsonObject::update ( JsonStack& stack, T hobject );
|
||||
//! \param The parser object stack.
|
||||
//! \param stack parser object stack.
|
||||
//! \param hobject the newly created DataBase object.
|
||||
//!
|
||||
//! \Remark This is a helper for JsonStack::toData().
|
||||
|
@ -193,6 +207,117 @@
|
|||
//! object and bind it to the JsonObject.
|
||||
|
||||
|
||||
//! \addtogroup JsonSupport
|
||||
//! \{
|
||||
|
||||
/*! \class JsonStack
|
||||
* \brief JSON Parser Stack
|
||||
*
|
||||
*
|
||||
* The JSON parser stack contains three separate stacks and a lookup
|
||||
* table:
|
||||
* -# The \c attribute stack. Objects that have been translated from
|
||||
* JSON to the Hurricane database (or POD objects).
|
||||
* -# The \c dbo stack, similar to the previous one, but contains
|
||||
* \b only objects whose base class is DBo.
|
||||
* -# The JsonObject stack. The stack of objects currently under
|
||||
* parsing.
|
||||
* -# A lookup table for the Entity, between the Hurricane \c id and
|
||||
* the JSON \c id.
|
||||
*/
|
||||
|
||||
//! \}
|
||||
|
||||
|
||||
//! \function size_t JsonStack::size () const;
|
||||
//! \Return The size of the attribute stack.
|
||||
|
||||
//! \function void JsonStack::push_back ( const std::string& key, T hobject );
|
||||
//! \param key Key associated to \c hobject
|
||||
//! \param hobject The \e attribute object.
|
||||
//!
|
||||
//! Push back (on top) an element on the \e attribute stack.
|
||||
|
||||
//! \function void JsonStack::pop_back ( size_t count=1 );
|
||||
//! \param count The number of element to pop.
|
||||
//!
|
||||
//! Remove \c count element(s) from the top of the stack.
|
||||
|
||||
//! \function int JsonStack::rhas ( const string& key );
|
||||
//! \param key The key element's to look for.
|
||||
//! \return the index of the element, from the top.
|
||||
//!
|
||||
//! The function name's stands for "Reverse HAS".
|
||||
//! Search from the top of the \e attribute stack downward an
|
||||
//! element with \c key. Return an index from the top of the stack,
|
||||
//! that is, the end of the vector. The returned index is a negative
|
||||
//! value, for exemple the element on top of the stack has an index
|
||||
//! of \c -1. If no element with a matching key is found, returns 0.
|
||||
|
||||
//! \function T JsonStack::as ( const std::string& key ) const;
|
||||
//! \param key The key's element to search.
|
||||
//! \return The element, casted as type T.
|
||||
//!
|
||||
//! Search an element with key matching \c key, from the top of the
|
||||
//! stack. If found, returns the element casted as type \c T.
|
||||
//! As the cast operation uses \c boost::any_cast<>, the exact type
|
||||
//! \c T must be used (\b not a base class of \c T), otherwise the
|
||||
//! cast will fail and an exception will be thrown.
|
||||
|
||||
//! \function T JsonStack::as ( int index ) const;
|
||||
//! \param index the position of the element to convert.
|
||||
//! \return The element, casted as type T.
|
||||
//!
|
||||
//! Cast the element at \c index into type T.
|
||||
//! As the cast operation uses \c boost::any_cast<>, the exact type
|
||||
//! \c T must be used (\b not a base class of \c T), otherwise the
|
||||
//! cast will fail and an exception will be thrown.
|
||||
//!
|
||||
//! A positive or null index means the element must be taken from the
|
||||
//! bottom of the stack and a stictly negative one means from the top
|
||||
//! of the stack.
|
||||
|
||||
//! \function void JsonStack::push_back_dbo ( DBo* dbo );
|
||||
//! \param dbo The DataBase object to push back.
|
||||
//!
|
||||
//! Dedicated stack to push objects \e after they had been casted
|
||||
//! into the DBo* base class. We need to create this separate stack
|
||||
//! from the \e attribute stack due to the inability of \c boost::any_cast<>
|
||||
//! to use a base class.
|
||||
|
||||
//! \function void JsonStack::pop_back_dbo ();
|
||||
//! Remove one element from the top of the DBo* stack.
|
||||
|
||||
//! \function DBo* JsonStack::back_dbo () const;
|
||||
//! \Return The elemet at the top of the DBo* stack.
|
||||
|
||||
//! \function void JsonStack::addEntity ( unsigned int jsonId, Entity* entity );
|
||||
//! \param jsonId the \c id of the Entity, in the JSON file
|
||||
//! \param entity the associated Entity.
|
||||
//!
|
||||
//! When parsing a DataBase object \b not in \e blob mode, we cannot
|
||||
//! restore the ids of the Entities as they are in the file.
|
||||
//! Thus when an Entity is re-created, it comes with a different id.
|
||||
//! So we have to keep track of the association between this newbox
|
||||
//! id (in the Hurricane database) and the one in the JSON file.
|
||||
//!
|
||||
//! This function adds such an association.
|
||||
|
||||
//! \function T JsonStack::getEntity ( unsigned int jsonId ) const;
|
||||
//! \Return The entity, casted as type \c T.
|
||||
//!
|
||||
//! Find an Entity with the JSON id \c jsonId and cast it into
|
||||
//! type \c T.
|
||||
//!
|
||||
//! Obviously, this Entity must have been registered with a call
|
||||
//! to addEntity() before.
|
||||
|
||||
//! \function vector<JsonObject*>& JsonStack::jobjects ();
|
||||
//! \Return the stack of JSON objects, for direct manipulation by the involded
|
||||
//! parties.
|
||||
|
||||
//! \function void JsonStack::print ( std::ostream& o ) const;
|
||||
//! Dump the contents of the \e attribute stack int the stream \c o.
|
||||
//! For debugging purposes.
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
"+netMap": [
|
||||
],
|
||||
}
|
||||
|
||||
\endcode
|
||||
*
|
||||
* \section secJsonDriver JSON Driver Support
|
||||
|
@ -165,8 +164,8 @@ class JsonPoint : public JsonObject {
|
|||
public:
|
||||
static void initialize ();
|
||||
JsonPoint (unsigned long flags);
|
||||
virtual string getTypeName();
|
||||
virtual JsonPoint* clone (unsigned long flags);
|
||||
virtual string getTypeName() const;
|
||||
virtual JsonPoint* clone (unsigned long flags) const;
|
||||
virtual void toData (JsonStack&);
|
||||
};
|
||||
\endcode
|
||||
|
@ -235,6 +234,105 @@ void JsonPoint::toData ( JsonStack& stack )
|
|||
update( stack, point );
|
||||
}
|
||||
\endcode
|
||||
*
|
||||
*
|
||||
* \subsection secJsonArray JSON Array
|
||||
*
|
||||
* JSON array are not translated into containers of any kind.
|
||||
* They are simply ignored (from the stack point of view).
|
||||
* Objects in array comes from a great variety of containers
|
||||
* including Hurricane::Collection, in almost all cases, their
|
||||
* very constructors are responsibles for inserting the object
|
||||
* in the relevant container/collection. So there is no need
|
||||
* to build a mechanism to keep track of all the objects in an
|
||||
* array through a temporary container.
|
||||
*
|
||||
* The corollary is that an object in an array must be able to
|
||||
* extract the relevant context information from the stack.
|
||||
* Say, if we are in an array of components, they must belong
|
||||
* to a Net, which must be present in the stack with a key ".Net".
|
||||
*
|
||||
*
|
||||
* \subsection secJsonStack Parser Stack
|
||||
*
|
||||
* While performing the parsing, the parser maintain a stack
|
||||
* (JsonStack) containing:
|
||||
* - The stack of attributes translateds, but not consumeds
|
||||
* by the parser and the objects currently openeds (that is,
|
||||
* which parsing is not completed). This stack contains POD
|
||||
* or Hurricane objects (value or pointer).
|
||||
* It is a vector of pair \c (key,value) where the \e key
|
||||
* is either the attribute name (\c _boundingBox, \c _xMin,
|
||||
* \c _masterCell, ...) or the class name (\c .Net, \c .Cell, ...).
|
||||
* - The stack of JSON objects currently openeds, thoses objects
|
||||
* are all derived classes of JsonObject.
|
||||
* - A stack of currently opened DBo*. This stack is somewhat
|
||||
* redundant with the first, but is needed because
|
||||
* \c boost::any_cast<> is not able to perform dynamic conversions.
|
||||
* You have to know the exact for the conversion to work.
|
||||
* Here, everything is DBo*, so the problem do not arises.
|
||||
*
|
||||
*
|
||||
* \subsection secJsonCycle JsonObject Life Cycle
|
||||
*
|
||||
\code{.json}
|
||||
{ # JsonDummy() (1).
|
||||
"_typename": "Net", # JsonNet() CTOR (2).
|
||||
"_id": 14622,
|
||||
"_name": "saccu(0)",
|
||||
"_isGlobal": false,
|
||||
"_isExternal": false,
|
||||
"_isAutomatic": false,
|
||||
"_type": "LOGICAL",
|
||||
"_direction": "---- (UNDEFINED)",
|
||||
"+aliases": [], # JsonNet::toData() (3).
|
||||
"+componentSet": [
|
||||
{
|
||||
"@typename": "RoutingPad",
|
||||
"_id": 27410,
|
||||
"_bodyHook": "Contact::AnchorHook.46566",
|
||||
"_occurrence": {
|
||||
"@typename": "Occurrence",
|
||||
"_path": "14720.14976",
|
||||
"_entity": 3888
|
||||
},
|
||||
"+propertySet": []
|
||||
},
|
||||
{
|
||||
"@typename": "RoutingPad",
|
||||
"_id": 27409,
|
||||
"_bodyHook": "Contact::AnchorHook.46574",
|
||||
"_occurrence": {
|
||||
"@typename": "Occurrence",
|
||||
"_path": "14654.18564",
|
||||
"_entity": 4529
|
||||
},
|
||||
"+propertySet": []
|
||||
}
|
||||
}
|
||||
} # ~JsonNet() DTOR (4).
|
||||
\endcode
|
||||
*
|
||||
* At \c (1) , before \c _typename is encountered, we know that a new
|
||||
* object is about to be created, but do not know what is type will be.
|
||||
* So we push on top of the stack a \c JsonDummy.
|
||||
*
|
||||
* At \c (2) , the \c _typename allows us to create the right kind of
|
||||
* JsonObject, which will \e replace the \c JsonDummy on top of the
|
||||
* stack.
|
||||
*
|
||||
* At \c (3) , a first non-POD attribute of JsonNet is encountered.
|
||||
* This triggers the call to \c JsonObject::toData(), which creates
|
||||
* the Hurricane object Net, and put it back on the attribute stack
|
||||
* with the key \c ".Net" (because it is \e not an attribute).
|
||||
*
|
||||
* At \c (4) , the Json parser knows that the current JsonObject is
|
||||
* finished, so it removes JsonNet from the stack and destroy it.
|
||||
*
|
||||
* So, if you need to perform specific post-processing that can only
|
||||
* take place \c after the object and all it's sub-objects has been
|
||||
* fully parsed, you may do it in the destructor of the JsonObject.
|
||||
* For example, this technique is used to rebuild the rings of a Net.
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -590,6 +590,7 @@ INPUT = Generalities.dox \
|
|||
Initializer.dox \
|
||||
../../src/hurricane/hurricane/Initializer.h \
|
||||
JsonObject.dox \
|
||||
../../src/hurricane/hurricane/JsonObject.h \
|
||||
../../src/hurricane/hurricane/JsonReader.h \
|
||||
Hurricane.dox \
|
||||
../../src/hurricane/hurricane/Commons.h \
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,15 +26,13 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./BasicLayer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
# include "hurricane/BasicLayer.h"
|
||||
# include "hurricane/Technology.h"
|
||||
# include "hurricane/Error.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -272,13 +264,29 @@ namespace Hurricane {
|
|||
{
|
||||
Record* record = Layer::_getRecord();
|
||||
if (record) {
|
||||
record->add(getSlot("Material", &_material));
|
||||
record->add(getSlot("RealName", &_realName));
|
||||
record->add(getSlot("_material" , &_material));
|
||||
record->add(getSlot("_realName" , &_realName));
|
||||
record->add(getSlot("_blockageLayer", _blockageLayer));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
void BasicLayer::_toJson ( JsonWriter* writer ) const
|
||||
{
|
||||
Super::_toJson( writer );
|
||||
|
||||
jsonWrite( writer, "_material" , getString(&_material) );
|
||||
jsonWrite( writer, "_extractNumber", _extractNumber );
|
||||
jsonWrite( writer, "_realName" , _realName );
|
||||
if (_blockageLayer) {
|
||||
jsonWrite( writer, "_blockageLayer", _blockageLayer->getName() );
|
||||
} else {
|
||||
jsonWrite( writer, "_blockageLayer", "no_blockage_layer" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::BasicLayer::Material".
|
||||
|
||||
|
@ -300,6 +308,23 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
BasicLayer::Material BasicLayer::Material::fromString ( const string& s )
|
||||
{
|
||||
Code code = other;
|
||||
if (s == "nWell" ) code = nWell;
|
||||
else if (s == "pWell" ) code = pWell;
|
||||
else if (s == "nImplant") code = nImplant;
|
||||
else if (s == "pImplant") code = pImplant;
|
||||
else if (s == "active" ) code = active;
|
||||
else if (s == "poly" ) code = poly;
|
||||
else if (s == "cut" ) code = cut;
|
||||
else if (s == "metal" ) code = metal;
|
||||
else if (s == "blockage") code = blockage;
|
||||
|
||||
return Material(code);
|
||||
}
|
||||
|
||||
|
||||
string BasicLayer::Material::_getString () const
|
||||
{ return getString(&_code); }
|
||||
|
||||
|
@ -312,4 +337,120 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonBasicLayer".
|
||||
|
||||
Initializer<JsonBasicLayer> jsonBasicLayerInit ( 0 );
|
||||
|
||||
|
||||
void JsonBasicLayer::initialize ()
|
||||
{ JsonTypes::registerType( new JsonBasicLayer (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonBasicLayer::JsonBasicLayer ( unsigned long flags )
|
||||
: JsonLayer(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "JsonBasicLayer::JsonBasicLayer()" << endl;
|
||||
|
||||
add( "_material" , typeid(string) );
|
||||
add( "_extractNumber", typeid(string) );
|
||||
add( "_blockageLayer", typeid(string) );
|
||||
add( "_realName" , typeid(string) );
|
||||
}
|
||||
|
||||
|
||||
JsonBasicLayer::~JsonBasicLayer ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonBasicLayer::getTypeName () const
|
||||
{ return "BasicLayer"; }
|
||||
|
||||
|
||||
JsonBasicLayer* JsonBasicLayer::clone ( unsigned long flags ) const
|
||||
{ return new JsonBasicLayer ( flags ); }
|
||||
|
||||
|
||||
void JsonBasicLayer::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonBasicLayer::toData" );
|
||||
|
||||
Technology* techno = lookupTechnology( stack, "JsonBasicLayer::toData" );
|
||||
BasicLayer* basicLayer = NULL;
|
||||
|
||||
if (techno) {
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string smask = get<string> ( stack, "_mask" );
|
||||
DbU::Unit minimalSize = get<int64_t>( stack, "_minimalSize" );
|
||||
DbU::Unit minimalSpacing = get<int64_t>( stack, "_minimalSpacing" );
|
||||
bool isWorking = get<bool> ( stack, "_working" );
|
||||
string materialName = get<string> ( stack, "_material" );
|
||||
unsigned int extractNumber = get<int64_t>( stack, "_extractNumber" );
|
||||
string blockageLayer = get<string> ( stack, "_blockageLayer" );
|
||||
string realName = get<string> ( stack, "_realName" );
|
||||
|
||||
BasicLayer::Material material = BasicLayer::Material::fromString(materialName);
|
||||
Layer::Mask mask = Layer::Mask::fromString(smask);
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
basicLayer = BasicLayer::create( techno
|
||||
, name
|
||||
, material
|
||||
, extractNumber
|
||||
, minimalSize
|
||||
, minimalSpacing
|
||||
);
|
||||
basicLayer->setWorking( isWorking );
|
||||
|
||||
if (blockageLayer != "no_blockage_layer") {
|
||||
JsonTechnology* jtechno = jget<JsonTechnology>( stack );
|
||||
if (jtechno) {
|
||||
jtechno->addBlockageRef( blockageLayer, basicLayer );
|
||||
}
|
||||
}
|
||||
|
||||
if (basicLayer->getMask() != mask) {
|
||||
cerr << Error( "JsonBasicLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(basicLayer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
// Add here association with blockage layer...
|
||||
} else {
|
||||
// Check coherency with existing layer.
|
||||
basicLayer = dynamic_cast<BasicLayer*>( techno->getLayer(name) );
|
||||
if (basicLayer) {
|
||||
if (basicLayer->getMask() != mask) {
|
||||
cerr << Error( "JsonBasicLayer::toData(): Layer mask discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(basicLayer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonBasicLayer::toData(): No BasicLayer \"%s\" in the existing technology."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonBasicLayer::toData(): Cannot find technology, aborting BasicLayer creation." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, basicLayer );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
hurricane/FileReadGzStream.h
|
||||
hurricane/FileWriteGzStream.h
|
||||
hurricane/JsonWriter.h
|
||||
hurricane/JsonObject.h
|
||||
hurricane/JsonReader.h
|
||||
hurricane/Signature.h
|
||||
hurricane/Observer.h
|
||||
|
@ -98,7 +99,6 @@
|
|||
hurricane/Views.h
|
||||
hurricane/Warning.h
|
||||
hurricane/TextTranslator.h
|
||||
hurricane/DesignBlob.h
|
||||
)
|
||||
set ( cpps Record.cpp
|
||||
Slot.cpp
|
||||
|
@ -109,6 +109,7 @@
|
|||
FileReadGzStream.cpp
|
||||
FileWriteGzStream.cpp
|
||||
JsonWriter.cpp
|
||||
JsonObject.cpp
|
||||
JsonReader.cpp
|
||||
Signature.cpp
|
||||
Exception.cpp
|
||||
|
@ -179,7 +180,6 @@
|
|||
Marker.cpp
|
||||
Timer.cpp
|
||||
TextTranslator.cpp
|
||||
DesignBlob.cpp
|
||||
)
|
||||
|
||||
add_library ( hurricane ${cpps} )
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "hurricane/Component.h"
|
||||
#include "hurricane/UpdateSession.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/JsonReader.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
@ -365,6 +366,22 @@ Cell* Cell::create(Library* library, const Name& name)
|
|||
return cell;
|
||||
}
|
||||
|
||||
Cell* Cell::fromJson(const string& filename)
|
||||
// *****************************************
|
||||
{
|
||||
UpdateSession::open();
|
||||
|
||||
JsonReader reader ( JsonWriter::CellMode );
|
||||
reader.parse( filename );
|
||||
|
||||
UpdateSession::close();
|
||||
|
||||
const JsonStack& stack = reader.getStack();
|
||||
if (stack.rhas(".Cell")) return stack.as<Cell*>(".Cell");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Box Cell::getBoundingBox() const
|
||||
// *****************************
|
||||
{
|
||||
|
|
|
@ -583,8 +583,13 @@ void JsonContact::toData(JsonStack& stack)
|
|||
, DbU::fromDb( get<int64_t>(stack,"_height") )
|
||||
);
|
||||
|
||||
stack.addHookLink( contact->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
stack.addHookLink( contact->getAnchorHook(), jsonId, get<string>(stack,"_anchorHook") );
|
||||
JsonNet* jnet = jget<JsonNet>( stack );
|
||||
if (jnet) {
|
||||
jnet->addHookLink( contact->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
jnet->addHookLink( contact->getAnchorHook(), jsonId, get<string>(stack,"_anchorHook") );
|
||||
} else {
|
||||
cerr << Error( "JsonContact::toData(): Missing (Json)Net in stack context." ) << endl;
|
||||
}
|
||||
|
||||
// Hook/Ring rebuild are done as a post-process.
|
||||
update( stack, contact );
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,16 +26,14 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./ContactLayer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
# include "hurricane/BasicLayer.h"
|
||||
# include "hurricane/ContactLayer.h"
|
||||
# include "hurricane/Technology.h"
|
||||
# include "hurricane/Error.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/ContactLayer.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -199,4 +191,150 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void ContactLayer::_toJson ( JsonWriter* w ) const
|
||||
{
|
||||
Super::_toJson( w );
|
||||
|
||||
jsonWrite( w, "_metal" , _basicLayers[0]->getName() );
|
||||
jsonWrite( w, "_cut" , _basicLayers[1]->getName() );
|
||||
jsonWrite( w, "_active" , _basicLayers[2]->getName() );
|
||||
jsonWrite( w, "_diffusion", _basicLayers[3]->getName() );
|
||||
if (_basicLayers.size() == 5) jsonWrite( w, "_well", _basicLayers[4]->getName() );
|
||||
else jsonWrite( w, "_well", "no_well_layer" );
|
||||
|
||||
jsonWrite( w, "_enclosure.metal" , _enclosures[0] );
|
||||
jsonWrite( w, "_enclosure.cut" , _enclosures[1] );
|
||||
jsonWrite( w, "_enclosure.active" , _enclosures[2] );
|
||||
jsonWrite( w, "_enclosure.diffusion", _enclosures[3] );
|
||||
jsonWrite( w, "_enclosure.well" , (_basicLayers.size() == 5) ? _enclosures[4] : 0 );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonContactLayer".
|
||||
|
||||
Initializer<JsonContactLayer> jsonContactLayerInit ( 0 );
|
||||
|
||||
|
||||
void JsonContactLayer::initialize ()
|
||||
{ JsonTypes::registerType( new JsonContactLayer (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonContactLayer::JsonContactLayer ( unsigned long flags )
|
||||
: JsonLayer(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "JsonContactLayer::JsonContactLayer()" << endl;
|
||||
|
||||
add( "_metal" , typeid(string) );
|
||||
add( "_cut" , typeid(string) );
|
||||
add( "_active" , typeid(string) );
|
||||
add( "_diffusion" , typeid(string) );
|
||||
add( "_well" , typeid(string) );
|
||||
add( "_enclosure.metal" , typeid(int64_t) );
|
||||
add( "_enclosure.cut" , typeid(int64_t) );
|
||||
add( "_enclosure.active" , typeid(int64_t) );
|
||||
add( "_enclosure.diffusion", typeid(int64_t) );
|
||||
add( "_enclosure.well" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
JsonContactLayer::~JsonContactLayer ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonContactLayer::getTypeName () const
|
||||
{ return "ContactLayer"; }
|
||||
|
||||
|
||||
JsonContactLayer* JsonContactLayer::clone ( unsigned long flags ) const
|
||||
{ return new JsonContactLayer ( flags ); }
|
||||
|
||||
|
||||
void JsonContactLayer::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonContactLayer::toData" );
|
||||
|
||||
Technology* techno = lookupTechnology( stack, "JsonContactLayer::toData" );
|
||||
ContactLayer* layer = NULL;
|
||||
|
||||
if (techno) {
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string smask = get<string> ( stack, "_mask" );
|
||||
//DbU::Unit minimalSize = get<int64_t>( stack, "_minimalSize" );
|
||||
//DbU::Unit minimalSpacing = get<int64_t>( stack, "_minimalSpacing" );
|
||||
bool isWorking = get<bool> ( stack, "_working" );
|
||||
|
||||
BasicLayer* metal = techno->getBasicLayer( get<string>(stack,"_metal" ) );
|
||||
BasicLayer* cut = techno->getBasicLayer( get<string>(stack,"_cut" ) );
|
||||
BasicLayer* active = techno->getBasicLayer( get<string>(stack,"_active" ) );
|
||||
BasicLayer* diffusion = techno->getBasicLayer( get<string>(stack,"_diffusion") );
|
||||
BasicLayer* well = techno->getBasicLayer( get<string>(stack,"_well" ) );
|
||||
DbU::Unit metalEncl = get<int64_t>( stack, "_enclosure.metal" );
|
||||
DbU::Unit cutEncl = get<int64_t>( stack, "_enclosure.cut" );
|
||||
DbU::Unit activeEncl = get<int64_t>( stack, "_enclosure.active" );
|
||||
DbU::Unit diffusionEncl = get<int64_t>( stack, "_enclosure.diffusion" );
|
||||
DbU::Unit wellEncl = get<int64_t>( stack, "_enclosure.well" );
|
||||
|
||||
Layer::Mask mask = Layer::Mask::fromString( smask );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
layer = ContactLayer::create( techno
|
||||
, name
|
||||
, metal
|
||||
, cut
|
||||
, active
|
||||
, diffusion
|
||||
, well
|
||||
);
|
||||
layer->setWorking ( isWorking );
|
||||
layer->setEnclosure( metal , metalEncl );
|
||||
layer->setEnclosure( cut , cutEncl );
|
||||
layer->setEnclosure( active , activeEncl );
|
||||
layer->setEnclosure( diffusion, diffusionEncl );
|
||||
if (well) layer->setEnclosure( well, wellEncl );
|
||||
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonContactLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
// Add here association with blockage layer...
|
||||
} else {
|
||||
// Check coherency with existing layer.
|
||||
layer = dynamic_cast<ContactLayer*>( techno->getLayer(name) );
|
||||
if (layer) {
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonContactLayer::toData(): Layer mask discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonContactLayer::toData(): No ContactLayer \"%s\" in the existing technology."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonContactLayer::toData(): Cannot find technology, aborting ContactLayer creation." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, layer );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/DBo.h"
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/DBo.h"
|
||||
#include "hurricane/Entity.h"
|
||||
#include "hurricane/Property.h"
|
||||
#include "hurricane/Quark.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
@ -201,13 +202,19 @@ namespace Hurricane {
|
|||
void DBo::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
std::string tname = _getTypeName();
|
||||
if (w->issetFlags(JsonWriter::UsePlugReference) and (tname == "Plug")) {
|
||||
tname.insert( 0, "&" );
|
||||
const Entity* entity = dynamic_cast<const Entity*>( this );
|
||||
if (w->issetFlags(JsonWriter::UseEntityReference) and entity) {
|
||||
jsonWrite( w, "@typename", "&Entity" );
|
||||
jsonWrite( w, "_id" , entity->getId() );
|
||||
} else {
|
||||
std::string tname = _getTypeName();
|
||||
if (w->issetFlags(JsonWriter::UsePlugReference) and (tname == "Plug")) {
|
||||
tname.insert( 0, "&" );
|
||||
}
|
||||
jsonWrite( w, "@typename", tname );
|
||||
_toJson( w );
|
||||
_toJsonCollections( w );
|
||||
}
|
||||
jsonWrite( w, "@typename", tname );
|
||||
_toJson( w );
|
||||
_toJsonCollections( w );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,11 @@ void DataBase::_toJson(JsonWriter* w) const
|
|||
{
|
||||
Inherit::_toJson( w );
|
||||
|
||||
jsonWrite( w, "_rootLibrary" , _rootLibrary );
|
||||
jsonWrite( w, "_precision" , DbU::getPrecision() );
|
||||
jsonWrite( w, "_gridsPerLambda" , DbU::getGridsPerLambda() );
|
||||
jsonWrite( w, "_physicalsPerGrid", DbU::getPhysicalsPerGrid() );
|
||||
jsonWrite( w, "_technology" , _technology );
|
||||
jsonWrite( w, "_rootLibrary" , _rootLibrary );
|
||||
|
||||
w->key( "+cellsOrderedByDepth" );
|
||||
w->startArray();
|
||||
|
@ -282,7 +286,11 @@ JsonDataBase::JsonDataBase(unsigned long flags)
|
|||
// ********************************************
|
||||
: JsonDBo(flags)
|
||||
{
|
||||
add( "_rootLibrary", typeid(Library*) );
|
||||
add( "_precision" , typeid(int64_t ) );
|
||||
add( "_gridsPerLambda" , typeid(double ) );
|
||||
add( "_physicalsPerGrid", typeid(double ) );
|
||||
add( "_technology" , typeid(Technology*) );
|
||||
add( "_rootLibrary" , typeid(Library* ) );
|
||||
}
|
||||
|
||||
string JsonDataBase::getTypeName() const
|
||||
|
@ -303,6 +311,9 @@ void JsonDataBase::toData(JsonStack& stack)
|
|||
check( stack, "JsonDataBase::toData" );
|
||||
|
||||
DataBase* db = DataBase::getDB();
|
||||
DbU::setPrecision ( get<int64_t>(stack,"_precision" ), DbU::NoTechnoUpdate );
|
||||
DbU::setGridsPerLambda ( get<double >(stack,"_gridsPerLambda" ), DbU::NoTechnoUpdate );
|
||||
DbU::setPhysicalsPerGrid( get<double >(stack,"_physicalsPerGrid"), DbU::Unity );
|
||||
|
||||
update( stack, db );
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace Hurricane {
|
|||
{ return _resolution; }
|
||||
|
||||
|
||||
void DbU::setPrecision ( unsigned int precision )
|
||||
void DbU::setPrecision ( unsigned int precision, unsigned int flags )
|
||||
{
|
||||
if ( _maximalPrecision < precision)
|
||||
throw Error ( "DbU::Unit::setPrecision(): Precision %ud exceed maximal precision %ud."
|
||||
|
@ -159,7 +159,8 @@ namespace Hurricane {
|
|||
_resolution = 1;
|
||||
while ( precision-- ) _resolution /= 10;
|
||||
|
||||
DataBase::getDB()->getTechnology()->_onDbuChange ( scale );
|
||||
if (not (flags & NoTechnoUpdate))
|
||||
DataBase::getDB()->getTechnology()->_onDbuChange ( scale );
|
||||
|
||||
setSymbolicSnapGridStep ( DbU::lambda( 1.0) );
|
||||
setRealSnapGridStep ( DbU::grid (10.0) );
|
||||
|
@ -197,7 +198,7 @@ namespace Hurricane {
|
|||
{ return ( physical * getUnitPower(p) ) / _physicalsPerGrid; }
|
||||
|
||||
|
||||
void DbU::setGridsPerLambda ( double gridsPerLambda )
|
||||
void DbU::setGridsPerLambda ( double gridsPerLambda, unsigned int flags )
|
||||
{
|
||||
if ( ( rint(gridsPerLambda) != gridsPerLambda )
|
||||
|| ( remainder(gridsPerLambda,2.0) != 0.0 ) )
|
||||
|
@ -209,7 +210,8 @@ namespace Hurricane {
|
|||
|
||||
_gridsPerLambda = gridsPerLambda;
|
||||
|
||||
DataBase::getDB()->getTechnology()->_onDbuChange ( scale );
|
||||
if (not (flags & NoTechnoUpdate))
|
||||
DataBase::getDB()->getTechnology()->_onDbuChange ( scale );
|
||||
|
||||
setSymbolicSnapGridStep ( DbU::lambda(1) );
|
||||
|
||||
|
|
|
@ -163,8 +163,6 @@ namespace Hurricane {
|
|||
{
|
||||
ltracein(51);
|
||||
|
||||
_stack = &stack;
|
||||
|
||||
check( stack, "JsonDeepNet::toData" );
|
||||
presetId( stack );
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,16 +26,14 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./DiffusionLayer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/DiffusionLayer.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/DiffusionLayer.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -95,7 +87,7 @@ namespace Hurricane {
|
|||
|
||||
_setMask ( activeLayer->getMask() | diffusionLayer->getMask() );
|
||||
_setExtractMask ( activeLayer->getExtractMask() | diffusionLayer->getExtractMask() );
|
||||
|
||||
|
||||
if ( wellLayer ) {
|
||||
_basicLayers .push_back ( wellLayer );
|
||||
_extentionCaps .push_back ( 0 );
|
||||
|
@ -227,4 +219,149 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void DiffusionLayer::_toJson ( JsonWriter* w ) const
|
||||
{
|
||||
Super::_toJson( w );
|
||||
|
||||
jsonWrite( w, "_active" , _basicLayers[0]->getName() );
|
||||
jsonWrite( w, "_diffusion", _basicLayers[1]->getName() );
|
||||
if (_basicLayers.size() == 3) jsonWrite( w, "_well", _basicLayers[2]->getName() );
|
||||
else jsonWrite( w, "_well", "no_well_layer" );
|
||||
|
||||
jsonWrite( w, "_extentionCap.active" , _extentionCaps[0] );
|
||||
jsonWrite( w, "_extentionCap.diffusion", _extentionCaps[1] );
|
||||
jsonWrite( w, "_extentionCap.well" , (_basicLayers.size() == 3) ? _extentionCaps[2] : 0 );
|
||||
|
||||
jsonWrite( w, "_extentionWidth.active" , _extentionWidths[0] );
|
||||
jsonWrite( w, "_extentionWidth.diffusion", _extentionWidths[1] );
|
||||
jsonWrite( w, "_extentionWidth.well" , (_basicLayers.size() == 3) ? _extentionWidths[2] : 0 );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonDiffusionLayer".
|
||||
|
||||
Initializer<JsonDiffusionLayer> jsonDiffusionLayerInit ( 0 );
|
||||
|
||||
|
||||
void JsonDiffusionLayer::initialize ()
|
||||
{ JsonTypes::registerType( new JsonDiffusionLayer (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonDiffusionLayer::JsonDiffusionLayer ( unsigned long flags )
|
||||
: JsonLayer(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "JsonDiffusionLayer::JsonDiffusionLayer()" << endl;
|
||||
|
||||
add( "_active" , typeid(string) );
|
||||
add( "_diffusion" , typeid(string) );
|
||||
add( "_well" , typeid(string) );
|
||||
add( "_extentionCap.active" , typeid(int64_t) );
|
||||
add( "_extentionCap.diffusion" , typeid(int64_t) );
|
||||
add( "_extentionCap.well" , typeid(int64_t) );
|
||||
add( "_extentionWidth.active" , typeid(int64_t) );
|
||||
add( "_extentionWidth.diffusion", typeid(int64_t) );
|
||||
add( "_extentionWidth.well" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
JsonDiffusionLayer::~JsonDiffusionLayer ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonDiffusionLayer::getTypeName () const
|
||||
{ return "DiffusionLayer"; }
|
||||
|
||||
|
||||
JsonDiffusionLayer* JsonDiffusionLayer::clone ( unsigned long flags ) const
|
||||
{ return new JsonDiffusionLayer ( flags ); }
|
||||
|
||||
|
||||
void JsonDiffusionLayer::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonDiffusionLayer::toData" );
|
||||
|
||||
Technology* techno = lookupTechnology( stack, "JsonDiffusionLayer::toData" );
|
||||
DiffusionLayer* layer = NULL;
|
||||
|
||||
if (techno) {
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string smask = get<string> ( stack, "_mask" );
|
||||
//DbU::Unit minimalSize = get<int64_t>( stack, "_minimalSize" );
|
||||
//DbU::Unit minimalSpacing = get<int64_t>( stack, "_minimalSpacing" );
|
||||
bool isWorking = get<bool> ( stack, "_working" );
|
||||
|
||||
BasicLayer* active = techno->getBasicLayer( get<string>(stack,"_active" ) );
|
||||
BasicLayer* diffusion = techno->getBasicLayer( get<string>(stack,"_diffusion" ) );
|
||||
BasicLayer* well = techno->getBasicLayer( get<string>(stack,"_well" ) );
|
||||
DbU::Unit eCapActive = get<int64_t>( stack, "_extentionCap.active" );
|
||||
DbU::Unit eCapDiffusion = get<int64_t>( stack, "_extentionCap.diffusion" );
|
||||
DbU::Unit eCapWell = get<int64_t>( stack, "_extentionCap.well" );
|
||||
DbU::Unit eWidthActive = get<int64_t>( stack, "_extentionWidth.active" );
|
||||
DbU::Unit eWidthDiffusion = get<int64_t>( stack, "_extentionWidth.diffusion" );
|
||||
DbU::Unit eWidthWell = get<int64_t>( stack, "_extentionWidth.well" );
|
||||
|
||||
Layer::Mask mask = Layer::Mask::fromString( smask );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
layer = DiffusionLayer::create( techno
|
||||
, name
|
||||
, active
|
||||
, diffusion
|
||||
, well
|
||||
);
|
||||
layer->setWorking ( isWorking );
|
||||
layer->setExtentionCap ( active , eCapActive );
|
||||
layer->setExtentionCap ( diffusion, eCapDiffusion );
|
||||
layer->setExtentionWidth( active , eWidthActive );
|
||||
layer->setExtentionWidth( diffusion, eWidthDiffusion );
|
||||
if (well) {
|
||||
layer->setExtentionCap ( well, eCapWell );
|
||||
layer->setExtentionWidth( well, eWidthWell );
|
||||
}
|
||||
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonDiffusionLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
// Add here association with blockage layer...
|
||||
} else {
|
||||
// Check coherency with existing layer.
|
||||
layer = dynamic_cast<DiffusionLayer*>( techno->getLayer(name) );
|
||||
if (layer) {
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonDiffusionLayer::toData(): Layer mask discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonDiffusionLayer::toData(): No DiffusionLayer \"%s\" in the existing technology."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonDiffusionLayer::toData(): Cannot find technology, aborting DiffusionLayer creation." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, layer );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -195,6 +195,58 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonEntityRef".
|
||||
|
||||
Initializer<JsonEntityRef> jsonEntityRefInit ( 0 );
|
||||
|
||||
|
||||
void JsonEntityRef::initialize ()
|
||||
{ JsonTypes::registerType( new JsonEntityRef (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonEntityRef::JsonEntityRef ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
add( "_id", typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
string JsonEntityRef::getTypeName () const
|
||||
{ return "&Entity"; }
|
||||
|
||||
|
||||
JsonEntityRef* JsonEntityRef::clone( unsigned long flags ) const
|
||||
{ return new JsonEntityRef ( flags ); }
|
||||
|
||||
|
||||
void JsonEntityRef::toData ( JsonStack& stack )
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonEntityRef::toData" );
|
||||
|
||||
unsigned int jsonId = get<int64_t>( stack, "_id" );
|
||||
Entity* entity = stack.getEntity<Entity*>( jsonId );
|
||||
|
||||
ltrace(51) << "jsonId:" << jsonId << " entity:" << entity << endl;
|
||||
|
||||
if (entity) {
|
||||
JsonBaseArray<Entity*>* array = jget< JsonBaseArray<Entity*> >( stack );
|
||||
if (array) array->push_back( entity );
|
||||
else
|
||||
cerr << Error( "JsonEntityRef::toData(): Missing JsonBaseArray in stack context." ) << endl;
|
||||
} else {
|
||||
cerr << Error( "JsonEntityRef::toData(): No Entity id:%u in stack LUT.", jsonId ) << endl;
|
||||
}
|
||||
|
||||
update( stack, NULL );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -247,9 +247,14 @@ void JsonHorizontal::toData(JsonStack& stack)
|
|||
, DbU::fromDb( get<int64_t>(stack,"_dxTarget") )
|
||||
);
|
||||
|
||||
stack.addHookLink( horizontal->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
stack.addHookLink( horizontal->getSourceHook(), jsonId, get<string>(stack,"_sourceHook") );
|
||||
stack.addHookLink( horizontal->getTargetHook(), jsonId, get<string>(stack,"_targetHook") );
|
||||
JsonNet* jnet = jget<JsonNet>( stack );
|
||||
if (jnet) {
|
||||
jnet->addHookLink( horizontal->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
jnet->addHookLink( horizontal->getSourceHook(), jsonId, get<string>(stack,"_sourceHook") );
|
||||
jnet->addHookLink( horizontal->getTargetHook(), jsonId, get<string>(stack,"_targetHook") );
|
||||
} else {
|
||||
cerr << Error( "JsonHorizontal::toData(): Missing (Json)Net in stack context." ) << endl;
|
||||
}
|
||||
|
||||
// Hook/Ring rebuild are done as a post-process.
|
||||
update( stack, horizontal );
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved
|
||||
//
|
||||
// This file is part of Hurricane.
|
||||
//
|
||||
// Hurricane is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// Hurricane is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
|
||||
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Lesser GNU General Public
|
||||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | 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@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./JsonObject.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
// Needed for registering. May be deleted later.
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/DebugSession.h"
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Cell.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonObject".
|
||||
|
||||
JsonObject::JsonObject ( unsigned long flags )
|
||||
: _flags (flags)
|
||||
, _name ()
|
||||
, _stackeds ()
|
||||
, _attributes ()
|
||||
, _collections()
|
||||
, _object ()
|
||||
{ }
|
||||
|
||||
|
||||
JsonObject::~JsonObject ()
|
||||
{ }
|
||||
|
||||
|
||||
bool JsonObject::isDummy () const
|
||||
{ return false; }
|
||||
|
||||
|
||||
void JsonObject::add ( const string& key, type_index tid )
|
||||
{
|
||||
if (key.empty()) {
|
||||
cerr << "[ERROR] JsonObject::add(): Attempt to add attribute with an empty name, ignored."
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
if (has(key)) {
|
||||
cerr << "[ERROR] JsonObject::add(): Attempt to add attribute \"" << key << "\" twice, cancelled."
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( key[0] ) {
|
||||
case '.': _stackeds .push_back( JsonAttribute(key,tid) ); return;
|
||||
case '_': _attributes .push_back( JsonAttribute(key,tid) ); return;
|
||||
case '+': _collections.push_back( JsonAttribute(key,tid) ); return;
|
||||
default: break;
|
||||
}
|
||||
|
||||
cerr << "[ERROR] JsonObject::add(): Key name \"" << key
|
||||
<< "\" do not follow naming convention, cancelled." << endl;
|
||||
}
|
||||
|
||||
|
||||
void JsonObject::remove ( const std::string& key )
|
||||
{
|
||||
if (key.empty()) {
|
||||
cerr << Error( "JsonObject::remove(): Attempt to remove attribute with an empty name, ignored." ) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( key[0] ) {
|
||||
case '.':
|
||||
for ( auto it = _stackeds.begin() ; it != _stackeds.end() ; ++it )
|
||||
if (key == (*it).key()) { _stackeds.erase(it); break; }
|
||||
break;
|
||||
case '_':
|
||||
for ( auto it = _attributes.begin() ; it != _attributes.end() ; ++it )
|
||||
if (key == (*it).key()) { _attributes.erase(it); break; }
|
||||
break;
|
||||
case '+':
|
||||
for ( auto it = _collections.begin() ; it != _collections.end() ; ++it )
|
||||
if (key == (*it).key()) { _collections.erase(it); break; }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool JsonObject::has ( const std::string& key ) const
|
||||
{
|
||||
if (key.empty()) return false;
|
||||
switch ( key[0] ) {
|
||||
case '.':
|
||||
for ( size_t i=0 ; i<_stackeds.size() ; ++i )
|
||||
if (key == _stackeds[i].key()) return true;
|
||||
break;
|
||||
case '_':
|
||||
for ( size_t i=0 ; i<_attributes.size() ; ++i )
|
||||
if (key == _attributes[i].key()) return true;
|
||||
break;
|
||||
case '+':
|
||||
for ( size_t i=0 ; i<_collections.size() ; ++i )
|
||||
if (key == _collections[i].key()) return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool JsonObject::check ( JsonStack& stack, string fname ) const
|
||||
{
|
||||
for ( size_t i=0 ; i<_stackeds.size() ; ++i ) {
|
||||
if (not stack.rhas(_stackeds[i].key())) {
|
||||
cerr << Error( "%s(): Stack is missing context element with key \"%s\""
|
||||
, fname.c_str(), _stackeds[i].key().c_str() ) << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for ( size_t i=0 ; i<_attributes.size() ; ++i ) {
|
||||
if (not stack.rhas(_attributes[i].key())) {
|
||||
cerr << Error( "%s(): Stack is missing attribute element with key \"%s\""
|
||||
, fname.c_str(), _attributes[i].key().c_str() ) << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void JsonObject::toData ( JsonStack& )
|
||||
{ }
|
||||
|
||||
|
||||
unsigned int JsonObject::presetId ( JsonStack& stack )
|
||||
{
|
||||
unsigned int jsonId = get<int64_t>( stack, "_id" );
|
||||
if (issetFlags(JsonWriter::DesignBlobMode)) {
|
||||
Entity::setNextId( jsonId );
|
||||
}
|
||||
return jsonId;
|
||||
}
|
||||
|
||||
|
||||
void JsonObject::print ( ostream& o ) const
|
||||
{
|
||||
o << tab << "JsonObject for type: " << getTypeName() << endl;
|
||||
for ( size_t i=0 ; i<_stackeds.size() ; ++i )
|
||||
o << tab << "key:" << left << setw(20) << _stackeds[i].key()
|
||||
<< " type:" << _stackeds[i].tid().name() << endl;
|
||||
|
||||
for ( size_t i=0 ; i<_attributes.size() ; ++i )
|
||||
o << tab << "key:" << left << setw(20) << _attributes[i].key()
|
||||
<< " type:" << _attributes[i].tid().name() << endl;
|
||||
|
||||
for ( size_t i=0 ; i<_collections.size() ; ++i )
|
||||
o << tab << "key:" << left << setw(20) << _collections[i].key()
|
||||
<< " type:" << _collections[i].tid().name() << endl;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonKey".
|
||||
|
||||
JsonKey::JsonKey ( const string& key )
|
||||
: JsonObject(0)
|
||||
, _key (key)
|
||||
{ }
|
||||
|
||||
|
||||
string JsonKey::getTypeName () const { return _key; }
|
||||
JsonKey* JsonKey::clone ( unsigned long ) const { return new JsonKey ( *this ); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDummy".
|
||||
|
||||
JsonDummy::JsonDummy ()
|
||||
: JsonObject(0)
|
||||
, _typename ("dummy")
|
||||
{ }
|
||||
|
||||
|
||||
bool JsonDummy::isDummy () const { return true; }
|
||||
string JsonDummy::getTypeName () const { return _typename; }
|
||||
void JsonDummy::setTypeName ( const string& name ) { _typename=name; }
|
||||
JsonDummy* JsonDummy::clone ( unsigned long ) const { return new JsonDummy ( *this ); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonTypes".
|
||||
|
||||
Initializer<JsonTypes> jsonTypesInitialize ( 10 );
|
||||
|
||||
JsonTypes* JsonTypes::_jsonTypes = NULL;
|
||||
|
||||
|
||||
JsonTypes::JsonTypes ()
|
||||
: _jsonObjects()
|
||||
{ }
|
||||
|
||||
|
||||
JsonTypes::~JsonTypes ()
|
||||
{
|
||||
for ( JsonObject* object : _jsonObjects ) delete object;
|
||||
}
|
||||
|
||||
|
||||
void JsonTypes::_registerType ( JsonObject* object )
|
||||
{
|
||||
if (_find(object->getTypeName())) {
|
||||
throw Error( "JsonTypes::_registerType(): Attempt to register <%s> twice.", object->getTypeName().c_str() );
|
||||
}
|
||||
_jsonObjects.insert( object );
|
||||
}
|
||||
|
||||
|
||||
JsonObject* JsonTypes::_find ( const string& tname )
|
||||
{
|
||||
JsonKey key( tname );
|
||||
set<JsonObject*>::iterator it = _jsonObjects.find( &key );
|
||||
if (it != _jsonObjects.end()) return (*it);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void JsonTypes::registerType ( JsonObject* object )
|
||||
{
|
||||
if (not _jsonTypes) initialize();
|
||||
_jsonTypes->_registerType( object );
|
||||
}
|
||||
|
||||
|
||||
JsonObject* JsonTypes::find ( const string& tname )
|
||||
{
|
||||
if (not _jsonTypes) initialize();
|
||||
return _jsonTypes->_find( tname );
|
||||
}
|
||||
|
||||
|
||||
void JsonTypes::initialize ()
|
||||
{ if (not _jsonTypes) _jsonTypes = new JsonTypes (); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonStack".
|
||||
|
||||
void JsonStack::addEntity ( unsigned int jsonId, Entity* entity )
|
||||
{ _entities.insert( std::make_pair(jsonId,entity) ); }
|
||||
|
||||
|
||||
void JsonStack::print ( ostream& o ) const
|
||||
{
|
||||
o << tab << "JsonStack::print() Stack contains " << _stack.size() << " elements." << endl;
|
||||
for ( size_t i=0 ; i<_stack.size() ; ++i ) {
|
||||
o << "[" << right << setw(2) << i << "] key: \"" << left << setw(20) << _stack[i].first
|
||||
<< "\", type: \"" << demangle(_stack[i].second.type()) << "\"." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -29,35 +29,19 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "rapidjson/filereadstream.h"
|
||||
#include "rapidjson/reader.h"
|
||||
// Needed for registering. May be deleted later.
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/FileReadGzStream.h"
|
||||
#include "hurricane/DebugSession.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/Signature.h"
|
||||
#include "hurricane/JsonReader.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/Net.h"
|
||||
#include "hurricane/DeepNet.h"
|
||||
#include "hurricane/Instance.h"
|
||||
#include "hurricane/RoutingPad.h"
|
||||
#include "hurricane/Contact.h"
|
||||
#include "hurricane/Vertical.h"
|
||||
#include "hurricane/Horizontal.h"
|
||||
#include "hurricane/Pad.h"
|
||||
#include "hurricane/UpdateSession.h"
|
||||
#include "hurricane/DesignBlob.h"
|
||||
#include "hurricane/Entity.h"
|
||||
#include "hurricane/Property.h"
|
||||
|
||||
|
||||
namespace {
|
||||
namespace Hurricane {
|
||||
|
||||
using namespace std;
|
||||
using namespace rapidjson;
|
||||
using namespace Hurricane;
|
||||
|
||||
class JsonReader;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -65,25 +49,27 @@ namespace {
|
|||
|
||||
class HurricaneHandler {
|
||||
public:
|
||||
HurricaneHandler ( JsonReader& );
|
||||
public:
|
||||
bool Null ();
|
||||
bool Bool ( bool );
|
||||
bool Int ( int );
|
||||
bool Int64 ( int64_t );
|
||||
bool Uint ( unsigned int );
|
||||
bool Uint64 ( uint64_t );
|
||||
bool Double ( double );
|
||||
bool String ( const char*, SizeType, bool copy );
|
||||
bool Key ( const char*, SizeType, bool copy );
|
||||
bool StartObject ();
|
||||
bool EndObject ( SizeType );
|
||||
bool StartArray ();
|
||||
bool EndArray ( SizeType );
|
||||
inline bool isDummy () const;
|
||||
inline bool doCallToData () const;
|
||||
inline JsonStack& stack ();
|
||||
inline unsigned long flags ();
|
||||
HurricaneHandler ( JsonReader& );
|
||||
public:
|
||||
bool Null ();
|
||||
bool Bool ( bool );
|
||||
bool Int ( int );
|
||||
bool Int64 ( int64_t );
|
||||
bool Uint ( unsigned int );
|
||||
bool Uint64 ( uint64_t );
|
||||
bool Double ( double );
|
||||
bool String ( const char*, SizeType, bool copy );
|
||||
bool Key ( const char*, SizeType, bool copy );
|
||||
bool StartObject ();
|
||||
bool EndObject ( SizeType );
|
||||
bool StartArray ();
|
||||
bool EndArray ( SizeType );
|
||||
inline bool isDummy () const;
|
||||
inline bool doCallToData () const;
|
||||
inline JsonStack& stack ();
|
||||
inline vector<JsonObject*>& objects ();
|
||||
inline vector<JsonObject*>& objects () const;
|
||||
inline unsigned long flags ();
|
||||
private:
|
||||
enum Flags { TypenameKey = (1<<0)
|
||||
};
|
||||
|
@ -91,40 +77,10 @@ namespace {
|
|||
unsigned long _state;
|
||||
string _key;
|
||||
string _objectName;
|
||||
vector<JsonObject*> _objects;
|
||||
JsonReader& _reader;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonReader" (declaration).
|
||||
|
||||
class JsonReader {
|
||||
public:
|
||||
JsonReader ( unsigned long flags );
|
||||
~JsonReader ();
|
||||
inline JsonReader* setFlags ( unsigned long mask );
|
||||
inline JsonReader* resetFlags ( unsigned long mask );
|
||||
inline bool issetFlags ( unsigned long mask ) const;
|
||||
inline unsigned long getFlags () const;
|
||||
inline JsonStack& getStack ();
|
||||
void parse ( std::string fileName );
|
||||
void close ();
|
||||
private:
|
||||
JsonReader ( const JsonReader& );
|
||||
JsonReader& operator= ( const JsonReader& ) const;
|
||||
private:
|
||||
unsigned long _flags;
|
||||
size_t _bufferSize;
|
||||
char* _buffer;
|
||||
FILE* _file;
|
||||
FileReadGzStream* _stream;
|
||||
JsonStack _stack;
|
||||
Reader _reader;
|
||||
HurricaneHandler _handler;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "HurricaneHandler" (definition).
|
||||
|
||||
|
@ -132,21 +88,22 @@ namespace {
|
|||
: _state (0)
|
||||
, _key ()
|
||||
, _objectName()
|
||||
, _objects ()
|
||||
, _reader (reader)
|
||||
{ }
|
||||
|
||||
|
||||
inline JsonStack& HurricaneHandler::stack () { return _reader.getStack(); }
|
||||
inline unsigned long HurricaneHandler::flags () { return _reader.getFlags(); }
|
||||
inline JsonStack& HurricaneHandler::stack () { return _reader.getStack(); }
|
||||
inline vector<JsonObject*>& HurricaneHandler::objects () { return _reader.getStack().jobjects(); }
|
||||
inline vector<JsonObject*>& HurricaneHandler::objects () const { return _reader.getStack().jobjects(); }
|
||||
inline unsigned long HurricaneHandler::flags () { return _reader.getStack().getFlags(); }
|
||||
|
||||
|
||||
inline bool HurricaneHandler::isDummy () const
|
||||
{ return _objects.empty() or _objects.back()->isDummy(); }
|
||||
{ return objects().empty() or objects().back()->isDummy(); }
|
||||
|
||||
|
||||
inline bool HurricaneHandler::doCallToData () const
|
||||
{ return not _objects.empty() and _objects.back() and not _objects.back()->isBound(); }
|
||||
{ return not objects().empty() and objects().back() and not objects().back()->isBound(); }
|
||||
|
||||
|
||||
bool HurricaneHandler::Null ()
|
||||
|
@ -234,14 +191,14 @@ namespace {
|
|||
// Keep the dummy object on top of the stack.
|
||||
cerr << Warning( "JsonReader::parse(): Do not know how to parse type \"%s\" (ignored)."
|
||||
, value ) << endl;
|
||||
dynamic_cast<JsonDummy*>(_objects.back())->setTypeName( value );
|
||||
dynamic_cast<JsonDummy*>(objects().back())->setTypeName( value );
|
||||
} else {
|
||||
// Replace the dummy object on top of the stack.
|
||||
delete _objects.back();
|
||||
_objects[_objects.size()-1] = object->clone( flags() );
|
||||
_objects.back()->setName( _objectName );
|
||||
delete objects().back();
|
||||
objects()[objects().size()-1] = object->clone( flags() );
|
||||
objects().back()->setName( _objectName );
|
||||
|
||||
signature = dynamic_cast<JsonSignature*>( _objects.back() );
|
||||
signature = dynamic_cast<JsonSignature*>( objects().back() );
|
||||
if (signature) {
|
||||
size_t dot = svalue.find('.');
|
||||
signature->setSubType( svalue.substr(dot+1) );
|
||||
|
@ -266,15 +223,15 @@ namespace {
|
|||
_key = key;
|
||||
if (_state & TypenameKey) return true;
|
||||
|
||||
//ltrace(51) << "HurricaneHandler::Key() key:" << _key << " _objects.size():" << _objects.size() << endl;
|
||||
//ltrace(51) << "HurricaneHandler::Key() key:" << _key << " objects().size():" << objects().size() << endl;
|
||||
|
||||
if (_objects.back()) {
|
||||
if (objects().back()) {
|
||||
if ( doCallToData() and not _key.empty() and (_key[0] != '_') ) {
|
||||
// The key is no longer a simple attribute of the object.
|
||||
// Triggers it's creation in the Json stack.
|
||||
ltrace(51) << "HurricaneHandler::key() Calling "
|
||||
<< _objects.back()->getTypeName() << "::toData(JsonStack&)." << endl;
|
||||
_objects.back()->toData( stack() );
|
||||
<< objects().back()->getTypeName() << "::toData(JsonStack&)." << endl;
|
||||
objects().back()->toData( stack() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,9 +246,9 @@ namespace {
|
|||
|
||||
_state |= TypenameKey;
|
||||
_objectName = _key;
|
||||
_objects.push_back( new JsonDummy() );
|
||||
objects().push_back( new JsonDummy() );
|
||||
_key.clear();
|
||||
ltrace(51) << "_objects.push_back(NULL), size():" << _objects.size() << "." << endl;
|
||||
ltrace(51) << "objects().push_back(NULL), size():" << objects().size() << "." << endl;
|
||||
|
||||
ltracein(50);
|
||||
return true;
|
||||
|
@ -307,20 +264,20 @@ namespace {
|
|||
_objectName.clear();
|
||||
if (not isDummy()) {
|
||||
if (doCallToData()) {
|
||||
ltrace(51) << "Calling " << _objects.back()->getTypeName() << "::toData(JsonStack&)." << endl;
|
||||
_objects.back()->toData( stack() );
|
||||
ltrace(51) << "Calling " << objects().back()->getTypeName() << "::toData(JsonStack&)." << endl;
|
||||
objects().back()->toData( stack() );
|
||||
}
|
||||
if (stack().size() > 1) {
|
||||
if (stack()[-1].first[0] != '_') stack().pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
ltrace(51) << "_objects.pop_back(), size():" << _objects.size() << "." << endl;
|
||||
if (_objects.back()->issetFlags(JsonWriter::DBoObject))
|
||||
ltrace(51) << "objects().pop_back(), size():" << objects().size() << "." << endl;
|
||||
if (objects().back()->issetFlags(JsonWriter::DBoObject))
|
||||
stack().pop_back_dbo();
|
||||
|
||||
delete _objects.back();
|
||||
_objects.pop_back();
|
||||
delete objects().back();
|
||||
objects().pop_back();
|
||||
|
||||
ltraceout(50);
|
||||
return true;
|
||||
|
@ -355,15 +312,15 @@ namespace {
|
|||
// Class : "JsonReader" (definition).
|
||||
|
||||
JsonReader::JsonReader ( unsigned long flags )
|
||||
: _flags (flags)
|
||||
, _bufferSize(65536)
|
||||
: _bufferSize(65536)
|
||||
, _buffer (new char [_bufferSize])
|
||||
, _file (NULL)
|
||||
, _stream (NULL)
|
||||
, _stack ()
|
||||
, _reader ()
|
||||
, _handler (*this)
|
||||
, _handler (new HurricaneHandler(*this))
|
||||
{
|
||||
_stack.setFlags( flags );
|
||||
}
|
||||
|
||||
|
||||
|
@ -371,6 +328,7 @@ namespace {
|
|||
{
|
||||
close();
|
||||
delete _buffer;
|
||||
delete _handler;
|
||||
}
|
||||
|
||||
|
||||
|
@ -381,13 +339,6 @@ namespace {
|
|||
}
|
||||
|
||||
|
||||
inline JsonReader* JsonReader::setFlags ( unsigned long mask ) { _flags |= mask; return this; }
|
||||
inline JsonReader* JsonReader::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; }
|
||||
inline bool JsonReader::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
inline unsigned long JsonReader::getFlags () const { return _flags; }
|
||||
inline JsonStack& JsonReader::getStack () { return _stack; }
|
||||
|
||||
|
||||
void JsonReader::parse ( string fileName )
|
||||
{
|
||||
close();
|
||||
|
@ -407,8 +358,11 @@ namespace {
|
|||
|
||||
if (issetFlags(JsonWriter::DesignBlobMode))
|
||||
Entity::enableForcedIdMode();
|
||||
_reader.Parse( *_stream, _handler );
|
||||
_stack.print( cerr );
|
||||
_reader.Parse( *_stream, *_handler );
|
||||
if (_stack.size() != 1) {
|
||||
cerr << Error( "JsonReader::parse(): Stack must contain exatly one element upon completion." ) << endl;
|
||||
_stack.print( cerr );
|
||||
}
|
||||
if (issetFlags(JsonWriter::DesignBlobMode))
|
||||
Entity::disableForcedIdMode();
|
||||
|
||||
|
@ -419,395 +373,4 @@ namespace {
|
|||
}
|
||||
|
||||
|
||||
} // local namespace.
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonObject".
|
||||
|
||||
JsonObject::JsonObject ( unsigned long flags )
|
||||
: _flags (flags)
|
||||
, _name ()
|
||||
, _stackeds ()
|
||||
, _attributes ()
|
||||
, _collections()
|
||||
, _object ()
|
||||
{ }
|
||||
|
||||
|
||||
JsonObject::~JsonObject ()
|
||||
{ }
|
||||
|
||||
|
||||
bool JsonObject::isDummy () const
|
||||
{ return false; }
|
||||
|
||||
|
||||
void JsonObject::add ( const string& key, type_index tid )
|
||||
{
|
||||
if (key.empty()) {
|
||||
cerr << "[ERROR] JsonObject::add(): Attempt to add attribute with an empty name, ignored."
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
if (has(key)) {
|
||||
cerr << "[ERROR] JsonObject::add(): Attempt to add attribute \"" << key << "\" twice, cancelled."
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( key[0] ) {
|
||||
case '.': _stackeds .push_back( JsonAttribute(key,tid) ); return;
|
||||
case '_': _attributes .push_back( JsonAttribute(key,tid) ); return;
|
||||
case '+': _collections.push_back( JsonAttribute(key,tid) ); return;
|
||||
default: break;
|
||||
}
|
||||
|
||||
cerr << "[ERROR] JsonObject::add(): Key name \"" << key
|
||||
<< "\" do not follow naming convention, cancelled." << endl;
|
||||
}
|
||||
|
||||
|
||||
void JsonObject::remove ( const std::string& key )
|
||||
{
|
||||
if (key.empty()) {
|
||||
cerr << Error( "JsonObject::remove(): Attempt to remove attribute with an empty name, ignored." ) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( key[0] ) {
|
||||
case '.':
|
||||
for ( auto it = _stackeds.begin() ; it != _stackeds.end() ; ++it )
|
||||
if (key == (*it).key()) { _stackeds.erase(it); break; }
|
||||
break;
|
||||
case '_':
|
||||
for ( auto it = _attributes.begin() ; it != _attributes.end() ; ++it )
|
||||
if (key == (*it).key()) { _attributes.erase(it); break; }
|
||||
break;
|
||||
case '+':
|
||||
for ( auto it = _collections.begin() ; it != _collections.end() ; ++it )
|
||||
if (key == (*it).key()) { _collections.erase(it); break; }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool JsonObject::has ( const std::string& key ) const
|
||||
{
|
||||
if (key.empty()) return false;
|
||||
switch ( key[0] ) {
|
||||
case '.':
|
||||
for ( size_t i=0 ; i<_stackeds.size() ; ++i )
|
||||
if (key == _stackeds[i].key()) return true;
|
||||
break;
|
||||
case '_':
|
||||
for ( size_t i=0 ; i<_attributes.size() ; ++i )
|
||||
if (key == _attributes[i].key()) return true;
|
||||
break;
|
||||
case '+':
|
||||
for ( size_t i=0 ; i<_collections.size() ; ++i )
|
||||
if (key == _collections[i].key()) return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool JsonObject::check ( JsonStack& stack, string fname ) const
|
||||
{
|
||||
for ( size_t i=0 ; i<_stackeds.size() ; ++i ) {
|
||||
if (not stack.rhas(_stackeds[i].key())) {
|
||||
cerr << Error( "%s(): Stack is missing context element with key \"%s\""
|
||||
, fname.c_str(), _stackeds[i].key().c_str() ) << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for ( size_t i=0 ; i<_attributes.size() ; ++i ) {
|
||||
if (not stack.rhas(_attributes[i].key())) {
|
||||
cerr << Error( "%s(): Stack is missing attribute element with key \"%s\""
|
||||
, fname.c_str(), _attributes[i].key().c_str() ) << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void JsonObject::toData ( JsonStack& )
|
||||
{ }
|
||||
|
||||
|
||||
unsigned int JsonObject::presetId ( JsonStack& stack )
|
||||
{
|
||||
unsigned int jsonId = get<int64_t>( stack, "_id" );
|
||||
if (issetFlags(JsonWriter::DesignBlobMode)) {
|
||||
Entity::setNextId( jsonId );
|
||||
}
|
||||
return jsonId;
|
||||
}
|
||||
|
||||
|
||||
void JsonObject::print ( ostream& o ) const
|
||||
{
|
||||
o << tab << "JsonObject for type: " << getTypeName() << endl;
|
||||
for ( size_t i=0 ; i<_stackeds.size() ; ++i )
|
||||
o << tab << "key:" << left << setw(20) << _stackeds[i].key()
|
||||
<< " type:" << _stackeds[i].tid().name() << endl;
|
||||
|
||||
for ( size_t i=0 ; i<_attributes.size() ; ++i )
|
||||
o << tab << "key:" << left << setw(20) << _attributes[i].key()
|
||||
<< " type:" << _attributes[i].tid().name() << endl;
|
||||
|
||||
for ( size_t i=0 ; i<_collections.size() ; ++i )
|
||||
o << tab << "key:" << left << setw(20) << _collections[i].key()
|
||||
<< " type:" << _collections[i].tid().name() << endl;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonKey".
|
||||
|
||||
JsonKey::JsonKey ( const string& key )
|
||||
: JsonObject(0)
|
||||
, _key (key)
|
||||
{ }
|
||||
|
||||
|
||||
string JsonKey::getTypeName () const { return _key; }
|
||||
JsonKey* JsonKey::clone ( unsigned long ) const { return new JsonKey ( *this ); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDummy".
|
||||
|
||||
JsonDummy::JsonDummy ()
|
||||
: JsonObject(0)
|
||||
, _typename ("dummy")
|
||||
{ }
|
||||
|
||||
|
||||
bool JsonDummy::isDummy () const { return true; }
|
||||
string JsonDummy::getTypeName () const { return _typename; }
|
||||
void JsonDummy::setTypeName ( const string& name ) { _typename=name; }
|
||||
JsonDummy* JsonDummy::clone ( unsigned long ) const { return new JsonDummy ( *this ); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonTypes".
|
||||
|
||||
Initializer<JsonTypes> jsonTypesInitialize ( 10 );
|
||||
|
||||
JsonTypes* JsonTypes::_jsonTypes = NULL;
|
||||
|
||||
|
||||
JsonTypes::JsonTypes ()
|
||||
: _jsonObjects()
|
||||
{ }
|
||||
|
||||
|
||||
JsonTypes::~JsonTypes ()
|
||||
{
|
||||
for ( JsonObject* object : _jsonObjects ) delete object;
|
||||
}
|
||||
|
||||
|
||||
void JsonTypes::_registerType ( JsonObject* object )
|
||||
{
|
||||
if (_find(object->getTypeName())) {
|
||||
throw Error( "JsonTypes::_registerType(): Attempt to register <%s> twice.", object->getTypeName().c_str() );
|
||||
}
|
||||
_jsonObjects.insert( object );
|
||||
}
|
||||
|
||||
|
||||
JsonObject* JsonTypes::_find ( const string& tname )
|
||||
{
|
||||
JsonKey key( tname );
|
||||
set<JsonObject*>::iterator it = _jsonObjects.find( &key );
|
||||
if (it != _jsonObjects.end()) return (*it);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void JsonTypes::registerType ( JsonObject* object )
|
||||
{
|
||||
if (not _jsonTypes) initialize();
|
||||
_jsonTypes->_registerType( object );
|
||||
}
|
||||
|
||||
|
||||
JsonObject* JsonTypes::find ( const string& tname )
|
||||
{
|
||||
if (not _jsonTypes) initialize();
|
||||
return _jsonTypes->_find( tname );
|
||||
}
|
||||
|
||||
|
||||
void JsonTypes::initialize ()
|
||||
{ if (not _jsonTypes) _jsonTypes = new JsonTypes (); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonStack".
|
||||
|
||||
void JsonStack::addEntity ( unsigned int jsonId, Entity* entity )
|
||||
{ _entities.insert( std::make_pair(jsonId,entity) ); }
|
||||
|
||||
|
||||
void JsonStack::addHookLink ( Hook* hook, unsigned int jsonId, const string& jsonNext )
|
||||
{
|
||||
if (jsonNext.empty()) return;
|
||||
|
||||
unsigned int id = jsonId;
|
||||
string tname = hook->_getTypeName();
|
||||
|
||||
auto ielement = _hooks.find( HookKey(id,tname) );
|
||||
if (ielement == _hooks.end()) {
|
||||
auto r = _hooks.insert( make_pair( HookKey(id,tname), HookElement(hook) ) );
|
||||
ielement = r.first;
|
||||
(*ielement).second.setFlags( HookElement::OpenRingStart );
|
||||
}
|
||||
HookElement* current = &((*ielement).second);
|
||||
if (not current->hook()) current->setHook( hook );
|
||||
|
||||
hookFromString( jsonNext, id, tname );
|
||||
ielement = _hooks.find( HookKey(id,tname) );
|
||||
if (ielement == _hooks.end()) {
|
||||
auto r = _hooks.insert( make_pair( HookKey(id,tname), HookElement(NULL) ) );
|
||||
ielement = r.first;
|
||||
} else {
|
||||
(*ielement).second.resetFlags( HookElement::OpenRingStart );
|
||||
}
|
||||
current->setNext( &((*ielement).second) );
|
||||
}
|
||||
|
||||
|
||||
Hook* JsonStack::getHook ( unsigned int jsonId, const std::string& tname ) const
|
||||
{
|
||||
auto ihook = _hooks.find( HookKey(jsonId,tname) );
|
||||
if (ihook == _hooks.end()) return NULL;
|
||||
|
||||
return (*ihook).second.hook();
|
||||
}
|
||||
|
||||
|
||||
bool JsonStack::hookFromString ( std::string s, unsigned int& id, std::string& tname )
|
||||
{
|
||||
size_t dot = s.rfind('.');
|
||||
if (dot == string::npos) return false;
|
||||
|
||||
tname = s.substr( 0, dot );
|
||||
id = stoul( s.substr(dot+1) );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool JsonStack::checkRings () const
|
||||
{
|
||||
bool status = true;
|
||||
|
||||
for ( auto kv : _hooks ) {
|
||||
HookElement* ringStart = &(kv.second);
|
||||
if (ringStart->issetFlags(HookElement::ClosedRing)) continue;
|
||||
|
||||
if (ringStart->issetFlags(HookElement::OpenRingStart)) {
|
||||
cerr << Error( "JsonStack::checkRing(): Open ring found, starting with %s.\n"
|
||||
" Closing the ring..."
|
||||
, getString(ringStart->hook()).c_str() ) << endl;
|
||||
|
||||
status = false;
|
||||
HookElement* element = ringStart;
|
||||
while ( true ) {
|
||||
if (not element->next()) {
|
||||
// The ring is open: close it (loop on ringStart).
|
||||
element->setNext( ringStart );
|
||||
element->setFlags( HookElement::ClosedRing );
|
||||
|
||||
cerr << Error( "Simple open ring." ) << endl;
|
||||
break;
|
||||
}
|
||||
if (element->next()->issetFlags(HookElement::ClosedRing)) {
|
||||
// The ring is half merged with itself, or another ring.
|
||||
// (i.e. *multiple* hooks pointing the *same* next element)
|
||||
element->setNext( ringStart );
|
||||
element->setFlags( HookElement::ClosedRing );
|
||||
|
||||
cerr << Error( "Complex fault: ring partially merged (convergent)." ) << endl;
|
||||
break;
|
||||
}
|
||||
element = element->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
void JsonStack::buildRings () const
|
||||
{
|
||||
for ( auto kv : _hooks ) {
|
||||
kv.second.hook()->_setNextHook( kv.second.next()->hook() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JsonStack::print ( ostream& o ) const
|
||||
{
|
||||
o << tab << "JsonStack::print() Stack contains " << _stack.size() << " elements." << endl;
|
||||
for ( size_t i=0 ; i<_stack.size() ; ++i ) {
|
||||
o << "[" << right << setw(2) << i << "] key: \"" << left << setw(20) << _stack[i].first
|
||||
<< "\", type: \"" << demangle(_stack[i].second.type()) << "\"." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Function : Json Cell parser.
|
||||
|
||||
Cell* jsonCellParse ( string filename )
|
||||
{
|
||||
UpdateSession::open();
|
||||
|
||||
JsonReader reader ( JsonWriter::CellMode );
|
||||
reader.parse( filename );
|
||||
|
||||
UpdateSession::close();
|
||||
|
||||
const JsonStack& stack = reader.getStack();
|
||||
if (stack.rhas(".Cell")) return stack.as<Cell*>(".Cell");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Function : Json Blob parser.
|
||||
|
||||
Cell* jsonBlobParse ( string filename )
|
||||
{
|
||||
UpdateSession::open();
|
||||
|
||||
JsonReader reader ( JsonWriter::DesignBlobMode );
|
||||
reader.parse( filename );
|
||||
|
||||
UpdateSession::close();
|
||||
|
||||
const JsonStack& stack = reader.getStack();
|
||||
if (stack.rhas(".DesignBlob")) {
|
||||
DesignBlob* blob = stack.as<DesignBlob*>(".DesignBlob");
|
||||
Cell* cell = blob->getTopCell();
|
||||
delete blob;
|
||||
return cell;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -94,6 +94,10 @@
|
|||
void JsonWriter::write ( unsigned int v ) { _WRITER->Uint ( v); }
|
||||
void JsonWriter::write ( const unsigned long* v ) { _WRITER->Uint64(*v); }
|
||||
void JsonWriter::write ( unsigned long v ) { _WRITER->Uint64( v); }
|
||||
void JsonWriter::write ( const float* v ) { _WRITER->Double((double)*v); }
|
||||
void JsonWriter::write ( float v ) { _WRITER->Double((double) v); }
|
||||
void JsonWriter::write ( const double* v ) { _WRITER->Double(*v); }
|
||||
void JsonWriter::write ( double v ) { _WRITER->Double( v); }
|
||||
JsonWriter* JsonWriter::setFlags ( unsigned long mask ) { _flags |= mask; return this; }
|
||||
JsonWriter* JsonWriter::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; }
|
||||
bool JsonWriter::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,16 +26,14 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./Layer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
# include "hurricane/Layer.h"
|
||||
# include "hurricane/BasicLayer.h"
|
||||
# include "hurricane/Technology.h"
|
||||
# include "hurricane/Error.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/Layer.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -50,7 +42,6 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::Layer".
|
||||
|
||||
|
||||
Layer::Layer ( Technology* technology
|
||||
, const Name& name
|
||||
, const DbU::Unit& minimalSize
|
||||
|
@ -245,4 +236,46 @@ namespace Hurricane {
|
|||
const Name& Layer::_sgetName ( const Layer* layer )
|
||||
{ return layer->getName(); }
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
void Layer::_toJson ( JsonWriter* writer ) const
|
||||
{
|
||||
Super::_toJson( writer );
|
||||
|
||||
jsonWrite( writer, "_name" , getName() );
|
||||
jsonWrite( writer, "_mask" , getString(_mask) );
|
||||
jsonWrite( writer, "_extractMask" , getString(_extractMask) );
|
||||
jsonWrite( writer, "_minimalSize" , _minimalSize );
|
||||
jsonWrite( writer, "_minimalSpacing", _minimalSpacing );
|
||||
jsonWrite( writer, "_working" , _working );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonLayer".
|
||||
|
||||
JsonLayer::JsonLayer ( unsigned long flags )
|
||||
: JsonDBo(flags)
|
||||
{
|
||||
add( "_name" , typeid(string) );
|
||||
add( "_mask" , typeid(string) );
|
||||
add( "_extractMask" , typeid(string) );
|
||||
add( "_minimalSize" , typeid(uint64_t) );
|
||||
add( "_minimalSpacing", typeid(uint64_t) );
|
||||
add( "_working" , typeid(uint64_t) );
|
||||
}
|
||||
|
||||
|
||||
Technology* JsonLayer::lookupTechnology ( JsonStack& stack, const string& fname ) const
|
||||
{
|
||||
Technology* techno = get<Technology*>( stack, ".Technology" );
|
||||
if (not techno) {
|
||||
techno = get<Technology*>( stack, "_technology" );
|
||||
}
|
||||
if (not techno) {
|
||||
cerr << Error( "%s(): .Technology/_technology missing in the stack.", fname.c_str() ) << endl;
|
||||
techno = DataBase::getDB()->getTechnology();
|
||||
}
|
||||
return techno;
|
||||
}
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
// ****************************************************************************************************
|
||||
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/Net.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/Instance.h"
|
||||
|
@ -30,7 +31,7 @@
|
|||
#include "hurricane/Horizontal.h"
|
||||
#include "hurricane/Pad.h"
|
||||
#include "hurricane/UpdateSession.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/NetExternalComponents.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
@ -765,6 +766,9 @@ void Net::_toJsonCollections(JsonWriter* writer) const
|
|||
jsonWrite( writer, "+componentSet", getComponents() );
|
||||
writer->resetFlags( JsonWriter::UsePlugReference );
|
||||
|
||||
writer->key( "+externalComponents" );
|
||||
NetExternalComponents::toJson( writer, this );
|
||||
|
||||
Inherit::_toJsonCollections( writer );
|
||||
}
|
||||
|
||||
|
@ -1059,87 +1063,184 @@ string Net_SlavePlugs::Locator::_getString() const
|
|||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonNet".
|
||||
|
||||
// ****************************************************************************************************
|
||||
// JsonNet implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonNet> jsonNetInit ( 0 );
|
||||
Initializer<JsonNet> jsonNetInit ( 0 );
|
||||
|
||||
void JsonNet::initialize()
|
||||
// **************************
|
||||
{ JsonTypes::registerType( new JsonNet (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonNet::JsonNet(unsigned long flags)
|
||||
// **********************************
|
||||
: JsonEntity (flags)
|
||||
, _autoMaterialize(not Go::autoMaterializationIsDisabled())
|
||||
, _net (NULL)
|
||||
, _stack (NULL)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
void JsonNet::initialize ()
|
||||
{ JsonTypes::registerType( new JsonNet (JsonWriter::RegisterMode) ); }
|
||||
|
||||
ltrace(51) << "JsonNet::JsonNet()" << endl;
|
||||
|
||||
add( "_name" , typeid(string) );
|
||||
add( "_isGlobal" , typeid(bool) );
|
||||
add( "_isExternal" , typeid(bool) );
|
||||
add( "_isAutomatic" , typeid(bool) );
|
||||
add( "_type" , typeid(string) );
|
||||
add( "_direction" , typeid(string) );
|
||||
add( "+aliases" , typeid(JsonArray) );
|
||||
add( "+componentSet", typeid(JsonArray) );
|
||||
JsonNet::JsonNet ( unsigned long flags )
|
||||
: JsonEntity (flags)
|
||||
, _autoMaterialize(not Go::autoMaterializationIsDisabled())
|
||||
, _net (NULL)
|
||||
, _hooks ()
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "Disabling auto-materialization (" << _autoMaterialize << ")." << endl;
|
||||
Go::disableAutoMaterialization();
|
||||
}
|
||||
ltrace(51) << "JsonNet::JsonNet()" << endl;
|
||||
|
||||
JsonNet::~JsonNet()
|
||||
// ****************
|
||||
{
|
||||
_stack->checkRings();
|
||||
_stack->buildRings();
|
||||
_stack->clearHookLinks();
|
||||
add( "_name" , typeid(string) );
|
||||
add( "_isGlobal" , typeid(bool) );
|
||||
add( "_isExternal" , typeid(bool) );
|
||||
add( "_isAutomatic" , typeid(bool) );
|
||||
add( "_type" , typeid(string) );
|
||||
add( "_direction" , typeid(string) );
|
||||
add( "+aliases" , typeid(JsonArray) );
|
||||
add( "+componentSet" , typeid(JsonArray) );
|
||||
add( "+externalComponents", typeid(JsonArray) );
|
||||
|
||||
_net->materialize();
|
||||
|
||||
if (_autoMaterialize) {
|
||||
Go::enableAutoMaterialization();
|
||||
ltrace(51) << "Enabling auto-materialization." << endl;
|
||||
ltrace(51) << "Disabling auto-materialization (" << _autoMaterialize << ")." << endl;
|
||||
Go::disableAutoMaterialization();
|
||||
}
|
||||
}
|
||||
|
||||
string JsonNet::getTypeName() const
|
||||
// *********************************
|
||||
{ return "Net"; }
|
||||
|
||||
JsonNet* JsonNet::clone(unsigned long flags) const
|
||||
// ***********************************************
|
||||
{ return new JsonNet ( flags ); }
|
||||
JsonNet::~JsonNet ()
|
||||
{
|
||||
checkRings();
|
||||
buildRings();
|
||||
clearHookLinks();
|
||||
|
||||
_net->materialize();
|
||||
|
||||
void JsonNet::toData(JsonStack& stack)
|
||||
// ***********************************
|
||||
{
|
||||
ltracein(51);
|
||||
if (_autoMaterialize) {
|
||||
Go::enableAutoMaterialization();
|
||||
ltrace(51) << "Enabling auto-materialization." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
_stack = &stack;
|
||||
|
||||
check( stack, "JsonNet::toData" );
|
||||
presetId( stack );
|
||||
string JsonNet::getTypeName () const
|
||||
{ return "Net"; }
|
||||
|
||||
_net = Net::create( get<Cell*>(stack,".Cell") , get<string>(stack,"_name") );
|
||||
_net->setGlobal ( get<bool>(stack,"_isGlobal" ) );
|
||||
_net->setExternal ( get<bool>(stack,"_isExternal" ) );
|
||||
_net->setAutomatic( get<bool>(stack,"_isAutomatic") );
|
||||
_net->setType ( Net::Type (get<string>(stack,"_type")) );
|
||||
_net->setDirection( Net::Direction(get<string>(stack,"_direction")) );
|
||||
|
||||
update( stack, _net );
|
||||
JsonNet* JsonNet::clone( unsigned long flags ) const
|
||||
{ return new JsonNet ( flags ); }
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
void JsonNet::toData ( JsonStack& stack )
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonNet::toData" );
|
||||
presetId( stack );
|
||||
|
||||
_net = Net::create( get<Cell*>(stack,".Cell") , get<string>(stack,"_name") );
|
||||
_net->setGlobal ( get<bool>(stack,"_isGlobal" ) );
|
||||
_net->setExternal ( get<bool>(stack,"_isExternal" ) );
|
||||
_net->setAutomatic( get<bool>(stack,"_isAutomatic") );
|
||||
_net->setType ( Net::Type (get<string>(stack,"_type")) );
|
||||
_net->setDirection( Net::Direction(get<string>(stack,"_direction")) );
|
||||
|
||||
update( stack, _net );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
void JsonNet::addHookLink ( Hook* hook, unsigned int jsonId, const string& jsonNext )
|
||||
{
|
||||
if (jsonNext.empty()) return;
|
||||
|
||||
unsigned int id = jsonId;
|
||||
string tname = hook->_getTypeName();
|
||||
|
||||
auto ielement = _hooks.find( HookKey(id,tname) );
|
||||
if (ielement == _hooks.end()) {
|
||||
auto r = _hooks.insert( make_pair( HookKey(id,tname), HookElement(hook) ) );
|
||||
ielement = r.first;
|
||||
(*ielement).second.setFlags( HookElement::OpenRingStart );
|
||||
}
|
||||
HookElement* current = &((*ielement).second);
|
||||
if (not current->hook()) current->setHook( hook );
|
||||
|
||||
hookFromString( jsonNext, id, tname );
|
||||
ielement = _hooks.find( HookKey(id,tname) );
|
||||
if (ielement == _hooks.end()) {
|
||||
auto r = _hooks.insert( make_pair( HookKey(id,tname), HookElement(NULL) ) );
|
||||
ielement = r.first;
|
||||
} else {
|
||||
(*ielement).second.resetFlags( HookElement::OpenRingStart );
|
||||
}
|
||||
current->setNext( &((*ielement).second) );
|
||||
}
|
||||
|
||||
|
||||
Hook* JsonNet::getHook ( unsigned int jsonId, const std::string& tname ) const
|
||||
{
|
||||
auto ihook = _hooks.find( HookKey(jsonId,tname) );
|
||||
if (ihook == _hooks.end()) return NULL;
|
||||
|
||||
return (*ihook).second.hook();
|
||||
}
|
||||
|
||||
|
||||
bool JsonNet::hookFromString ( std::string s, unsigned int& id, std::string& tname )
|
||||
{
|
||||
size_t dot = s.rfind('.');
|
||||
if (dot == string::npos) return false;
|
||||
|
||||
tname = s.substr( 0, dot );
|
||||
id = stoul( s.substr(dot+1) );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool JsonNet::checkRings () const
|
||||
{
|
||||
bool status = true;
|
||||
|
||||
for ( auto kv : _hooks ) {
|
||||
HookElement* ringStart = &(kv.second);
|
||||
if (ringStart->issetFlags(HookElement::ClosedRing)) continue;
|
||||
|
||||
if (ringStart->issetFlags(HookElement::OpenRingStart)) {
|
||||
cerr << Error( "JsonNet::checkRing(): Open ring found, starting with %s.\n"
|
||||
" Closing the ring..."
|
||||
, getString(ringStart->hook()).c_str() ) << endl;
|
||||
|
||||
status = false;
|
||||
HookElement* element = ringStart;
|
||||
while ( true ) {
|
||||
if (not element->next()) {
|
||||
// The ring is open: close it (loop on ringStart).
|
||||
element->setNext( ringStart );
|
||||
element->setFlags( HookElement::ClosedRing );
|
||||
|
||||
cerr << Error( "Simple open ring." ) << endl;
|
||||
break;
|
||||
}
|
||||
if (element->next()->issetFlags(HookElement::ClosedRing)) {
|
||||
// The ring is half merged with itself, or another ring.
|
||||
// (i.e. *multiple* hooks pointing the *same* next element)
|
||||
element->setNext( ringStart );
|
||||
element->setFlags( HookElement::ClosedRing );
|
||||
|
||||
cerr << Error( "Complex fault: ring partially merged (convergent)." ) << endl;
|
||||
break;
|
||||
}
|
||||
element = element->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
void JsonNet::buildRings () const
|
||||
{
|
||||
for ( auto kv : _hooks ) {
|
||||
kv.second.hook()->_setNextHook( kv.second.next()->hook() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
|
|
|
@ -212,6 +212,15 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void NetAliasName::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "NetAlias" );
|
||||
jsonWrite( w, "_name" , _name );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::AliasList" (Collection).
|
||||
|
||||
|
@ -263,4 +272,47 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonNetAlias".
|
||||
|
||||
Initializer<JsonNetAlias> jsonNetAliasInit ( 0 );
|
||||
|
||||
|
||||
void JsonNetAlias::initialize ()
|
||||
{ JsonTypes::registerType( new JsonNetAlias (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonNetAlias::JsonNetAlias( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( ".Net" , typeid(Net*) );
|
||||
add( "_name", typeid(string) );
|
||||
}
|
||||
|
||||
|
||||
string JsonNetAlias::getTypeName () const
|
||||
{ return "NetAlias"; }
|
||||
|
||||
|
||||
JsonNetAlias* JsonNetAlias::clone ( unsigned long flags ) const
|
||||
{ return new JsonNetAlias ( flags ); }
|
||||
|
||||
|
||||
void JsonNetAlias::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonNetAlias::toData" );
|
||||
|
||||
Net* net = get<Net*>( stack, ".Net" );
|
||||
if (net) {
|
||||
string name = get<string>( stack, "_name" );
|
||||
if (not name.empty()) {
|
||||
net->addAlias( name );
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonNetAlias::toData(): Missing \".Net\" in stack context." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, NULL );
|
||||
}
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,10 +26,7 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./NetExternalComponents.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/Error.h"
|
||||
|
@ -45,6 +36,8 @@
|
|||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "NetExternalComponents".
|
||||
|
||||
const Name NetExternalComponents::_name = "ExternalComponentsRelation";
|
||||
|
||||
|
@ -96,4 +89,73 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void NetExternalComponents::toJson ( JsonWriter* w, const Net* net )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "NetExternalComponents" );
|
||||
|
||||
w->setFlags( JsonWriter::UseEntityReference );
|
||||
if (net->isExternal()) {
|
||||
jsonWrite( w, "+entities", get(net) );
|
||||
} else {
|
||||
w->key( "+entities" );
|
||||
w->startArray();
|
||||
w->endArray();
|
||||
}
|
||||
w->resetFlags( JsonWriter::UseEntityReference );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonNetExternalComponents".
|
||||
|
||||
Initializer<JsonNetExternalComponents> jsonNetExternalComponentsInit ( 0 );
|
||||
|
||||
|
||||
void JsonNetExternalComponents::initialize ()
|
||||
{ JsonTypes::registerType( new JsonNetExternalComponents (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonNetExternalComponents::JsonNetExternalComponents ( unsigned long flags )
|
||||
: JsonBaseArray<Entity*>(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
add( "+entities", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
JsonNetExternalComponents::~JsonNetExternalComponents ()
|
||||
{
|
||||
for ( Entity* entity : array() ) {
|
||||
Component* component = dynamic_cast<Component*>( entity );
|
||||
if (component) NetExternalComponents::setExternal( component );
|
||||
else {
|
||||
cerr << Error( "JsonNetExternalComponents(): %s in not a Component."
|
||||
, getString(entity).c_str() ) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string JsonNetExternalComponents::getTypeName () const
|
||||
{ return "NetExternalComponents"; }
|
||||
|
||||
|
||||
JsonNetExternalComponents* JsonNetExternalComponents::clone( unsigned long flags ) const
|
||||
{ return new JsonNetExternalComponents ( flags ); }
|
||||
|
||||
|
||||
void JsonNetExternalComponents::toData ( JsonStack& stack )
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check ( stack, "JsonNetExternalComponents::toData" );
|
||||
update( stack, NULL );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -188,7 +188,12 @@ void JsonPad::toData(JsonStack& stack)
|
|||
, get<Box>(stack,".Box")
|
||||
);
|
||||
|
||||
stack.addHookLink( pad->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
JsonNet* jnet = jget<JsonNet>( stack );
|
||||
if (jnet) {
|
||||
jnet->addHookLink( pad->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
} else {
|
||||
cerr << Error( "JsonPad::toData(): Missing (Json)Net in stack context." ) << endl;
|
||||
}
|
||||
|
||||
// Hook/Ring rebuild are done as a post-process.
|
||||
update( stack, pad );
|
||||
|
|
|
@ -197,6 +197,7 @@ void Plug::_toJson(JsonWriter* writer) const
|
|||
if (writer->issetFlags(JsonWriter::UsePlugReference)) {
|
||||
jsonWrite( writer, "_id" , getId() );
|
||||
jsonWrite( writer, "_instance", getInstance()->getName() );
|
||||
jsonWrite( writer, "_bodyHook", (const_cast<Plug*>(this)->getBodyHook())->getNextHook()->toJson() );
|
||||
} else {
|
||||
Inherit::_toJson( writer );
|
||||
jsonWrite( writer, "_masterNet", getMasterNet()->getName() );
|
||||
|
@ -285,7 +286,6 @@ void JsonPlug::toData(JsonStack& stack)
|
|||
plug = instance->getPlug( masterNet );
|
||||
if (issetFlags(JsonWriter::DesignBlobMode))
|
||||
plug->forceId( jsonId );
|
||||
stack.addHookLink( plug->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonPlug::toData(): Cannot find \".Instance\" in stack, skipping." ) << endl;
|
||||
|
@ -314,6 +314,7 @@ JsonPlugRef::JsonPlugRef(unsigned long flags)
|
|||
add( ".Net" , typeid(Net*) );
|
||||
add( "_id" , typeid(uint64_t) );
|
||||
add( "_instance", typeid(string) );
|
||||
add( "_bodyHook", typeid(string) );
|
||||
}
|
||||
|
||||
string JsonPlugRef::getTypeName() const
|
||||
|
@ -337,6 +338,13 @@ void JsonPlugRef::toData(JsonStack& stack)
|
|||
Plug* plug = stack.getEntity<Plug*>(id);
|
||||
if (plug) {
|
||||
plug->setNet( net );
|
||||
|
||||
JsonNet* jnet = jget<JsonNet>( stack );
|
||||
if (jnet) {
|
||||
jnet->addHookLink( plug->getBodyHook (), id, get<string>(stack,"_bodyHook" ) );
|
||||
} else {
|
||||
cerr << Error( "JsonPlug::toData(): Missing (Json)Net in stack context." ) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonPlugRef::toData(): No Plug id:%u in instance %s, while building net %s."
|
||||
, id, getString(instance->getName()).c_str(), getString(net->getName()).c_str()
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/RegularLayer.h"
|
||||
#include "hurricane/Technology.h"
|
||||
|
@ -323,4 +324,123 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void RegularLayer::_toJson ( JsonWriter* writer ) const
|
||||
{
|
||||
Super::_toJson( writer );
|
||||
|
||||
jsonWrite( writer, "_basicLayer" , _basicLayer->getName() );
|
||||
jsonWrite( writer, "_enclosure" , _enclosure );
|
||||
jsonWrite( writer, "_extentionCap" , _extentionCap );
|
||||
jsonWrite( writer, "_extentionWidth" , _extentionWidth );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonRegularLayer".
|
||||
|
||||
Initializer<JsonRegularLayer> jsonRegularLayerInit ( 0 );
|
||||
|
||||
|
||||
void JsonRegularLayer::initialize ()
|
||||
{ JsonTypes::registerType( new JsonRegularLayer (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonRegularLayer::JsonRegularLayer ( unsigned long flags )
|
||||
: JsonLayer(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "JsonRegularLayer::JsonRegularLayer()" << endl;
|
||||
|
||||
add( "_basicLayer" , typeid(string) );
|
||||
add( "_enclosure" , typeid(int64_t) );
|
||||
add( "_extentionCap" , typeid(int64_t) );
|
||||
add( "_extentionWidth", typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
JsonRegularLayer::~JsonRegularLayer ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonRegularLayer::getTypeName () const
|
||||
{ return "RegularLayer"; }
|
||||
|
||||
|
||||
JsonRegularLayer* JsonRegularLayer::clone ( unsigned long flags ) const
|
||||
{ return new JsonRegularLayer ( flags ); }
|
||||
|
||||
|
||||
void JsonRegularLayer::toData( JsonStack& stack )
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonRegularLayer::toData" );
|
||||
|
||||
Technology* techno = lookupTechnology( stack, "JsonRegularLayer::toData" );
|
||||
RegularLayer* layer = NULL;
|
||||
|
||||
if (techno) {
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string smask = get<string> ( stack, "_mask" );
|
||||
DbU::Unit minimalSize = get<int64_t>( stack, "_minimalSize" );
|
||||
DbU::Unit minimalSpacing = get<int64_t>( stack, "_minimalSpacing" );
|
||||
bool isWorking = get<bool> ( stack, "_working" );
|
||||
|
||||
BasicLayer* basicLayer = techno->getBasicLayer( get<string>(stack,"_basicLayer" ) );
|
||||
DbU::Unit enclosure = get<int64_t>( stack, "_enclosure" );
|
||||
DbU::Unit extensionCap = get<int64_t>( stack, "_extentionCap" );
|
||||
DbU::Unit extensionWidth = get<int64_t>( stack, "_extentionWidth" );
|
||||
|
||||
Layer::Mask mask = Layer::Mask::fromString( smask );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
layer = RegularLayer::create( techno, name );
|
||||
layer->setBasicLayer ( basicLayer );
|
||||
layer->setWorking ( isWorking );
|
||||
layer->setMinimalSize ( minimalSize );
|
||||
layer->setMinimalSpacing( minimalSpacing );
|
||||
layer->setEnclosure ( basicLayer, enclosure );
|
||||
layer->setExtentionCap ( basicLayer, extensionCap );
|
||||
layer->setExtentionWidth( basicLayer, extensionWidth );
|
||||
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonRegularLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
// Add here association with blockage layer...
|
||||
} else {
|
||||
// Check coherency with existing layer.
|
||||
layer = dynamic_cast<RegularLayer*>( techno->getLayer(name) );
|
||||
if (layer) {
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonRegularLayer::toData(): Layer mask discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonRegularLayer::toData(): No RegularLayer \"%s\" in the existing technology."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonRegularLayer::toData(): Cannot find technology, aborting RegularLayer creation." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, layer );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -433,8 +433,13 @@ namespace Hurricane {
|
|||
( get<Net*> (stack,".Net")
|
||||
, get<Occurrence>(stack,"_occurrence")
|
||||
);
|
||||
|
||||
stack.addHookLink( rp->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
|
||||
JsonNet* jnet = jget<JsonNet>( stack );
|
||||
if (jnet) {
|
||||
jnet->addHookLink( rp->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
} else {
|
||||
cerr << Error( "JsonRoutingPad::toData(): Missing (Json)Net in stack context." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, rp );
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
// not, see <http://www.gnu.org/licenses/>.
|
||||
// ****************************************************************************************************
|
||||
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/SharedName.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
|
@ -27,6 +29,21 @@
|
|||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class CompareByMask {
|
||||
public:
|
||||
bool operator() ( const Hurricane::Layer* lhs, const Hurricane::Layer* rhs )
|
||||
{
|
||||
if (not lhs) return rhs;
|
||||
if (not rhs) return false;
|
||||
|
||||
return lhs->getMask() < rhs->getMask();
|
||||
}
|
||||
};
|
||||
|
||||
} // Anonymous namespace.
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
@ -363,14 +380,12 @@ void Technology::_removeFromLayerMaskMap ( Layer* layer )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
string Technology::_getTypeName () const
|
||||
// **************************************
|
||||
{
|
||||
return _TName("Technology");
|
||||
}
|
||||
|
||||
|
||||
|
||||
string Technology::_getString() const
|
||||
// **********************************
|
||||
{
|
||||
|
@ -393,6 +408,38 @@ Record* Technology::_getRecord() const
|
|||
return record;
|
||||
}
|
||||
|
||||
void Technology::_toJson(JsonWriter* writer) const
|
||||
// ***********************************************
|
||||
{
|
||||
Inherit::_toJson( writer );
|
||||
|
||||
jsonWrite( writer, "_name", getName() );
|
||||
}
|
||||
|
||||
void Technology::_toJsonCollections(JsonWriter* writer) const
|
||||
// ***********************************************************
|
||||
{
|
||||
writer->key( "+layers" );
|
||||
writer->startArray();
|
||||
|
||||
vector<BasicLayer*> basicLayers;
|
||||
vector<Layer*> layers;
|
||||
for ( Layer* layer : getLayers() ) {
|
||||
BasicLayer* basicLayer = dynamic_cast<BasicLayer*>( layer );
|
||||
if (basicLayer) basicLayers.push_back( basicLayer );
|
||||
else layers .push_back( layer );
|
||||
}
|
||||
|
||||
sort( basicLayers.begin(), basicLayers.end(), CompareByMask() );
|
||||
sort( layers .begin(), layers .end(), CompareByMask() );
|
||||
|
||||
for ( BasicLayer* basicLayer : basicLayers ) jsonWrite( writer, basicLayer );
|
||||
for ( Layer* layer : layers ) jsonWrite( writer, layer );
|
||||
|
||||
writer->endArray();
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Technology::LayerMap implementation
|
||||
// ****************************************************************************************************
|
||||
|
@ -575,6 +622,96 @@ string Technology_BasicLayers::Locator::_getString() const
|
|||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// JsonTechnology implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonTechnology> jsonTechnologyInit ( 0 );
|
||||
|
||||
void JsonTechnology::initialize()
|
||||
// *******************************
|
||||
{ JsonTypes::registerType( new JsonTechnology (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonTechnology::JsonTechnology(unsigned long flags)
|
||||
// ************************************************
|
||||
: JsonDBo (flags)
|
||||
, _blockagesMap()
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "JsonTechnology::JsonTechnology()" << endl;
|
||||
|
||||
add( "_name" , typeid(string) );
|
||||
add( "+layers", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
JsonTechnology::~JsonTechnology()
|
||||
// ******************************
|
||||
{
|
||||
const Technology* techno = getObject<Technology*>();
|
||||
|
||||
for ( auto element : _blockagesMap ) {
|
||||
BasicLayer* blockage = techno->getBasicLayer( element.first );
|
||||
if (blockage) {
|
||||
for ( BasicLayer* layer : element.second ) {
|
||||
layer->setBlockageLayer( blockage );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string JsonTechnology::getTypeName() const
|
||||
// ****************************************
|
||||
{ return "Technology"; }
|
||||
|
||||
JsonTechnology* JsonTechnology::clone(unsigned long flags) const
|
||||
// *************************************************************
|
||||
{ return new JsonTechnology ( flags ); }
|
||||
|
||||
void JsonTechnology::addBlockageRef(const string& blockageLayer, BasicLayer* layer )
|
||||
// *********************************************************************************
|
||||
{
|
||||
map< string, vector<BasicLayer*> >::iterator im = _blockagesMap.find( blockageLayer );
|
||||
if (im != _blockagesMap.end()) {
|
||||
(*im).second.push_back( layer );
|
||||
} else {
|
||||
_blockagesMap.insert( make_pair( blockageLayer, vector<BasicLayer*>(1,layer) ) );
|
||||
}
|
||||
}
|
||||
|
||||
void JsonTechnology::toData(JsonStack& stack)
|
||||
// ******************************************
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonTechnology::toData" );
|
||||
|
||||
string technoName = get<string>( stack, "_name" );
|
||||
Technology* techno = DataBase::getDB()->getTechnology();
|
||||
|
||||
if (techno) {
|
||||
if (techno->getName() == technoName) {
|
||||
cerr << Warning( "JsonTechnology::toData(): A technology with the same name (%s) is already loaded."
|
||||
, technoName.c_str()
|
||||
) << endl;
|
||||
} else {
|
||||
cerr << Error( "JsonTechnology::toData(): Try to load \"%s\", but \"%s\" is already loaded."
|
||||
, technoName.c_str()
|
||||
, getString(techno->getName()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
techno = Technology::create( DataBase::getDB(), technoName );
|
||||
stack.setFlags( JsonWriter::TechnoMode );
|
||||
}
|
||||
|
||||
update( stack, techno );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,16 +26,14 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./TransistorLayer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/TransistorLayer.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/TransistorLayer.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -229,4 +221,161 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void TransistorLayer::_toJson ( JsonWriter* w ) const
|
||||
{
|
||||
Super::_toJson( w );
|
||||
|
||||
jsonWrite( w, "_gate" , _basicLayers[0]->getName() );
|
||||
jsonWrite( w, "_active" , _basicLayers[1]->getName() );
|
||||
jsonWrite( w, "_diffusion", _basicLayers[2]->getName() );
|
||||
if (_basicLayers.size() == 4) jsonWrite( w, "_well" , _basicLayers[3]->getName() );
|
||||
else jsonWrite( w, "_well", "no_well_layer" );
|
||||
|
||||
jsonWrite( w, "_extentionCap.gate" , _extentionCaps[0] );
|
||||
jsonWrite( w, "_extentionCap.active" , _extentionCaps[1] );
|
||||
jsonWrite( w, "_extentionCap.diffusion", _extentionCaps[2] );
|
||||
jsonWrite( w, "_extentionCap.well" , (_basicLayers.size() == 4) ? _extentionCaps[3] : 0 );
|
||||
|
||||
jsonWrite( w, "_extentionWidth.gate" , _extentionWidths[0] );
|
||||
jsonWrite( w, "_extentionWidth.active" , _extentionWidths[1] );
|
||||
jsonWrite( w, "_extentionWidth.diffusion", _extentionWidths[2] );
|
||||
jsonWrite( w, "_extentionWidth.well" , (_basicLayers.size() == 4) ? _extentionWidths[3] : 0 );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonTransistorLayer".
|
||||
|
||||
Initializer<JsonTransistorLayer> jsonTransistorLayerInit ( 0 );
|
||||
|
||||
|
||||
void JsonTransistorLayer::initialize ()
|
||||
{ JsonTypes::registerType( new JsonTransistorLayer (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonTransistorLayer::JsonTransistorLayer ( unsigned long flags )
|
||||
: JsonLayer(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "JsonTransistorLayer::JsonTransistorLayer()" << endl;
|
||||
|
||||
add( "_gate" , typeid(string) );
|
||||
add( "_active" , typeid(string) );
|
||||
add( "_diffusion" , typeid(string) );
|
||||
add( "_well" , typeid(string) );
|
||||
add( "_extentionCap.gate" , typeid(int64_t) );
|
||||
add( "_extentionCap.active" , typeid(int64_t) );
|
||||
add( "_extentionCap.diffusion" , typeid(int64_t) );
|
||||
add( "_extentionCap.well" , typeid(int64_t) );
|
||||
add( "_extentionWidth.gate" , typeid(int64_t) );
|
||||
add( "_extentionWidth.active" , typeid(int64_t) );
|
||||
add( "_extentionWidth.diffusion", typeid(int64_t) );
|
||||
add( "_extentionWidth.well" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
JsonTransistorLayer::~JsonTransistorLayer ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonTransistorLayer::getTypeName () const
|
||||
{ return "TransistorLayer"; }
|
||||
|
||||
|
||||
JsonTransistorLayer* JsonTransistorLayer::clone ( unsigned long flags ) const
|
||||
{ return new JsonTransistorLayer ( flags ); }
|
||||
|
||||
|
||||
void JsonTransistorLayer::toData ( JsonStack& stack )
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonTransistorLayer::toData" );
|
||||
|
||||
Technology* techno = lookupTechnology( stack, "JsonTransistorLayer::toData" );
|
||||
TransistorLayer* layer = NULL;
|
||||
|
||||
if (techno) {
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string smask = get<string> ( stack, "_mask" );
|
||||
//DbU::Unit minimalSize = get<int64_t>( stack, "_minimalSize" );
|
||||
//DbU::Unit minimalSpacing = get<int64_t>( stack, "_minimalSpacing" );
|
||||
bool isWorking = get<bool> ( stack, "_working" );
|
||||
|
||||
BasicLayer* gate = techno->getBasicLayer( get<string>(stack,"_gate" ) );
|
||||
BasicLayer* active = techno->getBasicLayer( get<string>(stack,"_active" ) );
|
||||
BasicLayer* diffusion = techno->getBasicLayer( get<string>(stack,"_diffusion" ) );
|
||||
BasicLayer* well = techno->getBasicLayer( get<string>(stack,"_well" ) );
|
||||
DbU::Unit eCapGate = get<int64_t>( stack, "_extentionCap.gate" );
|
||||
DbU::Unit eCapActive = get<int64_t>( stack, "_extentionCap.active" );
|
||||
DbU::Unit eCapDiffusion = get<int64_t>( stack, "_extentionCap.diffusion" );
|
||||
DbU::Unit eCapWell = get<int64_t>( stack, "_extentionCap.well" );
|
||||
DbU::Unit eWidthGate = get<int64_t>( stack, "_extentionWidth.gate" );
|
||||
DbU::Unit eWidthActive = get<int64_t>( stack, "_extentionWidth.active" );
|
||||
DbU::Unit eWidthDiffusion = get<int64_t>( stack, "_extentionWidth.diffusion" );
|
||||
DbU::Unit eWidthWell = get<int64_t>( stack, "_extentionWidth.well" );
|
||||
|
||||
Layer::Mask mask = Layer::Mask::fromString( smask );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
layer = TransistorLayer::create( techno
|
||||
, name
|
||||
, gate
|
||||
, active
|
||||
, diffusion
|
||||
, well
|
||||
);
|
||||
layer->setWorking ( isWorking );
|
||||
layer->setExtentionCap ( gate , eCapGate );
|
||||
layer->setExtentionCap ( active , eCapActive );
|
||||
layer->setExtentionCap ( diffusion, eCapDiffusion );
|
||||
layer->setExtentionWidth( gate , eWidthGate );
|
||||
layer->setExtentionWidth( active , eWidthActive );
|
||||
layer->setExtentionWidth( diffusion, eWidthDiffusion );
|
||||
if (well) {
|
||||
layer->setExtentionCap ( well, eCapWell );
|
||||
layer->setExtentionWidth( well, eWidthWell );
|
||||
}
|
||||
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonTransistorLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
// Add here association with blockage layer...
|
||||
} else {
|
||||
// Check coherency with existing layer.
|
||||
layer = dynamic_cast<TransistorLayer*>( techno->getLayer(name) );
|
||||
if (layer) {
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonTransistorLayer::toData(): Layer mask discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonTransistorLayer::toData(): No TransistorLayer \"%s\" in the existing technology."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonTransistorLayer::toData(): Cannot find technology, aborting TransistorLayer creation." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, layer );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -249,10 +249,15 @@ void JsonVertical::toData(JsonStack& stack)
|
|||
, DbU::fromDb( get<int64_t>(stack,"_dySource") )
|
||||
, DbU::fromDb( get<int64_t>(stack,"_dyTarget") )
|
||||
);
|
||||
|
||||
stack.addHookLink( vertical->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
stack.addHookLink( vertical->getSourceHook(), jsonId, get<string>(stack,"_sourceHook") );
|
||||
stack.addHookLink( vertical->getTargetHook(), jsonId, get<string>(stack,"_targetHook") );
|
||||
|
||||
JsonNet* jnet = jget<JsonNet>( stack );
|
||||
if (jnet) {
|
||||
jnet->addHookLink( vertical->getBodyHook (), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
jnet->addHookLink( vertical->getSourceHook(), jsonId, get<string>(stack,"_sourceHook") );
|
||||
jnet->addHookLink( vertical->getTargetHook(), jsonId, get<string>(stack,"_targetHook") );
|
||||
} else {
|
||||
cerr << Error( "JsonVertical::toData(): Missing (Json)Net in stack context." ) << endl;
|
||||
}
|
||||
|
||||
// Hook/Ring rebuild are done as a post-process.
|
||||
update( stack, vertical );
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,16 +26,14 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./ViaLayer.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
# include "hurricane/BasicLayer.h"
|
||||
# include "hurricane/ViaLayer.h"
|
||||
# include "hurricane/Technology.h"
|
||||
# include "hurricane/Error.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/ViaLayer.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -65,7 +57,6 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::ViaLayer".
|
||||
|
||||
|
||||
ViaLayer::ViaLayer ( Technology* technology
|
||||
, const Name& name
|
||||
, BasicLayer* bottomLayer
|
||||
|
@ -210,4 +201,133 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void ViaLayer::_toJson ( JsonWriter* w ) const
|
||||
{
|
||||
Super::_toJson( w );
|
||||
|
||||
jsonWrite( w, "_bottom", _basicLayers[0]->getName() );
|
||||
jsonWrite( w, "_cut" , _basicLayers[1]->getName() );
|
||||
jsonWrite( w, "_top" , _basicLayers[2]->getName() );
|
||||
|
||||
jsonWrite( w, "_enclosure.bottom", _enclosures[0] );
|
||||
jsonWrite( w, "_enclosure.cut" , _enclosures[1] );
|
||||
jsonWrite( w, "_enclosure.top" , _enclosures[2] );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonViaLayer".
|
||||
|
||||
Initializer<JsonViaLayer> jsonViaLayerInit ( 0 );
|
||||
|
||||
|
||||
void JsonViaLayer::initialize ()
|
||||
{ JsonTypes::registerType( new JsonViaLayer (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonViaLayer::JsonViaLayer ( unsigned long flags )
|
||||
: JsonLayer(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
ltrace(51) << "JsonViaLayer::JsonViaLayer()" << endl;
|
||||
|
||||
add( "_bottom" , typeid(string) );
|
||||
add( "_cut" , typeid(string) );
|
||||
add( "_top" , typeid(string) );
|
||||
add( "_enclosure.bottom", typeid(int64_t) );
|
||||
add( "_enclosure.cut" , typeid(int64_t) );
|
||||
add( "_enclosure.top" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
JsonViaLayer::~JsonViaLayer ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonViaLayer::getTypeName () const
|
||||
{ return "ViaLayer"; }
|
||||
|
||||
|
||||
JsonViaLayer* JsonViaLayer::clone ( unsigned long flags ) const
|
||||
{ return new JsonViaLayer ( flags ); }
|
||||
|
||||
|
||||
void JsonViaLayer::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonViaLayer::toData" );
|
||||
|
||||
Technology* techno = lookupTechnology( stack, "JsonViaLayer::toData" );
|
||||
ViaLayer* layer = NULL;
|
||||
|
||||
if (techno) {
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string smask = get<string> ( stack, "_mask" );
|
||||
//DbU::Unit minimalSize = get<int64_t>( stack, "_minimalSize" );
|
||||
//DbU::Unit minimalSpacing = get<int64_t>( stack, "_minimalSpacing" );
|
||||
bool isWorking = get<bool> ( stack, "_working" );
|
||||
|
||||
BasicLayer* bottom = techno->getBasicLayer( get<string>(stack,"_bottom" ) );
|
||||
BasicLayer* cut = techno->getBasicLayer( get<string>(stack,"_cut" ) );
|
||||
BasicLayer* top = techno->getBasicLayer( get<string>(stack,"_top" ) );
|
||||
DbU::Unit bottomEncl = get<int64_t>( stack, "_enclosure.bottom" );
|
||||
DbU::Unit cutEncl = get<int64_t>( stack, "_enclosure.cut" );
|
||||
DbU::Unit topEncl = get<int64_t>( stack, "_enclosure.top" );
|
||||
|
||||
Layer::Mask mask = Layer::Mask::fromString( smask );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
layer = ViaLayer::create( techno
|
||||
, name
|
||||
, bottom
|
||||
, cut
|
||||
, top
|
||||
);
|
||||
layer->setWorking ( isWorking );
|
||||
layer->setEnclosure( bottom, bottomEncl );
|
||||
layer->setEnclosure( cut , cutEncl );
|
||||
layer->setEnclosure( top , topEncl );
|
||||
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonViaLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
// Add here association with blockage layer...
|
||||
} else {
|
||||
// Check coherency with existing layer.
|
||||
layer = dynamic_cast<ViaLayer*>( techno->getLayer(name) );
|
||||
if (layer) {
|
||||
if (layer->getMask() != mask) {
|
||||
cerr << Error( "JsonViaLayer::toData(): Layer mask discrepency on \"%s\":\n"
|
||||
" Blob: %s\n"
|
||||
" DataBase: %s"
|
||||
, name.c_str()
|
||||
, getString(mask).c_str()
|
||||
, getString(layer->getMask()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonViaLayer::toData(): No ViaLayer \"%s\" in the existing technology."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonViaLayer::toData(): Cannot find technology, aborting ViaLayer creation." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, layer );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -42,6 +42,8 @@ namespace Hurricane {
|
|||
|
||||
|
||||
class BasicLayer : public Layer {
|
||||
public:
|
||||
typedef Layer Super;
|
||||
|
||||
public:
|
||||
// Subclass: Material.
|
||||
|
@ -66,6 +68,7 @@ namespace Hurricane {
|
|||
Material& operator= ( const Material& material );
|
||||
inline operator const Code& () const;
|
||||
inline const Code& getCode () const;
|
||||
static Material fromString ( const string& );
|
||||
inline string _getTypeName () const;
|
||||
string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
|
@ -95,6 +98,7 @@ namespace Hurricane {
|
|||
inline void setExtractNumber ( unsigned int );
|
||||
inline void setRealName ( const char* realName);
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* writer ) const;
|
||||
virtual BasicLayer* _getSymbolicBasicLayer ();
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
|
@ -135,6 +139,20 @@ namespace Hurricane {
|
|||
inline void BasicLayer::setRealName ( const char* realName) { _realName = realName; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonBasicLayer".
|
||||
|
||||
class JsonBasicLayer : public JsonLayer {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonBasicLayer ( unsigned long flags );
|
||||
~JsonBasicLayer ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonBasicLayer* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -333,6 +333,7 @@ class Cell : public Entity {
|
|||
// ************
|
||||
|
||||
public: static Cell* create(Library* library, const Name& name);
|
||||
public: static Cell* fromJson(const string& filename);
|
||||
|
||||
// Accessors
|
||||
// *********
|
||||
|
|
|
@ -742,7 +742,7 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
|
|||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/Tabulation.h"
|
||||
#include "hurricane/JsonWriter.h"
|
||||
#include "hurricane/JsonReader.h"
|
||||
#include "hurricane/JsonObject.h"
|
||||
|
||||
|
||||
#endif // HURRICANE_COMMONS_H
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,14 +26,11 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/ContactLayer.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_CONTACT_LAYER__
|
||||
#define __HURRICANE_CONTACT_LAYER__
|
||||
#ifndef HURRICANE_CONTACT_LAYER_H
|
||||
#define HURRICANE_CONTACT_LAYER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -49,7 +40,12 @@
|
|||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::ContactLayer".
|
||||
|
||||
class ContactLayer : public Layer {
|
||||
public:
|
||||
typedef Layer Super;
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
|
@ -68,6 +64,7 @@ namespace Hurricane {
|
|||
// Updators.
|
||||
virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure );
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual void _onDbuChange ( float scale );
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
|
@ -91,6 +88,20 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonContactLayer".
|
||||
|
||||
class JsonContactLayer : public JsonLayer {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonContactLayer ( unsigned long flags );
|
||||
~JsonContactLayer ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonContactLayer* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class DataBase : public DBo {
|
|||
// Types
|
||||
// *****
|
||||
|
||||
public: typedef DBo Inherit;
|
||||
public: typedef DBo Inherit;
|
||||
public: enum Flags { NoFlags = 0
|
||||
, CreateLib =(1<<0)
|
||||
, WarnCreateLib=(1<<2) };
|
||||
|
|
|
@ -42,26 +42,28 @@ namespace Hurricane {
|
|||
|
||||
class DbU {
|
||||
public:
|
||||
enum UnitPower { Pico = 1
|
||||
, Nano
|
||||
, Micro
|
||||
, Milli
|
||||
, Unity
|
||||
, Kilo
|
||||
};
|
||||
enum FunctionFlags { NoFlags = 0
|
||||
, NoTechnoUpdate = (1<<0)
|
||||
};
|
||||
enum UnitPower { Pico = 1
|
||||
, Nano
|
||||
, Micro
|
||||
, Milli
|
||||
, Unity
|
||||
, Kilo
|
||||
};
|
||||
enum StringMode { Db = (1<<0)
|
||||
, Grid = (1<<1)
|
||||
, Symbolic = (1<<2)
|
||||
, Physical = (1<<3)
|
||||
, SmartTruncate = (1<<4)
|
||||
};
|
||||
enum SnapMode { Inferior = 1
|
||||
, Superior = 2
|
||||
, Nearest = 4
|
||||
};
|
||||
public:
|
||||
typedef long Unit;
|
||||
public:
|
||||
enum StringMode { Db = (1<<0)
|
||||
, Grid = (1<<1)
|
||||
, Symbolic = (1<<2)
|
||||
, Physical = (1<<3)
|
||||
, SmartTruncate = (1<<4)
|
||||
};
|
||||
enum SnapMode { Inferior = 1
|
||||
, Superior = 2
|
||||
, Nearest = 4
|
||||
};
|
||||
|
||||
public:
|
||||
static void checkGridBound ( double value );
|
||||
|
@ -81,14 +83,14 @@ namespace Hurricane {
|
|||
static unsigned int getPrecision ();
|
||||
static unsigned int getMaximalPrecision ();
|
||||
static double getResolution ();
|
||||
static void setPrecision ( unsigned int precision );
|
||||
static void setPrecision ( unsigned int precision, unsigned int flags=NoFlags );
|
||||
// Founder Grid Managment.
|
||||
static double getUnitPower ( UnitPower p );
|
||||
static void setPhysicalsPerGrid ( double gridsPerLambda, UnitPower p );
|
||||
static double getPhysicalsPerGrid ();
|
||||
static double physicalToGrid ( double physical, UnitPower p );
|
||||
// Lamba Managment.
|
||||
static void setGridsPerLambda ( double gridsPerLambda );
|
||||
static void setGridsPerLambda ( double gridsPerLambda, unsigned int flags=NoFlags );
|
||||
static double getGridsPerLambda ();
|
||||
// Snap Grid Managment.
|
||||
static DbU::Unit getRealSnapGridStep ();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,14 +26,11 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/DiffusionLayer.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_DIFFUSION_LAYER__
|
||||
#define __HURRICANE_DIFFUSION_LAYER__
|
||||
#ifndef HURRICANE_DIFFUSION_LAYER_H
|
||||
#define HURRICANE_DIFFUSION_LAYER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -48,8 +39,12 @@
|
|||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::DiffusionLayer".
|
||||
|
||||
class DiffusionLayer : public Layer {
|
||||
public:
|
||||
typedef Layer Super;
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
|
@ -69,6 +64,7 @@ namespace Hurricane {
|
|||
virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap );
|
||||
virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width );
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual void _onDbuChange ( float scale );
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
|
@ -93,10 +89,24 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonDiffusionLayer".
|
||||
|
||||
class JsonDiffusionLayer : public JsonLayer {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonDiffusionLayer ( unsigned long flags );
|
||||
~JsonDiffusionLayer ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonDiffusionLayer* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(Hurricane::DiffusionLayer);
|
||||
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -98,6 +98,20 @@ namespace Hurricane {
|
|||
stack.addEntity( jsonId, hobject );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonEntityRef".
|
||||
|
||||
class JsonEntityRef : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonEntityRef ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonEntityRef* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,424 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved
|
||||
//
|
||||
// This file is part of Hurricane.
|
||||
//
|
||||
// Hurricane is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// Hurricane is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
|
||||
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Lesser GNU General Public
|
||||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | 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@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/JsonObject.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_JSON_OBJECT_H
|
||||
#define HURRICANE_JSON_OBJECT_H
|
||||
|
||||
#ifndef HURRICANE_SLOT_H
|
||||
#error "JsonObject.h must be included through Commons.h"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
#include <typeindex>
|
||||
#include <type_traits>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <boost/any.hpp>
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
class DBo;
|
||||
class Hook;
|
||||
class Entity;
|
||||
class Cell;
|
||||
class Component;
|
||||
class JsonStack;
|
||||
|
||||
class JsonArray { };
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonAttribute".
|
||||
|
||||
class JsonAttribute {
|
||||
public:
|
||||
inline JsonAttribute ( const std::string& key, std::type_index tid );
|
||||
inline std::string key () const;
|
||||
inline std::type_index tid () const;
|
||||
private:
|
||||
std::string _key;
|
||||
std::type_index _tid;
|
||||
};
|
||||
|
||||
inline JsonAttribute::JsonAttribute ( const std::string& key, std::type_index tid ) : _key(key), _tid(tid) { }
|
||||
inline std::string JsonAttribute::key () const { return _key; }
|
||||
inline std::type_index JsonAttribute::tid () const { return _tid; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonObject".
|
||||
|
||||
class JsonObject {
|
||||
public:
|
||||
JsonObject ( unsigned long flags );
|
||||
virtual ~JsonObject ();
|
||||
virtual bool isDummy () const;
|
||||
virtual std::string getTypeName () const = 0;
|
||||
inline std::string getStackName () const;
|
||||
bool check ( JsonStack&, std::string fname ) const;
|
||||
void print ( std::ostream& ) const;
|
||||
bool has ( const std::string& key ) const;
|
||||
void add ( const std::string& key, std::type_index tid );
|
||||
void remove ( const std::string& key );
|
||||
template<typename T> inline T get ( JsonStack&, const std::string& key ) const;
|
||||
template<typename T> inline T* jget ( JsonStack& ) const;
|
||||
inline void copyAttrs ( const JsonObject*, bool reset=false );
|
||||
inline void clear ();
|
||||
inline std::string getName () const;
|
||||
inline void setName ( const std::string& );
|
||||
template<typename T> inline T getObject () const;
|
||||
template<typename T> inline void setObject ( T ) ;
|
||||
inline bool isBound () const;
|
||||
virtual JsonObject* clone ( unsigned long flags ) const = 0;
|
||||
virtual void toData ( JsonStack& );
|
||||
unsigned int presetId ( JsonStack& );
|
||||
template<typename T> inline void update ( JsonStack&, T );
|
||||
inline JsonObject* setFlags ( unsigned long mask );
|
||||
inline JsonObject* resetFlags ( unsigned long mask );
|
||||
inline bool issetFlags ( unsigned long mask ) const;
|
||||
protected:
|
||||
unsigned long _flags;
|
||||
std::string _name;
|
||||
std::vector<JsonAttribute> _stackeds;
|
||||
std::vector<JsonAttribute> _attributes;
|
||||
std::vector<JsonAttribute> _collections;
|
||||
boost::any _object;
|
||||
};
|
||||
|
||||
|
||||
inline bool JsonObject::isBound () const { return not _object.empty(); }
|
||||
inline std::string JsonObject::getName () const { return _name; }
|
||||
inline void JsonObject::setName ( const string& name ) { _name=name; }
|
||||
inline JsonObject* JsonObject::setFlags ( unsigned long mask ) { _flags |= mask; return this; }
|
||||
inline JsonObject* JsonObject::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; }
|
||||
inline bool JsonObject::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
|
||||
inline std::string JsonObject::getStackName () const
|
||||
{ return (_name.empty()) ? std::string(".")+getTypeName(): _name; }
|
||||
|
||||
template<typename T> inline T JsonObject::getObject () const
|
||||
{ return boost::any_cast<T>(_object); }
|
||||
|
||||
template<typename T> inline void JsonObject::setObject ( T t )
|
||||
{ _object = t; }
|
||||
|
||||
inline void JsonObject::copyAttrs ( const JsonObject* other, bool reset )
|
||||
{
|
||||
if (reset) _attributes.clear();
|
||||
for ( size_t i=0 ; i<other->_attributes.size() ; ++i )
|
||||
_attributes.push_back( other->_attributes[i] );
|
||||
}
|
||||
|
||||
void JsonObject::clear ()
|
||||
{
|
||||
_stackeds.clear();
|
||||
_attributes.clear();
|
||||
_collections.clear();
|
||||
boost::any emptyAny;
|
||||
_object.swap( emptyAny );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonKey".
|
||||
|
||||
class JsonKey : public JsonObject {
|
||||
public:
|
||||
inline JsonKey ( const std::string& );
|
||||
virtual std::string getTypeName () const;
|
||||
virtual JsonKey* clone ( unsigned long ) const;
|
||||
private:
|
||||
std::string _key;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDummy".
|
||||
|
||||
class JsonDummy : public JsonObject {
|
||||
public:
|
||||
JsonDummy ();
|
||||
virtual bool isDummy () const;
|
||||
virtual std::string getTypeName () const;
|
||||
void setTypeName ( const std::string& name );
|
||||
virtual JsonDummy* clone ( unsigned long ) const;
|
||||
private:
|
||||
std::string _typename;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonBaseArray".
|
||||
|
||||
template<typename T>
|
||||
class JsonBaseArray : public JsonObject {
|
||||
public:
|
||||
inline JsonBaseArray ( unsigned long flags );
|
||||
inline const std::vector<T>& array () const;
|
||||
inline void push_back ( T );
|
||||
private:
|
||||
std::vector<T> _array;
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline JsonBaseArray<T>::JsonBaseArray ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
, _array()
|
||||
{ }
|
||||
|
||||
template<typename T>
|
||||
inline const std::vector<T>& JsonBaseArray<T>::array () const { return _array; }
|
||||
|
||||
template<typename T>
|
||||
inline void JsonBaseArray<T>::push_back ( T element )
|
||||
{ _array.push_back(element); }
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
namespace std {
|
||||
|
||||
template<>
|
||||
struct less<Hurricane::JsonObject*> {
|
||||
inline bool operator() ( const Hurricane::JsonObject* lhs, const Hurricane::JsonObject* rhs )
|
||||
{ return lhs->getTypeName() < rhs->getTypeName(); }
|
||||
};
|
||||
|
||||
} // std namespace.
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonTypes".
|
||||
|
||||
class JsonTypes {
|
||||
public:
|
||||
static void initialize ();
|
||||
static void registerType ( JsonObject* );
|
||||
static JsonObject* find ( const std::string& tname );
|
||||
private:
|
||||
JsonTypes ();
|
||||
~JsonTypes ();
|
||||
JsonTypes ( const JsonTypes& );
|
||||
void _registerType ( JsonObject* );
|
||||
JsonObject* _find ( const std::string& tname );
|
||||
private:
|
||||
static JsonTypes* _jsonTypes;
|
||||
std::set<JsonObject*> _jsonObjects;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonStack".
|
||||
|
||||
class JsonStack {
|
||||
public:
|
||||
typedef std::pair<std::string, boost::any> Element;
|
||||
public:
|
||||
inline JsonStack ();
|
||||
inline size_t size () const;
|
||||
template<typename T> inline void push_back ( const std::string&, T );
|
||||
inline void pop_back ( size_t count=1 );
|
||||
inline int rhas ( const std::string& ) const;
|
||||
template<typename T> inline T as ( const std::string& ) const;
|
||||
template<typename T> inline T as ( int ) const;
|
||||
inline void push_back_dbo ( DBo* );
|
||||
inline void pop_back_dbo ();
|
||||
inline DBo* back_dbo () const;
|
||||
inline vector<JsonObject*>& jobjects ();
|
||||
template<typename T> inline T getEntity ( unsigned int ) const;
|
||||
void addEntity ( unsigned int jsonId, Entity* );
|
||||
void print ( std::ostream& ) const;
|
||||
inline unsigned long getFlags () const;
|
||||
inline JsonStack* setFlags ( unsigned long mask );
|
||||
inline JsonStack* resetFlags ( unsigned long mask );
|
||||
inline bool issetFlags ( unsigned long mask ) const;
|
||||
inline const Element& operator[] ( int index ) const;
|
||||
private:
|
||||
unsigned long _flags;
|
||||
vector<Element> _stack;
|
||||
vector<JsonObject*> _jstack;
|
||||
vector<DBo*> _dbos;
|
||||
std::map<unsigned int,Entity*> _entities;
|
||||
};
|
||||
|
||||
|
||||
inline JsonStack::JsonStack ()
|
||||
: _flags(0), _stack(), _jstack(), _dbos(), _entities()
|
||||
{ }
|
||||
|
||||
template<typename T> inline void JsonStack::push_back ( const std::string& key, T t )
|
||||
{
|
||||
ltrace(51) << "JsonStack::push_back(T) key:" << key << " value:" << t
|
||||
<< " (" << demangle(typeid(T)) << ")." << endl;
|
||||
_stack.push_back(std::make_pair(key,boost::any(t)));
|
||||
}
|
||||
|
||||
inline void JsonStack::pop_back ( size_t count )
|
||||
{
|
||||
while (count--) {
|
||||
if (_stack.empty()) {
|
||||
std::cerr << "[ERROR] JsonStack::pop_back(): Stack is empty, but "
|
||||
<< (count+1) << " elements remains to pop." << std::endl;
|
||||
break;
|
||||
}
|
||||
ltrace(51) << "| _stack.pop_back() \"" << _stack.back().first
|
||||
<< "\", size:" << _stack.size() << ", dbos:" << _dbos.size() << endl;
|
||||
_stack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
inline const JsonStack::Element& JsonStack::operator[] ( int index ) const
|
||||
{
|
||||
if (index < 0) return _stack[_stack.size()+index];
|
||||
return _stack[index];
|
||||
}
|
||||
|
||||
inline int JsonStack::rhas ( const std::string& key ) const
|
||||
{
|
||||
if (_stack.empty()) return 0;
|
||||
|
||||
int i = _stack.size()-1;
|
||||
do {
|
||||
if (_stack[i].first == key) {
|
||||
ltrace(51) << "JsonStack::rhas(): key \"" << key << "\" found at index:"
|
||||
<< (i-(int)_stack.size()) << " (i:" << i << ") "
|
||||
<< "(" << demangle(_stack[i].second.type().name()) << ")."
|
||||
<< endl;
|
||||
return i-(int)_stack.size();
|
||||
}
|
||||
if (i == 0) break;
|
||||
--i;
|
||||
} while ( true );
|
||||
|
||||
ltrace(51) << "JsonStack::rhas(): key \"" << key << "\" not found (returning index: 0)." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T> inline T JsonStack::as ( const std::string& key ) const
|
||||
{
|
||||
if (not _stack.empty()) {
|
||||
int i = _stack.size()-1;
|
||||
do {
|
||||
if (_stack[i].first == key) {
|
||||
ltrace(51) << "JsonStack::as<T>() k:" << key
|
||||
<< " value:" << demangle(_stack[i].second.type().name()) << std::endl;
|
||||
return boost::any_cast<T>( _stack[i].second );
|
||||
}
|
||||
if (i == 0) break;
|
||||
--i;
|
||||
} while ( true );
|
||||
|
||||
std::cerr << "[ERROR] JsonStack::as<T>(key): No element with key \""
|
||||
<< key << "\" in stack." << std::endl;
|
||||
} else {
|
||||
std::cerr << "[ERROR] JsonStack::as<T>(key): Stack is empty while searching for key \""
|
||||
<< key << "\"." << std::endl;
|
||||
}
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
template<typename T> inline T JsonStack::as ( int index ) const
|
||||
{
|
||||
size_t i = (index >= 0) ? index : (_stack.size()+index);
|
||||
return boost::any_cast<T>( _stack[i].second );
|
||||
}
|
||||
|
||||
|
||||
template<typename T> inline T JsonStack::getEntity ( unsigned int id ) const
|
||||
{
|
||||
std::map<unsigned int,Entity*>::const_iterator it = _entities.find(id);
|
||||
if (it == _entities.end()) return NULL;
|
||||
return dynamic_cast<T>((*it).second);
|
||||
}
|
||||
|
||||
inline void JsonStack::push_back_dbo ( DBo* dbo ) { _dbos.push_back(dbo); }
|
||||
inline void JsonStack::pop_back_dbo () { _dbos.pop_back(); }
|
||||
inline DBo* JsonStack::back_dbo () const { return (_dbos.empty()) ? NULL : _dbos.back(); }
|
||||
inline vector<JsonObject*>& JsonStack::jobjects () { return _jstack; }
|
||||
inline size_t JsonStack::size () const { return _stack.size(); }
|
||||
inline unsigned long JsonStack::getFlags () const { return _flags; }
|
||||
inline JsonStack* JsonStack::setFlags ( unsigned long mask ) { _flags |= mask; return this; }
|
||||
inline JsonStack* JsonStack::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; }
|
||||
inline bool JsonStack::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
|
||||
template<typename T>
|
||||
T JsonObject::get ( JsonStack& stack, const std::string& key ) const
|
||||
{
|
||||
int index = stack.rhas(key);
|
||||
if (index == 0) return T();;
|
||||
if (stack[index].second.type() == typeid(void*)) return T();
|
||||
|
||||
return stack.as<T>( index );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* JsonObject::jget ( JsonStack& stack ) const
|
||||
{
|
||||
vector<JsonObject*>& jobjects = stack.jobjects();
|
||||
vector<JsonObject*>::reverse_iterator rit = jobjects.rbegin();
|
||||
|
||||
for ( ; rit != jobjects.rend() ; ++rit ) {
|
||||
T* jobject = dynamic_cast<T*>( *rit );
|
||||
if (jobject) return jobject;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void JsonObject::update ( JsonStack& stack, T hobject )
|
||||
{
|
||||
ltrace(51) << "JsonObject::update<T>()" << endl;
|
||||
stack.pop_back( _attributes.size() );
|
||||
stack.push_back<T>( getStackName(), hobject );
|
||||
setObject<T>( hobject );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Function : Json Parsers.
|
||||
|
||||
Cell* jsonCellParse ( std::string filename );
|
||||
Cell* jsonBlobParse ( std::string filename );
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_JSON_OBJECT_H
|
|
@ -32,421 +32,53 @@
|
|||
#ifndef HURRICANE_JSON_READER_H
|
||||
#define HURRICANE_JSON_READER_H
|
||||
|
||||
#ifndef HURRICANE_SLOT_H
|
||||
#error "JsonWriter.h must be included through Commons.h"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
#include <typeindex>
|
||||
#include <type_traits>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <boost/any.hpp>
|
||||
#include "rapidjson/filereadstream.h"
|
||||
#include "rapidjson/reader.h"
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/FileReadGzStream.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
class DBo;
|
||||
class Hook;
|
||||
class Entity;
|
||||
class Cell;
|
||||
class Component;
|
||||
using rapidjson::Reader;
|
||||
class HurricaneHandler;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonObject".
|
||||
// Class : "JsonReader".
|
||||
|
||||
class JsonStack;
|
||||
class JsonArray { };
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonAttribute".
|
||||
|
||||
class JsonAttribute {
|
||||
class JsonReader {
|
||||
public:
|
||||
inline JsonAttribute ( const std::string& key, std::type_index tid );
|
||||
inline std::string key () const;
|
||||
inline std::type_index tid () const;
|
||||
private:
|
||||
std::string _key;
|
||||
std::type_index _tid;
|
||||
};
|
||||
|
||||
inline JsonAttribute::JsonAttribute ( const std::string& key, std::type_index tid ) : _key(key), _tid(tid) { }
|
||||
inline std::string JsonAttribute::key () const { return _key; }
|
||||
inline std::type_index JsonAttribute::tid () const { return _tid; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonObject".
|
||||
|
||||
class JsonObject {
|
||||
public:
|
||||
JsonObject ( unsigned long flags );
|
||||
virtual ~JsonObject ();
|
||||
virtual bool isDummy () const;
|
||||
virtual std::string getTypeName () const = 0;
|
||||
inline std::string getStackName () const;
|
||||
bool check ( JsonStack&, std::string fname ) const;
|
||||
void print ( std::ostream& ) const;
|
||||
bool has ( const std::string& key ) const;
|
||||
void add ( const std::string& key, std::type_index tid );
|
||||
void remove ( const std::string& key );
|
||||
template<typename T> inline T get ( JsonStack&, const std::string& key ) const;
|
||||
inline void copyAttrs ( const JsonObject*, bool reset=false );
|
||||
inline void clear ();
|
||||
inline std::string getName () const;
|
||||
inline void setName ( const std::string& );
|
||||
template<typename T> inline T& getObject () const;
|
||||
template<typename T> inline void setObject ( T ) ;
|
||||
inline bool isBound () const;
|
||||
virtual JsonObject* clone ( unsigned long flags ) const = 0;
|
||||
virtual void toData ( JsonStack& );
|
||||
unsigned int presetId ( JsonStack& );
|
||||
template<typename T> inline void update ( JsonStack&, T );
|
||||
inline JsonObject* setFlags ( unsigned long mask );
|
||||
inline JsonObject* resetFlags ( unsigned long mask );
|
||||
inline bool issetFlags ( unsigned long mask ) const;
|
||||
protected:
|
||||
unsigned long _flags;
|
||||
std::string _name;
|
||||
std::vector<JsonAttribute> _stackeds;
|
||||
std::vector<JsonAttribute> _attributes;
|
||||
std::vector<JsonAttribute> _collections;
|
||||
boost::any _object;
|
||||
};
|
||||
|
||||
|
||||
inline bool JsonObject::isBound () const { return not _object.empty(); }
|
||||
inline std::string JsonObject::getName () const { return _name; }
|
||||
inline void JsonObject::setName ( const string& name ) { _name=name; }
|
||||
inline JsonObject* JsonObject::setFlags ( unsigned long mask ) { _flags |= mask; return this; }
|
||||
inline JsonObject* JsonObject::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; }
|
||||
inline bool JsonObject::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
|
||||
inline std::string JsonObject::getStackName () const
|
||||
{ return (_name.empty()) ? std::string(".")+getTypeName(): _name; }
|
||||
|
||||
template<typename T> inline T& JsonObject::getObject () const
|
||||
{ return boost::any_cast<T>(_object); }
|
||||
|
||||
template<typename T> inline void JsonObject::setObject ( T t )
|
||||
{ _object = t; }
|
||||
|
||||
inline void JsonObject::copyAttrs ( const JsonObject* other, bool reset )
|
||||
{
|
||||
if (reset) _attributes.clear();
|
||||
for ( size_t i=0 ; i<other->_attributes.size() ; ++i )
|
||||
_attributes.push_back( other->_attributes[i] );
|
||||
}
|
||||
|
||||
void JsonObject::clear ()
|
||||
{
|
||||
_stackeds.clear();
|
||||
_attributes.clear();
|
||||
_collections.clear();
|
||||
boost::any emptyAny;
|
||||
_object.swap( emptyAny );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonKey".
|
||||
|
||||
class JsonKey : public JsonObject {
|
||||
public:
|
||||
inline JsonKey ( const std::string& );
|
||||
virtual std::string getTypeName () const;
|
||||
virtual JsonKey* clone ( unsigned long ) const;
|
||||
private:
|
||||
std::string _key;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDummy".
|
||||
|
||||
class JsonDummy : public JsonObject {
|
||||
public:
|
||||
inline JsonDummy ();
|
||||
virtual bool isDummy () const;
|
||||
virtual std::string getTypeName () const;
|
||||
void setTypeName ( const std::string& name );
|
||||
virtual JsonDummy* clone ( unsigned long ) const;
|
||||
private:
|
||||
std::string _typename;
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
namespace std {
|
||||
|
||||
template<>
|
||||
struct less<Hurricane::JsonObject*> {
|
||||
inline bool operator() ( const Hurricane::JsonObject* lhs, const Hurricane::JsonObject* rhs )
|
||||
{ return lhs->getTypeName() < rhs->getTypeName(); }
|
||||
};
|
||||
|
||||
} // std namespace.
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonTypes".
|
||||
|
||||
class JsonTypes {
|
||||
public:
|
||||
static void initialize ();
|
||||
static void registerType ( JsonObject* );
|
||||
static JsonObject* find ( const std::string& tname );
|
||||
private:
|
||||
JsonTypes ();
|
||||
~JsonTypes ();
|
||||
JsonTypes ( const JsonTypes& );
|
||||
void _registerType ( JsonObject* );
|
||||
JsonObject* _find ( const std::string& tname );
|
||||
private:
|
||||
static JsonTypes* _jsonTypes;
|
||||
std::set<JsonObject*> _jsonObjects;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "HookKey".
|
||||
|
||||
class HookKey {
|
||||
public:
|
||||
inline HookKey ( unsigned int id, const std::string& tname );
|
||||
inline unsigned int id () const;
|
||||
inline std::string tname () const;
|
||||
private:
|
||||
unsigned int _id;
|
||||
std::string _tname;
|
||||
};
|
||||
|
||||
|
||||
inline HookKey::HookKey ( unsigned int id, const std::string& tname ) : _id(id), _tname(tname) { }
|
||||
inline unsigned int HookKey::id () const { return _id; }
|
||||
inline std::string HookKey::tname () const { return _tname; }
|
||||
|
||||
inline bool operator< ( const HookKey& lhs, const HookKey& rhs )
|
||||
{
|
||||
if (lhs.id() != rhs.id()) return lhs.id() < rhs.id();
|
||||
return lhs.tname() < rhs.tname();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "HookElement".
|
||||
|
||||
class HookElement {
|
||||
public:
|
||||
enum Flags { OpenRingStart = (1<<0)
|
||||
, ClosedRing = (1<<1)
|
||||
};
|
||||
public:
|
||||
inline HookElement ( Hook*, unsigned long flags=0 );
|
||||
inline Hook* hook () const;
|
||||
inline HookElement* next () const;
|
||||
inline void setHook ( Hook* );
|
||||
inline void setNext ( HookElement* );
|
||||
inline unsigned long flags () const;
|
||||
inline HookElement& setFlags ( unsigned long mask );
|
||||
inline HookElement& resetFlags ( unsigned long mask );
|
||||
JsonReader ( unsigned long flags );
|
||||
~JsonReader ();
|
||||
inline JsonReader* setFlags ( unsigned long mask );
|
||||
inline JsonReader* resetFlags ( unsigned long mask );
|
||||
inline bool issetFlags ( unsigned long mask ) const;
|
||||
inline unsigned long getFlags () const;
|
||||
inline JsonStack& getStack ();
|
||||
void parse ( std::string fileName );
|
||||
void close ();
|
||||
private:
|
||||
JsonReader ( const JsonReader& );
|
||||
JsonReader& operator= ( const JsonReader& ) const;
|
||||
private:
|
||||
Hook* _hook;
|
||||
HookElement* _next;
|
||||
unsigned long _flags;
|
||||
size_t _bufferSize;
|
||||
char* _buffer;
|
||||
FILE* _file;
|
||||
FileReadGzStream* _stream;
|
||||
JsonStack _stack;
|
||||
Reader _reader;
|
||||
HurricaneHandler* _handler;
|
||||
};
|
||||
|
||||
|
||||
inline HookElement::HookElement ( Hook* hook, unsigned long flags ) : _hook(hook), _next(NULL), _flags(flags) { }
|
||||
inline Hook* HookElement::hook () const { return _hook; }
|
||||
inline HookElement* HookElement::next () const { return _next; }
|
||||
inline void HookElement::setHook ( Hook* hook ) { _hook = hook; }
|
||||
inline void HookElement::setNext ( HookElement* element ) { _next = element; }
|
||||
inline unsigned long HookElement::flags () const { return _flags; }
|
||||
inline HookElement& HookElement::setFlags ( unsigned long mask ) { _flags |= mask; return *this; }
|
||||
inline HookElement& HookElement::resetFlags ( unsigned long mask ) { _flags &= ~mask; return *this; }
|
||||
inline bool HookElement::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
|
||||
|
||||
typedef map<HookKey,HookElement> HookLut;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonStack".
|
||||
|
||||
class JsonStack {
|
||||
public:
|
||||
typedef std::pair<std::string, boost::any> Element;
|
||||
public:
|
||||
static bool hookFromString ( std::string s, unsigned int& id, std::string& tname );
|
||||
public:
|
||||
inline JsonStack ();
|
||||
inline size_t size () const;
|
||||
template<typename T> inline void push_back ( const std::string&, T );
|
||||
inline void pop_back ( size_t count=1 );
|
||||
inline int rhas ( const std::string& ) const;
|
||||
template<typename T> inline T as ( const std::string& ) const;
|
||||
template<typename T> inline T as ( int ) const;
|
||||
inline void push_back_dbo ( DBo* );
|
||||
inline void pop_back_dbo ();
|
||||
inline DBo* back_dbo () const;
|
||||
template<typename T> inline T getEntity ( unsigned int ) const;
|
||||
void addEntity ( unsigned int jsonId, Entity* );
|
||||
void addHookLink ( Hook*, unsigned int jsonId, const std::string& jsonNext );
|
||||
Hook* getHook ( unsigned int jsonId, const std::string& tname ) const;
|
||||
bool checkRings () const;
|
||||
void buildRings () const;
|
||||
inline void clearHookLinks ();
|
||||
void print ( std::ostream& ) const;
|
||||
inline JsonStack* setFlags ( unsigned long mask );
|
||||
inline JsonStack* resetFlags ( unsigned long mask );
|
||||
inline bool issetFlags ( unsigned long mask ) const;
|
||||
inline const Element& operator[] ( int index ) const;
|
||||
private:
|
||||
unsigned long _flags;
|
||||
vector<Element> _stack;
|
||||
vector<DBo*> _dbos;
|
||||
std::map<unsigned int,Entity*> _entities;
|
||||
HookLut _hooks;
|
||||
};
|
||||
|
||||
|
||||
inline JsonStack::JsonStack ()
|
||||
: _flags(0), _stack(), _dbos(), _entities(), _hooks()
|
||||
{ }
|
||||
|
||||
template<typename T> inline void JsonStack::push_back ( const std::string& key, T t )
|
||||
{
|
||||
ltrace(51) << "JsonStack::push_back(T) key:" << key << " value:" << t
|
||||
<< " (" << demangle(typeid(T)) << ")." << endl;
|
||||
_stack.push_back(std::make_pair(key,boost::any(t)));
|
||||
}
|
||||
|
||||
inline void JsonStack::pop_back ( size_t count )
|
||||
{
|
||||
while (count--) {
|
||||
if (_stack.empty()) {
|
||||
std::cerr << "[ERROR] JsonStack::pop_back(): Stack is empty, but "
|
||||
<< (count+1) << " elements remains to pop." << std::endl;
|
||||
break;
|
||||
}
|
||||
ltrace(51) << "| _stack.pop_back() \"" << _stack.back().first
|
||||
<< "\", size:" << _stack.size() << ", dbos:" << _dbos.size() << endl;
|
||||
_stack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
inline const JsonStack::Element& JsonStack::operator[] ( int index ) const
|
||||
{
|
||||
if (index < 0) return _stack[_stack.size()+index];
|
||||
return _stack[index];
|
||||
}
|
||||
|
||||
inline int JsonStack::rhas ( const std::string& key ) const
|
||||
{
|
||||
if (_stack.empty()) return 0;
|
||||
|
||||
int i = _stack.size()-1;
|
||||
do {
|
||||
if (_stack[i].first == key) {
|
||||
ltrace(51) << "JsonStack::rhas(): key \"" << key << "\" found at index:"
|
||||
<< (i-(int)_stack.size()) << " (i:" << i << ") "
|
||||
<< "(" << demangle(_stack[i].second.type().name()) << ")."
|
||||
<< endl;
|
||||
return i-(int)_stack.size();
|
||||
}
|
||||
if (i == 0) break;
|
||||
--i;
|
||||
} while ( true );
|
||||
|
||||
ltrace(51) << "JsonStack::rhas(): key \"" << key << "\" not found (returning index: 0)." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T> inline T JsonStack::as ( const std::string& key ) const
|
||||
{
|
||||
if (not _stack.empty()) {
|
||||
int i = _stack.size()-1;
|
||||
do {
|
||||
if (_stack[i].first == key) {
|
||||
ltrace(51) << "JsonStack::as<T>() k:" << key
|
||||
<< " value:" << demangle(_stack[i].second.type().name()) << std::endl;
|
||||
return boost::any_cast<T>( _stack[i].second );
|
||||
}
|
||||
if (i == 0) break;
|
||||
--i;
|
||||
} while ( true );
|
||||
|
||||
std::cerr << "[ERROR] JsonStack::as<T>(key): No element with key \""
|
||||
<< key << "\" in stack." << std::endl;
|
||||
} else {
|
||||
std::cerr << "[ERROR] JsonStack::as<T>(key): Stack is empty while searching for key \""
|
||||
<< key << "\"." << std::endl;
|
||||
}
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
template<typename T> inline T JsonStack::as ( int index ) const
|
||||
{
|
||||
size_t i = (index >= 0) ? index : (_stack.size()+index);
|
||||
return boost::any_cast<T>( _stack[i].second );
|
||||
}
|
||||
|
||||
|
||||
template<typename T> inline T JsonStack::getEntity ( unsigned int id ) const
|
||||
{
|
||||
std::map<unsigned int,Entity*>::const_iterator it = _entities.find(id);
|
||||
if (it == _entities.end()) return NULL;
|
||||
return dynamic_cast<T>((*it).second);
|
||||
}
|
||||
|
||||
inline void JsonStack::push_back_dbo ( DBo* dbo ) { _dbos.push_back(dbo); }
|
||||
inline void JsonStack::pop_back_dbo () { _dbos.pop_back(); }
|
||||
inline DBo* JsonStack::back_dbo () const { return (_dbos.empty()) ? NULL : _dbos.back(); }
|
||||
inline void JsonStack::clearHookLinks () { _hooks.clear(); }
|
||||
inline size_t JsonStack::size () const { return _stack.size(); }
|
||||
inline JsonStack* JsonStack::setFlags ( unsigned long mask ) { _flags |= mask; return this; }
|
||||
inline JsonStack* JsonStack::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; }
|
||||
inline bool JsonStack::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
|
||||
|
||||
template<typename T>
|
||||
T JsonObject::get ( JsonStack& stack, const std::string& key ) const
|
||||
{
|
||||
int index = stack.rhas(key);
|
||||
if (index == 0) return T();;
|
||||
if (stack[index].second.type() == typeid(void*)) return T();
|
||||
|
||||
return stack.as<T>( index );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void JsonObject::update ( JsonStack& stack, T hobject )
|
||||
{
|
||||
ltrace(51) << "JsonObject::update<T>()" << endl;
|
||||
stack.pop_back( _attributes.size() );
|
||||
stack.push_back<T>( getStackName(), hobject );
|
||||
setObject<T>( hobject );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Function : Json Parsers.
|
||||
|
||||
Cell* jsonCellParse ( std::string filename );
|
||||
Cell* jsonBlobParse ( std::string filename );
|
||||
inline JsonReader* JsonReader::setFlags ( unsigned long mask ) { _stack.setFlags(mask); return this; }
|
||||
inline JsonReader* JsonReader::resetFlags ( unsigned long mask ) { _stack.resetFlags(mask); return this; }
|
||||
inline bool JsonReader::issetFlags ( unsigned long mask ) const { return _stack.issetFlags(mask); }
|
||||
inline unsigned long JsonReader::getFlags () const { return _stack.getFlags(); }
|
||||
inline JsonStack& JsonReader::getStack () { return _stack; }
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace rapidjson {
|
||||
class FileWriteStream;
|
||||
|
@ -54,15 +56,17 @@ namespace Hurricane {
|
|||
|
||||
class JsonWriter {
|
||||
public:
|
||||
enum Mode { UsePlugReference = (1<<0)
|
||||
, DesignBlobMode = (1<<1)
|
||||
, CellMode = (1<<2)
|
||||
, RegisterMode = (1<<3)
|
||||
, RegisterStatus = (1<<4)
|
||||
, RegisterType = (1<<5)
|
||||
, UnregisterType = (1<<6)
|
||||
, CellObject = (1<<7)
|
||||
, DBoObject = (1<<8)
|
||||
enum Mode { UsePlugReference = (1<< 0)
|
||||
, UseEntityReference = (1<< 1)
|
||||
, DesignBlobMode = (1<< 2)
|
||||
, CellMode = (1<< 3)
|
||||
, TechnoMode = (1<< 4)
|
||||
, RegisterMode = (1<< 5)
|
||||
, RegisterStatus = (1<< 6)
|
||||
, RegisterType = (1<< 7)
|
||||
, UnregisterType = (1<< 8)
|
||||
, CellObject = (1<< 9)
|
||||
, DBoObject = (1<<10)
|
||||
};
|
||||
public:
|
||||
JsonWriter ( std::string fileName );
|
||||
|
@ -87,14 +91,18 @@ namespace Hurricane {
|
|||
void write ( const unsigned int* );
|
||||
void write ( unsigned long );
|
||||
void write ( const unsigned long* );
|
||||
void write ( float );
|
||||
void write ( const float* );
|
||||
void write ( double );
|
||||
void write ( const double* );
|
||||
void close ();
|
||||
JsonWriter* setFlags ( unsigned long mask );
|
||||
JsonWriter* resetFlags ( unsigned long mask );
|
||||
bool issetFlags ( unsigned long mask ) const;
|
||||
unsigned long getFlags () const;
|
||||
private:
|
||||
JsonWriter ( const JsonWriter& );
|
||||
JsonWriter& operator= ( const JsonWriter& ) const;
|
||||
JsonWriter ( const JsonWriter& );
|
||||
JsonWriter& operator= ( const JsonWriter& ) const;
|
||||
private:
|
||||
unsigned long _flags;
|
||||
size_t _bufferSize;
|
||||
|
@ -126,6 +134,10 @@ inline void jsonWrite ( JsonWriter* w, const unsigned int* v ) { w->write(v);
|
|||
inline void jsonWrite ( JsonWriter* w, unsigned int v ) { w->write(v); }
|
||||
inline void jsonWrite ( JsonWriter* w, const unsigned long* v ) { w->write(v); }
|
||||
inline void jsonWrite ( JsonWriter* w, unsigned long v ) { w->write(v); }
|
||||
inline void jsonWrite ( JsonWriter* w, const float* v ) { w->write(v); }
|
||||
inline void jsonWrite ( JsonWriter* w, float v ) { w->write(v); }
|
||||
inline void jsonWrite ( JsonWriter* w, const double* v ) { w->write(v); }
|
||||
inline void jsonWrite ( JsonWriter* w, double v ) { w->write(v); }
|
||||
|
||||
|
||||
//template<typename Type>
|
||||
|
@ -181,11 +193,27 @@ inline void jsonWrite ( JsonWriter* w, const std::string& key, const std::strin
|
|||
{ w->key( key ); w->write( value ); }
|
||||
|
||||
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, const float* value )
|
||||
{ w->key( key ); w->write( value ); }
|
||||
|
||||
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, float value )
|
||||
{ w->key( key ); w->write( value ); }
|
||||
|
||||
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, const double* value )
|
||||
{ w->key( key ); w->write( value ); }
|
||||
|
||||
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, double value )
|
||||
{ w->key( key ); w->write( value ); }
|
||||
|
||||
|
||||
template<typename C>
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, const C& )
|
||||
{
|
||||
w->key( key );
|
||||
std::string message = "Unsupported type " + Hurricane::demangle(typeid(C).name());
|
||||
std::string message = "JSON unsupported type " + Hurricane::demangle(typeid(C).name());
|
||||
w->write( message.c_str() );
|
||||
}
|
||||
|
||||
|
@ -222,11 +250,52 @@ inline void jsonWrite ( JsonWriter* w, const std::string& key, const C* object
|
|||
Hurricane::ltracein(50);
|
||||
|
||||
w->key( key );
|
||||
if (object) object->toJson( w );
|
||||
if (object) jsonWrite( w, object );
|
||||
else jsonWrite(w);
|
||||
|
||||
Hurricane::ltraceout(50);
|
||||
}
|
||||
|
||||
|
||||
template<typename Element>
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, const std::vector<Element>& v )
|
||||
{
|
||||
if (Hurricane::inltrace(50))
|
||||
std::cerr << Hurricane::tab
|
||||
<< "jsonWrite< vector<" << Hurricane::demangle(typeid(Element).name())
|
||||
<< "> >(w,key,v)" << " key:\"" << key << "\"" << std::endl;
|
||||
Hurricane::ltracein(50);
|
||||
|
||||
w->key( key );
|
||||
w->startArray();
|
||||
for ( Element element : v ) jsonWrite( w, element );
|
||||
w->endArray();
|
||||
|
||||
Hurricane::ltraceout(50);
|
||||
}
|
||||
|
||||
|
||||
template<typename Key, typename Element, typename Compare, typename Allocator>
|
||||
inline void jsonWrite ( JsonWriter* w
|
||||
, const std::string& key
|
||||
, const std::map<Key,Element,Compare,Allocator>& m )
|
||||
{
|
||||
if (Hurricane::inltrace(50))
|
||||
std::cerr << Hurricane::tab
|
||||
<< "jsonWrite< map<"
|
||||
<< Hurricane::demangle(typeid(Key ).name()) << ","
|
||||
<< Hurricane::demangle(typeid(Element).name()) << ","
|
||||
<< Hurricane::demangle(typeid(Compare).name())
|
||||
<< "> >(w,key,m)" << " key:\"" << key << "\"" << std::endl;
|
||||
Hurricane::ltracein(50);
|
||||
|
||||
w->key( key );
|
||||
w->startArray();
|
||||
for ( auto mapElement : m ) jsonWrite( w, mapElement.second );
|
||||
w->endArray();
|
||||
|
||||
Hurricane::ltraceout(50);
|
||||
}
|
||||
|
||||
|
||||
#endif // HURRICANE_JSON_WRITER_H
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_LAYER__
|
||||
#define __HURRICANE_LAYER__
|
||||
#ifndef HURRICANE_LAYER_H
|
||||
#define HURRICANE_LAYER_H
|
||||
|
||||
#include "hurricane/Mask.h"
|
||||
#include "hurricane/DBo.h"
|
||||
|
@ -46,7 +46,12 @@ namespace Hurricane {
|
|||
class Technology;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::Layer".
|
||||
|
||||
class Layer : public DBo {
|
||||
public:
|
||||
typedef DBo Super;
|
||||
|
||||
public:
|
||||
// Types.
|
||||
|
@ -88,6 +93,7 @@ namespace Hurricane {
|
|||
virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit );
|
||||
virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit );
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
inline Layer* _getNextOfTechnologyLayerMap () const;
|
||||
|
@ -110,14 +116,14 @@ namespace Hurricane {
|
|||
|
||||
protected:
|
||||
// Internal: Constructors & Destructors.
|
||||
Layer ( Technology* technology
|
||||
, const Name& name
|
||||
, const DbU::Unit& minimalSize = 0
|
||||
, const DbU::Unit& minimalSpacing = 0
|
||||
, const DbU::Unit& pitch = 0
|
||||
);
|
||||
virtual void _postCreate ();
|
||||
virtual void _preDestroy ();
|
||||
Layer ( Technology* technology
|
||||
, const Name& name
|
||||
, const DbU::Unit& minimalSize = 0
|
||||
, const DbU::Unit& minimalSpacing = 0
|
||||
, const DbU::Unit& pitch = 0
|
||||
);
|
||||
virtual void _postCreate ();
|
||||
virtual void _preDestroy ();
|
||||
|
||||
public:
|
||||
struct CompareByMask : public binary_function<const Layer*,const Layer*,bool> {
|
||||
|
@ -146,12 +152,21 @@ namespace Hurricane {
|
|||
{ return (lhs?lhs->getMask():Layer::Mask()) < (rhs?rhs->getMask():Layer::Mask()); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonLayer".
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
class JsonLayer : public JsonDBo {
|
||||
public:
|
||||
JsonLayer ( unsigned long flags );
|
||||
Technology* lookupTechnology ( JsonStack&, const string& fname ) const;
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(Hurricane::Layer);
|
||||
INSPECTOR_PV_SUPPORT(Hurricane::Layer::Mask);
|
||||
|
||||
|
||||
# endif
|
||||
#endif // HURRICANE_LAYER_H
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define HURRICANE_MASK_H
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include "hurricane/Commons.h"
|
||||
|
||||
|
||||
|
@ -43,31 +44,33 @@ namespace Hurricane {
|
|||
class Mask {
|
||||
public:
|
||||
// Methods.
|
||||
inline Mask ( IntType mask=0 );
|
||||
inline bool zero () const;
|
||||
inline Mask& set ( const Mask mask );
|
||||
inline Mask& unset ( const Mask mask );
|
||||
inline bool isSet ( const Mask mask ) const;
|
||||
inline bool contains ( const Mask mask ) const;
|
||||
inline bool intersect ( const Mask mask ) const;
|
||||
inline Mask nthbit ( unsigned int ) const;
|
||||
inline Mask operator compl () const;
|
||||
inline Mask operator bitand ( const Mask mask ) const;
|
||||
inline Mask operator bitor ( const Mask mask ) const;
|
||||
inline Mask operator xor ( const Mask mask ) const;
|
||||
inline Mask lshift ( unsigned int ) const;
|
||||
inline Mask rshift ( unsigned int ) const;
|
||||
inline Mask& operator |= ( const Mask mask );
|
||||
inline Mask& operator &= ( const Mask mask );
|
||||
inline bool operator == ( const Mask mask ) const;
|
||||
inline bool operator != ( const Mask mask ) const;
|
||||
inline bool operator < ( const Mask mask ) const;
|
||||
inline bool operator > ( const Mask mask ) const;
|
||||
inline operator IntType () const;
|
||||
inline Mask ( IntType mask=0 );
|
||||
inline bool zero () const;
|
||||
inline Mask& set ( const Mask mask );
|
||||
inline Mask& unset ( const Mask mask );
|
||||
inline bool isSet ( const Mask mask ) const;
|
||||
inline bool contains ( const Mask mask ) const;
|
||||
inline bool intersect ( const Mask mask ) const;
|
||||
inline Mask nthbit ( unsigned int ) const;
|
||||
inline Mask operator compl () const;
|
||||
inline Mask operator bitand ( const Mask mask ) const;
|
||||
inline Mask operator bitor ( const Mask mask ) const;
|
||||
inline Mask operator xor ( const Mask mask ) const;
|
||||
inline Mask lshift ( unsigned int ) const;
|
||||
inline Mask rshift ( unsigned int ) const;
|
||||
inline Mask& operator += ( unsigned int );
|
||||
inline Mask& operator |= ( const Mask mask );
|
||||
inline Mask& operator &= ( const Mask mask );
|
||||
inline bool operator == ( const Mask mask ) const;
|
||||
inline bool operator != ( const Mask mask ) const;
|
||||
inline bool operator < ( const Mask mask ) const;
|
||||
inline bool operator > ( const Mask mask ) const;
|
||||
inline operator IntType () const;
|
||||
static inline Mask fromString ( const string& );
|
||||
// Hurricane Managment.
|
||||
inline string _getTypeName () const;
|
||||
inline string _getString () const;
|
||||
inline Record* _getRecord () const;
|
||||
inline string _getTypeName () const;
|
||||
inline string _getString () const;
|
||||
inline Record* _getRecord () const;
|
||||
protected:
|
||||
// Internal: Attributes.
|
||||
static size_t _width;
|
||||
|
@ -138,6 +141,10 @@ namespace Hurricane {
|
|||
inline Mask<IntType> Mask<IntType>::rshift ( unsigned int s ) const
|
||||
{ return _mask >> s; }
|
||||
|
||||
template<typename IntType>
|
||||
inline Mask<IntType>& Mask<IntType>::operator += ( unsigned int v )
|
||||
{ _mask += v; return *this; }
|
||||
|
||||
template<typename IntType>
|
||||
inline Mask<IntType>& Mask<IntType>::operator |= ( const Mask<IntType> mask )
|
||||
{ _mask |= mask._mask; return *this; }
|
||||
|
@ -189,6 +196,58 @@ namespace Hurricane {
|
|||
size_t Mask<IntType>::_width = sizeof(IntType)<<2;
|
||||
|
||||
|
||||
template<typename IntType>
|
||||
inline Mask<IntType> Mask<IntType>::fromString ( const string& s )
|
||||
{
|
||||
IntType value;
|
||||
istringstream iss ( s );
|
||||
|
||||
iss >> hex >> value;
|
||||
Mask<IntType> mask ( value );
|
||||
|
||||
|
||||
#if NO_ISTRINGSTREAM
|
||||
if ( (s.size() > 2) and (s.size() <= _width+2) and (s.substr(0,2) == "0x") ) {
|
||||
for ( size_t i=2 ; i<s.size() ; ++i ) {
|
||||
mask.lshift( 4 );
|
||||
|
||||
switch ( s[i] ) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
mask += (unsigned int)(s[i] - '0'); break;
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
mask += (unsigned int)(s[i] - 'a')+10; break;
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
mask += (unsigned int)(s[i] - 'A')+10; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
# endif // HURRICANE_MASK_H
|
||||
|
|
|
@ -259,25 +259,99 @@ class Net : public Entity {
|
|||
|
||||
};
|
||||
|
||||
class JsonNet : public JsonEntity {
|
||||
// ********************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonNet(unsigned long flags);
|
||||
public: virtual ~JsonNet();
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonNet* clone(unsigned long) const;
|
||||
public: virtual void toData(JsonStack&);
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "HookKey".
|
||||
|
||||
// Attributes
|
||||
// **********
|
||||
class HookKey {
|
||||
public:
|
||||
inline HookKey ( unsigned int id, const std::string& tname );
|
||||
inline unsigned int id () const;
|
||||
inline std::string tname () const;
|
||||
private:
|
||||
unsigned int _id;
|
||||
std::string _tname;
|
||||
};
|
||||
|
||||
protected: bool _autoMaterialize;
|
||||
protected: Net* _net;
|
||||
protected: JsonStack* _stack;
|
||||
};
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
inline HookKey::HookKey ( unsigned int id, const std::string& tname ) : _id(id), _tname(tname) { }
|
||||
inline unsigned int HookKey::id () const { return _id; }
|
||||
inline std::string HookKey::tname () const { return _tname; }
|
||||
|
||||
inline bool operator< ( const HookKey& lhs, const HookKey& rhs )
|
||||
{
|
||||
if (lhs.id() != rhs.id()) return lhs.id() < rhs.id();
|
||||
return lhs.tname() < rhs.tname();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "HookElement".
|
||||
|
||||
class HookElement {
|
||||
public:
|
||||
enum Flags { OpenRingStart = (1<<0)
|
||||
, ClosedRing = (1<<1)
|
||||
};
|
||||
public:
|
||||
inline HookElement ( Hook*, unsigned long flags=0 );
|
||||
inline Hook* hook () const;
|
||||
inline HookElement* next () const;
|
||||
inline void setHook ( Hook* );
|
||||
inline void setNext ( HookElement* );
|
||||
inline unsigned long flags () const;
|
||||
inline HookElement& setFlags ( unsigned long mask );
|
||||
inline HookElement& resetFlags ( unsigned long mask );
|
||||
inline bool issetFlags ( unsigned long mask ) const;
|
||||
private:
|
||||
Hook* _hook;
|
||||
HookElement* _next;
|
||||
unsigned long _flags;
|
||||
};
|
||||
|
||||
|
||||
inline HookElement::HookElement ( Hook* hook, unsigned long flags ) : _hook(hook), _next(NULL), _flags(flags) { }
|
||||
inline Hook* HookElement::hook () const { return _hook; }
|
||||
inline HookElement* HookElement::next () const { return _next; }
|
||||
inline void HookElement::setHook ( Hook* hook ) { _hook = hook; }
|
||||
inline void HookElement::setNext ( HookElement* element ) { _next = element; }
|
||||
inline unsigned long HookElement::flags () const { return _flags; }
|
||||
inline HookElement& HookElement::setFlags ( unsigned long mask ) { _flags |= mask; return *this; }
|
||||
inline HookElement& HookElement::resetFlags ( unsigned long mask ) { _flags &= ~mask; return *this; }
|
||||
inline bool HookElement::issetFlags ( unsigned long mask ) const { return _flags & mask; }
|
||||
|
||||
|
||||
typedef map<HookKey,HookElement> HookLut;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonNet".
|
||||
|
||||
class JsonNet : public JsonEntity {
|
||||
public:
|
||||
static bool hookFromString ( std::string s, unsigned int& id, std::string& tname );
|
||||
static void initialize ();
|
||||
JsonNet ( unsigned long flags );
|
||||
virtual ~JsonNet ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonNet* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
void addHookLink ( Hook*, unsigned int jsonId, const std::string& jsonNext );
|
||||
Hook* getHook ( unsigned int jsonId, const std::string& tname ) const;
|
||||
bool checkRings () const;
|
||||
void buildRings () const;
|
||||
inline void clearHookLinks ();
|
||||
protected:
|
||||
bool _autoMaterialize;
|
||||
Net* _net;
|
||||
HookLut _hooks;
|
||||
};
|
||||
|
||||
|
||||
inline void JsonNet::clearHookLinks () { _hooks.clear(); }
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
|
|
@ -110,6 +110,7 @@ namespace Hurricane {
|
|||
virtual bool isSlave () const;
|
||||
virtual Name getName () const;
|
||||
virtual Net* getNet () const;
|
||||
virtual void toJson ( JsonWriter* ) const;
|
||||
virtual std::string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
public:
|
||||
|
@ -182,6 +183,19 @@ namespace Hurricane {
|
|||
{ }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonNetAlias".
|
||||
|
||||
class JsonNetAlias : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonNetAlias ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonNetAlias* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // Namespace Hurricane.
|
||||
|
||||
|
||||
|
|
|
@ -38,12 +38,15 @@
|
|||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "NetExternalComponents".
|
||||
|
||||
class NetExternalComponents {
|
||||
public:
|
||||
static Components get ( const Net* );
|
||||
static void setExternal ( Component* );
|
||||
static bool isExternal ( Component* );
|
||||
static void toJson ( JsonWriter*, const Net* );
|
||||
protected:
|
||||
static StandardRelation* getRelation ( const Net* );
|
||||
private:
|
||||
|
@ -51,6 +54,20 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonNetExternalComponents".
|
||||
|
||||
class JsonNetExternalComponents : public JsonBaseArray<Entity*> {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonNetExternalComponents ( unsigned long flags );
|
||||
virtual ~JsonNetExternalComponents ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonNetExternalComponents* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_NET_EXTERNAL_COMPONENTS_H
|
||||
|
|
|
@ -39,8 +39,12 @@
|
|||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::RegularLayer".
|
||||
|
||||
class RegularLayer : public Layer {
|
||||
public:
|
||||
typedef Layer Super;
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
|
@ -66,6 +70,7 @@ namespace Hurricane {
|
|||
virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap );
|
||||
virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width );
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual void _onDbuChange ( float scale );
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
|
@ -90,6 +95,20 @@ namespace Hurricane {
|
|||
inline BasicLayer* RegularLayer::getBasicLayer () const { return _basicLayer; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonRegularLayer".
|
||||
|
||||
class JsonRegularLayer : public JsonLayer {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonRegularLayer ( unsigned long flags );
|
||||
~JsonRegularLayer ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonRegularLayer* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
INSPECTOR_P_SUPPORT(Hurricane::RegularLayer);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,14 +26,11 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/Technology.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_TECHNOLOGY__
|
||||
#define __HURRICANE_TECHNOLOGY__
|
||||
#ifndef HURRICANE_TECHNOLOGY_H
|
||||
#define HURRICANE_TECHNOLOGY_H
|
||||
|
||||
#include <map>
|
||||
#include "hurricane/Mask.h"
|
||||
|
@ -64,7 +55,6 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::Technology".
|
||||
|
||||
|
||||
class Technology : public DBo {
|
||||
|
||||
public:
|
||||
|
@ -120,6 +110,8 @@ namespace Hurricane {
|
|||
inline Layer::Mask& _getMetalMask ();
|
||||
void _onDbuChange ( float scale );
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual void _toJsonCollections ( JsonWriter* ) const;
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
@ -153,10 +145,27 @@ namespace Hurricane {
|
|||
inline Layer::Mask& Technology::_getMetalMask () { return _metalMask; }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonTechnology".
|
||||
|
||||
class JsonTechnology : public JsonDBo {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonTechnology ( unsigned long flags );
|
||||
virtual ~JsonTechnology ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonTechnology* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
void addBlockageRef ( const std::string&, BasicLayer* );
|
||||
private:
|
||||
std::map< string, vector<BasicLayer*> > _blockagesMap;
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(Hurricane::Technology);
|
||||
|
||||
|
||||
#endif // __HURRICANE_TECHNOLOGY__
|
||||
#endif // HURRICANE_TECHNOLOGY_H
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,27 +18,19 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/TransistorLayer.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// | C++ Header : "./hurricane/TransistorLayer.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_TRANSISTOR_LAYER__
|
||||
#define __HURRICANE_TRANSISTOR_LAYER__
|
||||
#ifndef HURRICANE_TRANSISTOR_LAYER_H
|
||||
#define HURRICANE_TRANSISTOR_LAYER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -49,8 +40,12 @@
|
|||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::TransistorLayer".
|
||||
|
||||
class TransistorLayer : public Layer {
|
||||
public:
|
||||
typedef Layer Super;
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
|
@ -71,6 +66,7 @@ namespace Hurricane {
|
|||
virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap );
|
||||
virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width );
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual void _onDbuChange ( float scale );
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
|
@ -96,6 +92,20 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonTransistorLayer".
|
||||
|
||||
class JsonTransistorLayer : public JsonLayer {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonTransistorLayer ( unsigned long flags );
|
||||
~JsonTransistorLayer ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonTransistorLayer* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved
|
||||
|
@ -19,12 +18,7 @@
|
|||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $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 |
|
||||
// | |
|
||||
|
@ -32,14 +26,11 @@
|
|||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/ViaLayer.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_VIA_LAYER__
|
||||
#define __HURRICANE_VIA_LAYER__
|
||||
#ifndef HURRICANE_VIA_LAYER_H
|
||||
#define HURRICANE_VIA_LAYER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -49,8 +40,12 @@
|
|||
|
||||
namespace Hurricane {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::ViaLayer".
|
||||
|
||||
class ViaLayer : public Layer {
|
||||
public:
|
||||
typedef Layer Super;
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
|
@ -70,6 +65,7 @@ namespace Hurricane {
|
|||
// Updators.
|
||||
virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure );
|
||||
// Hurricane Managment.
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual void _onDbuChange ( float scale );
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
|
@ -92,6 +88,20 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonViaLayer".
|
||||
|
||||
class JsonViaLayer : public JsonLayer {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonViaLayer ( unsigned long flags );
|
||||
~JsonViaLayer ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonViaLayer* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2013, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
@ -149,5 +148,5 @@ extern "C" {
|
|||
} // End of extern "C".
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
} // Isobar namespace.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved
|
||||
// Copyright (c) UPMC 2010-2016, All Rights Reserved
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
|
@ -13,18 +11,11 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./PyNetExternalComponents.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ifndef __PY_NET_EXTERNAL_COMPONENTS__
|
||||
# define __PY_NET_EXTERNAL_COMPONENTS__
|
||||
|
||||
#ifndef PY_NET_EXTERNAL_COMPONENTS_H
|
||||
#define PY_NET_EXTERNAL_COMPONENTS_H
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "hurricane/NetExternalComponents.h"
|
||||
|
@ -43,8 +34,6 @@ extern "C" {
|
|||
} PyNetExternalComponents;
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyHurricane.cpp".
|
||||
|
||||
|
@ -59,13 +48,9 @@ extern "C" {
|
|||
#define PYNETEXTERNALCOMPONENTS_O(v) ( PY_NET_EXTERNAL_COMPONENTS(v)->_object )
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
} // extern "C".
|
||||
|
||||
|
||||
} // Isobar namespace.
|
||||
|
||||
} // End of Isobar namespace.
|
||||
|
||||
|
||||
|
||||
|
||||
# endif
|
||||
#endif // PY_NET_EXTERNAL_COMPONENTS_H
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
hurricane/viewer/HierarchyCommand.h
|
||||
hurricane/viewer/SelectorCriterion.h
|
||||
hurricane/viewer/CellWidgets.h
|
||||
hurricane/viewer/DesignBlob.h
|
||||
hurricane/viewer/JsonConfiguration.h
|
||||
)
|
||||
set( pyIncludes hurricane/viewer/PyHSVr.h
|
||||
hurricane/viewer/PyDrawingStyle.h
|
||||
|
@ -114,6 +116,8 @@
|
|||
DisplayFilterWidget.cpp
|
||||
ControllerWidget.cpp
|
||||
ScriptWidget.cpp
|
||||
DesignBlob.cpp
|
||||
JsonConfiguration.cpp
|
||||
)
|
||||
set( pyCpps PyHSVr.cpp
|
||||
PyDrawingStyle.cpp
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace Hurricane {
|
|||
setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );
|
||||
|
||||
setCentralWidget( _cellWidget );
|
||||
_palette->build ();
|
||||
_palette->readGraphics ();
|
||||
|
||||
_cellWidget->bindToPalette( _palette );
|
||||
_cellWidget->refresh();
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Hurricane {
|
|||
setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );
|
||||
|
||||
setCentralWidget( _cellWidget );
|
||||
_palette->build ();
|
||||
_palette->readGraphics ();
|
||||
|
||||
_cellWidget->bindToPalette( _palette );
|
||||
_cellWidget->refresh();
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/DesignBlob.h"
|
||||
//#include "MapView.h"
|
||||
#include "hurricane/isobar/PyCell.h"
|
||||
#include "hurricane/viewer/Script.h"
|
||||
|
@ -49,6 +48,7 @@
|
|||
#include "hurricane/viewer/ScriptWidget.h"
|
||||
#include "hurricane/viewer/ExceptionWidget.h"
|
||||
#include "hurricane/viewer/GotoWidget.h"
|
||||
#include "hurricane/viewer/DesignBlob.h"
|
||||
#include "hurricane/viewer/OpenBlobDialog.h"
|
||||
#include "hurricane/viewer/SelectCommand.h"
|
||||
#include "hurricane/viewer/PyCellViewer.h"
|
||||
|
@ -727,9 +727,15 @@ namespace Hurricane {
|
|||
QString blobName;
|
||||
if (OpenBlobDialog::runDialog(this,blobName)) {
|
||||
string fileName = blobName.toStdString() + ".blob";
|
||||
DebugSession::open( 50 );
|
||||
Cell* topCell = jsonBlobParse( fileName );
|
||||
DebugSession::close();
|
||||
//DebugSession::open( 50 );
|
||||
|
||||
Cell* topCell = NULL;
|
||||
DesignBlob* blob = DesignBlob::fromJson( fileName );
|
||||
|
||||
if (blob) topCell = blob->getTopCell();
|
||||
delete blob;
|
||||
|
||||
//DebugSession::close();
|
||||
|
||||
setCell ( topCell );
|
||||
emit cellLoadedFromDisk( topCell );
|
||||
|
|
|
@ -1080,9 +1080,6 @@ namespace Hurricane {
|
|||
setMouseTracking ( true );
|
||||
|
||||
//_mapView = new MapView ( this );
|
||||
DataBase* database = DataBase::getDB();
|
||||
if ( database )
|
||||
_technology = database->getTechnology ();
|
||||
|
||||
QFont font = Graphics::getNormalFont();
|
||||
_textFontHeight = QFontMetrics(font).ascent();
|
||||
|
@ -1270,17 +1267,21 @@ namespace Hurricane {
|
|||
|
||||
void CellWidget::_redraw ( QRect redrawArea )
|
||||
{
|
||||
// cerr << "CellWidget::redraw() - start "
|
||||
// << _selectionHasChanged << " filter:"
|
||||
// << _state->getQueryFilter() << endl;
|
||||
//cerr << "CellWidget::redraw() - start "
|
||||
// << _selectionHasChanged << " filter:"
|
||||
// << _state->getQueryFilter() << endl;
|
||||
|
||||
// static bool timedout;
|
||||
// static Timer timer;
|
||||
//static bool timedout;
|
||||
//static Timer timer;
|
||||
|
||||
if ( not isVisible() ) return;
|
||||
|
||||
// timer.start ();
|
||||
// timedout = false;
|
||||
DataBase* database = DataBase::getDB();
|
||||
if ( database ) _technology = database->getTechnology ();
|
||||
|
||||
//timer.start ();
|
||||
//timedout = false;
|
||||
|
||||
_cellChanged = false;
|
||||
_redrawRectCount = 0;
|
||||
|
||||
|
@ -1409,26 +1410,26 @@ namespace Hurricane {
|
|||
popCursor ();
|
||||
repaint ();
|
||||
|
||||
// timer.stop ();
|
||||
// cerr << "CellWidget::redraw() - " << _redrawRectCount
|
||||
// << " in " << timer.getCombTime() << "s ("
|
||||
// << setprecision(3) << (timer.getCombTime()/_redrawRectCount) << " s/r)";
|
||||
// if ( _drawingQuery.getGoCount() )
|
||||
// cerr << " " << _drawingQuery.getGoCount()
|
||||
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoCount()) << " s/go)";
|
||||
// else
|
||||
// cerr << " 0 Gos";
|
||||
// if ( _drawingQuery.getExtensionGoCount() )
|
||||
// cerr << " " << _drawingQuery.getExtensionGoCount()
|
||||
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getExtensionGoCount()) << " s/ego)";
|
||||
// else
|
||||
// cerr << " 0 eGos";
|
||||
// if ( _drawingQuery.getInstanceCount() )
|
||||
// cerr << " " << _drawingQuery.getInstanceCount()
|
||||
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getInstanceCount()) << " s/inst)";
|
||||
// else
|
||||
// cerr << " 0 Instances";
|
||||
// cerr << endl;
|
||||
//timer.stop ();
|
||||
//cerr << "CellWidget::redraw() - " << _redrawRectCount
|
||||
// << " in " << timer.getCombTime() << "s ("
|
||||
// << setprecision(3) << (timer.getCombTime()/_redrawRectCount) << " s/r)";
|
||||
//if ( _drawingQuery.getGoCount() )
|
||||
// cerr << " " << _drawingQuery.getGoCount()
|
||||
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoCount()) << " s/go)";
|
||||
//else
|
||||
// cerr << " 0 Gos";
|
||||
//if ( _drawingQuery.getExtensionGoCount() )
|
||||
// cerr << " " << _drawingQuery.getExtensionGoCount()
|
||||
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getExtensionGoCount()) << " s/ego)";
|
||||
//else
|
||||
// cerr << " 0 eGos";
|
||||
//if ( _drawingQuery.getInstanceCount() )
|
||||
// cerr << " " << _drawingQuery.getInstanceCount()
|
||||
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getInstanceCount()) << " s/inst)";
|
||||
//else
|
||||
// cerr << " 0 Instances";
|
||||
//cerr << endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -73,6 +73,10 @@ namespace Hurricane {
|
|||
{ }
|
||||
|
||||
|
||||
void ControllerTab::graphicsUpdated ()
|
||||
{ }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::TabGraphics".
|
||||
|
||||
|
@ -99,6 +103,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void TabGraphics::graphicsUpdated ()
|
||||
{ _graphics->rereadGraphics(); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::TabDisplayFilter".
|
||||
|
||||
|
@ -135,7 +143,6 @@ namespace Hurricane {
|
|||
{
|
||||
//_palette->setOneColumn ();
|
||||
_palette->setObjectName ( "controller.tabPalette.palette" );
|
||||
_palette->build ();
|
||||
//_palette->setSectionVisible ( "Viewer", false );
|
||||
|
||||
QVBoxLayout* wLayout = new QVBoxLayout ();
|
||||
|
@ -159,6 +166,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void TabPalette::graphicsUpdated ()
|
||||
{ _palette->rereadGraphics(); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::TabNetlist".
|
||||
|
||||
|
@ -489,8 +500,9 @@ namespace Hurricane {
|
|||
|
||||
TabSettings::TabSettings ( QWidget* parent )
|
||||
: ControllerTab (parent)
|
||||
, _timestamp (0)
|
||||
, _configuration(Configuration::get()->buildWidget(ConfigurationWidget::Embedded))
|
||||
{
|
||||
{
|
||||
setContentsMargins ( 5, 0, 5, 5 );
|
||||
|
||||
_configuration->setObjectName ( "controller.tabSettings.settings" );
|
||||
|
@ -506,6 +518,25 @@ namespace Hurricane {
|
|||
{ }
|
||||
|
||||
|
||||
void TabSettings::showEvent ( QShowEvent* )
|
||||
{
|
||||
Configuration* conf = Configuration::get();
|
||||
|
||||
if (_timestamp < conf->getLayout().getTimestamp()) {
|
||||
_timestamp = conf->getLayout().getTimestamp();
|
||||
|
||||
QLayoutItem* child = NULL;
|
||||
while ( (child = layout()->takeAt(0)) != 0 ) {
|
||||
layout()->removeWidget( child->widget() );
|
||||
delete child->widget();
|
||||
}
|
||||
|
||||
_configuration = conf->buildWidget( ConfigurationWidget::Embedded );
|
||||
layout()->addWidget ( _configuration );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TabSettings::TabSettings ( QWidget* parent )
|
||||
// : ControllerTab(parent)
|
||||
// , _settings(new QTabWidget())
|
||||
|
@ -527,6 +558,7 @@ namespace Hurricane {
|
|||
|
||||
ControllerWidget::ControllerWidget ( QWidget* parent )
|
||||
: QTabWidget (parent)
|
||||
, _observer (this)
|
||||
, _cellWidget (NULL)
|
||||
, _tabGraphics (new TabGraphics())
|
||||
, _tabPalette (new TabPalette())
|
||||
|
@ -570,6 +602,8 @@ namespace Hurricane {
|
|||
connect( this , SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)) );
|
||||
connect( _tabSelection->getSelection(), SIGNAL(inspect(Occurrence&))
|
||||
, _tabInspector , SLOT (setSelectionOccurrence(Occurrence&)) );
|
||||
|
||||
Graphics::getGraphics()->addObserver( &_observer );
|
||||
|
||||
resize( Graphics::toHighDpi(600), Graphics::toHighDpi(500) );
|
||||
}
|
||||
|
@ -617,4 +651,22 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void ControllerWidget::graphicsUpdated ()
|
||||
{
|
||||
for ( int i=0 ; i<count() ; ++i )
|
||||
(static_cast<ControllerTab*>(widget(i)))->graphicsUpdated ();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "ControllerWidget::GraphicsObserver".
|
||||
|
||||
void ControllerWidget::GraphicsObserver::notify ( unsigned int flags )
|
||||
{
|
||||
ControllerWidget* controller = getOwner();
|
||||
if (flags & Graphics::ChangedDisplayStyles) {
|
||||
controller->graphicsUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -15,9 +15,13 @@
|
|||
|
||||
|
||||
#include <iostream>
|
||||
#include "hurricane/JsonReader.h"
|
||||
#include "hurricane/UpdateSession.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/DesignBlob.h"
|
||||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/DesignBlob.h"
|
||||
#include "hurricane/viewer/JsonParameter.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -32,13 +36,30 @@ namespace Hurricane {
|
|||
void DesignBlob::toJson( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", _getTypeName() );
|
||||
jsonWrite( w, "_topCell" , getTopCell()->getHierarchicalName() );
|
||||
jsonWrite( w, "_database", DataBase::getDB() );
|
||||
jsonWrite( w, "@typename" , _getTypeName() );
|
||||
jsonWrite( w, "_topCell" , getTopCell()->getHierarchicalName() );
|
||||
jsonWrite( w, "_database" , DataBase::getDB() );
|
||||
jsonWrite( w, "_graphics" , Graphics::getGraphics() );
|
||||
jsonWrite( w, "_configuration", Cfg::Configuration::get() );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
DesignBlob* DesignBlob::fromJson ( const string& filename )
|
||||
{
|
||||
UpdateSession::open();
|
||||
|
||||
JsonReader reader ( JsonWriter::DesignBlobMode );
|
||||
reader.parse( filename );
|
||||
|
||||
UpdateSession::close();
|
||||
|
||||
const JsonStack& stack = reader.getStack();
|
||||
if (stack.rhas(".DesignBlob")) return stack.as<DesignBlob*>(".DesignBlob");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDesignBlob".
|
||||
|
||||
|
@ -54,8 +75,10 @@ namespace Hurricane {
|
|||
{
|
||||
ltrace(51) << "JsonDesignblob::JsonDesignblob()" << endl;
|
||||
|
||||
add( "_topCell" , typeid(string) );
|
||||
add( "_database", typeid(DataBase*) );
|
||||
add( "_topCell" , typeid(string) );
|
||||
add( "_database" , typeid(DataBase*) );
|
||||
add( "_graphics" , typeid(Graphics*) );
|
||||
add( "_configuration", typeid(Cfg::Configuration*) );
|
||||
}
|
||||
|
||||
|
|
@ -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-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | H U R R I C A N E |
|
||||
|
@ -49,6 +48,8 @@ namespace Hurricane {
|
|||
const Name DisplayStyle::Undef = "undef";
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "RawDrawingStyle".
|
||||
|
||||
RawDrawingStyle::RawDrawingStyle ( const Name& name
|
||||
, const string& pattern
|
||||
|
@ -73,6 +74,15 @@ namespace Hurricane {
|
|||
{ }
|
||||
|
||||
|
||||
RawDrawingStyle::~RawDrawingStyle ()
|
||||
{
|
||||
if ( _color ) {
|
||||
delete _color;
|
||||
delete _pen;
|
||||
delete _brush;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DrawingStyle RawDrawingStyle::create ( const Name& name
|
||||
, const string& pattern
|
||||
|
@ -149,16 +159,114 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
RawDrawingStyle::~RawDrawingStyle ()
|
||||
void RawDrawingStyle::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
if ( _color ) {
|
||||
delete _color;
|
||||
delete _pen;
|
||||
delete _brush;
|
||||
}
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "DrawingStyle" );
|
||||
jsonWrite( w, "_name" , _name );
|
||||
jsonWrite( w, "_red" , _red );
|
||||
jsonWrite( w, "_green" , _green );
|
||||
jsonWrite( w, "_blue" , _blue );
|
||||
jsonWrite( w, "_borderWidth", _borderWidth );
|
||||
jsonWrite( w, "_pattern" , _pattern );
|
||||
jsonWrite( w, "_threshold" , _threshold );
|
||||
jsonWrite( w, "_goMatched" , _goMatched );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDrawingStyle".
|
||||
|
||||
Initializer<JsonDrawingStyle> jsonDrawingStyleInit ( 0 );
|
||||
|
||||
|
||||
void JsonDrawingStyle::initialize ()
|
||||
{ JsonTypes::registerType( new JsonDrawingStyle (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonDrawingStyle::JsonDrawingStyle ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
add( ".DrawingGroup", typeid(DrawingGroup) );
|
||||
add( "_name" , typeid(string) );
|
||||
add( "_red" , typeid(int64_t) );
|
||||
add( "_green" , typeid(int64_t) );
|
||||
add( "_blue" , typeid(int64_t) );
|
||||
add( "_borderWidth" , typeid(int64_t) );
|
||||
add( "_pattern" , typeid(string) );
|
||||
add( "_threshold" , typeid(double) );
|
||||
add( "_goMatched" , typeid(bool) );
|
||||
}
|
||||
|
||||
|
||||
JsonDrawingStyle::~JsonDrawingStyle ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonDrawingStyle::getTypeName () const
|
||||
{ return "DrawingStyle"; }
|
||||
|
||||
|
||||
JsonDrawingStyle* JsonDrawingStyle::clone ( unsigned long flags ) const
|
||||
{ return new JsonDrawingStyle ( flags ); }
|
||||
|
||||
|
||||
void JsonDrawingStyle::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonDrawingStyle::toData" );
|
||||
|
||||
DrawingGroup* dg = get<DrawingGroup*>( stack, ".DrawingGroup" );
|
||||
DrawingStyle ds;
|
||||
|
||||
if (not dg) return;
|
||||
|
||||
string name = get<string> ( stack, "_name" );
|
||||
int red = get<int64_t>( stack, "_red" );
|
||||
int green = get<int64_t>( stack, "_green" );
|
||||
int blue = get<int64_t>( stack, "_blue" );
|
||||
int borderWidth = get<int64_t>( stack, "_borderWidth" );
|
||||
string pattern = get<string> ( stack, "_pattern" );
|
||||
float threshold = get<double> ( stack, "_threshold" );
|
||||
bool goMatched = get<bool> ( stack, "_goMatched" );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
ds = RawDrawingStyle::create( name
|
||||
, pattern
|
||||
, red
|
||||
, green
|
||||
, blue
|
||||
, borderWidth
|
||||
, threshold
|
||||
, goMatched
|
||||
);
|
||||
dg->addDrawingStyle( ds );
|
||||
|
||||
if (Graphics::isEnabled()) dg->qtAllocate();
|
||||
} else {
|
||||
// Check coherency with existing DrawingStyle.
|
||||
ds = dg->find( name );
|
||||
if (ds == nullptr) {
|
||||
cerr << Error( "JsonDrawingStyle::toData(): No DrawingStyle \"%s\" in the existing DisplayStyle."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, NULL );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "DrawingGroup".
|
||||
|
||||
DrawingGroup::DrawingGroup ( const Name& name )
|
||||
: _name (name)
|
||||
, _drawingStyles()
|
||||
|
@ -208,6 +316,17 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void DrawingGroup::addDrawingStyle ( DrawingStyle ds )
|
||||
{
|
||||
size_t i = findIndex ( ds->getName() );
|
||||
if ( i != InvalidIndex ) {
|
||||
_drawingStyles[i] = ds;
|
||||
} else {
|
||||
_drawingStyles.push_back ( ds );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DrawingStyle DrawingGroup::addDrawingStyle ( const Name& key
|
||||
, const string& pattern
|
||||
, int red
|
||||
|
@ -230,6 +349,91 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void DrawingGroup::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "DrawingGroup" );
|
||||
jsonWrite( w, "_name", _name );
|
||||
|
||||
w->key( "+drawingStyles" );
|
||||
w->startArray();
|
||||
for ( DrawingStyle ds : _drawingStyles ) ds->toJson( w );
|
||||
w->endArray();
|
||||
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDrawingGroup".
|
||||
|
||||
Initializer<JsonDrawingGroup> jsonDrawingGroupInit ( 0 );
|
||||
|
||||
|
||||
void JsonDrawingGroup::initialize ()
|
||||
{ JsonTypes::registerType( new JsonDrawingGroup (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonDrawingGroup::JsonDrawingGroup ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
add( ".DisplayStyle" , typeid(DisplayStyle*) );
|
||||
add( "_name" , typeid(string) );
|
||||
add( "+drawingStyles", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
JsonDrawingGroup::~JsonDrawingGroup ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonDrawingGroup::getTypeName () const
|
||||
{ return "DrawingGroup"; }
|
||||
|
||||
|
||||
JsonDrawingGroup* JsonDrawingGroup::clone ( unsigned long flags ) const
|
||||
{ return new JsonDrawingGroup ( flags ); }
|
||||
|
||||
|
||||
void JsonDrawingGroup::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonDrawingGroup::toData" );
|
||||
|
||||
DisplayStyle* ds = get<DisplayStyle*>( stack, ".DisplayStyle" );
|
||||
DrawingGroup* dg = NULL;
|
||||
|
||||
if (not ds) return;
|
||||
|
||||
string name = get<string>( stack, "_name" );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
size_t gi = 0;
|
||||
ds->findOrCreate( name, gi );
|
||||
dg = ds->findGroup( name );
|
||||
} else {
|
||||
// Check coherency with existing DrawingGroup.
|
||||
dg = ds->findGroup( name );
|
||||
if (dg == NULL) {
|
||||
cerr << Error( "JsonDrawingGroup::toData(): No DrawingGroup \"%s\" in the existing DisplayStyle."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, dg );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "DisplayStyle".
|
||||
|
||||
QColor DisplayStyle::darken ( const QColor& color, const DisplayStyle::HSVr& darkening )
|
||||
{
|
||||
QColor hsvColor = color.toHsv();
|
||||
|
@ -332,6 +536,16 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
DrawingGroup* DisplayStyle::findGroup ( const Name& groupKey )
|
||||
{
|
||||
for ( size_t gi=0 ; gi < _groups.size() ; gi++ ) {
|
||||
if ( _groups[gi]->getName() == groupKey )
|
||||
return _groups[gi];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void DisplayStyle::findOrCreate ( const Name& groupKey, size_t& gi )
|
||||
{
|
||||
for ( gi=0 ; gi < _groups.size() ; gi++ ) {
|
||||
|
@ -428,4 +642,143 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
void DisplayStyle::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "DisplayStyle" );
|
||||
jsonWrite( w, "_name" , _name );
|
||||
jsonWrite( w, "_description", _description );
|
||||
jsonWrite( w, "_darkening" , &_darkening );
|
||||
|
||||
w->key( "+groups" );
|
||||
w->startArray();
|
||||
for ( DrawingGroup* dg : _groups ) dg->toJson( w );
|
||||
w->endArray();
|
||||
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDisplayStyle".
|
||||
|
||||
Initializer<JsonDisplayStyle> jsonDisplayStyleInit ( 0 );
|
||||
|
||||
|
||||
void JsonDisplayStyle::initialize ()
|
||||
{ JsonTypes::registerType( new JsonDisplayStyle (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonDisplayStyle::JsonDisplayStyle ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
add( "_name" , typeid(string) );
|
||||
add( "_description", typeid(string) );
|
||||
add( "_darkening" , typeid(DisplayStyle::HSVr) );
|
||||
add( "+groups" , typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
JsonDisplayStyle::~JsonDisplayStyle ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonDisplayStyle::getTypeName () const
|
||||
{ return "DisplayStyle"; }
|
||||
|
||||
|
||||
JsonDisplayStyle* JsonDisplayStyle::clone ( unsigned long flags ) const
|
||||
{ return new JsonDisplayStyle ( flags ); }
|
||||
|
||||
|
||||
void JsonDisplayStyle::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonDisplayStyle::toData" );
|
||||
|
||||
Graphics* graphics = get<Graphics*>( stack, "_graphics" );
|
||||
DisplayStyle* ds = NULL;
|
||||
|
||||
if (not graphics) return;
|
||||
|
||||
string name = get<string> ( stack, "_name" );
|
||||
string description = get<string> ( stack, "_description" );
|
||||
DisplayStyle::HSVr* darkening = get<DisplayStyle::HSVr*>( stack, "_darkening" );
|
||||
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
// Actual creation.
|
||||
ds = new DisplayStyle ( name );
|
||||
ds->setDescription( description );
|
||||
ds->setDarkening ( *darkening );
|
||||
graphics->addStyle( ds );
|
||||
} else {
|
||||
// Check coherency with existing DisplayStyle.
|
||||
ds = Graphics::getStyle( name );
|
||||
if (ds == NULL) {
|
||||
cerr << Error( "JsonDisplayStyle::toData(): No DisplayStyle \"%s\" in the existing DisplayStyle."
|
||||
, name.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, ds );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonHSVr".
|
||||
|
||||
Initializer<JsonHSVr> jsonHSVrInit ( 0 );
|
||||
|
||||
|
||||
void JsonHSVr::initialize ()
|
||||
{ JsonTypes::registerType( new JsonHSVr (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonHSVr::JsonHSVr ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
add( "_hue" , typeid(double) );
|
||||
add( "_saturation", typeid(double) );
|
||||
add( "_value" , typeid(double) );
|
||||
}
|
||||
|
||||
|
||||
JsonHSVr::~JsonHSVr ()
|
||||
{ }
|
||||
|
||||
|
||||
string JsonHSVr::getTypeName () const
|
||||
{ return "HSVr"; }
|
||||
|
||||
|
||||
JsonHSVr* JsonHSVr::clone ( unsigned long flags ) const
|
||||
{ return new JsonHSVr ( flags ); }
|
||||
|
||||
|
||||
void JsonHSVr::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonHSVr::toData" );
|
||||
|
||||
double hue = get<double>( stack, "_hue" );
|
||||
double saturation = get<double>( stack, "_saturation" );
|
||||
double value = get<double>( stack, "_value" );
|
||||
|
||||
DisplayStyle::HSVr* hsvr = new DisplayStyle::HSVr(hue,saturation,value);
|
||||
|
||||
update( stack, hsvr );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -34,7 +34,8 @@ namespace Hurricane {
|
|||
|
||||
|
||||
Graphics::Graphics ()
|
||||
: _htmlTranslator ()
|
||||
: _observers ()
|
||||
, _htmlTranslator ()
|
||||
, _styles ()
|
||||
, _active (NULL)
|
||||
, _fireColorScale ()
|
||||
|
@ -70,6 +71,18 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void Graphics::addObserver ( BaseObserver* observer )
|
||||
{ getGraphics()->_observers.addObserver( observer ); }
|
||||
|
||||
|
||||
void Graphics::removeObserver ( BaseObserver* observer )
|
||||
{ getGraphics()->_observers.removeObserver( observer ); }
|
||||
|
||||
|
||||
void Graphics::notify ( unsigned flags )
|
||||
{ getGraphics()->_observers.notify( flags ); }
|
||||
|
||||
|
||||
Graphics* Graphics::getGraphics ()
|
||||
{
|
||||
if (not _singleton) {
|
||||
|
@ -351,6 +364,70 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void Graphics::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Graphics" );
|
||||
jsonWrite( w, "_active" , _active->getName() );
|
||||
|
||||
w->key( "+styles" );
|
||||
w->startArray();
|
||||
for ( DisplayStyle* ds : _styles ) ds->toJson( w );
|
||||
w->endArray();
|
||||
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonGraphics".
|
||||
|
||||
Initializer<JsonGraphics> jsonGraphicsInit ( 0 );
|
||||
|
||||
|
||||
void JsonGraphics::initialize ()
|
||||
{ JsonTypes::registerType( new JsonGraphics (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonGraphics::JsonGraphics ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
, _active ()
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode) return;
|
||||
|
||||
add( "_active", typeid(string) );
|
||||
add( "+groups", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
JsonGraphics::~JsonGraphics ()
|
||||
{
|
||||
Graphics* graphics = Graphics::getGraphics();
|
||||
graphics->setStyle( _active );
|
||||
graphics->notify ( Graphics::ChangedDisplayStyles );
|
||||
}
|
||||
|
||||
|
||||
string JsonGraphics::getTypeName () const
|
||||
{ return "Graphics"; }
|
||||
|
||||
|
||||
JsonGraphics* JsonGraphics::clone ( unsigned long flags ) const
|
||||
{ return new JsonGraphics ( flags ); }
|
||||
|
||||
|
||||
void JsonGraphics::toData(JsonStack& stack)
|
||||
{
|
||||
ltracein(51);
|
||||
|
||||
check( stack, "JsonGraphics::toData" );
|
||||
|
||||
_active = get<string>( stack, "_active" );
|
||||
|
||||
update( stack, Graphics::getGraphics() );
|
||||
|
||||
ltraceout(51);
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -35,19 +35,34 @@ namespace Hurricane {
|
|||
GraphicsWidget::GraphicsWidget ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _cellWidget (NULL)
|
||||
, _stylesGrid (new QGridLayout())
|
||||
, _stylesGroup(new QButtonGroup())
|
||||
, _updateState(ExternalEmit)
|
||||
{
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
setWindowTitle ( tr("Display Styles") );
|
||||
setFont ( Graphics::getNormalFont(true) );
|
||||
|
||||
QButtonGroup* group = new QButtonGroup ();
|
||||
QGroupBox* groupBox = new QGroupBox ( tr("Display Styles") );
|
||||
QGridLayout* gLayout = new QGridLayout ();
|
||||
QVBoxLayout* wLayout = new QVBoxLayout ();
|
||||
|
||||
const vector<DisplayStyle*>& styles = Graphics::getStyles ();
|
||||
DisplayStyle* activeStyle = Graphics::getStyle ();
|
||||
if (Graphics::isHighDpi()) _stylesGrid->setContentsMargins( 30, 30, 30, 30 );
|
||||
|
||||
groupBox->setLayout ( _stylesGrid );
|
||||
wLayout->addWidget ( groupBox );
|
||||
wLayout->addStretch ();
|
||||
setLayout ( wLayout );
|
||||
|
||||
connect ( _stylesGroup, SIGNAL(buttonClicked(int)), this, SLOT(setStyle(int)) );
|
||||
|
||||
readGraphics ();
|
||||
}
|
||||
|
||||
|
||||
void GraphicsWidget::readGraphics ()
|
||||
{
|
||||
const vector<DisplayStyle*>& styles = Graphics::getStyles ();
|
||||
DisplayStyle* activeStyle = Graphics::getStyle ();
|
||||
|
||||
size_t hideFallback = (styles.size() > 1) ? 1 : 0;
|
||||
for ( size_t istyle=hideFallback ; istyle < styles.size() ; istyle++ ) {
|
||||
|
@ -59,18 +74,10 @@ namespace Hurricane {
|
|||
label->setText ( styles[istyle]->getDescription().c_str() );
|
||||
label->setFont ( Graphics::getNormalFont() );
|
||||
|
||||
gLayout->addWidget ( button, istyle-hideFallback, 0 );
|
||||
gLayout->addWidget ( label , istyle-hideFallback, 1 );
|
||||
group->addButton ( button, istyle );
|
||||
_stylesGrid ->addWidget ( button, istyle-hideFallback, 0 );
|
||||
_stylesGrid ->addWidget ( label , istyle-hideFallback, 1 );
|
||||
_stylesGroup->addButton ( button, istyle );
|
||||
}
|
||||
if (Graphics::isHighDpi()) gLayout->setContentsMargins( 30, 30, 30, 30 );
|
||||
|
||||
groupBox->setLayout ( gLayout );
|
||||
wLayout->addWidget ( groupBox );
|
||||
wLayout->addStretch ();
|
||||
setLayout ( wLayout );
|
||||
|
||||
connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(setStyle(int)) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,5 +116,22 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void GraphicsWidget::resetGraphics ()
|
||||
{
|
||||
QLayoutItem* child = NULL;
|
||||
while ( (child = _stylesGrid->takeAt(0)) != 0 ) {
|
||||
_stylesGrid->removeWidget( child->widget() );
|
||||
delete child->widget();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GraphicsWidget::rereadGraphics ()
|
||||
{
|
||||
resetGraphics();
|
||||
readGraphics();
|
||||
//setStyle( 0 );
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -0,0 +1,523 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | 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@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./JsonConfiguration.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "vlsisapd/configuration/LayoutDescription.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/viewer/JsonConfiguration.h"
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::Parameter* p )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Cfg::Parameter" );
|
||||
jsonWrite( w, "_id" , p->getId() );
|
||||
jsonWrite( w, "_type" , Cfg::Parameter::typeToString(p->getType()) );
|
||||
jsonWrite( w, "_priority", Cfg::Parameter::priorityToString(p->getPriority()) );
|
||||
jsonWrite( w, "_value" , p->asString() );
|
||||
jsonWrite( w, "_flags" , p->getFlags() );
|
||||
|
||||
if (p->getType() == Cfg::Parameter::Int) {
|
||||
if (p->hasMin()) jsonWrite( w, "_minInt", p->getMinInt() );
|
||||
if (p->hasMax()) jsonWrite( w, "_maxInt", p->getMaxInt() );
|
||||
}
|
||||
if (p->getType() == Cfg::Parameter::Double) {
|
||||
if (p->hasMin()) jsonWrite( w, "_minDouble", p->getMinDouble() );
|
||||
if (p->hasMax()) jsonWrite( w, "_maxDouble", p->getMaxDouble() );
|
||||
}
|
||||
|
||||
jsonWrite( w, "+values", p->getValues() );
|
||||
|
||||
w->key( "+slaves" );
|
||||
w->startArray();
|
||||
for ( std::string slave : p->getSlaves() ) {
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Cfg::Parameter::Slave" );
|
||||
jsonWrite( w, "_id" , slave );
|
||||
w->endObject();
|
||||
}
|
||||
w->endArray();
|
||||
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::Parameter::EnumValue v )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Cfg::Parameter::EnumValue" );
|
||||
jsonWrite( w, "_label" , v._label );
|
||||
jsonWrite( w, "_value" , v._value );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::Configuration* cfg )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename" , "Cfg::Configuration" );
|
||||
jsonWrite( w, "+parameters", cfg->getParameters() );
|
||||
jsonWrite( w, "+layout" , &cfg->getLayout () );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::WidgetDescription* widget )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Cfg::WidgetDescription" );
|
||||
jsonWrite( w, "_type" , Cfg::WidgetDescription::typeToString(widget->getType()) );
|
||||
jsonWrite( w, "_id" , widget->getId () );
|
||||
jsonWrite( w, "_label" , widget->getLabel () );
|
||||
jsonWrite( w, "_column" , widget->getColumn() );
|
||||
jsonWrite( w, "_span" , widget->getSpan () );
|
||||
jsonWrite( w, "_flags" , widget->getFlags () );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::TabDescription* tab )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Cfg::TabDescription" );
|
||||
jsonWrite( w, "_name" , tab->getName() );
|
||||
jsonWrite( w, "_id" , tab->getId() );
|
||||
jsonWrite( w, "+widgets" , tab->getWidgets() );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::LayoutDescription* layout )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Cfg::LayoutDescription" );
|
||||
jsonWrite( w, "+tabs" , layout->getTabs() );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
using Cfg::Parameter;
|
||||
using Cfg::Configuration;
|
||||
using Cfg::LayoutDescription;
|
||||
using Cfg::TabDescription;
|
||||
using Cfg::WidgetDescription;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonConfiguration"
|
||||
|
||||
Initializer<JsonConfiguration> jsonConfigurationInit ( 0 );
|
||||
|
||||
|
||||
void JsonConfiguration::initialize ()
|
||||
{ JsonTypes::registerType( new JsonConfiguration (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonConfiguration::JsonConfiguration( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "+parameters", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
string JsonConfiguration::getTypeName () const
|
||||
{ return "Cfg::Configuration"; }
|
||||
|
||||
|
||||
JsonConfiguration* JsonConfiguration::clone ( unsigned long flags ) const
|
||||
{ return new JsonConfiguration ( flags ); }
|
||||
|
||||
|
||||
void JsonConfiguration::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonConfiguration::toData" );
|
||||
|
||||
Configuration* cfg = Configuration::get();
|
||||
|
||||
update( stack, cfg );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParameter"
|
||||
|
||||
Initializer<JsonParameter> jsonParameterInit ( 0 );
|
||||
|
||||
|
||||
void JsonParameter::initialize ()
|
||||
{ JsonTypes::registerType( new JsonParameter (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonParameter::JsonParameter ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_id" , typeid(string) );
|
||||
add( "_type" , typeid(string) );
|
||||
add( "_priority", typeid(string) );
|
||||
add( "_value" , typeid(string) );
|
||||
add( "_flags" , typeid(int64_t) );
|
||||
add( "+values" , typeid(JsonArray) );
|
||||
add( "+slaves" , typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
string JsonParameter::getTypeName () const
|
||||
{ return "Cfg::Parameter"; }
|
||||
|
||||
|
||||
JsonParameter* JsonParameter::clone ( unsigned long flags ) const
|
||||
{ return new JsonParameter ( flags ); }
|
||||
|
||||
|
||||
void JsonParameter::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonParameter::toData" );
|
||||
|
||||
Configuration* cfg = get<Configuration*>( stack, "_configuration" );
|
||||
|
||||
Parameter* param = NULL;
|
||||
string id = get<string> ( stack, "_id" );
|
||||
string stype = get<string> ( stack, "_type" );
|
||||
string spriority = get<string> ( stack, "_priority" );
|
||||
string value = get<string> ( stack, "_value" );
|
||||
int flags = get<int64_t>( stack, "_flags" );
|
||||
|
||||
Parameter::Type type = Parameter::stringToType (stype);
|
||||
Parameter::Priority priority = Parameter::stringToPriority(spriority);
|
||||
|
||||
param = cfg->getParameter( id );
|
||||
if (not param) {
|
||||
param = cfg->addParameter( id, type, value, priority );
|
||||
} else {
|
||||
if (param->getType() != type) {
|
||||
cerr << Error( "JsonParameter::toData(): Type incoherency on parameter \"%s\", not restored."
|
||||
, id.c_str() ) << endl;
|
||||
}
|
||||
param->setRawString( value, Parameter::Interactive );
|
||||
param->setPriority( priority );
|
||||
}
|
||||
|
||||
if (type == Parameter::Int) {
|
||||
if (flags & Parameter::HasMin) {
|
||||
add( "_minInt", typeid(int64_t) );
|
||||
param->setMin( (int)get<int64_t>( stack, "_minInt" ), Parameter::Interactive );
|
||||
}
|
||||
if (flags & Parameter::HasMax) {
|
||||
add( "_maxInt", typeid(int64_t) );
|
||||
param->setMax( (int)get<int64_t>( stack, "_maxInt" ), Parameter::Interactive );
|
||||
}
|
||||
}
|
||||
|
||||
if (type == Parameter::Double) {
|
||||
if (flags & Parameter::HasMin) {
|
||||
add( "_minDouble", typeid(int64_t) );
|
||||
param->setMin( (double)get<int64_t>( stack, "_minDouble" ), Parameter::Interactive );
|
||||
}
|
||||
if (flags & Parameter::HasMax) {
|
||||
add( "_maxDouble", typeid(int64_t) );
|
||||
param->setMax( (double)get<int64_t>( stack, "_maxDouble" ), Parameter::Interactive );
|
||||
}
|
||||
}
|
||||
|
||||
if (param) param->valueChanged();
|
||||
|
||||
update( stack, param );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParamEnumValue"
|
||||
|
||||
Initializer<JsonParamEnumValue> jsonParamEnumValueInit ( 0 );
|
||||
|
||||
|
||||
void JsonParamEnumValue::initialize ()
|
||||
{ JsonTypes::registerType( new JsonParamEnumValue (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonParamEnumValue::JsonParamEnumValue ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_label", typeid(string) );
|
||||
add( "_value", typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
string JsonParamEnumValue::getTypeName () const
|
||||
{ return "Cfg::Parameter::EnumValue"; }
|
||||
|
||||
|
||||
JsonParamEnumValue* JsonParamEnumValue::clone ( unsigned long flags ) const
|
||||
{ return new JsonParamEnumValue ( flags ); }
|
||||
|
||||
|
||||
void JsonParamEnumValue::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonParamEnumValue::toData" );
|
||||
|
||||
Parameter* param = get<Parameter*>( stack, ".Cfg::Parameter" );
|
||||
string label = get<string> ( stack, "_label" );
|
||||
int value = get<int64_t> ( stack, "_value" );
|
||||
|
||||
if (not param) {
|
||||
cerr << Error( "JsonParamEnumValue::toData(): Missing \".Cfg::Parameter\" in stack context.\n"
|
||||
" (while reading Cfg::Parameter::EnumValue \"%s\")"
|
||||
, label.c_str()
|
||||
) << endl;
|
||||
} else {
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
param->addValue( label, value );
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, NULL );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParamSlave"
|
||||
|
||||
Initializer<JsonParamSlave> jsonParamSlaveInit ( 0 );
|
||||
|
||||
|
||||
void JsonParamSlave::initialize ()
|
||||
{ JsonTypes::registerType( new JsonParamSlave (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonParamSlave::JsonParamSlave ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_id", typeid(string) );
|
||||
}
|
||||
|
||||
|
||||
string JsonParamSlave::getTypeName () const
|
||||
{ return "Cfg::Parameter::Slave"; }
|
||||
|
||||
|
||||
JsonParamSlave* JsonParamSlave::clone ( unsigned long flags ) const
|
||||
{ return new JsonParamSlave ( flags ); }
|
||||
|
||||
|
||||
void JsonParamSlave::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonParamSlave::toData" );
|
||||
|
||||
Parameter* param = get<Parameter*>( stack, ".Cfg::Parameter" );
|
||||
string id = get<string> ( stack, "_id " );
|
||||
|
||||
if (not param) {
|
||||
cerr << Error( "JsonParamSlave::toData(): Missing \".Cfg::Parameter\" in stack context.\n"
|
||||
" (while reading Cfg::Parameter::Slave \"%s\")"
|
||||
, id.c_str()
|
||||
) << endl;
|
||||
} else {
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
param->addSlave( id );
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, NULL );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonWidgetDescription"
|
||||
|
||||
Initializer<JsonWidgetDescription> jsonWidgetDescriptionInit ( 0 );
|
||||
|
||||
|
||||
void JsonWidgetDescription::initialize ()
|
||||
{ JsonTypes::registerType( new JsonWidgetDescription (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonWidgetDescription::JsonWidgetDescription ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( ".Cfg::TabDescription", typeid(Cfg::TabDescription*) );
|
||||
add( "_type" , typeid(string) );
|
||||
add( "_id" , typeid(string) );
|
||||
add( "_label" , typeid(string) );
|
||||
add( "_column" , typeid(int64_t) );
|
||||
add( "_span" , typeid(int64_t) );
|
||||
add( "_flags" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
string JsonWidgetDescription::getTypeName () const
|
||||
{ return "Cfg::WidgetDescription"; }
|
||||
|
||||
|
||||
JsonWidgetDescription* JsonWidgetDescription::clone ( unsigned long flags ) const
|
||||
{ return new JsonWidgetDescription ( flags ); }
|
||||
|
||||
|
||||
void JsonWidgetDescription::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonWidgetDescription::toData" );
|
||||
|
||||
LayoutDescription* layout = get<LayoutDescription*>( stack, "+layout" );
|
||||
TabDescription* tab = get<TabDescription*> ( stack, ".Cfg::TabDescription" );
|
||||
|
||||
WidgetDescription* widget = NULL;
|
||||
string stype = get<string> ( stack, "_type" );
|
||||
string id = get<string> ( stack, "_id" );
|
||||
string label = get<string> ( stack, "_label" );
|
||||
int column = get<int64_t>( stack, "_column" );
|
||||
int span = get<int64_t>( stack, "_span" );
|
||||
int flags = get<int64_t>( stack, "_flags" );
|
||||
|
||||
WidgetDescription::Type type = WidgetDescription::stringToType(stype);
|
||||
|
||||
if (not layout) {
|
||||
cerr << Error( "JsonWidgetDescription::toData(): Missing \"+layout\" in stack context.\n"
|
||||
" (while reading \"%s\")"
|
||||
, id.c_str()
|
||||
) << endl;
|
||||
} else if (not tab) {
|
||||
cerr << Error( "JsonWidgetDescription::toData(): Missing \".Cfg::TabDescription\" in stack context.\n"
|
||||
" (while reading \"%s\")"
|
||||
, id.c_str()
|
||||
) << endl;
|
||||
} else {
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
switch ( type ) {
|
||||
case WidgetDescription::Rule: layout->addRule ( tab->getName() ); break;
|
||||
case WidgetDescription::Title: layout->addTitle ( tab->getName(), label ); break;
|
||||
case WidgetDescription::Section: layout->addSection( tab->getName(), label, column ); break;
|
||||
case WidgetDescription::Parameter:
|
||||
layout->addParameter( tab->getName(), id, label, column, span, flags );
|
||||
widget = layout->getWidget( id );
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Coherency checking only.
|
||||
if (type == WidgetDescription::Parameter) {
|
||||
widget = layout->getWidget( id );
|
||||
if (not widget) {
|
||||
cerr << Error( "JsonWidgetDescription::toData(): Parameter id=\"%s\" has no layout."
|
||||
, id.c_str() ) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, widget );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonTabDescription"
|
||||
|
||||
Initializer<JsonTabDescription> jsonTabDescriptionInit ( 0 );
|
||||
|
||||
|
||||
void JsonTabDescription::initialize ()
|
||||
{ JsonTypes::registerType( new JsonTabDescription (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonTabDescription::JsonTabDescription ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_name" , typeid(string) );
|
||||
add( "_id" , typeid(string) );
|
||||
add( "+widgets", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
string JsonTabDescription::getTypeName () const
|
||||
{ return "Cfg::TabDescription"; }
|
||||
|
||||
|
||||
JsonTabDescription* JsonTabDescription::clone ( unsigned long flags ) const
|
||||
{ return new JsonTabDescription ( flags ); }
|
||||
|
||||
|
||||
void JsonTabDescription::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonTabDescription::toData" );
|
||||
|
||||
LayoutDescription* layout = get<LayoutDescription*>( stack, "+layout" );
|
||||
|
||||
TabDescription* tab = NULL;
|
||||
string id = get<string>( stack, "_id" );
|
||||
string name = get<string>( stack, "_name" );
|
||||
|
||||
if (not layout) {
|
||||
cerr << Error( "JsonTabDescription::toData(): Missing \"+layout\" in stack context.\n"
|
||||
" (while reading TabDescription \"%s\")"
|
||||
, id.c_str()
|
||||
) << endl;
|
||||
} else {
|
||||
if (stack.issetFlags(JsonWriter::TechnoMode)) {
|
||||
layout->addTab( name, id );
|
||||
tab = layout->getTab( name, id );
|
||||
} else {
|
||||
// Coherency checking only.
|
||||
tab = layout->getTab( name, id );
|
||||
if (not tab) {
|
||||
cerr << Error( "JsonTabDescription::toData(): Tab name=\"%s\", id=\"%s\" has no layout."
|
||||
, name.c_str(), id.c_str() ) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, tab );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonLayoutDescription"
|
||||
|
||||
Initializer<JsonLayoutDescription> jsonLayoutDescriptionInit ( 0 );
|
||||
|
||||
|
||||
void JsonLayoutDescription::initialize ()
|
||||
{ JsonTypes::registerType( new JsonLayoutDescription (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonLayoutDescription::JsonLayoutDescription ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "+tabs", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
JsonLayoutDescription::~JsonLayoutDescription ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
string JsonLayoutDescription::getTypeName () const
|
||||
{ return "Cfg::LayoutDescription"; }
|
||||
|
||||
|
||||
JsonLayoutDescription* JsonLayoutDescription::clone ( unsigned long flags ) const
|
||||
{ return new JsonLayoutDescription ( flags ); }
|
||||
|
||||
|
||||
void JsonLayoutDescription::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonLayoutDescription::toData" );
|
||||
|
||||
LayoutDescription* layout = &Configuration::get()->getLayout();
|
||||
|
||||
update( stack, layout );
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -0,0 +1,185 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | 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@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./JsonParameter.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/viewer/JsonParameter.h"
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::Configuration* cfg )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename" , "Cfg::Configuration" );
|
||||
jsonWrite( w, "+parameters", cfg->getParameters() );
|
||||
|
||||
// w->key( "+parameters" );
|
||||
// w->startArray();
|
||||
// for ( auto mapElement : cfg->getParameters() ) jsonWrite( w, mapElement.second );
|
||||
// w->endArray();
|
||||
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter* w, const Cfg::Parameter* p )
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Cfg::Parameter" );
|
||||
jsonWrite( w, "_id" , p->getId() );
|
||||
jsonWrite( w, "_type" , Cfg::Parameter::typeToString(p->getType()) );
|
||||
jsonWrite( w, "_priority", Cfg::Parameter::priorityToString(p->getPriority()) );
|
||||
jsonWrite( w, "_value" , p->asString() );
|
||||
jsonWrite( w, "_flags" , p->getFlags() );
|
||||
|
||||
if (p->getType() == Cfg::Parameter::Int) {
|
||||
if (p->hasMin()) jsonWrite( w, "_minInt", p->getMinInt() );
|
||||
if (p->hasMax()) jsonWrite( w, "_maxInt", p->getMaxInt() );
|
||||
}
|
||||
if (p->getType() == Cfg::Parameter::Double) {
|
||||
if (p->hasMin()) jsonWrite( w, "_minDouble", p->getMinDouble() );
|
||||
if (p->hasMax()) jsonWrite( w, "_maxDouble", p->getMaxDouble() );
|
||||
}
|
||||
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
using Cfg::Parameter;
|
||||
using Cfg::Configuration;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonConfiguration"
|
||||
|
||||
Initializer<JsonConfiguration> jsonConfigurationInit ( 0 );
|
||||
|
||||
|
||||
void JsonConfiguration::initialize ()
|
||||
{ JsonTypes::registerType( new JsonConfiguration (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonConfiguration::JsonConfiguration( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "+parameters", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
string JsonConfiguration::getTypeName () const
|
||||
{ return "Cfg::Configuration"; }
|
||||
|
||||
|
||||
JsonConfiguration* JsonConfiguration::clone ( unsigned long flags ) const
|
||||
{ return new JsonConfiguration ( flags ); }
|
||||
|
||||
|
||||
void JsonConfiguration::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonConfiguration::toData" );
|
||||
|
||||
Configuration* cfg = Configuration::get();
|
||||
|
||||
update( stack, cfg );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParameter"
|
||||
|
||||
Initializer<JsonParameter> jsonParameterInit ( 0 );
|
||||
|
||||
|
||||
void JsonParameter::initialize ()
|
||||
{ JsonTypes::registerType( new JsonParameter (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonParameter::JsonParameter( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_id" , typeid(string) );
|
||||
add( "_type" , typeid(string) );
|
||||
add( "_priority", typeid(string) );
|
||||
add( "_value" , typeid(string) );
|
||||
add( "_flags" , typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
string JsonParameter::getTypeName () const
|
||||
{ return "Cfg::Parameter"; }
|
||||
|
||||
|
||||
JsonParameter* JsonParameter::clone ( unsigned long flags ) const
|
||||
{ return new JsonParameter ( flags ); }
|
||||
|
||||
|
||||
void JsonParameter::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonParameter::toData" );
|
||||
|
||||
Configuration* cfg = get<Configuration*>( stack, "_configuration" );
|
||||
|
||||
Parameter* param = NULL;
|
||||
string id = get<string> ( stack, "_id" );
|
||||
string stype = get<string> ( stack, "_type" );
|
||||
string spriority = get<string> ( stack, "_priority" );
|
||||
string value = get<string> ( stack, "_value" );
|
||||
int flags = get<int64_t>( stack, "_flags" );
|
||||
|
||||
Parameter::Type type = Parameter::stringToType (stype);
|
||||
Parameter::Priority priority = Parameter::stringToPriority(spriority);
|
||||
|
||||
param = cfg->getParameter( id );
|
||||
if (not param) {
|
||||
param = cfg->addParameter( id, type, value, priority );
|
||||
} else {
|
||||
if (param->getType() != type) {
|
||||
cerr << Error( "JsonParameter::toData(): Type incoherency on parameter \"%s\", not restored."
|
||||
, id.c_str() ) << endl;
|
||||
}
|
||||
param->setRawString( value, Parameter::Interactive );
|
||||
param->setPriority( priority );
|
||||
}
|
||||
|
||||
if (type == Parameter::Int) {
|
||||
if (flags & Parameter::HasMin) {
|
||||
add( "_minInt", typeid(int64_t) );
|
||||
param->setMin( (int)get<int64_t>( stack, "_minInt" ), Parameter::Interactive );
|
||||
}
|
||||
if (flags & Parameter::HasMax) {
|
||||
add( "_maxInt", typeid(int64_t) );
|
||||
param->setMax( (int)get<int64_t>( stack, "_maxInt" ), Parameter::Interactive );
|
||||
}
|
||||
}
|
||||
|
||||
if (type == Parameter::Double) {
|
||||
if (flags & Parameter::HasMin) {
|
||||
add( "_minDouble", typeid(int64_t) );
|
||||
param->setMin( (double)get<int64_t>( stack, "_minDouble" ), Parameter::Interactive );
|
||||
}
|
||||
if (flags & Parameter::HasMax) {
|
||||
add( "_maxDouble", typeid(int64_t) );
|
||||
param->setMax( (double)get<int64_t>( stack, "_maxDouble" ), Parameter::Interactive );
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, param );
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -1,15 +1,9 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, 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,10 +11,7 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PaletteNamedItem.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <QCheckBox>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | H U R R I C A N E |
|
||||
|
@ -62,13 +62,16 @@ namespace {
|
|||
};
|
||||
|
||||
|
||||
GridBuffer::GridBuffer ( QGridLayout* grid, size_t maxRow, size_t startRow, size_t startColumn )
|
||||
: _grid (grid)
|
||||
, _rowMax (maxRow)
|
||||
, _row (startRow)
|
||||
, _column (startColumn)
|
||||
, _widgets()
|
||||
, _aligns ()
|
||||
GridBuffer::GridBuffer ( QGridLayout* grid
|
||||
, size_t maxRow
|
||||
, size_t startRow
|
||||
, size_t startColumn )
|
||||
: _grid (grid)
|
||||
, _rowMax (maxRow)
|
||||
, _row (startRow)
|
||||
, _column (startColumn)
|
||||
, _widgets ()
|
||||
, _aligns ()
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -123,6 +126,9 @@ namespace {
|
|||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "PaletteWidget".
|
||||
|
||||
QWidget* PaletteWidget::_createGroupItem ( const Name& name )
|
||||
{
|
||||
QLabel* groupLabel = new QLabel ();
|
||||
|
@ -218,10 +224,12 @@ namespace Hurricane {
|
|||
vLayout->addWidget ( _scrollArea );
|
||||
|
||||
setLayout ( vLayout );
|
||||
|
||||
readGraphics ();
|
||||
}
|
||||
|
||||
|
||||
void PaletteWidget::build ()
|
||||
void PaletteWidget::readGraphics ()
|
||||
{
|
||||
GridBuffer gridBuffer ( _grid, _columnHeight );
|
||||
|
||||
|
@ -299,19 +307,20 @@ namespace Hurricane {
|
|||
|
||||
void PaletteWidget::updateExtensions ( Cell* cell )
|
||||
{
|
||||
_grid->removeWidget ( _extensionGroup );
|
||||
//_extensionGroup->deleteLater ();
|
||||
delete _extensionGroup;
|
||||
_extensionGroup = NULL;
|
||||
if (_extensionGroup) {
|
||||
_grid->removeWidget ( _extensionGroup );
|
||||
//_extensionGroup->deleteLater ();
|
||||
delete _extensionGroup;
|
||||
_extensionGroup = NULL;
|
||||
|
||||
PaletteItems::iterator iextension = _extensionGoItems.begin();
|
||||
for ( ; iextension != _extensionGoItems.end() ; ++iextension ) {
|
||||
_grid->removeWidget ( iextension->second );
|
||||
//iextension->second->deleteLater ();
|
||||
delete iextension->second;
|
||||
PaletteItems::iterator iextension = _extensionGoItems.begin();
|
||||
for ( ; iextension != _extensionGoItems.end() ; ++iextension ) {
|
||||
_grid->removeWidget ( iextension->second );
|
||||
//iextension->second->deleteLater ();
|
||||
delete iextension->second;
|
||||
}
|
||||
_extensionGoItems.clear ();
|
||||
}
|
||||
_extensionGoItems.clear ();
|
||||
|
||||
|
||||
GridBuffer gridBuffer ( _grid, _columnHeight, _extensionRow, _extensionColumn );
|
||||
_extensionGroup = _createGroupItem ( "Extensions" );
|
||||
|
@ -328,6 +337,28 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void PaletteWidget::resetGraphics ()
|
||||
{
|
||||
QLayoutItem* child = NULL;
|
||||
while ( (child = _grid->takeAt(0)) != 0 ) {
|
||||
_grid->removeWidget( child->widget() );
|
||||
delete child->widget();
|
||||
}
|
||||
|
||||
_layerItems.clear();
|
||||
_extensionGroup = NULL;
|
||||
_extensionGoItems.clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PaletteWidget::rereadGraphics ()
|
||||
{
|
||||
resetGraphics();
|
||||
readGraphics();
|
||||
}
|
||||
|
||||
|
||||
void PaletteWidget::_getSection ( const QString section, QLabel*& label, vector<PaletteItem*>& items ) const
|
||||
{
|
||||
label = NULL;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
|
@ -19,7 +18,7 @@
|
|||
#define HURRICANE_CONTROLLER_WIDGET_H
|
||||
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <QTabWidget>
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
|
||||
|
@ -27,7 +26,8 @@ namespace Cfg {
|
|||
class ConfigurationWidget;
|
||||
}
|
||||
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include "hurricane/Observer.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -63,6 +63,7 @@ namespace Hurricane {
|
|||
virtual void updateTab ();
|
||||
virtual void cellPreModificate ();
|
||||
virtual void cellPostModificate ();
|
||||
virtual void graphicsUpdated ();
|
||||
|
||||
protected:
|
||||
CellWidget* _cellWidget;
|
||||
|
@ -80,10 +81,11 @@ namespace Hurricane {
|
|||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
TabGraphics ( QWidget* parent=NULL );
|
||||
inline GraphicsWidget* getGraphics ();
|
||||
TabGraphics ( QWidget* parent=NULL );
|
||||
inline GraphicsWidget* getGraphics ();
|
||||
public slots:
|
||||
void setCellWidget ( CellWidget* );
|
||||
void setCellWidget ( CellWidget* );
|
||||
virtual void graphicsUpdated ();
|
||||
|
||||
protected:
|
||||
GraphicsWidget* _graphics;
|
||||
|
@ -122,10 +124,11 @@ namespace Hurricane {
|
|||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
TabPalette ( QWidget* parent=NULL );
|
||||
inline PaletteWidget* getPalette ();
|
||||
TabPalette ( QWidget* parent=NULL );
|
||||
inline PaletteWidget* getPalette ();
|
||||
public slots:
|
||||
virtual void setCellWidget ( CellWidget* );
|
||||
virtual void setCellWidget ( CellWidget* );
|
||||
virtual void graphicsUpdated ();
|
||||
|
||||
protected:
|
||||
PaletteWidget* _palette;
|
||||
|
@ -256,13 +259,15 @@ namespace Hurricane {
|
|||
class TabSettings : public ControllerTab {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
TabSettings ( QWidget* parent=NULL );
|
||||
inline ConfigurationWidget* getSettings ();
|
||||
TabSettings ( QWidget* parent=NULL );
|
||||
inline ConfigurationWidget* getSettings ();
|
||||
public slots:
|
||||
void setCellWidget ( CellWidget* );
|
||||
void setCellWidget ( CellWidget* );
|
||||
protected:
|
||||
virtual void showEvent ( QShowEvent* );
|
||||
private:
|
||||
size_t _timestamp;
|
||||
ConfigurationWidget* _configuration;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -291,6 +296,15 @@ namespace Hurricane {
|
|||
|
||||
class ControllerWidget : public QTabWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
class GraphicsObserver : public Observer<ControllerWidget> {
|
||||
public:
|
||||
inline GraphicsObserver ( ControllerWidget* );
|
||||
virtual void notify ( unsigned int flags );
|
||||
private:
|
||||
GraphicsObserver ( const GraphicsObserver& );
|
||||
};
|
||||
|
||||
public:
|
||||
ControllerWidget ( QWidget* parent=NULL );
|
||||
|
@ -306,6 +320,7 @@ namespace Hurricane {
|
|||
void setCellWidget ( CellWidget* );
|
||||
//inline int addSetting ( QWidget* page, const QString& label );
|
||||
public slots:
|
||||
void graphicsUpdated ();
|
||||
void cellPreModificate ();
|
||||
void cellPostModificate ();
|
||||
void cellChanged ( Cell* );
|
||||
|
@ -313,6 +328,7 @@ namespace Hurricane {
|
|||
void toggleShow ();
|
||||
|
||||
protected:
|
||||
GraphicsObserver _observer;
|
||||
CellWidget* _cellWidget;
|
||||
TabGraphics* _tabGraphics;
|
||||
TabPalette* _tabPalette;
|
||||
|
@ -335,6 +351,11 @@ namespace Hurricane {
|
|||
inline InspectorWidget* ControllerWidget::getInspectorWidget () { return _tabInspector->getInspectorWidget(); }
|
||||
inline TabSettings* ControllerWidget::getSettings () { return _tabSettings; }
|
||||
//inline int ControllerWidget::addSetting ( QWidget* page, const QString& label ) { return _tabSettings->addSetting(page,label); }
|
||||
|
||||
|
||||
inline ControllerWidget::GraphicsObserver::GraphicsObserver ( ControllerWidget* owner )
|
||||
: Observer<ControllerWidget>(owner)
|
||||
{ }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace Hurricane {
|
|||
inline DesignBlob ( Cell* );
|
||||
inline Cell* getTopCell () const;
|
||||
void toJson ( JsonWriter* ) const;
|
||||
static DesignBlob* fromJson ( const std::string& filename );
|
||||
inline std::string _getTypeName () const;
|
||||
private:
|
||||
Cell* _topCell;
|
|
@ -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-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | H U R R I C A N E |
|
||||
|
@ -15,9 +14,8 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_DISPLAYSTYLE_H__
|
||||
#define __HURRICANE_DISPLAYSTYLE_H__
|
||||
|
||||
#ifndef HURRICANE_DISPLAYSTYLE_H
|
||||
#define HURRICANE_DISPLAYSTYLE_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -36,10 +34,13 @@ namespace Hurricane {
|
|||
typedef std::vector <DrawingStyle> DrawingStyles;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "DrawingGroup".
|
||||
|
||||
class DrawingGroup {
|
||||
public:
|
||||
// Constructors & Destructors.
|
||||
DrawingGroup ( const Name& name );
|
||||
DrawingGroup ( const Name& name );
|
||||
~DrawingGroup ();
|
||||
DrawingGroup* getClone ();
|
||||
void qtAllocate ();
|
||||
|
@ -57,6 +58,8 @@ namespace Hurricane {
|
|||
, float threshold
|
||||
, bool goMatched
|
||||
);
|
||||
void addDrawingStyle ( DrawingStyle );
|
||||
void toJson ( JsonWriter* ) const;
|
||||
protected:
|
||||
const Name _name;
|
||||
DrawingStyles _drawingStyles;
|
||||
|
@ -67,18 +70,37 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDrawingGroup".
|
||||
|
||||
class JsonDrawingGroup : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonDrawingGroup ( unsigned long flags );
|
||||
~JsonDrawingGroup ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonDrawingGroup* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "DisplayStyle".
|
||||
|
||||
class DisplayStyle {
|
||||
public:
|
||||
class HSVr {
|
||||
public:
|
||||
inline HSVr ( float hue=1.0, float saturation=1.0, float value=1.0 );
|
||||
inline bool isId () const;
|
||||
inline float getHue () const;
|
||||
inline float getSaturation () const;
|
||||
inline float getValue () const;
|
||||
inline void setHue ( float );
|
||||
inline void setSaturation ( float );
|
||||
inline void setValue ( float );
|
||||
inline HSVr ( float hue=1.0, float saturation=1.0, float value=1.0 );
|
||||
inline bool isId () const;
|
||||
inline float getHue () const;
|
||||
inline float getSaturation () const;
|
||||
inline float getValue () const;
|
||||
inline void setHue ( float );
|
||||
inline void setSaturation ( float );
|
||||
inline void setValue ( float );
|
||||
inline void toJson ( JsonWriter* ) const;
|
||||
inline std::string _getString () const;
|
||||
private:
|
||||
float _hue;
|
||||
float _saturation;
|
||||
|
@ -142,6 +164,9 @@ namespace Hurricane {
|
|||
, float threshold
|
||||
, bool goMatched =true
|
||||
);
|
||||
DrawingGroup* findGroup ( const Name& groupKey );
|
||||
void findOrCreate ( const Name& groupKey, size_t& gi );
|
||||
void toJson ( JsonWriter* ) const;
|
||||
|
||||
protected:
|
||||
// Internals - Attributes.
|
||||
|
@ -151,8 +176,6 @@ namespace Hurricane {
|
|||
HSVr _darkening;
|
||||
|
||||
// Internals - Methods.
|
||||
void findOrCreate ( const Name& groupKey
|
||||
, size_t& gi );
|
||||
void find ( const Name& groupKey
|
||||
, const Name& key
|
||||
, size_t& gi
|
||||
|
@ -161,6 +184,37 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDisplayStyle".
|
||||
|
||||
class JsonDisplayStyle : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonDisplayStyle ( unsigned long flags );
|
||||
~JsonDisplayStyle ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonDisplayStyle* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonHSVr".
|
||||
|
||||
class JsonHSVr : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonHSVr ( unsigned long flags );
|
||||
~JsonHSVr ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonHSVr* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "RawDrawingStyle".
|
||||
|
||||
class RawDrawingStyle {
|
||||
public:
|
||||
// Constructors & Destructors.
|
||||
|
@ -183,6 +237,7 @@ namespace Hurricane {
|
|||
QPen getPen ( const DisplayStyle::HSVr& ) const;
|
||||
QBrush getBrush ( const DisplayStyle::HSVr& ) const;
|
||||
inline float getThreshold () const;
|
||||
void toJson ( JsonWriter* ) const;
|
||||
private:
|
||||
// Internal - Attributes.
|
||||
const Name _name;
|
||||
|
@ -214,7 +269,23 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
// Functions.
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDrawingStyle".
|
||||
|
||||
class JsonDrawingStyle : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonDrawingStyle ( unsigned long flags );
|
||||
~JsonDrawingStyle ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonDrawingStyle* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Inline Functions.
|
||||
|
||||
inline bool RawDrawingStyle::isGoMatched () const { return _goMatched; }
|
||||
inline const Name& RawDrawingStyle::getName () const { return _name; }
|
||||
inline const std::string& RawDrawingStyle::getPattern () const { return _pattern; }
|
||||
|
@ -241,8 +312,28 @@ namespace Hurricane {
|
|||
inline void DisplayStyle::HSVr::setSaturation ( float saturation ) { _saturation=saturation; }
|
||||
inline void DisplayStyle::HSVr::setValue ( float value ) { _value=value; }
|
||||
|
||||
inline std::string DisplayStyle::HSVr::_getString () const
|
||||
{
|
||||
std::string s = "<HSVr " + getString(_hue)
|
||||
+ " " + getString(_saturation)
|
||||
+ " " + getString(_value) + ">";
|
||||
return s;
|
||||
}
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
inline void DisplayStyle::HSVr::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "HSVr" );
|
||||
jsonWrite( w, "_hue" , _hue );
|
||||
jsonWrite( w, "_saturation", _saturation );
|
||||
jsonWrite( w, "_value" , _value );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_DISPLAYSTYLE__
|
||||
GETSTRING_VALUE_SUPPORT(Hurricane::DisplayStyle::HSVr);
|
||||
|
||||
|
||||
#endif // HURRICANE_DISPLAYSTYLE_H
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <QFont>
|
||||
#include "hurricane/Observer.h"
|
||||
#include "hurricane/Breakpoint.h"
|
||||
#include "hurricane/TextTranslator.h"
|
||||
#include "hurricane/viewer/DisplayStyle.h"
|
||||
|
@ -37,11 +38,18 @@ namespace Hurricane {
|
|||
class Name;
|
||||
|
||||
|
||||
class Graphics {
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Graphics".
|
||||
|
||||
class Graphics {
|
||||
public:
|
||||
enum NotifyFlags { ChangedDisplayStyles = (1<<0) };
|
||||
public:
|
||||
// Accessors.
|
||||
static Graphics* getGraphics ();
|
||||
static void addObserver ( BaseObserver* );
|
||||
static void removeObserver ( BaseObserver* );
|
||||
static void notify ( unsigned int flags );
|
||||
static bool isEnabled ();
|
||||
static bool isHighDpi ();
|
||||
static const QFont getFixedFont ( int weight=QFont::Normal, bool italic=false, bool underline=false, int scale=0 );
|
||||
|
@ -59,7 +67,6 @@ namespace Hurricane {
|
|||
static string toHtml ( const string& );
|
||||
static int toHighDpi ( int );
|
||||
static bool breakpointStopCb ( const string& message );
|
||||
|
||||
// Modifiers.
|
||||
static void addStyle ( DisplayStyle* displayStyle );
|
||||
static void setStyle ( const Name& key );
|
||||
|
@ -68,10 +75,11 @@ namespace Hurricane {
|
|||
static DisplayStyle* getStyle ();
|
||||
static const vector<DisplayStyle*>& getStyles ();
|
||||
static void enable ();
|
||||
|
||||
void toJson ( JsonWriter* ) const;
|
||||
// Internals - Attributes.
|
||||
protected:
|
||||
static Graphics* _singleton;
|
||||
Observable _observers;
|
||||
TextTranslator _htmlTranslator;
|
||||
vector<DisplayStyle*> _styles;
|
||||
DisplayStyle* _active;
|
||||
|
@ -86,7 +94,6 @@ namespace Hurricane {
|
|||
Graphics ( const Graphics& );
|
||||
Graphics& operator= ( const Graphics& );
|
||||
~Graphics ();
|
||||
|
||||
// Internals - Methods.
|
||||
size_t _findStyle ( const Name& key ) const;
|
||||
void _addStyle ( DisplayStyle* displayStyle );
|
||||
|
@ -105,7 +112,6 @@ namespace Hurricane {
|
|||
inline const ColorScale& _getColorScale ( ColorScale::ScaleType ) const;
|
||||
inline void _enable ();
|
||||
inline const TextTranslator& _getHtmlTranslator () const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -157,6 +163,20 @@ namespace Hurricane {
|
|||
{ return _htmlTranslator; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonGraphics".
|
||||
|
||||
class JsonGraphics : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonGraphics ( unsigned long flags );
|
||||
~JsonGraphics ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonGraphics* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
private:
|
||||
std::string _active;
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
|
||||
#include <QWidget>
|
||||
class QGridLayout;
|
||||
class QButtonGroup;
|
||||
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
@ -32,17 +34,21 @@ namespace Hurricane {
|
|||
public:
|
||||
GraphicsWidget ( QWidget* parent=NULL );
|
||||
void setCellWidget ( CellWidget* );
|
||||
void readGraphics ();
|
||||
void resetGraphics ();
|
||||
void rereadGraphics ();
|
||||
public slots:
|
||||
void changeStyle ();
|
||||
void setStyle ( int id );
|
||||
|
||||
protected:
|
||||
CellWidget* _cellWidget;
|
||||
UpdateState _updateState;
|
||||
CellWidget* _cellWidget;
|
||||
QGridLayout* _stylesGrid;
|
||||
QButtonGroup* _stylesGroup;
|
||||
UpdateState _updateState;
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | 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@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/viewer/JsonConfiguration.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_JSON_CONFIGURATION_H
|
||||
#define HURRICANE_JSON_CONFIGURATION_H
|
||||
|
||||
#include "vlsisapd/configuration/Parameter.h"
|
||||
#include "vlsisapd/configuration/Configuration.h"
|
||||
#include "hurricane/Commons.h"
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter*, const Cfg::Parameter* );
|
||||
void jsonWrite ( JsonWriter*, const Cfg::Parameter::EnumValue );
|
||||
void jsonWrite ( JsonWriter*, const Cfg::Configuration* );
|
||||
void jsonWrite ( JsonWriter*, const Cfg::WidgetDescription* );
|
||||
void jsonWrite ( JsonWriter*, const Cfg::TabDescription* );
|
||||
void jsonWrite ( JsonWriter*, const Cfg::LayoutDescription* );
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParameter".
|
||||
|
||||
class JsonParameter : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonParameter ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonParameter* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParamEnumValue".
|
||||
|
||||
class JsonParamEnumValue : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonParamEnumValue ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonParamEnumValue* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParamSlave".
|
||||
|
||||
class JsonParamSlave : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonParamSlave ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonParamSlave* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonConfiguration".
|
||||
|
||||
class JsonConfiguration : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonConfiguration ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonConfiguration* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonWidgetDescription".
|
||||
|
||||
class JsonWidgetDescription : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonWidgetDescription ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonWidgetDescription* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonTabDescription".
|
||||
|
||||
class JsonTabDescription : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonTabDescription ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonTabDescription* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonLayoutDescription".
|
||||
|
||||
class JsonLayoutDescription : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonLayoutDescription ( unsigned long );
|
||||
virtual ~JsonLayoutDescription ();
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonLayoutDescription* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_JSON_CONFIGURATION_H
|
|
@ -0,0 +1,66 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2016, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | 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@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/viewer/JsonParameter.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_JSON_PARAMETER_H
|
||||
#define HURRICANE_JSON_PARAMETER_H
|
||||
|
||||
#include "vlsisapd/configuration/Parameter.h"
|
||||
#include "vlsisapd/configuration/Configuration.h"
|
||||
#include "hurricane/Commons.h"
|
||||
|
||||
|
||||
void jsonWrite ( JsonWriter*, const Cfg::Parameter* );
|
||||
void jsonWrite ( JsonWriter*, const Cfg::Configuration* );
|
||||
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, const Cfg::Parameter* p )
|
||||
{ w->key(key); jsonWrite( w, p ); }
|
||||
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, const Cfg::Configuration* cfg )
|
||||
{ w->key(key); jsonWrite( w, cfg ); }
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonParameter".
|
||||
|
||||
class JsonParameter : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonParameter ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonParameter* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonConfiguration".
|
||||
|
||||
class JsonConfiguration : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonConfiguration ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonConfiguration* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_JSON_PARAMETER_H
|
|
@ -1,30 +1,21 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, 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 : "./PaletteLayerItem.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// | C++ Header : "./hurricane/viewer/PaletteLayerItem.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_PALETTE_LAYER_ITEM__
|
||||
#define __HURRICANE_PALETTE_LAYER_ITEM__
|
||||
#ifndef HURRICANE_PALETTE_LAYER_ITEM_H
|
||||
#define HURRICANE_PALETTE_LAYER_ITEM_H
|
||||
|
||||
|
||||
class QCheckBox;
|
||||
|
@ -64,7 +55,6 @@ namespace Hurricane {
|
|||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_PALETTE_LAYER_ITEM__
|
||||
#endif // HURRICANE_PALETTE_LAYER_ITEM_H
|
||||
|
|
|
@ -1,37 +1,28 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
// Copyright (c) UPMC 2008-2016, 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 : "./PaletteWidget.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// | C++ Header : "./hurricane/viewer/PaletteWidget.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_PALETTE_WIDGET__
|
||||
#define __HURRICANE_PALETTE_WIDGET__
|
||||
#ifndef HURRICANE_PALETTE_WIDGET_H
|
||||
#define HURRICANE_PALETTE_WIDGET_H
|
||||
|
||||
#include <map>
|
||||
#include <limits>
|
||||
#include <QScrollArea>
|
||||
#include <map>
|
||||
#include <limits>
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Name.h"
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Name.h"
|
||||
|
||||
|
||||
class QLabel;
|
||||
|
@ -52,8 +43,12 @@ namespace Hurricane {
|
|||
class PaletteNamedItem;
|
||||
class PaletteLayerItem;
|
||||
class PaletteExtensionGoItem;
|
||||
class PaletteWidget;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "PaletteWidget".
|
||||
|
||||
class PaletteWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
|
@ -66,7 +61,9 @@ namespace Hurricane {
|
|||
bool isSelectable ( const Name& name ) const;
|
||||
inline void setOneColumn ();
|
||||
inline void setColumnHeight ( size_t height=std::numeric_limits<size_t>::max() );
|
||||
void build ();
|
||||
void readGraphics ();
|
||||
void resetGraphics ();
|
||||
void rereadGraphics ();
|
||||
signals:
|
||||
void paletteChanged ();
|
||||
public slots:
|
||||
|
@ -80,16 +77,16 @@ namespace Hurricane {
|
|||
void setItemVisible ( const Name& name, bool visible );
|
||||
|
||||
protected:
|
||||
QScrollArea* _scrollArea;
|
||||
PaletteItems _layerItems;
|
||||
PaletteItems _extensionGoItems;
|
||||
QPushButton* _showAll;
|
||||
QPushButton* _hideAll;
|
||||
QGridLayout* _grid;
|
||||
size_t _columnHeight;
|
||||
int _extensionRow;
|
||||
int _extensionColumn;
|
||||
QWidget* _extensionGroup;
|
||||
QScrollArea* _scrollArea;
|
||||
PaletteItems _layerItems;
|
||||
PaletteItems _extensionGoItems;
|
||||
QPushButton* _showAll;
|
||||
QPushButton* _hideAll;
|
||||
QGridLayout* _grid;
|
||||
size_t _columnHeight;
|
||||
int _extensionRow;
|
||||
int _extensionColumn;
|
||||
QWidget* _extensionGroup;
|
||||
|
||||
private:
|
||||
PaletteWidget ( const PaletteWidget& );
|
||||
|
@ -108,7 +105,6 @@ namespace Hurricane {
|
|||
inline void PaletteWidget::setColumnHeight ( size_t height ) { _columnHeight = height; }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_PALETTE_WIDGET__
|
||||
#endif // HURRICANE_PALETTE_WIDGET_H
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue